[PATCH v2 2/2] testsuite: add -fpu=auto to complex_neon checks for arm
Richard Earnshaw
Richard.Earnshaw@arm.com
Thu Jan 22 16:05:36 GMT 2026
On 14/01/2026 14:20, Artemiy Volkov wrote:
> This is a v2 of
> https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705195.html with
> feedback from Richard and Christophe addressed.
>
> 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. (This split of option sets allows us to remove the redundant
> "+simd" from -march on aarch64, as simd is present on all base
> architectures all the way from armv8-a.) Moreover, it changes
> check_effective_target_arm_v8_3a_complex_neon_ok_nocache in a similar way,
> except offering an empty string as the first alternative to try testing
> with the flags that gcc was configured with.
>
> This (together with patch 1/2) fixes the
> advsimd-intrinsics/vector-complex_f16.c testcase, which was previously
> being compiled with the -mfpu=neon-fp16 flag added by the .exp file
> itself.
>
> Re-tested on aarch64 by me and on arm by Christophe.
>
> Changes from v1:
>
> - Add "" and "-mfpu=auto" as the first alternative
> in check_effective_target_arm_v8_3a{,_fp16}_complex_neon_ok,
> respectively.
> - Clarify the changes to -march values in the aarch64 case in the commit
> message.
>
> Co-authored-by: Richard Earnshaw <rearnsha@arm.com>
>
> 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 | 33 ++++++++++++++++++---------
> 1 file changed, 22 insertions(+), 11 deletions(-)
>
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index dbcba42629f..77399a04bc5 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -13717,27 +13717,33 @@ 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 {
> + ""
I don't see how it can be right that we don't need -mcpu=auto here...
> + "-mcpu=unset -march=armv8.3-a+simd"
> + "-mfloat-abi=softfp -mfpu=auto -mcpu=unset -march=armv8.3-a+simd"
> + "-mfloat-abi=hard -mfpu=auto -mcpu=unset -march=armv8.3-a+simd"
> + }
> + } else {
> + set flag_opts { "" "-march=armv8.3-a" }
> }
>
> # 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 +13771,25 @@ 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 {
> + "-mfpu=auto"
... but do here. This implies something else is wrong. FWIW, I think
the first case is what we really want, though there may be other bugs in
some tests that need fixing as well.
> + "-mfpu=auto -mcpu=unset -march=armv8.3-a+fp16+simd"
> + "-mfloat-abi=softfp -mfpu=auto -mcpu=unset -march=armv8.3-a+fp16+simd"
> + "-mfloat-abi=hard -mfpu=auto -mcpu=unset -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 +13799,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;
> }
> }
R.
More information about the Gcc-patches
mailing list