Hi,

As discussed some time ago with Kyrylo (on IRC IIRC), the attached
patch makes sure that arm_neon_fp16_ok and arm_neonv2_ok effective
targets imply that arm_neon_ok passes, and use the corresponding
flags.

Without this patch, the 3 effective targets have different, possibly
inconsistent conditions. For instance, arm_neon_ok make sure that
__ARM_ARCH >= 7, but arm_neon_fp16_ok does not.

This led to failures on configurations not supporting neon, but where
arm_neon_fp16_ok passes as the test is less strict.
Rather than duplicating the same tests, I preferred to call
arm_neon_ok from the other places.

We then use the union of flags needed for arm_neon_ok and
arm_neon_fp16_ok to pass.

Tested on many arm configurations with no harm. It prevents
arm_neon_fp16 tests from passing when forcing -march=armv5t, that
seems coherent.

OK?

Christophe
gcc/testsuite/ChangeLog:

2016-06-17  Christophe Lyon  <christophe.l...@linaro.org>

        * lib/target-supports.exp
        (check_effective_target_arm_neon_fp16_ok_nocache): Call
        arm_neon_ok and merge flags. Fix temporary test name.
        (check_effective_target_arm_neonv2_ok_nocache): Call arm_neon_ok
        and merge flags.
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index f4cb276..bbb5343 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2990,23 +2990,25 @@ proc check_effective_target_arm_crc_ok { } {
 
 proc check_effective_target_arm_neon_fp16_ok_nocache { } {
     global et_arm_neon_fp16_flags
+    global et_arm_neon_flags
     set et_arm_neon_fp16_flags ""
-    if { [check_effective_target_arm32] } {
+    if { [check_effective_target_arm32]
+        && [check_effective_target_arm_neon_ok] } {
        foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
                       "-mfpu=neon-fp16 -mfloat-abi=softfp"
                       "-mfp16-format=ieee"
                       "-mfloat-abi=softfp -mfp16-format=ieee"
                       "-mfpu=neon-fp16 -mfp16-format=ieee"
                       "-mfpu=neon-fp16 -mfloat-abi=softfp -mfp16-format=ieee"} 
{
-           if { [check_no_compiler_messages_nocache arm_neon_fp_16_ok object {
+           if { [check_no_compiler_messages_nocache arm_neon_fp16_ok object {
                #include "arm_neon.h"
                float16x4_t
                foo (float32x4_t arg)
                {
                   return vcvt_f16_f32 (arg);
                }
-           } "$flags"] } {
-               set et_arm_neon_fp16_flags $flags
+           } "$et_arm_neon_flags $flags"] } {
+               set et_arm_neon_fp16_flags [concat $et_arm_neon_flags $flags]
                return 1
            }
        }
@@ -3085,8 +3087,10 @@ proc check_effective_target_arm_v8_neon_ok { } {
 
 proc check_effective_target_arm_neonv2_ok_nocache { } {
     global et_arm_neonv2_flags
+    global et_arm_neon_flags
     set et_arm_neonv2_flags ""
-    if { [check_effective_target_arm32] } {
+    if { [check_effective_target_arm32]
+        && [check_effective_target_arm_neon_ok] } {
        foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" 
"-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
            if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
                #include "arm_neon.h"
@@ -3095,8 +3099,8 @@ proc check_effective_target_arm_neonv2_ok_nocache { } {
                 {
                   return vfma_f32 (a, b, c);
                 }
-           } "$flags"] } {
-               set et_arm_neonv2_flags $flags
+           } "$et_arm_neon_flags $flags"] } {
+               set et_arm_neonv2_flags [concat $et_arm_neon_flags $flags]
                return 1
            }
        }

Reply via email to