public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ARM] PR66791: Replace builtin in vld1_dup intrinsics
@ 2021-07-29 14:28 Prathamesh Kulkarni
  2021-08-05 10:07 ` Prathamesh Kulkarni
  0 siblings, 1 reply; 5+ messages in thread
From: Prathamesh Kulkarni @ 2021-07-29 14:28 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov, Richard Earnshaw

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

Hi,
The attached patch replaces builtins in vld1_dup intrinsics with call
to corresponding vdup_n intrinsic and removes entry for vld1_dup from
arm_neon_builtins.def.
Bootstrapped+tested on arm-linux-gnueabihf.
OK to commit ?

Thanks,
Prathamesh

[-- Attachment #2: vld1_dup-2.txt --]
[-- Type: text/plain, Size: 8526 bytes --]

gcc/ChangeLog:

	PR target/66791
	* config/arm/arm_neon.h (vld1_dup_s8): Replace builtin with call to
	corresponding vdup_n intrinsic.
	(vld1_dup_s16): Likewise.
	(vld1_dup_s32): Likewise.
	(vld1_dup_f32): Likewise.
	(vld1_dup_u8): Likewise.
	(vld1_dup_u16): Likewise.
	(vld1_dup_u32): Likewise.
	(vld1_dup_p8): Likewise.
	(vld1_dup_p16): Likewise.
	(vld1_dup_p64): Likewise.
	(vld1_dup_s64): Likewise.
	(vld1_dup_u64): Likewise.
	(vld1q_dup_s8): Likewise.
	(vld1q_dup_s16): Likewise.
	(vld1q_dup_s32): Likewise.
	(vld1q_dup_f32): Likewise.
	(vld1q_dup_u8): Likewise.
	(vld1q_dup_u16): Likewise.
	(vld1q_dup_u32): Likewise.
	(vld1q_dup_p8): Likewise.
	(vld1q_dup_p16): Likewise.
	(vld1q_dup_p64): Likewise.
	(vld1q_dup_s64): Likewise.
	(vld1q_dup_u64): Likewise.
	* config/arm/arm_neon_builtins.def (vld1_dup): Remove entry.


diff --git a/gcc/config/arm/arm_neon.h b/gcc/config/arm/arm_neon.h
index 41b596b5fc6..bc55dacffd3 100644
--- a/gcc/config/arm/arm_neon.h
+++ b/gcc/config/arm/arm_neon.h
@@ -10683,21 +10683,21 @@ __extension__ extern __inline int8x8_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_s8 (const int8_t * __a)
 {
-  return (int8x8_t)__builtin_neon_vld1_dupv8qi ((const __builtin_neon_qi *) __a);
+  return vdup_n_s8 (*__a);
 }
 
 __extension__ extern __inline int16x4_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_s16 (const int16_t * __a)
 {
-  return (int16x4_t)__builtin_neon_vld1_dupv4hi ((const __builtin_neon_hi *) __a);
+  return vdup_n_s16 (*__a);
 }
 
 __extension__ extern __inline int32x2_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_s32 (const int32_t * __a)
 {
-  return (int32x2_t)__builtin_neon_vld1_dupv2si ((const __builtin_neon_si *) __a);
+  return vdup_n_s32 (*__a);
 }
 
 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
@@ -10714,42 +10714,42 @@ __extension__ extern __inline float32x2_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_f32 (const float32_t * __a)
 {
-  return (float32x2_t)__builtin_neon_vld1_dupv2sf ((const __builtin_neon_sf *) __a);
+  return vdup_n_f32 (*__a);
 }
 
 __extension__ extern __inline uint8x8_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_u8 (const uint8_t * __a)
 {
-  return (uint8x8_t)__builtin_neon_vld1_dupv8qi ((const __builtin_neon_qi *) __a);
+  return vdup_n_u8 (*__a);
 }
 
 __extension__ extern __inline uint16x4_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_u16 (const uint16_t * __a)
 {
-  return (uint16x4_t)__builtin_neon_vld1_dupv4hi ((const __builtin_neon_hi *) __a);
+  return vdup_n_u16 (*__a);
 }
 
 __extension__ extern __inline uint32x2_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_u32 (const uint32_t * __a)
 {
-  return (uint32x2_t)__builtin_neon_vld1_dupv2si ((const __builtin_neon_si *) __a);
+  return vdup_n_u32 (*__a);
 }
 
 __extension__ extern __inline poly8x8_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_p8 (const poly8_t * __a)
 {
-  return (poly8x8_t)__builtin_neon_vld1_dupv8qi ((const __builtin_neon_qi *) __a);
+  return vdup_n_p8 (*__a);
 }
 
 __extension__ extern __inline poly16x4_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_p16 (const poly16_t * __a)
 {
-  return (poly16x4_t)__builtin_neon_vld1_dupv4hi ((const __builtin_neon_hi *) __a);
+  return vdup_n_p16 (*__a);
 }
 
 #pragma GCC push_options
@@ -10758,7 +10758,7 @@ __extension__ extern __inline poly64x1_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_p64 (const poly64_t * __a)
 {
-  return (poly64x1_t)__builtin_neon_vld1_dupdi ((const __builtin_neon_di *) __a);
+  return vdup_n_p64 (*__a);
 }
 
 #pragma GCC pop_options
@@ -10766,35 +10766,35 @@ __extension__ extern __inline int64x1_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_s64 (const int64_t * __a)
 {
-  return (int64x1_t)__builtin_neon_vld1_dupdi ((const __builtin_neon_di *) __a);
+  return vdup_n_s64 (*__a);
 }
 
 __extension__ extern __inline uint64x1_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1_dup_u64 (const uint64_t * __a)
 {
-  return (uint64x1_t)__builtin_neon_vld1_dupdi ((const __builtin_neon_di *) __a);
+  return vdup_n_u64 (*__a);
 }
 
 __extension__ extern __inline int8x16_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_s8 (const int8_t * __a)
 {
-  return (int8x16_t)__builtin_neon_vld1_dupv16qi ((const __builtin_neon_qi *) __a);
+  return vdupq_n_s8 (*__a);
 }
 
 __extension__ extern __inline int16x8_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_s16 (const int16_t * __a)
 {
-  return (int16x8_t)__builtin_neon_vld1_dupv8hi ((const __builtin_neon_hi *) __a);
+  return vdupq_n_s16 (*__a);
 }
 
 __extension__ extern __inline int32x4_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_s32 (const int32_t * __a)
 {
-  return (int32x4_t)__builtin_neon_vld1_dupv4si ((const __builtin_neon_si *) __a);
+  return vdupq_n_s32 (*__a);
 }
 
 #if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE)
@@ -10811,42 +10811,42 @@ __extension__ extern __inline float32x4_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_f32 (const float32_t * __a)
 {
-  return (float32x4_t)__builtin_neon_vld1_dupv4sf ((const __builtin_neon_sf *) __a);
+  return vdupq_n_f32 (*__a);
 }
 
 __extension__ extern __inline uint8x16_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_u8 (const uint8_t * __a)
 {
-  return (uint8x16_t)__builtin_neon_vld1_dupv16qi ((const __builtin_neon_qi *) __a);
+  return vdupq_n_u8 (*__a);
 }
 
 __extension__ extern __inline uint16x8_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_u16 (const uint16_t * __a)
 {
-  return (uint16x8_t)__builtin_neon_vld1_dupv8hi ((const __builtin_neon_hi *) __a);
+  return vdupq_n_u16 (*__a);
 }
 
 __extension__ extern __inline uint32x4_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_u32 (const uint32_t * __a)
 {
-  return (uint32x4_t)__builtin_neon_vld1_dupv4si ((const __builtin_neon_si *) __a);
+  return vdupq_n_u32 (*__a);
 }
 
 __extension__ extern __inline poly8x16_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_p8 (const poly8_t * __a)
 {
-  return (poly8x16_t)__builtin_neon_vld1_dupv16qi ((const __builtin_neon_qi *) __a);
+  return vdupq_n_p8 (*__a);
 }
 
 __extension__ extern __inline poly16x8_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_p16 (const poly16_t * __a)
 {
-  return (poly16x8_t)__builtin_neon_vld1_dupv8hi ((const __builtin_neon_hi *) __a);
+  return vdupq_n_p16 (*__a);
 }
 
 #pragma GCC push_options
@@ -10855,7 +10855,7 @@ __extension__ extern __inline poly64x2_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_p64 (const poly64_t * __a)
 {
-  return (poly64x2_t)__builtin_neon_vld1_dupv2di ((const __builtin_neon_di *) __a);
+  return vdupq_n_p64 (*__a);
 }
 
 #pragma GCC pop_options
@@ -10863,14 +10863,14 @@ __extension__ extern __inline int64x2_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_s64 (const int64_t * __a)
 {
-  return (int64x2_t)__builtin_neon_vld1_dupv2di ((const __builtin_neon_di *) __a);
+  return vdupq_n_s64 (*__a);
 }
 
 __extension__ extern __inline uint64x2_t
 __attribute__  ((__always_inline__, __gnu_inline__, __artificial__))
 vld1q_dup_u64 (const uint64_t * __a)
 {
-  return (uint64x2_t)__builtin_neon_vld1_dupv2di ((const __builtin_neon_di *) __a);
+  return vdupq_n_u64 (*__a);
 }
 
 #pragma GCC push_options
diff --git a/gcc/config/arm/arm_neon_builtins.def b/gcc/config/arm/arm_neon_builtins.def
index 70438ac1848..a2aeb21f350 100644
--- a/gcc/config/arm/arm_neon_builtins.def
+++ b/gcc/config/arm/arm_neon_builtins.def
@@ -307,8 +307,6 @@ VAR14 (LOAD1, vld1,
         v4bf, v8bf)
 VAR12 (LOAD1LANE, vld1_lane,
 	v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di, v4bf, v8bf)
-VAR10 (LOAD1, vld1_dup,
-	v8qi, v4hi, v2si, v2sf, di, v16qi, v8hi, v4si, v4sf, v2di)
 VAR14 (STORE1, vst1,
         v8qi, v4hi, v4hf, v2si, v2sf, di, v16qi, v8hi, v8hf, v4si, v4sf, v2di,
         v4bf, v8bf)

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

* Re: [ARM] PR66791: Replace builtin in vld1_dup intrinsics
  2021-07-29 14:28 [ARM] PR66791: Replace builtin in vld1_dup intrinsics Prathamesh Kulkarni
@ 2021-08-05 10:07 ` Prathamesh Kulkarni
  2021-08-13 11:10   ` Prathamesh Kulkarni
  0 siblings, 1 reply; 5+ messages in thread
From: Prathamesh Kulkarni @ 2021-08-05 10:07 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov, Richard Earnshaw

On Thu, 29 Jul 2021 at 19:58, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
>
> Hi,
> The attached patch replaces builtins in vld1_dup intrinsics with call
> to corresponding vdup_n intrinsic and removes entry for vld1_dup from
> arm_neon_builtins.def.
> Bootstrapped+tested on arm-linux-gnueabihf.
> OK to commit ?
ping https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html

Thanks,
Prathamesh
>
> Thanks,
> Prathamesh

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

* Re: [ARM] PR66791: Replace builtin in vld1_dup intrinsics
  2021-08-05 10:07 ` Prathamesh Kulkarni
