From 02b5377b3766804059b7824330d33d0e1cef2e5b Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Wed, 23 Sep 2020 12:02:29 +0100 Subject: [PATCH] AArch64: Implement missing vrndns_f32 intrinsic 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 | 3 +-- gcc/config/aarch64/arm_neon.h | 7 +++++++ .../gcc.target/aarch64/simd/vrndns_f32_1.c | 13 +++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c diff --git a/gcc/config/aarch64/aarch64-simd-builtins.def b/gcc/config/aarch64/aarch64-simd-builtins.def index d1b21102b2f..48ecd4a2d6b 100644 --- a/gcc/config/aarch64/aarch64-simd-builtins.def +++ b/gcc/config/aarch64/aarch64-simd-builtins.def @@ -338,12 +338,11 @@ 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) diff --git a/gcc/config/aarch64/arm_neon.h b/gcc/config/aarch64/arm_neon.h index e8c130f5e80..b3c9b642014 100644 --- a/gcc/config/aarch64/arm_neon.h +++ b/gcc/config/aarch64/arm_neon.h @@ -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 index 00000000000..960e4f6f768 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/vrndns_f32_1.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#include + +float32_t +test (float32_t a) +{ + return vrndns_f32 (a); +} + +/* { dg-final { scan-assembler-times "frintn\\ts\[0-9\]+, s\[0-9\]+" 1 } } */ + -- 2.30.2