On 20/03/2025 16:15, Christophe Lyon wrote:
> Like previous patches, fix the use of -mcpu=unset and -mfpu=auto in
> several effective target shared between aarch64 and arm.
> 
> aarch64 does not support these flags, so we use them only on arm.
> 
> Replace "" with -mfpu=auto in the first flags we try on arm to make
> sure the intended FPU effect of -march is taken into account in case
> the whole testsuite is executed with flags overridden. (e.g. forcing
> M-profile)
> 
> This re-enables many tests, including:
> vdot-3-[134].c (aarch64)
> vdot-exec.c (aarch64)
> vector-complex.c (aarch64)
> vector-complex_f16.c (aarch64)
> some tests from vect/complex.exp (arm and aarch64)
> vqrdmlah* (aarch64)
> vqrdmlsh* (aarch64)
> f16 tests in advsimd-intrinsics (arm and aarch64)
> 
>       gcc/testsuite/
>       * lib/target-supports.exp
>       (check_effective_target_arm_v8_1a_neon_ok_nocache): Fix use of
>       -mcpu=unset and -mfpu=auto.
>       (check_effective_target_arm_v8_2a_fp16_scalar_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_3a_complex_neon_ok_nocache): Likewise.
>       (check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache): 
> Likewise.

And this one to (as patch 6).

R.

> ---
>  gcc/testsuite/lib/target-supports.exp | 93 +++++++++++++++++++++------
>  1 file changed, 74 insertions(+), 19 deletions(-)
> 
> diff --git a/gcc/testsuite/lib/target-supports.exp 
> b/gcc/testsuite/lib/target-supports.exp
> index 587db04b95e..aa0d18a0dc5 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -6588,17 +6588,27 @@ 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 ""
> +    set fpu_auto ""
>  
>      if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
>       return 0;
>      }
>  
> +    if { [istarget arm*-*-*] } {
> +     set cpu_unset "-mcpu=unset"
> +     set fpu_auto "-mfpu=auto"
> +    }
> +
>      # 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 flags [list "$fpu_auto" \
> +                    "-mfpu=neon-fp-armv8" \
> +                    "-mfloat-abi=softfp" \
> +                    "-mfpu=neon-fp-armv8 -mfloat-abi=softfp" ] {
> +     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"
> @@ -6625,22 +6635,31 @@ 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 ""
> +    set fpu_auto ""
>  
>      if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
>       return 0;
>      }
>  
> +    if { [istarget arm*-*-*] } {
> +     set cpu_unset "-mcpu=unset"
> +     set fpu_auto "-mfpu=auto"
> +    }
> +
>      # 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" \
> -                    "-mfpu=fp-armv8 -mfloat-abi=softfp"} {
> +    foreach flags [list "$fpu_auto" \
> +                    "-mfpu=fp-armv8" \
> +                    "-mfloat-abi=softfp" \
> +                    "-mfpu=fp-armv8 -mfloat-abi=softfp" ] {
>       if { [check_no_compiler_messages_nocache \
>                 arm_v8_2a_fp16_scalar_ok object {
>           #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
>       }
>      }
> @@ -6704,22 +6723,31 @@ 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 ""
> +    set fpu_auto ""
>  
>      if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
>       return 0;
>      }
>  
> +    if { [istarget arm*-*-*] } {
> +     set cpu_unset "-mcpu=unset"
> +     set fpu_auto "-mfpu=auto"
> +    }
> +
>      # 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"} {
> +    foreach flags [list "$fpu_auto" \
> +                    "-mfloat-abi=softfp -mfpu=neon-fp-armv8" \
> +                    "-mfloat-abi=hard -mfpu=neon-fp-armv8" ] {
>       if { [check_no_compiler_messages_nocache \
>                 arm_v8_2a_dotprod_neon_ok object {
>           #include <stdint.h>
>           #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
>       }
>      }
> @@ -6793,22 +6821,31 @@ 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 ""
> +    set fpu_auto ""
>  
>      if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
>       return 0;
>      }
>  
> +    if { [istarget arm*-*-*] } {
> +     set cpu_unset "-mcpu=unset"
> +     set fpu_auto "-mfpu=auto"
> +    }
> +
>      # 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" } {
> +    foreach flags [list "$fpu_auto" \
> +                    "-mfloat-abi=softfp -mfpu=neon-fp-armv8" \
> +                    "-mfloat-abi=hard -mfpu=neon-fp-armv8" ] {
>       if { [check_no_compiler_messages_nocache \
>                 arm_v8_2a_i8mm_ok object {
>           #include <arm_neon.h>
>           #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
>       }
>      }
> @@ -13387,21 +13424,30 @@ 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 ""
> +    set fpu_auto ""
>  
>      if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
>       return 0;
>      }
>  
> +    if { [istarget arm*-*-*] } {
> +     set cpu_unset "-mcpu=unset"
> +     set fpu_auto "-mfpu=auto"
> +    }
> +
>      # 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"} {
> +    foreach flags [list "$fpu_auto" \
> +                    "-mfloat-abi=softfp -mfpu=auto" \
> +                    "-mfloat-abi=hard -mfpu=auto" ] {
>       if { [check_no_compiler_messages_nocache \
>                 arm_v8_3a_complex_neon_ok assembly {
>           #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;
>       }
>      }
> @@ -13429,22 +13475,31 @@ 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 ""
> +    set fpu_auto ""
>  
>      if { ![istarget arm*-*-*] && ![istarget aarch64*-*-*] } {
>       return 0;
>      }
>  
> +    if { [istarget arm*-*-*] } {
> +     set cpu_unset "-mcpu=unset"
> +     set fpu_auto "-mfpu=auto"
> +    }
> +
>      # 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"} {
> +    foreach flags [list "$fpu_auto" \
> +                    "-mfloat-abi=softfp -mfpu=auto" \
> +                    "-mfloat-abi=hard -mfpu=auto"] {
>       if { [check_no_compiler_messages_nocache \
>                 arm_v8_3a_fp16_complex_neon_ok assembly {
>           #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