@ 2021-08-13 11:10   ` Prathamesh Kulkarni
  2021-08-24  8:01     ` Prathamesh Kulkarni
  0 siblings, 1 reply; 5+ messages in thread
From: Prathamesh Kulkarni @ 2021-08-13 11:10 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov, Richard Earnshaw

On Thu, 5 Aug 2021 at 15:37, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
>
> On Thu, 29 Jul 2021 at 19:58, Prathamesh Kulkarni
> <prathamesh.kulkarni@linaro.org> wrote:
> >
> > Hi,
> > The attached patch replaces builtins in vld1_dup intrinsics with call
> > to corresponding vdup_n intrinsic and removes entry for vld1_dup from
> > arm_neon_builtins.def.
> > Bootstrapped+tested on arm-linux-gnueabihf.
> > OK to commit ?
> ping https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html
ping * 2 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html

Thanks,
Prathamesh
>
> Thanks,
> Prathamesh
> >
> > Thanks,
> > Prathamesh

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

* Re: [ARM] PR66791: Replace builtin in vld1_dup intrinsics
  2021-08-13 11:10   ` Prathamesh Kulkarni
@ 2021-08-24  8:01     ` Prathamesh Kulkarni
  2021-08-24  8:16       ` Kyrylo Tkachov
  0 siblings, 1 reply; 5+ messages in thread
From: Prathamesh Kulkarni @ 2021-08-24  8:01 UTC (permalink / raw)
  To: gcc Patches, Kyrill Tkachov, Richard Earnshaw

On Fri, 13 Aug 2021 at 16:40, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
>
> On Thu, 5 Aug 2021 at 15:37, Prathamesh Kulkarni
> <prathamesh.kulkarni@linaro.org> wrote:
> >
> > On Thu, 29 Jul 2021 at 19:58, Prathamesh Kulkarni
> > <prathamesh.kulkarni@linaro.org> wrote:
> > >
> > > Hi,
> > > The attached patch replaces builtins in vld1_dup intrinsics with call
> > > to corresponding vdup_n intrinsic and removes entry for vld1_dup from
> > > arm_neon_builtins.def.
> > > Bootstrapped+tested on arm-linux-gnueabihf.
> > > OK to commit ?
> > ping https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html
> ping * 2 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html
ping * 3 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html

Thanks,
Prathamesh
>
> Thanks,
> Prathamesh
> >
> > Thanks,
> > Prathamesh
> > >
> > > Thanks,
> > > Prathamesh

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

* RE: [ARM] PR66791: Replace builtin in vld1_dup intrinsics
  2021-08-24  8:01     ` Prathamesh Kulkarni
