testsuite: Avoid running incompatible Arm tests
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
fail
|
Test failed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Ok for trunk and releases/gcc-14?
--
Overriding the -mpfu and -mfloat-abi might be incompatible with selected
multilib. As a result, verify that the current multilib is compatible
with the effective target without changing the -mfpu or -mfloat-abi
options.
gcc/testsuite/ChangeLog:
* lib/target-supports.exp
(check_effective_target_arm_hard_vfp_ok): Check -mfpu value.
(check_effective_target_arm_fp16_alternative_ok_nocache):
Reuse check_effective_target_arm_fp16_ok.
(check_effective_target_arm_fp16_none_ok_nocache): Likewise.
(check_effective_target_arm_v8_neon_ok_nocache): Align checks
with skeleton from check_effective_target_arm_fp16_ok_nocache.
(check_effective_target_arm_neonv2_ok_nocache): Likewise.
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com>
---
gcc/testsuite/lib/target-supports.exp | 119 ++++++++++++++++++--------
1 file changed, 83 insertions(+), 36 deletions(-)
Comments
On 12/07/2024 09:02, Torbjörn SVENSSON wrote:
> Ok for trunk and releases/gcc-14?
>
> --
>
> Overriding the -mpfu and -mfloat-abi might be incompatible with selected
> multilib. As a result, verify that the current multilib is compatible
> with the effective target without changing the -mfpu or -mfloat-abi
> options.
>
> gcc/testsuite/ChangeLog:
>
> * lib/target-supports.exp
> (check_effective_target_arm_hard_vfp_ok): Check -mfpu value.
> (check_effective_target_arm_fp16_alternative_ok_nocache):
> Reuse check_effective_target_arm_fp16_ok.
> (check_effective_target_arm_fp16_none_ok_nocache): Likewise.
> (check_effective_target_arm_v8_neon_ok_nocache): Align checks
> with skeleton from check_effective_target_arm_fp16_ok_nocache.
> (check_effective_target_arm_neonv2_ok_nocache): Likewise.>
Hmm, this is a tricky one. I really want to be moving away from any value being passed to -mfpu other than "auto" and this looks like it's moving in the wrong direction.
Which tests does this affect?
R.
> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
> Co-authored-by: Yvan ROUX <yvan.roux@foss.st.com>
> ---
> gcc/testsuite/lib/target-supports.exp | 119 ++++++++++++++++++--------
> 1 file changed, 83 insertions(+), 36 deletions(-)
>
> diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
> index f001c28072f..f90b80bb495 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -4829,6 +4829,7 @@ proc check_effective_target_arm_v8_vfp_ok {} {
>
> proc check_effective_target_arm_hard_vfp_ok { } {
> if { [check_effective_target_arm32]
> + && ! [check-flags [list "" { *-*-* } { "-mfpu=*" } { "-mfpu=vfp" }]]
> && ! [check-flags [list "" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
> return [check_no_compiler_messages arm_hard_vfp_ok executable {
> int main() { return 0;}
> @@ -5405,11 +5406,12 @@ proc check_effective_target_arm_fp16_alternative_ok_nocache { } {
> # Not supported by the target system.
> return 0
> }
> + global et_arm_fp16_flags
> global et_arm_fp16_alternative_flags
> set et_arm_fp16_alternative_flags ""
> - if { [check_effective_target_arm32] } {
> - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
> - "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
> +
> + if { [check_effective_target_arm32] && [check_effective_target_arm_fp16_ok] } {
> + foreach flags [list "" $et_arm_fp16_flags] {
> if { [check_no_compiler_messages_nocache \
> arm_fp16_alternative_ok object {
> #if !defined (__ARM_FP16_FORMAT_ALTERNATIVE) || ! (__ARM_FP & 2)
> @@ -5434,9 +5436,9 @@ proc check_effective_target_arm_fp16_alternative_ok { } {
> # format. Some multilibs may be incompatible with the options needed.
>
> proc check_effective_target_arm_fp16_none_ok_nocache { } {
> - if { [check_effective_target_arm32] } {
> - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
> - "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
> + global et_arm_fp16_flags
> + if { [check_effective_target_arm32] && [check_effective_target_arm_fp16_ok] } {
> + foreach flags [list "" $et_arm_fp16_flags] {
> if { [check_no_compiler_messages_nocache \
> arm_fp16_none_ok object {
> #if defined (__ARM_FP16_FORMAT_ALTERNATIVE)
> @@ -5467,23 +5469,46 @@ proc check_effective_target_arm_fp16_none_ok { } {
> proc check_effective_target_arm_v8_neon_ok_nocache { } {
> global et_arm_v8_neon_flags
> set et_arm_v8_neon_flags ""
> - if { [check_effective_target_arm32] } {
> - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
> - if { [check_no_compiler_messages_nocache arm_v8_neon_ok object {
> - #if __ARM_ARCH < 8
> - #error not armv8 or later
> - #endif
> - #include "arm_neon.h"
> - void
> - foo ()
> - {
> - __asm__ volatile ("vrintn.f32 q0, q0");
> - }
> - } "$flags -march=armv8-a"] } {
> - set et_arm_v8_neon_flags $flags
> - return 1
> - }
> + if { ! [check_effective_target_arm32] } {
> + return 0;
> + }
> + if [check-flags \
> + [list "" { *-*-* } { "-mfpu=*" } \
> + { "-mfpu=*fp-armv8*" } ]] {
> + # Multilib flags would override -mfpu.
> + return 0
> + }
> + if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
> + # Must generate floating-point instructions.
> + return 0
> + }
> + if [check_effective_target_arm_hf_eabi] {
> + # Use existing float-abi and force an fpu which supports fp16
> + set et_arm_v8_neon_flags "-mfpu=neon-fp-armv8"
> + return 1;
> + }
> + if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] {
> + # The existing -mfpu value is OK; use it, but add softfp.
> + set et_arm_v8_neon_flags "-mfloat-abi=softfp"
> + return 1;
> + }
> +
> + # Add -mfpu for a VFP fp16 variant since there is no preprocessor
> + # macro to check for this support.
> + set flags "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"
> + if { [check_no_compiler_messages_nocache arm_v8_neon_ok object {
> + #if __ARM_ARCH < 8
> + #error not armv8 or later
> + #endif
> + #include "arm_neon.h"
> + void
> + foo ()
> + {
> + __asm__ volatile ("vrintn.f32 q0, q0");
> }
> + } "$flags -march=armv8-a"] } {
> + set et_arm_v8_neon_flags $flags
> + return 1
> }
>
> return 0
> @@ -5503,21 +5528,43 @@ proc check_effective_target_arm_neonv2_ok_nocache { } {
> global et_arm_neonv2_flags
> global et_arm_neon_flags
> set et_arm_neonv2_flags ""
> - if { [check_effective_target_arm32]
> - && [check_effective_target_arm_neon_ok] } {
> - foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
> - if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
> - #include "arm_neon.h"
> - float32x2_t
> - foo (float32x2_t a, float32x2_t b, float32x2_t c)
> - {
> - return vfma_f32 (a, b, c);
> - }
> - } "$et_arm_neon_flags $flags"] } {
> - set et_arm_neonv2_flags [concat $et_arm_neon_flags $flags]
> - return 1
> - }
> + if { ! [check_effective_target_arm32] || ! [check_effective_target_arm_neon_ok] } {
> + return 0;
> + }
> + if [check-flags \
> + [list "" { *-*-* } { "-mfpu=*" } \
> + { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" \
> + "-mfpu=*fpv[1-9][0-9]*" "-mfpu=*fp-armv8*" } ]] {
> + # Multilib flags would override -mfpu.
> + return 0
> + }
> + if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
> + # Must generate floating-point instructions.
> + return 0
> + }
> + if [check_effective_target_arm_hf_eabi] {
> + # Use existing float-abi and force an fpu which supports neonv2
> + set et_arm_neonv2_flags [concat $et_arm_neon_flags "-mfpu=vfpv4"]
> + return 1;
> + }
> + if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] {
> + # The existing -mfpu value is OK; use it, but add softfp.
> + set et_arm_neonv2_flags [concat $et_arm_neon_flags "-mfloat-abi=softfp"]
> + return 1;
> + }
> + # Add -mfpu for a neonv2 variant since there is no preprocessor
> + # macro to check for this support.
> + set flags "-mfpu=vfpv4 -mfloat-abi=softfp"
> + if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
> + #include "arm_neon.h"
> + float32x2_t
> + foo (float32x2_t a, float32x2_t b, float32x2_t c)
> + {
> + return vfma_f32 (a, b, c);
> }
> + } "$et_arm_neon_flags $flags"] } {
> + set et_arm_neonv2_flags [concat $et_arm_neon_flags $flags]
> + return 1
> }
>
> return 0
@@ -4829,6 +4829,7 @@ proc check_effective_target_arm_v8_vfp_ok {} {
proc check_effective_target_arm_hard_vfp_ok { } {
if { [check_effective_target_arm32]
+ && ! [check-flags [list "" { *-*-* } { "-mfpu=*" } { "-mfpu=vfp" }]]
&& ! [check-flags [list "" { *-*-* } { "-mfloat-abi=*" } { "-mfloat-abi=hard" }]] } {
return [check_no_compiler_messages arm_hard_vfp_ok executable {
int main() { return 0;}
@@ -5405,11 +5406,12 @@ proc check_effective_target_arm_fp16_alternative_ok_nocache { } {
# Not supported by the target system.
return 0
}
+ global et_arm_fp16_flags
global et_arm_fp16_alternative_flags
set et_arm_fp16_alternative_flags ""
- if { [check_effective_target_arm32] } {
- foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
- "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
+
+ if { [check_effective_target_arm32] && [check_effective_target_arm_fp16_ok] } {
+ foreach flags [list "" $et_arm_fp16_flags] {
if { [check_no_compiler_messages_nocache \
arm_fp16_alternative_ok object {
#if !defined (__ARM_FP16_FORMAT_ALTERNATIVE) || ! (__ARM_FP & 2)
@@ -5434,9 +5436,9 @@ proc check_effective_target_arm_fp16_alternative_ok { } {
# format. Some multilibs may be incompatible with the options needed.
proc check_effective_target_arm_fp16_none_ok_nocache { } {
- if { [check_effective_target_arm32] } {
- foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
- "-mfpu=neon-fp16 -mfloat-abi=softfp"} {
+ global et_arm_fp16_flags
+ if { [check_effective_target_arm32] && [check_effective_target_arm_fp16_ok] } {
+ foreach flags [list "" $et_arm_fp16_flags] {
if { [check_no_compiler_messages_nocache \
arm_fp16_none_ok object {
#if defined (__ARM_FP16_FORMAT_ALTERNATIVE)
@@ -5467,23 +5469,46 @@ proc check_effective_target_arm_fp16_none_ok { } {
proc check_effective_target_arm_v8_neon_ok_nocache { } {
global et_arm_v8_neon_flags
set et_arm_v8_neon_flags ""
- if { [check_effective_target_arm32] } {
- foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
- if { [check_no_compiler_messages_nocache arm_v8_neon_ok object {
- #if __ARM_ARCH < 8
- #error not armv8 or later
- #endif
- #include "arm_neon.h"
- void
- foo ()
- {
- __asm__ volatile ("vrintn.f32 q0, q0");
- }
- } "$flags -march=armv8-a"] } {
- set et_arm_v8_neon_flags $flags
- return 1
- }
+ if { ! [check_effective_target_arm32] } {
+ return 0;
+ }
+ if [check-flags \
+ [list "" { *-*-* } { "-mfpu=*" } \
+ { "-mfpu=*fp-armv8*" } ]] {
+ # Multilib flags would override -mfpu.
+ return 0
+ }
+ if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
+ # Must generate floating-point instructions.
+ return 0
+ }
+ if [check_effective_target_arm_hf_eabi] {
+ # Use existing float-abi and force an fpu which supports fp16
+ set et_arm_v8_neon_flags "-mfpu=neon-fp-armv8"
+ return 1;
+ }
+ if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] {
+ # The existing -mfpu value is OK; use it, but add softfp.
+ set et_arm_v8_neon_flags "-mfloat-abi=softfp"
+ return 1;
+ }
+
+ # Add -mfpu for a VFP fp16 variant since there is no preprocessor
+ # macro to check for this support.
+ set flags "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"
+ if { [check_no_compiler_messages_nocache arm_v8_neon_ok object {
+ #if __ARM_ARCH < 8
+ #error not armv8 or later
+ #endif
+ #include "arm_neon.h"
+ void
+ foo ()
+ {
+ __asm__ volatile ("vrintn.f32 q0, q0");
}
+ } "$flags -march=armv8-a"] } {
+ set et_arm_v8_neon_flags $flags
+ return 1
}
return 0
@@ -5503,21 +5528,43 @@ proc check_effective_target_arm_neonv2_ok_nocache { } {
global et_arm_neonv2_flags
global et_arm_neon_flags
set et_arm_neonv2_flags ""
- if { [check_effective_target_arm32]
- && [check_effective_target_arm_neon_ok] } {
- foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-vfpv4" "-mfpu=neon-vfpv4 -mfloat-abi=softfp"} {
- if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
- #include "arm_neon.h"
- float32x2_t
- foo (float32x2_t a, float32x2_t b, float32x2_t c)
- {
- return vfma_f32 (a, b, c);
- }
- } "$et_arm_neon_flags $flags"] } {
- set et_arm_neonv2_flags [concat $et_arm_neon_flags $flags]
- return 1
- }
+ if { ! [check_effective_target_arm32] || ! [check_effective_target_arm_neon_ok] } {
+ return 0;
+ }
+ if [check-flags \
+ [list "" { *-*-* } { "-mfpu=*" } \
+ { "-mfpu=*fp16*" "-mfpu=*fpv[4-9]*" \
+ "-mfpu=*fpv[1-9][0-9]*" "-mfpu=*fp-armv8*" } ]] {
+ # Multilib flags would override -mfpu.
+ return 0
+ }
+ if [check-flags [list "" { *-*-* } { "-mfloat-abi=soft" } { "" } ]] {
+ # Must generate floating-point instructions.
+ return 0
+ }
+ if [check_effective_target_arm_hf_eabi] {
+ # Use existing float-abi and force an fpu which supports neonv2
+ set et_arm_neonv2_flags [concat $et_arm_neon_flags "-mfpu=vfpv4"]
+ return 1;
+ }
+ if [check-flags [list "" { *-*-* } { "-mfpu=*" } { "" } ]] {
+ # The existing -mfpu value is OK; use it, but add softfp.
+ set et_arm_neonv2_flags [concat $et_arm_neon_flags "-mfloat-abi=softfp"]
+ return 1;
+ }
+ # Add -mfpu for a neonv2 variant since there is no preprocessor
+ # macro to check for this support.
+ set flags "-mfpu=vfpv4 -mfloat-abi=softfp"
+ if { [check_no_compiler_messages_nocache arm_neonv2_ok object {
+ #include "arm_neon.h"
+ float32x2_t
+ foo (float32x2_t a, float32x2_t b, float32x2_t c)
+ {
+ return vfma_f32 (a, b, c);
}
+ } "$et_arm_neon_flags $flags"] } {
+ set et_arm_neonv2_flags [concat $et_arm_neon_flags $flags]
+ return 1
}
return 0