On Fri, 8 Aug 2025 at 16:58, Richard Earnshaw <richard.earns...@arm.com> wrote:
>
> On 04/07/2025 23:00, Christophe Lyon wrote:
> > A few arm effective-targets call check_effective_target_arm32 even
> > though they would force a -march=XXX flag which supports Arm and/or
> > Thumb-2, thus making the arm32 check useless.  This has an impact when
> > the toolchain is configured with a default -march or -mcpu which
> > supports Thumb-1 only: in such a case, arm32 is false and we skip many
> > tests, thus reducing coverage.
> >
> > This patch removes the call to check_effective_target_arm32 where it
> > is useless, enabling about 2000 tests.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * lib/target-supports.exp
> >       (check_effective_target_arm_neon_ok_nocache): Remove arm32 check.
> >       (check_effective_target_arm_neon_fp16_ok_nocache): Likewise.
> >       (check_effective_target_arm_neon_softfp_fp16_ok_nocache): Likewise.
> >       (check_effective_target_arm_v8_neon_ok_nocache): Likewise.
> >       (check_effective_target_arm_neonv2_ok_nocache): Likewise.
>
> As long as you're sure that none of these ETs are called from outside an
> arm-specific part of the testsuite, this is ok.  But if it's called from
> any generic test then we probably need to replace arm32 with a 'target
> arm*-*-*' or equivant.
>

Good point!
Most places use
[istarget arm*-*-*] && [check_effective_target_arm_neon_ok]
but not all.

It would be better to include the [istarget arm*-*-*] inside the ET,
and simplify all such calls.

BTW checking for this, I noticed several instances of useless
[istarget aarch64*-*-*]
      && ![check_effective_target_aarch64_sve]


Thanks,

Christophe

> R.
>
> > ---
> >   gcc/testsuite/lib/target-supports.exp | 69 ++++++++++++---------------
> >   1 file changed, 31 insertions(+), 38 deletions(-)
> >
> > diff --git a/gcc/testsuite/lib/target-supports.exp 
> > b/gcc/testsuite/lib/target-supports.exp
> > index 956bc0bc7ca..2581c8d5b01 100644
> > --- a/gcc/testsuite/lib/target-supports.exp
> > +++ b/gcc/testsuite/lib/target-supports.exp
> > @@ -5493,23 +5493,21 @@ proc add_options_for_arm_vfp3 { flags } {
> >   proc check_effective_target_arm_neon_ok_nocache { } {
> >       global et_arm_neon_flags
> >       set et_arm_neon_flags ""
> > -    if { [check_effective_target_arm32] } {
> > -     foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon 
> > -mfloat-abi=softfp" "-mfpu=neon -mfloat-abi=softfp -mcpu=unset 
> > -march=armv7-a" "-mfloat-abi=hard" "-mfpu=neon -mfloat-abi=hard" 
> > "-mfpu=neon -mfloat-abi=hard -mcpu=unset -march=armv7-a"} {
> > -         if { [check_no_compiler_messages_nocache arm_neon_ok object {
> > -             #include <arm_neon.h>
> > -             int dummy;
> > -             #ifndef __ARM_NEON__
> > -             #error not NEON
> > -             #endif
> > -             /* Avoid the case where a test adds -mfpu=neon, but the 
> > toolchain is
> > -                configured for -mcpu=arm926ej-s, for example.  */
> > -             #if __ARM_ARCH < 7 || __ARM_ARCH_PROFILE == 'M'
> > -             #error Architecture does not support NEON.
> > -             #endif
> > -         } "$flags"] } {
> > -             set et_arm_neon_flags $flags
> > -             return 1
> > -         }
> > +    foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon" "-mfpu=neon 
> > -mfloat-abi=softfp" "-mfpu=neon -mfloat-abi=softfp -mcpu=unset 
> > -march=armv7-a" "-mfloat-abi=hard" "-mfpu=neon -mfloat-abi=hard" 
> > "-mfpu=neon -mfloat-abi=hard -mcpu=unset -march=armv7-a"} {
> > +     if { [check_no_compiler_messages_nocache arm_neon_ok object {
> > +         #include <arm_neon.h>
> > +         int dummy;
> > +         #ifndef __ARM_NEON__
> > +         #error not NEON
> > +         #endif
> > +         /* Avoid the case where a test adds -mfpu=neon, but the toolchain 
> > is
> > +         configured for -mcpu=arm926ej-s, for example.  */
> > +         #if __ARM_ARCH < 7 || __ARM_ARCH_PROFILE == 'M'
> > +         #error Architecture does not support NEON.
> > +         #endif
> > +     } "$flags"] } {
> > +         set et_arm_neon_flags $flags
> > +         return 1
> >       }
> >       }
> >
> > @@ -5695,8 +5693,7 @@ proc check_effective_target_arm_neon_fp16_ok_nocache 
> > { } {
> >       global et_arm_neon_fp16_flags
> >       global et_arm_neon_flags
> >       set et_arm_neon_fp16_flags ""
> > -    if { [check_effective_target_arm32]
> > -      && [check_effective_target_arm_neon_ok] } {
> > +    if { [check_effective_target_arm_neon_ok] } {
> >       foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp16"
> >                      "-mfpu=neon-fp16 -mfloat-abi=softfp"
> >                      "-mfp16-format=ieee"
> > @@ -5734,8 +5731,7 @@ proc 
> > check_effective_target_arm_neon_softfp_fp16_ok_nocache { } {
> >       global et_arm_neon_softfp_fp16_flags
> >       global et_arm_neon_flags
> >       set et_arm_neon_softfp_fp16_flags ""
> > -    if { [check_effective_target_arm32]
> > -      && [check_effective_target_arm_neon_ok] } {
> > +    if { [check_effective_target_arm_neon_ok] } {
> >       foreach flags {"-mfpu=neon-fp16 -mfloat-abi=softfp"
> >                      "-mfpu=neon-fp16 -mfloat-abi=softfp 
> > -mfp16-format=ieee"} {
> >           if { [check_no_compiler_messages_nocache arm_neon_softfp_fp16_ok 
> > object {
> > @@ -5871,22 +5867,20 @@ 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 -mcpu=unset -march=armv8-a"] } {
> > -             set et_arm_v8_neon_flags $flags
> > -             return 1
> > +    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 -mcpu=unset -march=armv8-a"] } {
> > +         set et_arm_v8_neon_flags $flags
> > +         return 1
> >       }
> >       }
> >
> > @@ -5907,8 +5901,7 @@ 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] } {
> > +    if { [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"
>

Reply via email to