https://gcc.gnu.org/g:f716eb6065aaf62b46f223a08f2666cce3e5ff99

commit r16-816-gf716eb6065aaf62b46f223a08f2666cce3e5ff99
Author: Christophe Lyon <christophe.l...@linaro.org>
Date:   Tue May 20 16:42:18 2025 +0000

    testsuite: aarch64: arm: Fix -mcpu=unset support in shared effective targets
    
    Many tests became unsupported on aarch64 when -mcpu=unset was added to
    several arm_* 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 lots of tests:
    advsimd-intrinsics/vqrdmlah
    fp16 tests
    dotprod tests
    i8mm tests
    aarch64/simd/vmmla.c
    bf16 tests
    gcc.dg/vect/complex tests
    
    With this change, a few more failures appear, but should be fixed 
separately:
    FAIL: gcc.dg/vect/complex/fast-math-complex-mls-double.c -flto 
-ffat-lto-objects  scan-tree-dump vect "Found COMPLEX_ADD_ROT270"
    FAIL: gcc.dg/vect/complex/fast-math-complex-mls-double.c scan-tree-dump 
vect "Found COMPLEX_ADD_ROT270"
    FAIL: gcc.dg/vect/complex/fast-math-complex-mls-float.c -flto 
-ffat-lto-objects  scan-tree-dump vect "Found COMPLEX_ADD_ROT270"
    FAIL: gcc.dg/vect/complex/fast-math-complex-mls-float.c scan-tree-dump vect 
"Found COMPLEX_ADD_ROT270"
    FAIL: gcc.dg/vect/complex/fast-math-complex-mls-half-float.c -flto 
-ffat-lto-objects  scan-tree-dump vect "Found COMPLEX_ADD_ROT270"
    FAIL: gcc.dg/vect/complex/fast-math-complex-mls-half-float.c scan-tree-dump 
vect "Found COMPLEX_ADD_ROT270"
    
            gcc/testsuite/ChangeLog
    
            * lib/target-supports.exp 
(check_effective_target_arm_v8_1a_neon_ok_nocache): Use
            -mcpu=unset on arm only.
            (check_effective_target_arm_v8_2a_fp16_scalar_ok_nocache): Likewise.
            (check_effective_target_arm_v8_2a_fp16_neon_ok_nocache): Likewise.
            (check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache): 
Likewise.
            (check_effective_target_arm_v8_2a_i8mm_ok_nocache): Likewise.
            (check_effective_target_arm_v8_2a_bf16_neon_ok_nocache): Likewise.
            (check_effective_target_arm_v8_3a_complex_neon_ok_nocache): 
Likewise.
            (check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache): 
Likewise.

Diff:
---
 gcc/testsuite/lib/target-supports.exp | 71 +++++++++++++++++++++++++++--------
 1 file changed, 56 insertions(+), 15 deletions(-)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index e0495d8437c9..6286e361fed0 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -6631,17 +6631,23 @@ proc add_options_for_arm_v8_1m_mve_fp { flags } {
 proc check_effective_target_arm_v8_1a_neon_ok_nocache { } {
     global et_arm_v8_1a_neon_flags
     set et_arm_v8_1a_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.  Start with the empty set
     # since AArch64 only needs the -march setting.
     foreach flags {"" "-mfpu=neon-fp-armv8" "-mfloat-abi=softfp" \
                       "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
-       foreach arches { "-mcpu=unset -march=armv8-a+rdma" "-mcpu=unset 
-march=armv8.1-a" } {
+       foreach arches [list "$cpu_unset -march=armv8-a+rdma" \
+                           "$cpu_unset -march=armv8.1-a" ] {
            if { [check_no_compiler_messages_nocache arm_v8_1a_neon_ok object {
                #if !defined (__ARM_FEATURE_QRDMX)
                #error "__ARM_FEATURE_QRDMX not defined"
@@ -6668,11 +6674,16 @@ proc check_effective_target_arm_v8_1a_neon_ok { } {
 proc check_effective_target_arm_v8_2a_fp16_scalar_ok_nocache { } {
     global et_arm_v8_2a_fp16_scalar_flags
     set et_arm_v8_2a_fp16_scalar_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=fp-armv8" "-mfloat-abi=softfp" \
@@ -6682,8 +6693,8 @@ proc 
check_effective_target_arm_v8_2a_fp16_scalar_ok_nocache { } {
            #if !defined (__ARM_FEATURE_FP16_SCALAR_ARITHMETIC)
            #error "__ARM_FEATURE_FP16_SCALAR_ARITHMETIC not defined"
            #endif
-       } "$flags -mcpu=unset -march=armv8.2-a+fp16"] } {
-           set et_arm_v8_2a_fp16_scalar_flags "$flags -mcpu=unset 
-march=armv8.2-a+fp16"
+       } "$flags $cpu_unset -march=armv8.2-a+fp16"] } {
+           set et_arm_v8_2a_fp16_scalar_flags "$flags $cpu_unset 
-march=armv8.2-a+fp16"
            return 1
        }
     }
@@ -6703,11 +6714,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" \
@@ -6717,8 +6733,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
        }
     }
@@ -6738,11 +6754,16 @@ proc check_effective_target_arm_v8_2a_fp16_neon_ok { } {
 proc check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache { } {
     global et_arm_v8_2a_dotprod_neon_flags
     set et_arm_v8_2a_dotprod_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 {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" 
"-mfloat-abi=hard -mfpu=neon-fp-armv8"} {
@@ -6752,8 +6773,8 @@ proc 
check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache { } {
            #if !defined (__ARM_FEATURE_DOTPROD)
            #error "__ARM_FEATURE_DOTPROD not defined"
            #endif
-       } "$flags -mcpu=unset -march=armv8.2-a+dotprod"] } {
-           set et_arm_v8_2a_dotprod_neon_flags "$flags -mcpu=unset 
-march=armv8.2-a+dotprod"
+       } "$flags $cpu_unset -march=armv8.2-a+dotprod"] } {
+           set et_arm_v8_2a_dotprod_neon_flags "$flags $cpu_unset 
-march=armv8.2-a+dotprod"
            return 1
        }
     }
@@ -6827,11 +6848,16 @@ proc add_options_for_arm_v8_2a_dotprod_neon { flags } {
 proc check_effective_target_arm_v8_2a_i8mm_ok_nocache { } {
     global et_arm_v8_2a_i8mm_flags
     set et_arm_v8_2a_i8mm_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 {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" 
"-mfloat-abi=hard -mfpu=neon-fp-armv8" } {
@@ -6841,8 +6867,8 @@ proc check_effective_target_arm_v8_2a_i8mm_ok_nocache { } 
{
            #if !defined (__ARM_FEATURE_MATMUL_INT8)
            #error "__ARM_FEATURE_MATMUL_INT8 not defined"
            #endif
-       } "$flags -mcpu=unset -march=armv8.2-a+i8mm"] } {
-           set et_arm_v8_2a_i8mm_flags "$flags -mcpu=unset 
-march=armv8.2-a+i8mm"
+       } "$flags $cpu_unset -march=armv8.2-a+i8mm"] } {
+           set et_arm_v8_2a_i8mm_flags "$flags $cpu_unset 
-march=armv8.2-a+i8mm"
            return 1
        }
     }
