]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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>
Mon, 28 Sep 2020 12:56:48 +0000 (13:56 +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.

(cherry picked from commit 02b5377b3766804059b7824330d33d0e1cef2e5b)

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 332a0b6b1eae00d1656be27da4bfd349ad449f7c..a1d88d0caead7fc820c80c73d172897c0c343ad7 100644 (file)
   BUILTIN_VHSDF (UNOP, nearbyint, 2)
   BUILTIN_VHSDF (UNOP, rint, 2)
   BUILTIN_VHSDF (UNOP, round, 2)
-  BUILTIN_VHSDF_DF (UNOP, frintn, 2)
+  BUILTIN_VHSDF_HSDF (UNOP, frintn, 2)
 
   VAR1 (UNOP, btrunc, 2, hf)
   VAR1 (UNOP, ceil, 2, hf)
   VAR1 (UNOP, floor, 2, hf)
-  VAR1 (UNOP, frintn, 2, hf)
   VAR1 (UNOP, nearbyint, 2, hf)
   VAR1 (UNOP, rint, 2, hf)
   VAR1 (UNOP, round, 2, 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 } } */
+