On Tue, 17 Feb 2026, Tamar Christina wrote: > > -----Original Message----- > > From: Richard Biener <[email protected]> > > Sent: 17 February 2026 12:26 > > To: Tamar Christina <[email protected]> > > Cc: [email protected]; nd <[email protected]>; [email protected] > > Subject: Re: [PATCH][RFC][vect]: Support running vect.exp in multiple > > different > > configuration > > > > On Mon, 16 Feb 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 > > > > > > Processing option: dg-add-options 1 vect_early_break > > > check_cached_effective_target_index vect_early_break: returning 0 -ftree- > > vectorize -fno-tree-loop-distribute-patterns -fno-vect-cost-model -fno- > > common -O2 -fdump-tree-vect-details vect_early_break > > > Processing option: dg-add-options 1 vect_early_break > > > check_cached_effective_target_index vect_early_break: returning 0 - > > march=armv8-a+sve -ftree-vectorize -fno-tree-loop-distribute-patterns -fno- > > vect-cost-model -fno-common -O2 -fdump-tree-vect-details vect_early_break > > > > > > does this do what you wanted Richi? > > > > I think this will still have the issue that tests like > > gcc.dg/vect/bb-slp-subgroups-2.c which have dump scans like > > > > /* { dg-final { scan-tree-dump-times "optimized: basic block" 2 "slp2" { > > target { ! vect256 } } } } */ > > /* { dg-final { scan-tree-dump-times "optimized: basic block" 1 "slp2" { > > target { vect256 } } } } */ > > > > I'm not sure it will, since vect256 will be re-evaluated if `-maxv2 is part > of the > torture. > > > and ultimatively end up invoking check_avx_available will not work > > correctly for a -mavx2 torture option since > > > > proc check_avx_available { } { > > if { [check_no_compiler_messages avx_available assembly { > > #ifndef __AVX__ > > #error unsupported > > #endif > > } ""] } { > > return 1; > > } > > return 0; > > } > > > > will not have -mavx2 included in the set of options fed in via > > VECT_ADDITIONAL_FLAGS (nor are flags set via EFFECTIVE_TARGETS). > > It's only flags from the RUNTESTFLAGS environment that seem to reach > > there. Thus, --target_board=unix/{,-mavx2} works, but nothing else. > > > > Are you sure? > > The above proc has > > proc check_no_compiler_messages {prop args} { > return [check_cached_effective_target $prop { > eval [list check_no_compiler_messages_nocache $prop] $args > }] > } > > So it calls down to check_cached_effective_target which appends prop. > > The patch changes check_cached_effective_target to do > > set target "[current_target_name] $vect_torture_flags" > > so `-mavx2` will be added *as if* it was part of current_target_name, > which is what --target_board=unix/{,-mavx2} defines. > > So did you test out the patch and it didn't work? If so can you send me > the version you tested so I can debug.
Yes, it didn't work. I used the patch below. > make check-g++ RUNTESTFLAGS="--target_board=unix/-m32 dg.exp=Wtime_t-1.c" ... FAIL: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2 scan-tree-dump-times slp2 "optimized: basic block" 2 FAIL: gcc.dg/vect/bb-slp-subgroups-2.c -flto -ffat-lto-objects -mavx2 scan-tree-dump-times slp2 "optimized: basic block" 2 and from the log: PASS: gcc.dg/vect/bb-slp-subgroups-2.c -mavx2 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 Executing on host: /spc/abuild/rguenther/obj-gcc-clean-g/gcc/xgcc -B/spc/abuild/rguenther/obj-gcc-clean-g/gcc/ avx_available6869.c -fdiagnostics-plain-output -Wno-complain-wrong-lang -S -o avx_available6869.s (timeout = 300) spawn -ignore SIGHUP /spc/abuild/rguenther/obj-gcc-clean-g/gcc/xgcc -B/spc/abuild/rguenther/obj-gcc-clean-g/gcc/ avx_available6869.c -fdiagnostics-plain-output -Wno-complain-wrong-lang -S -o avx_available6869.s^M avx_available6869.c:3:6: error: #error unsupported^M compiler exited with status 1 so the avx_available check does not get -mavx2 (it also doesn't get the targets DEFAULT_VECTCFLAGS which includes -msse2). At least it re-evaluates the test with the patch. Richard. >From 550378c218606f6f824dee210b42fc81c7552f52 Mon Sep 17 00:00:00 2001 From: Richard Biener <[email protected]> Date: Tue, 17 Feb 2026 13:39:17 +0100 Subject: [PATCH] stash To: [email protected] --- gcc/testsuite/gcc.dg/vect/vect.exp | 36 ++++++++++++++++++++++++++- gcc/testsuite/lib/target-supports.exp | 8 +++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp index 958156b6ae0..44fe4f866d9 100644 --- a/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc/testsuite/gcc.dg/vect/vect.exp @@ -67,12 +67,46 @@ set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details" lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details" -# Main loop. 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] + } + } + } +} + + +# Main loop. 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 c8791827556..089081b3a64 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -139,8 +139,14 @@ proc current_target_name { } { proc check_cached_effective_target { prop args } { global et_cache + global vect_torture_flags + if {![info exists vect_torture_flags]} { + set vect_torture_flags "" + } - 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)]} { verbose "check_cached_effective_target $prop: checking $target" 2 if {[string is true -strict $args] || [string is false -strict $args]} { -- 2.51.0
