On 1/8/26 12:53, Artemiy Volkov wrote:
The check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache
procedure in target-supports.exp should return a set of flags providing
all of AdvSIMD, complex numbers, and fp16 capabilities.  However, to
achieve this we have to be able to overwrite the current -mfpu setting.
This means that the current empty string alternative for $flags does not
work for us.  This patch splits sets of options to iterate over
between the arm and the aarch64 backend and prohibits an empty string for
the former.  Moreover, it changes
check_effective_target_arm_v8_3a_complex_neon_ok_nocache in the same way.

This (fully) fixes the advsimd-intrinsics.exp/vector-complex_f16.c
testcase, which was previously being compiled with the -mfpu=neon-fp16
flag added by the .exp file itself.

Tested on aarch64 by me and on arm by Christophe.

Co-authored-by: Richard Earnshaw <[email protected]>

gcc/testsuite/ChangeLog:

        * lib/target-supports.exp:
        (check_effective_target_arm_v8_3a_complex_neon_ok_nocache):
        Split and fill in arm and aarch64 compile options.  Remove the
        cpu_unset variable.
        (check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache):
        Likewise.
---
  gcc/testsuite/lib/target-supports.exp | 31 +++++++++++++++++----------
  1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index dbcba42629f..210e246c955 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -13717,27 +13717,32 @@ 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"
+       set flag_opts {
+           "-mcpu=unset -mfpu=auto -march=armv8.3-a+simd"
+           "-mcpu=unset -mfloat-abi=softfp -mfpu=auto -march=armv8.3-a+simd"
+           "-mcpu=unset -mfloat-abi=hard -mfpu=auto -march=armv8.3-a+simd"
+       }
+    } else {
+       set flag_opts { "" "-march=armv8.3-a" }
      }

While this had no visible effect with the configurations I/we have tested, I suspect we still want to start with just "-mcpu=unset" on arm. Richard?

And on aarch64, dropping +simd seems harmless at the moment, but maybe we want to keep it in order to be more future-proof?

Thanks,

Christophe

# 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 $flag_opts {
        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
            #include <complex.h>
-       } "$flags $cpu_unset -march=armv8.3-a+simd"] } {
-           set et_arm_v8_3a_complex_neon_flags "$flags $cpu_unset 
-march=armv8.3-a+simd"
+       } "$flags"] } {
+           set et_arm_v8_3a_complex_neon_flags "$flags"
            return 1;
        }
      }
@@ -13765,19 +13770,24 @@ 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"
+       set flag_opts {
+           "-mcpu=unset -mfpu=auto -march=armv8.3-a+fp16+simd"
+           "-mcpu=unset -mfloat-abi=softfp -mfpu=auto 
-march=armv8.3-a+fp16+simd"
+           "-mcpu=unset -mfloat-abi=hard -mfpu=auto -march=armv8.3-a+fp16+simd"
+       }
+    } else {
+       set flag_opts { "" "-march=armv8.3-a+fp16" }
      }
# 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 $flag_opts {
        if { [check_no_compiler_messages_nocache \
                  arm_v8_3a_fp16_complex_neon_ok assembly {
            #if !defined (__ARM_FEATURE_COMPLEX)
@@ -13787,9 +13797,8 @@ proc 
check_effective_target_arm_v8_3a_fp16_complex_neon_ok_nocache { } {
            #error "__ARM_FEATURE_FP16_VECTOR_ARITHMETIC not defined"
            #endif
            #include <complex.h>
-       } "$flags $cpu_unset -march=armv8.3-a+fp16+simd"] } {
-           set et_arm_v8_3a_fp16_complex_neon_flags \
-                       "$flags $cpu_unset -march=armv8.3-a+fp16+simd"
+       } "$flags"] } {
+           set et_arm_v8_3a_fp16_complex_neon_flags "$flags"
            return 1;
        }
      }

Reply via email to