Many tests became unsupported on aarch64 when -mcpu=unset was added to
arm_v8_2a_fp16_neon_ok and arm_v8_2a_bf16_neon_ok effective targets,
because this flag is only supported on arm.

Since these effective targets are used on arm and aarch64, the patch
adds -mcpu=unset on arm only, and restores "" on aarch64.

This re-enables bf16 tests on aarch64, and I noticed
  #PASS: 6838 -> 8290
  #UNSUPPORTED: 1491 -> 1030 in gcc.target/aarch64/advsimd-intrinsics

        gcc/testsuite/
        * lib/target-supports.exp
        (check_effective_target_arm_v8_2a_fp16_neon_ok_nocache): Use
        -mcpu=unset on arm only.
        (check_effective_target_arm_v8_2a_bf16_neon_ok_nocache): Likewise.
---
 gcc/testsuite/lib/target-supports.exp | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index 09b16a14024..c2df22d2255 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -6660,11 +6660,16 @@ proc check_effective_target_arm_v8_2a_fp16_scalar_ok { 
} {
 proc check_effective_target_arm_v8_2a_fp16_neon_ok_nocache { } {
     global et_arm_v8_2a_fp16_neon_flags
     set et_arm_v8_2a_fp16_neon_flags ""
+    set cpu_unset ""
 
     if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
        return 0;
     }
 
+    if { [istarget arm*-*-*] } {
+       set cpu_unset "-mcpu=unset"
+    }
+
     # Iterate through sets of options to find the compiler flags that
     # need to be added to the -march option.
     foreach flags {"" "-mfpu=neon-fp-armv8" "-mfloat-abi=softfp" \
@@ -6674,8 +6679,8 @@ proc 
check_effective_target_arm_v8_2a_fp16_neon_ok_nocache { } {
            #if !defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
            #error "__ARM_FEATURE_FP16_VECTOR_ARITHMETIC not defined"
            #endif
-       } "$flags -mcpu=unset -march=armv8.2-a+fp16"] } {
-           set et_arm_v8_2a_fp16_neon_flags "$flags -mcpu=unset 
-march=armv8.2-a+fp16"
+       } "$flags $cpu_unset -march=armv8.2-a+fp16"] } {
+           set et_arm_v8_2a_fp16_neon_flags "$flags $cpu_unset 
-march=armv8.2-a+fp16"
            return 1
        }
     }
@@ -6871,6 +6876,7 @@ proc add_options_for_arm_fp16fml_neon { flags } {
 proc check_effective_target_arm_v8_2a_bf16_neon_ok_nocache { } {
     global et_arm_v8_2a_bf16_neon_flags
     set et_arm_v8_2a_bf16_neon_flags ""
+    set cpu_unset ""
     set fpu_auto ""
 
     if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
@@ -6878,6 +6884,7 @@ proc 
check_effective_target_arm_v8_2a_bf16_neon_ok_nocache { } {
     }
 
     if { [istarget arm*-*-*] } {
+       set cpu_unset "-mcpu=unset"
        set fpu_auto "-mfpu=auto"
     }
 
@@ -6889,8 +6896,8 @@ proc 
check_effective_target_arm_v8_2a_bf16_neon_ok_nocache { } {
            #if !defined (__ARM_FEATURE_BF16_VECTOR_ARITHMETIC)
            #error "__ARM_FEATURE_BF16_VECTOR_ARITHMETIC not defined"
            #endif
-       } "$flags -mcpu=unset -march=armv8.2-a+bf16"] } {
-           set et_arm_v8_2a_bf16_neon_flags "$flags -mcpu=unset 
-march=armv8.2-a+bf16"
+       } "$flags $cpu_unset -march=armv8.2-a+bf16"] } {
+           set et_arm_v8_2a_bf16_neon_flags "$flags $cpu_unset 
-march=armv8.2-a+bf16"
            return 1
        }
     }
-- 
2.34.1

Reply via email to