@@ -6914,19 +6940,24 @@ 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 ""
 
     if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
        return 0;
     }
 
+    if { [istarget arm*-*-*] } {
+       set cpu_unset "-mcpu=unset"
+    }
+
     foreach flags {"" "-mfloat-abi=softfp -mfpu=neon-fp-armv8" 
"-mfloat-abi=hard -mfpu=neon-fp-armv8" } {
        if { [check_no_compiler_messages_nocache arm_v8_2a_bf16_neon_ok object {
            #include <arm_neon.h>
            #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
        }
     }
@@ -13404,11 +13435,16 @@ proc check_effective_target_inff { } {
 proc check_effective_target_arm_v8_3a_complex_neon_ok_nocache { } {
     global et_arm_v8_3a_complex_neon_flags
     set et_arm_v8_3a_complex_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 {"" "-mfloat-abi=softfp -mfpu=auto" "-mfloat-abi=hard 
-mfpu=auto"} {
@@ -13417,8 +13453,8 @@ proc 
check_effective_target_arm_v8_3a_complex_neon_ok_nocache { } {
            #if !defined (__ARM_FEATURE_COMPLEX)
            #error "__ARM_FEATURE_COMPLEX not defined"
            #endif
-       } "$flags -mcpu=unset -march=armv8.3-a"] } {
-           set et_arm_v8_3a_complex_neon_flags "$flags -mcpu=unset 
-march=armv8.3-a"
+       } "$flags $cpu_unset -march=armv8.3-a"] } {
+           set et_arm_v8_3a_complex_neon_flags "$flags $cpu_unset 
-march=armv8.3-a"
            return 1;
        }
     }
@@ -13446,11 +13482,16 @@ proc add_options_for_arm_v8_3a_complex_neon { flags } 
{
 proc check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache { } {
     global et_arm_v8_3a_fp16_complex_neon_flags
     set et_arm_v8_3a_fp16_complex_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 {"" "-mfloat-abi=softfp -mfpu=auto" "-mfloat-abi=hard 
-mfpu=auto"} {
@@ -13459,9 +13500,9 @@ proc 
check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache { } {
            #if !defined (__ARM_FEATURE_COMPLEX)
            #error "__ARM_FEATURE_COMPLEX not defined"
            #endif
-       } "$flags -mcpu=unset -march=armv8.3-a+fp16"] } {
+       } "$flags $cpu_unset -march=armv8.3-a+fp16"] } {
            set et_arm_v8_3a_fp16_complex_neon_flags \
-                       "$flags -mcpu=unset -march=armv8.3-a+fp16"
+                       "$flags $cpu_unset -march=armv8.3-a+fp16"
            return 1;
        }
     }

Reply via email to