AArch64: Implement missing vrndns_f32 intrinsic
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Wed, 23 Sep 2020 11:02:29 +0000 (12:02 +0100)
committerKyrylo Tkachov <kyrylo.tkachov@arm.com>
Wed, 23 Sep 2020 11:02:29 +0000 (12:02 +0100)
This patch implements the missing vrndns_f32 intrinsic. This operates on a scalar float32_t value.
It can be mapped down to a __builtin_aarch64_frintnsf builtin.

This patch does that.

Bootstrapped and tested on aarch64-none-linux-gnu.

gcc/
PR target/71233
* config/aarch64/aarch64-simd-builtins.def (frintn): Use BUILTIN_VHSDF_HSDF
for modes.  Remove explicit hf instantiation.
* config/aarch64/arm_neon.h (vrndns_f32): Define.

gcc/testsuite/
PR target/71233
* gcc.target/aarch64/simd/vrndns_f32_1.c: New test.

gcc/config/aarch64/aarch64-simd-builtins.def
gcc/config/aarch64/arm_neon.h
gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c [new file with mode: 0644]

index d1b21102b2f740c7a38a585e171f0a9a6e278ac9..48ecd4a2d6bc2ec8a1651ee224c831215354a3d9 100644 (file)
   BUILTIN_VHSDF (UNOP, nearbyint, 2, FP)
   BUILTIN_VHSDF (UNOP, rint, 2, FP)
   BUILTIN_VHSDF (UNOP, round, 2, FP)
-  BUILTIN_VHSDF_DF (UNOP, frintn, 2, FP)
+  BUILTIN_VHSDF_HSDF (UNOP, frintn, 2, FP)
 
   VAR1 (UNOP, btrunc, 2, FP, hf)
   VAR1 (UNOP, ceil, 2, FP, hf)
   VAR1 (UNOP, floor, 2, FP, hf)
-  VAR1 (UNOP, frintn, 2, FP, hf)
   VAR1 (UNOP, nearbyint, 2, FP, hf)
   VAR1 (UNOP, rint, 2, FP, hf)
   VAR1 (UNOP, round, 2, FP, hf)
index e8c130f5e80696778b553572cf023cc880a2233e..b3c9b64201424d5b7aa8b34e8a6b548567812070 100644 (file)
@@ -26073,6 +26073,13 @@ vrndmq_f64 (float64x2_t __a)
 
 /* vrndn  */
 
+__extension__ extern __inline float32_t
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+vrndns_f32 (float32_t __a)
+{
+  return __builtin_aarch64_frintnsf (__a);
+}
+
 __extension__ extern __inline float32x2_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
 vrndn_f32 (float32x2_t __a)
diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c b/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c
new file mode 100644 (file)
index 0000000..960e4f6
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+#include <arm_neon.h>
+
+float32_t
+test (float32_t a)
+{
+  return vrndns_f32 (a);
+}
+
+/* { dg-final { scan-assembler-times "frintn\\ts\[0-9\]+, s\[0-9\]+" 1 } } */
+