@ 2021-08-24  8:16       ` Kyrylo Tkachov
  0 siblings, 0 replies; 5+ messages in thread
From: Kyrylo Tkachov @ 2021-08-24  8:16 UTC (permalink / raw)
  To: Prathamesh Kulkarni, gcc Patches, Richard Earnshaw



> -----Original Message-----
> From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
> Sent: 24 August 2021 09:01
> To: gcc Patches <gcc-patches@gcc.gnu.org>; Kyrylo Tkachov
> <Kyrylo.Tkachov@arm.com>; Richard Earnshaw
> <Richard.Earnshaw@foss.arm.com>
> Subject: Re: [ARM] PR66791: Replace builtin in vld1_dup intrinsics
> 
> On Fri, 13 Aug 2021 at 16:40, Prathamesh Kulkarni
> <prathamesh.kulkarni@linaro.org> wrote:
> >
> > On Thu, 5 Aug 2021 at 15:37, Prathamesh Kulkarni
> > <prathamesh.kulkarni@linaro.org> wrote:
> > >
> > > On Thu, 29 Jul 2021 at 19:58, Prathamesh Kulkarni
> > > <prathamesh.kulkarni@linaro.org> wrote:
> > > >
> > > > Hi,
> > > > The attached patch replaces builtins in vld1_dup intrinsics with call
> > > > to corresponding vdup_n intrinsic and removes entry for vld1_dup from
> > > > arm_neon_builtins.def.
> > > > Bootstrapped+tested on arm-linux-gnueabihf.
> > > > OK to commit ?
> > > ping https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html
> > ping * 2 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html
> ping * 3 https://gcc.gnu.org/pipermail/gcc-patches/2021-July/576321.html

Sorry for the slow response.
I don't think this approach improves anything. With the current setup we'd be guaranteeing generation of the load-and-dup instruction even at low optimisation levels, but with this change we'd be relying on RTL optimisers merging the load and dup together. I don't think it gains us anything?

Thanks,
Kyrill

> 
> Thanks,
> Prathamesh
> >
> > Thanks,
> > Prathamesh
> > >
> > > Thanks,
> > > Prathamesh
> > > >
> > > > Thanks,
> > > > Prathamesh

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 14:28 [ARM] PR66791: Replace builtin in vld1_dup intrinsics Prathamesh Kulkarni
2021-08-05 10:07 ` Prathamesh Kulkarni
2021-08-13 11:10   ` Prathamesh Kulkarni
2021-08-24  8:01     ` Prathamesh Kulkarni
2021-08-24  8:16       ` 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).