From 4dcd1054bf677f8022fd5c92704e46597018396c Mon Sep 17 00:00:00 2001 From: James Greenhalgh Date: Tue, 8 Jan 2013 14:49:01 +0000 Subject: [PATCH] [AARCH64] Fix support for vectorization over sqrt (), sqrtf (). gcc/ * config/aarch64/aarch64-builtins.c (aarch64_builtin_vectorized_function): Handle sqrt, sqrtf. gcc/testsuite/ * gcc.target/aarch64/vsqrt.c (test_square_root_v2sf): Use endian-safe float pool loading. (test_square_root_v4sf): Likewise. (test_square_root_v2df): Likewise. * lib/target-supports.exp (check_effective_target_vect_call_sqrtf): Add AArch64. From-SVN: r195017 --- gcc/ChangeLog | 5 +++++ gcc/config/aarch64/aarch64-builtins.c | 3 +++ gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/gcc.target/aarch64/vsqrt.c | 12 +++++++++--- gcc/testsuite/lib/target-supports.exp | 3 ++- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4c8481ff55..478b4edbdf6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-01-08 James Greenhalgh + + * config/aarch64/aarch64-builtins.c + (aarch64_builtin_vectorized_function): Handle sqrt, sqrtf. + 2013-01-08 Martin Jambor PR debug/55579 diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index a683afd0bb6..f54e9f4a68d 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -1271,6 +1271,9 @@ aarch64_builtin_vectorized_function (tree fndecl, tree type_out, tree type_in) case BUILT_IN_NEARBYINT: case BUILT_IN_NEARBYINTF: return AARCH64_FIND_FRINT_VARIANT (frinti); + case BUILT_IN_SQRT: + case BUILT_IN_SQRTF: + return AARCH64_FIND_FRINT_VARIANT (sqrt); #undef AARCH64_CHECK_BUILTIN_MODE #define AARCH64_CHECK_BUILTIN_MODE(C, N) \ (out_mode == N##Imode && out_n == C \ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5d6acaf6194..a2ef1e84122 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2013-01-08 James Greenhalgh + + * gcc.target/aarch64/vsqrt.c (test_square_root_v2sf): Use + endian-safe float pool loading. + (test_square_root_v4sf): Likewise. + (test_square_root_v2df): Likewise. + * lib/target-supports.exp + (check_effective_target_vect_call_sqrtf): Add AArch64. + 2013-01-08 Martin Jambor PR debug/55579 diff --git a/gcc/testsuite/gcc.target/aarch64/vsqrt.c b/gcc/testsuite/gcc.target/aarch64/vsqrt.c index b59535a9b5f..5b777b236da 100644 --- a/gcc/testsuite/gcc.target/aarch64/vsqrt.c +++ b/gcc/testsuite/gcc.target/aarch64/vsqrt.c @@ -11,9 +11,11 @@ extern void abort (void); void test_square_root_v2sf () { - float32x2_t val = {4.0f, 9.0f}; + const float32_t pool[] = {4.0f, 9.0f}; + float32x2_t val; float32x2_t res; + val = vld1_f32 (pool); res = vsqrt_f32 (val); if (vget_lane_f32 (res, 0) != 2.0f) @@ -25,9 +27,11 @@ test_square_root_v2sf () void test_square_root_v4sf () { - float32x4_t val = {4.0f, 9.0f, 16.0f, 25.0f}; + const float32_t pool[] = {4.0f, 9.0f, 16.0f, 25.0f}; + float32x4_t val; float32x4_t res; + val = vld1q_f32 (pool); res = vsqrtq_f32 (val); if (vgetq_lane_f32 (res, 0) != 2.0f) @@ -43,9 +47,11 @@ test_square_root_v4sf () void test_square_root_v2df () { - float64x2_t val = {4.0, 9.0}; + const float64_t pool[] = {4.0, 9.0}; + float64x2_t val; float64x2_t res; + val = vld1q_f64 (pool); res = vsqrtq_f64 (val); if (vgetq_lane_f64 (res, 0) != 2.0) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index a3828cbbec6..a6d766e279f 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3952,7 +3952,8 @@ proc check_effective_target_vect_call_sqrtf { } { verbose "check_effective_target_vect_call_sqrtf: using cached result" 2 } else { set et_vect_call_sqrtf_saved 0 - if { [istarget i?86-*-*] + if { [istarget aarch64*-*-*] + || [istarget i?86-*-*] || [istarget x86_64-*-*] || ([istarget powerpc*-*-*] && [check_vsx_hw_available]) } { set et_vect_call_sqrtf_saved 1