public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ARM] PR66791: Replace builtins for signed vmul_n intrinsics
@ 2021-07-05  9:17 Prathamesh Kulkarni
  2021-07-12  9:53 ` Prathamesh Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Prathamesh Kulkarni @ 2021-07-05  9:17 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

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.

Thanks,
Prathamesh

[-- Attachment #2: vmul_n-6-int.txt --]
[-- Type: text/plain, Size: 1343 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ARM] PR66791: Replace builtins for signed vmul_n intrinsics
  2021-07-05  9:17 [ARM] PR66791: Replace builtins for signed vmul_n intrinsics Prathamesh Kulkarni
@ 2021-07-12  9:53 ` Prathamesh Kulkarni
  2021-07-12  9:54   ` Prathamesh Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Prathamesh Kulkarni @ 2021-07-12  9:53 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ARM] PR66791: Replace builtins for signed vmul_n intrinsics
  2021-07-12  9:53 ` Prathamesh Kulkarni
@ 2021-07-12  9:54   ` Prathamesh Kulkarni
  2021-08-05 10:14     ` Prathamesh Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Prathamesh Kulkarni @ 2021-07-12  9:54 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ARM] PR66791: Replace builtins for signed vmul_n intrinsics
  2021-07-12  9:54   ` Prathamesh Kulkarni
@ 2021-08-05 10:14     ` Prathamesh Kulkarni
  2021-08-13 11:10       ` Prathamesh Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Prathamesh Kulkarni @ 2021-08-05 10:14 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ARM] PR66791: Replace builtins for signed vmul_n intrinsics
  2021-08-05 10:14     ` Prathamesh Kulkarni
@ 2021-08-13 11:10       ` Prathamesh Kulkarni
  2021-08-24  8:01         ` Prathamesh Kulkarni
  0 siblings, 1 reply; 7+ messages in thread
From: Prathamesh Kulkarni @ 2021-08-13 11:10 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ARM] PR66791: Replace builtins for signed vmul_n intrinsics
  2021-08-13 11:10       ` Prathamesh Kulkarni
@ 2021-08-24  8:01         ` Prathamesh Kulkarni
  2021-08-24  8:18           ` Kyrylo Tkachov
  0 siblings, 1 reply; 7+ messages in thread
From: Prathamesh Kulkarni @ 2021-08-24  8:01 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [ARM] PR66791: Replace builtins for signed vmul_n intrinsics
  2021-08-24  8:01         ` Prathamesh Kulkarni
@ 2021-08-24  8:18           ` Kyrylo Tkachov
  0 siblings, 0 replies; 7+ messages in thread
From: Kyrylo Tkachov @ 2021-08-24  8:18 UTC (permalink / raw)
  To: Prathamesh Kulkarni, gcc Patches



> -----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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-08-24  8:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05  9:17 [ARM] PR66791: Replace builtins for signed vmul_n intrinsics Prathamesh Kulkarni
2021-07-12  9:53 ` Prathamesh Kulkarni
2021-07-12  9:54   ` Prathamesh Kulkarni
2021-08-05 10:14     ` Prathamesh Kulkarni
2021-08-13 11:10       ` Prathamesh Kulkarni
2021-08-24  8:01         ` Prathamesh Kulkarni
2021-08-24  8:18           ` Kyrylo Tkachov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).