[gcc r8-10582] PR target/97349 AArch64: Incorrect types for some Neon vdupq_n_<...> intrinsics

Kyrylo Tkachov ktkachov@gcc.gnu.org
Tue Oct 13 11:27:41 GMT 2020


https://gcc.gnu.org/g:5d3052a4755173f447cfcffa361086562033c8be

commit r8-10582-g5d3052a4755173f447cfcffa361086562033c8be
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Fri Oct 9 10:34:15 2020 +0100

    PR target/97349 AArch64: Incorrect types for some Neon vdupq_n_<...> intrinsics
    
    This patch fixes the PR by adjusting the input types of the intrinsic
    prototypes to the ones mandated by ACLE
    Turns out the tests in the testsuite were already using the correct
    ones, but implicit conversions hid the bug...
    
    Bootstrapped and tested on aarch64-none-linux-gnu.
    
    gcc/
            PR target/97349
            * config/aarch64/arm_neon.h (vdupq_n_p8, vdupq_n_p16,
            vdupq_n_p64, vdupq_n_s8, vdupq_n_s16, vdupq_n_u8, vdupq_n_u16):
            Fix argument type.
    
    gcc/testsuite/
            PR target/97349
            * gcc.target/aarch64/simd/pr97349.c: New test.
    
    (cherry picked from commit 8a3da2e6060ff0f61dae6aaada716e2c67f3d54f)
    (cherry picked from commit b9c1ca3e2fc84b40dc2ab70d12064e3d0eb8abdd)

Diff:
---
 gcc/config/aarch64/arm_neon.h                   | 14 +++++++-------
 gcc/testsuite/gcc.target/aarch64/simd/pr97349.c | 12 ++++++++++++
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h
index 2741b67b8d4..0216e583f0c 100644
--- a/gcc/config/aarch64/arm_neon.h
+++ b/gcc/config/aarch64/arm_neon.h
@@ -15746,7 +15746,7 @@ vdupq_n_f64 (float64_t __a)
 
 __extension__ extern __inline poly8x16_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_p8 (uint32_t __a)
+vdupq_n_p8 (poly8_t __a)
 {
   return (poly8x16_t) {__a, __a, __a, __a, __a, __a, __a, __a,
 		       __a, __a, __a, __a, __a, __a, __a, __a};
@@ -15754,21 +15754,21 @@ vdupq_n_p8 (uint32_t __a)
 
 __extension__ extern __inline poly16x8_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_p16 (uint32_t __a)
+vdupq_n_p16 (poly16_t __a)
 {
   return (poly16x8_t) {__a, __a, __a, __a, __a, __a, __a, __a};
 }
 
 __extension__ extern __inline poly64x2_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_p64 (uint64_t __a)
+vdupq_n_p64 (poly64_t __a)
 {
   return (poly64x2_t) {__a, __a};
 }
 
 __extension__ extern __inline int8x16_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_s8 (int32_t __a)
+vdupq_n_s8 (int8_t __a)
 {
   return (int8x16_t) {__a, __a, __a, __a, __a, __a, __a, __a,
 		      __a, __a, __a, __a, __a, __a, __a, __a};
@@ -15776,7 +15776,7 @@ vdupq_n_s8 (int32_t __a)
 
 __extension__ extern __inline int16x8_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_s16 (int32_t __a)
+vdupq_n_s16 (int16_t __a)
 {
   return (int16x8_t) {__a, __a, __a, __a, __a, __a, __a, __a};
 }
@@ -15797,7 +15797,7 @@ vdupq_n_s64 (int64_t __a)
 
 __extension__ extern __inline uint8x16_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_u8 (uint32_t __a)
+vdupq_n_u8 (uint8_t __a)
 {
   return (uint8x16_t) {__a, __a, __a, __a, __a, __a, __a, __a,
 		       __a, __a, __a, __a, __a, __a, __a, __a};
@@ -15805,7 +15805,7 @@ vdupq_n_u8 (uint32_t __a)
 
 __extension__ extern __inline uint16x8_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
-vdupq_n_u16 (uint32_t __a)
+vdupq_n_u16 (uint16_t __a)
 {
   return (uint16x8_t) {__a, __a, __a, __a, __a, __a, __a, __a};
 }
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/pr97349.c b/gcc/testsuite/gcc.target/aarch64/simd/pr97349.c
new file mode 100644
index 00000000000..026767a7243
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/simd/pr97349.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+#include <arm_neon.h>
+
+poly16x8_t  (*fp0)(poly16_t) = vdupq_n_p16;
+poly64x2_t  (*fp1)(poly64_t) = vdupq_n_p64;
+poly8x16_t  (*fp2)(poly8_t)  = vdupq_n_p8;
+int16x8_t   (*fp3)(int16_t)  = vdupq_n_s16;
+int8x16_t   (*fp4)(int8_t)   = vdupq_n_s8;
+uint16x8_t  (*fp5)(uint16_t) = vdupq_n_u16;
+uint8x16_t  (*fp6)(uint8_t)  = vdupq_n_u8;
+


More information about the Gcc-cvs mailing list