Message ID | CAAgBjMnCs_5Ba5AYcUjpj=y0yuWxykndKCy1fhUtA=ig4Zx0Cg@mail.gmail.com |
---|---|
State | New |
Headers | show |
Series | [ARM] PR66791: Replace builtins for signed vmul_n intrinsics | expand |
On Mon, 5 Jul 2021 at 14:47, Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> wrote: > > Hi, > This patch replaces builtins with __a * __b for signed variants of > vmul_n intrinsics. > As discussed earlier, the patch has issue if __a * __b overflows, and > whether we wish to leave > that as UB. ping https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6785eb595981abd93ad85edcfdf1d2e43c0841f5 Thanks, Prathamesh > > Thanks, > Prathamesh
On Mon, 12 Jul 2021 at 15:23, Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> wrote: > > On Mon, 5 Jul 2021 at 14:47, Prathamesh Kulkarni > <prathamesh.kulkarni@linaro.org> wrote: > > > > Hi, > > This patch replaces builtins with __a * __b for signed variants of > > vmul_n intrinsics. > > As discussed earlier, the patch has issue if __a * __b overflows, and > > whether we wish to leave > > that as UB. > ping https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6785eb595981abd93ad85edcfdf1d2e43c0841f5 Oops sorry, I meant this link: https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html Thanks, Prathamesh > > Thanks, > Prathamesh > > > > Thanks, > > Prathamesh
On Mon, 12 Jul 2021 at 15:24, Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> wrote: > > On Mon, 12 Jul 2021 at 15:23, Prathamesh Kulkarni > <prathamesh.kulkarni@linaro.org> wrote: > > > > On Mon, 5 Jul 2021 at 14:47, Prathamesh Kulkarni > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > Hi, > > > This patch replaces builtins with __a * __b for signed variants of > > > vmul_n intrinsics. > > > As discussed earlier, the patch has issue if __a * __b overflows, and > > > whether we wish to leave > > > that as UB. > > ping https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6785eb595981abd93ad85edcfdf1d2e43c0841f5 > Oops sorry, I meant this link: > https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html ping * 2 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html Thanks, Prathamesh > > Thanks, > Prathamesh > > > > Thanks, > > Prathamesh > > > > > > Thanks, > > > Prathamesh
On Thu, 5 Aug 2021 at 15:44, Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> wrote: > > On Mon, 12 Jul 2021 at 15:24, Prathamesh Kulkarni > <prathamesh.kulkarni@linaro.org> wrote: > > > > On Mon, 12 Jul 2021 at 15:23, Prathamesh Kulkarni > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > On Mon, 5 Jul 2021 at 14:47, Prathamesh Kulkarni > > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > > > Hi, > > > > This patch replaces builtins with __a * __b for signed variants of > > > > vmul_n intrinsics. > > > > As discussed earlier, the patch has issue if __a * __b overflows, and > > > > whether we wish to leave > > > > that as UB. > > > ping https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6785eb595981abd93ad85edcfdf1d2e43c0841f5 > > Oops sorry, I meant this link: > > https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html > ping * 2 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html ping * 3 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html Thanks, Prathamesh > > Thanks, > Prathamesh > > > > Thanks, > > Prathamesh > > > > > > Thanks, > > > Prathamesh > > > > > > > > Thanks, > > > > Prathamesh
On Fri, 13 Aug 2021 at 16:40, Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> wrote: > > On Thu, 5 Aug 2021 at 15:44, Prathamesh Kulkarni > <prathamesh.kulkarni@linaro.org> wrote: > > > > On Mon, 12 Jul 2021 at 15:24, Prathamesh Kulkarni > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > On Mon, 12 Jul 2021 at 15:23, Prathamesh Kulkarni > > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > > > On Mon, 5 Jul 2021 at 14:47, Prathamesh Kulkarni > > > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > > > > > Hi, > > > > > This patch replaces builtins with __a * __b for signed variants of > > > > > vmul_n intrinsics. > > > > > As discussed earlier, the patch has issue if __a * __b overflows, and > > > > > whether we wish to leave > > > > > that as UB. > > > > ping https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6785eb595981abd93ad85edcfdf1d2e43c0841f5 > > > Oops sorry, I meant this link: > > > https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html > > ping * 2 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html > ping * 3 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html ping * 4 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html Thanks, Prathamesh > > Thanks, > Prathamesh > > > > Thanks, > > Prathamesh > > > > > > Thanks, > > > Prathamesh > > > > > > > > Thanks, > > > > Prathamesh > > > > > > > > > > Thanks, > > > > > Prathamesh
> -----Original Message----- > From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> > Sent: 24 August 2021 09:02 > To: gcc Patches <gcc-patches@gcc.gnu.org>; Kyrylo Tkachov > <Kyrylo.Tkachov@arm.com> > Subject: Re: [ARM] PR66791: Replace builtins for signed vmul_n intrinsics > > On Fri, 13 Aug 2021 at 16:40, Prathamesh Kulkarni > <prathamesh.kulkarni@linaro.org> wrote: > > > > On Thu, 5 Aug 2021 at 15:44, Prathamesh Kulkarni > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > On Mon, 12 Jul 2021 at 15:24, Prathamesh Kulkarni > > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > > > On Mon, 12 Jul 2021 at 15:23, Prathamesh Kulkarni > > > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > > > > > On Mon, 5 Jul 2021 at 14:47, Prathamesh Kulkarni > > > > > <prathamesh.kulkarni@linaro.org> wrote: > > > > > > > > > > > > Hi, > > > > > > This patch replaces builtins with __a * __b for signed variants of > > > > > > vmul_n intrinsics. > > > > > > As discussed earlier, the patch has issue if __a * __b overflows, and > > > > > > whether we wish to leave > > > > > > that as UB. > > > > > ping > https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6785eb595981abd93ad85ed > cfdf1d2e43c0841f5 > > > > Oops sorry, I meant this link: > > > > https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html > > > ping * 2 https://gcc.gnu.org/pipermail/gcc-patches/2021- > July/574428.html > > ping * 3 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574428.html > ping * 4 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html I'm not very comfortable with this change. We'd be introducing direct signed multiplications that are undefined on overflow in C, but the vmul instructions in Neon have well-defined overflow semantics. So they wouldn't be exactly equivalent. Thanks, Kyrill > > Thanks, > Prathamesh > > > > Thanks, > > Prathamesh > > > > > > Thanks, > > > Prathamesh > > > > > > > > Thanks, > > > > Prathamesh > > > > > > > > > > Thanks, > > > > > Prathamesh > > > > > > > > > > > > Thanks, > > > > > > Prathamesh
diff --git a/gcc/config/arm/arm_neon.h b/gcc/config/arm/arm_neon.h index 41b596b5fc6..5928c25318b 100644 --- a/gcc/config/arm/arm_neon.h +++ b/gcc/config/arm/arm_neon.h @@ -8370,14 +8370,14 @@ __extension__ extern __inline int16x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vmul_n_s16 (int16x4_t __a, int16_t __b) { - return (int16x4_t)__builtin_neon_vmul_nv4hi (__a, (__builtin_neon_hi) __b); + return __a * __b; } __extension__ extern __inline int32x2_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vmul_n_s32 (int32x2_t __a, int32_t __b) { - return (int32x2_t)__builtin_neon_vmul_nv2si (__a, (__builtin_neon_si) __b); + return __a * __b; } __extension__ extern __inline float32x2_t @@ -8409,14 +8409,14 @@ __extension__ extern __inline int16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vmulq_n_s16 (int16x8_t __a, int16_t __b) { - return (int16x8_t)__builtin_neon_vmul_nv8hi (__a, (__builtin_neon_hi) __b); + return __a * __b; } __extension__ extern __inline int32x4_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) vmulq_n_s32 (int32x4_t __a, int32_t __b) { - return (int32x4_t)__builtin_neon_vmul_nv4si (__a, (__builtin_neon_si) __b); + return __a * __b; } __extension__ extern __inline float32x4_t