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 } } } } */
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.
Richard.
> ---
> diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp
> b/gcc/testsuite/gcc.dg/vect/vect.exp
> index
> edc0ce5bef9e9bcef469ccccdc56a20f2d9b9b67..46ea050c05c95cea50d0f030b67cc45847fabb54
> 100644
> --- a/gcc/testsuite/gcc.dg/vect/vect.exp
> +++ b/gcc/testsuite/gcc.dg/vect/vect.exp
> @@ -87,7 +87,36 @@ 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} \
> + ]
> +}
> +
> +# 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]
> et-dg-runtest dg-runtest [lsort \
> [glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
> $flags $DEFAULT_VECTCFLAGS
> diff --git a/gcc/testsuite/lib/target-supports.exp
> b/gcc/testsuite/lib/target-supports.exp
> index
> c87918275569b603ae6820fcf784f9c95641e658..089081b3a64d5d69e660064c70bf17482aac77bc
> 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]} {
>
>
>
--
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)