On Fri, 14 Aug 2026, Tamar Christina wrote:

> This is a proof of concept addressing some of the issues Richi pointed out 
> before.
> 
> In particular the extra vect options are now taken part of the cache key as 
> well
> so we re-evaluate all the different effective targets tests for them while 
> running
> under vect.exp.
> 
> The attached patch produces
> 
> make check-gcc RUNTESTFLAGS="--target_board=unix\{-m32,-m64\} 
> vect.exp=bb-slp-subgroups-2.c" -j
> 
> gives
> 
> Test run by tnfchris on Fri Aug 14 08:41:38 2026
> Native configuration is x86_64-pc-linux-gnu
> 
>                 === gcc tests ===
> 
> Schedule of variations:
>     unix/-m32
>     unix/-m64
> 
> Running target unix/-m32
> Running /home/tnfchris/gcc-dsg/gcc/testsuite/gcc.dg/vect/vect.exp ...
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c (test for excess errors)
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects  
> scan-tree-dump-times slp2 "Basic block will be vectorized using SLP" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects  
> scan-tree-dump-times slp2 "optimized: basic block" 2
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects (test for 
> excess errors)
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2  
> scan-tree-dump-times slp2 "Basic block will be vectorized using SLP" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2  
> scan-tree-dump-times slp2 "optimized: basic block" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2 (test 
> for excess errors)
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2 
> execution test
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects execution test
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2  scan-tree-dump-times slp2 
> "Basic block will be vectorized using SLP" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2  scan-tree-dump-times slp2 
> "optimized: basic block" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2 (test for excess errors)
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2 execution test
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c execution test
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c scan-tree-dump-times slp2 "Basic block 
> will be vectorized using SLP" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c scan-tree-dump-times slp2 "optimized: 
> basic block" 2
>                 === gcc Summary for unix/-m32 ===
> 
> # of expected passes            16
> Running target unix/-m64
> Running /home/tnfchris/gcc-dsg/gcc/testsuite/gcc.dg/vect/vect.exp ...
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c (test for excess errors)
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects  
> scan-tree-dump-times slp2 "Basic block will be vectorized using SLP" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects  
> scan-tree-dump-times slp2 "optimized: basic block" 2
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects (test for 
> excess errors)
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2  
> scan-tree-dump-times slp2 "Basic block will be vectorized using SLP" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2  
> scan-tree-dump-times slp2 "optimized: basic block" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2 (test 
> for excess errors)
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2 
> execution test
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects execution test
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2  scan-tree-dump-times slp2 
> "Basic block will be vectorized using SLP" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2  scan-tree-dump-times slp2 
> "optimized: basic block" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2 (test for excess errors)
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2 execution test
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c execution test
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c scan-tree-dump-times slp2 "Basic block 
> will be vectorized using SLP" 1
> PASS: gcc.dg/vect/bb-slp-subgroups-2.c scan-tree-dump-times slp2 "optimized: 
> basic block" 2
>                 === gcc Summary for unix/-m64 ===
> 
> # of expected passes            16
> 
>                 === gcc Summary ===
> 
> # of expected passes            32
> /home/tnfchris/gcc-peak/gcc/xgcc  version 17.0.0 20260727 (experimental) (GCC)
> 
> does this do what you wanted Richi?

It seems so (though it would have to be duplicated to the other
vect.exp harnesses).  Also do the effective target checks work
as intended when you handle "-flto -ffat-lto-objects" as one of
the tortures?

There is of course still the question about that other similar
mechanism (with its own issues).  Testsuite maintainers would
need to decide wheter we want two of them.

Thanks for keeping to work on this.

Richard.

