From 7926a220d853e7c28576e69f90eab1aff684c5ad Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Mon, 23 Sep 2019 15:28:10 -0400 Subject: [PATCH] 2019-09-23 Sandra Loosemore gcc/testsuite/ * lib/target-supports.exp (check_effective_target_arm_vfp_ok_nocache): New. (check_effective_target_arm_vfp_ok): Rewrite. (add_options_for_arm_vfp): New. (add_options_for_sqrt_insn): Add options for arm. * gcc.target/arm/attr-neon-builtin-fail2.c: Use dg-add-options. * gcc.target/arm/short-vfp-1.c: Likewise. From-SVN: r276063 --- gcc/testsuite/ChangeLog | 10 ++++ .../gcc.target/arm/attr-neon-builtin-fail2.c | 3 +- gcc/testsuite/gcc.target/arm/short-vfp-1.c | 2 +- gcc/testsuite/lib/target-supports.exp | 46 +++++++++++++++---- 4 files changed, 50 insertions(+), 11 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f381bb24f76..a9b108db1dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2019-09-23 Sandra Loosemore + + * lib/target-supports.exp + (check_effective_target_arm_vfp_ok_nocache): New. + (check_effective_target_arm_vfp_ok): Rewrite. + (add_options_for_arm_vfp): New. + (add_options_for_sqrt_insn): Add options for arm. + * gcc.target/arm/attr-neon-builtin-fail2.c: Use dg-add-options. + * gcc.target/arm/short-vfp-1.c: Likewise. + 2019-09-23 Marek Polacek PR c++/91844 - Implement CWG 2352, Similar types and reference binding. diff --git a/gcc/testsuite/gcc.target/arm/attr-neon-builtin-fail2.c b/gcc/testsuite/gcc.target/arm/attr-neon-builtin-fail2.c index 0f8ac1b723c..9cb5a2ebb90 100644 --- a/gcc/testsuite/gcc.target/arm/attr-neon-builtin-fail2.c +++ b/gcc/testsuite/gcc.target/arm/attr-neon-builtin-fail2.c @@ -1,7 +1,8 @@ /* Check that calling a neon builtin from a function compiled with vfp fails. */ /* { dg-do compile } */ /* { dg-require-effective-target arm_vfp_ok } */ -/* { dg-options "-O2 -mfloat-abi=softfp" } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_vfp } */ extern __simd64_int8_t a, b; diff --git a/gcc/testsuite/gcc.target/arm/short-vfp-1.c b/gcc/testsuite/gcc.target/arm/short-vfp-1.c index d96c7631798..3ca1ffc0017 100644 --- a/gcc/testsuite/gcc.target/arm/short-vfp-1.c +++ b/gcc/testsuite/gcc.target/arm/short-vfp-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-require-effective-target arm_vfp_ok } -/* { dg-options "-mfpu=vfp" } */ +/* { dg-add-options arm_vfp } */ int test_sisf (float x) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 414bf80003b..6a1aaca9691 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3489,18 +3489,43 @@ proc check_effective_target_arm_soft_ok { } { } } -# Return 1 if this is an ARM target supporting -mfpu=vfp -# -mfloat-abi=softfp. Some multilibs may be incompatible with these -# options. +# Return 1 if this is an ARM target supporting -mfpu=vfp with an +# appropriate abi. -proc check_effective_target_arm_vfp_ok { } { +proc check_effective_target_arm_vfp_ok_nocache { } { + global et_arm_vfp_flags + set et_arm_vfp_flags "" if { [check_effective_target_arm32] } { - return [check_no_compiler_messages arm_vfp_ok object { - int dummy; - } "-mfpu=vfp -mfloat-abi=softfp"] - } else { - return 0 + foreach flags {"-mfpu=vfp" "-mfpu=vfp -mfloat-abi=softfp" "-mpu=vfp -mfloat-abi=hard"} { + if { [check_no_compiler_messages_nocache arm_fp_ok object { + #ifndef __ARM_FP + #error __ARM_FP not defined + #endif + } "$flags"] } { + set et_arm_vfp_flags $flags + return 1 + } + } } + + return 0 +} + +proc check_effective_target_arm_vfp_ok { } { + return [check_cached_effective_target arm_vfp_ok \ + check_effective_target_arm_vfp_ok_nocache] +} + +# Add the options needed to compile code with -mfpu=vfp. We need either +# -mfloat-abi=softfp or -mfloat-abi=hard, but if one is already +# specified by the multilib, use it. + +proc add_options_for_arm_vfp { flags } { + if { ! [check_effective_target_arm_vfp_ok] } { + return "$flags" + } + global et_arm_vfp_flags + return "$flags $et_arm_vfp_flags" } # Return 1 if this is an ARM target supporting -mfpu=vfp3 @@ -6678,6 +6703,9 @@ proc add_options_for_sqrt_insn { flags } { if { [istarget amdgcn*-*-*] } { return "$flags -ffast-math" } + if { [istarget arm*-*-*] } { + return [add_options_for_arm_vfp "$flags"] + } return $flags } -- 2.30.2