> ---
> diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp 
> b/gcc/testsuite/gcc.dg/vect/vect.exp
> index 
> 958156b6ae01412b9d7a1b96bd4c394a038d5839..5008248c37f36cc4043ad961580979149a0d84c3
>  100644
> --- a/gcc/testsuite/gcc.dg/vect/vect.exp
> +++ b/gcc/testsuite/gcc.dg/vect/vect.exp
> @@ -72,7 +72,40 @@ set VECT_ADDITIONAL_FLAGS [list ""]
>  if { [check_effective_target_lto] } {
>      lappend VECT_ADDITIONAL_FLAGS "-flto -ffat-lto-objects"
>  }
> +
> +# Set target specific vect torture options
> +if { [istarget aarch64*-*-*] } {
> +  set TORTURE_OPTIONS [list \
> +      {-march=armv8-a} \
> +      {-march=armv8-a+sve} \
> +      {-march=armv8-a+sve -msve-vector-bits=128} \
> +      {-march=armv8-a+sve -msve-vector-bits=256} \
> +      {-march=armv9-a} \
> +  ]
> +}
> +
> +if { [istarget x86_64-*-*] } {
> +  set TORTURE_OPTIONS [list {-mavx2} ]
> +}
> +
> +# Allow TORTURE_OPTIONS to add extra flag sets on top of the existing ones.
> +if {[info exists TORTURE_OPTIONS]} {
> +    set base_vect_additional_flags $VECT_ADDITIONAL_FLAGS
> +    set VECT_ADDITIONAL_FLAGS [list]
> +    foreach base_flags $base_vect_additional_flags {
> +       lappend VECT_ADDITIONAL_FLAGS $base_flags
> +       foreach torture_flags $TORTURE_OPTIONS {
> +           if {$base_flags eq ""} {
> +               lappend VECT_ADDITIONAL_FLAGS $torture_flags
> +           } else {
> +               lappend VECT_ADDITIONAL_FLAGS [concat $base_flags 
> $torture_flags]
> +           }
> +       }
> +    }
> +}
> +
>  foreach flags $VECT_ADDITIONAL_FLAGS {
> +    set ::vect_torture_flags [concat $flags $DEFAULT_VECTCFLAGS]
>      set tests ""
>      foreach file [glob -nocomplain $srcdir/$subdir/*.\[cS\]] {
>       if { ! [string match $srcdir/$subdir/bb-slp-*.\[cS\] $file] } {
> diff --git a/gcc/testsuite/lib/target-supports.exp 
> b/gcc/testsuite/lib/target-supports.exp
> index 
> eb2444204a0df6ee4e39f3f857419c03bd067ae3..6a9782cfc76a6a24f32ca5499edde23e56bef5dd
>  100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -70,8 +70,18 @@ load_file $et_static
>  
>  proc check_compile {basename type contents args} {
>      global tool
> +    global vect_torture_flags
>      verbose "check_compile tool: $tool for $basename"
>  
> +    if {[info exists vect_torture_flags] && $vect_torture_flags ne ""} {
> +     if {[llength $args] > 0} {
> +         set args [lreplace $args 0 0 \
> +                       [concat $vect_torture_flags [lindex $args 0]]]
> +     } else {
> +         set args [list $vect_torture_flags]
> +     }
> +    }
> +
>      # Save additional_sources to avoid compiling testsuite's sources
>      # against check_compile's source.
>      global additional_sources
> @@ -166,13 +176,20 @@ proc check_cached_effective_target { prop args } {
>      global EFFECTIVE_TARGETS
>      global et_index
>      global et_cache
> +    global vect_torture_flags
> +    if {![info exists vect_torture_flags]} {
> +     set vect_torture_flags ""
> +    }
>  
>      if { [info exists et_index] } {
>       set et [lindex $EFFECTIVE_TARGETS $et_index]
>      } else {
>       set et "default"
>      }
> -    set target [current_target_name]
> +
> +    # Make the cache key depend on the actual target name plus any vect 
> torture
> +    # flags in effect.
> +    set target "[current_target_name] $vect_torture_flags"
>      if {![info exists et_cache($prop,$target,$et)]} {
>       verbose "check_cached_effective_target $prop: checking $target" 2
>       if {[string is true -strict $args] || [string is false -strict $args]} {
> 
> 
> 

-- 
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Jochen Jaser, Andrew McDonald, Abhinav Puri; (HRB 36809, AG Nuernberg)

Reply via email to