> -----Original Message-----
> From: Richard Biener <[email protected]>
> Sent: 11 February 2026 11:37
> To: [email protected]
> Cc: [email protected]; Tamar Christina
> <[email protected]>; [email protected]
> Subject: [PATCH] [testsuite] Add target specific extra vect flag sets
>
> The following exposes VECT_ADDITIONAL_FLAGS to
> check_vect_support_and_set_flags
> and makes its elements pairs of dg-do-what-default and an option. For
> x86 this adds -mavx2 as proof-of-concept. Ideally we'd have effective
> target checks for -march=x86-64-v[34], but we don't.
>
> I'm posting this for feedback on the TCL - there doesn't seem to be
> a documented minimum version. I have TCL 8.6 where the chosen way
> to concatenate two lists works ([concat ..] somehow does not).
>
> Any feedback on this part?
>
> The vect.exp testsuite is not yet clean with -mavx2, I am working on
> that though.
Perhaps it's easier to re-use the torture suite support here? That has the
additional benefit in that the variants will run in parallel rather than
sequentially.
I tested
diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp
b/gcc/testsuite/gcc.dg/vect/vect.exp
index edc0ce5bef9..163a3fb9b02 100644
--- a/gcc/testsuite/gcc.dg/vect/vect.exp
+++ b/gcc/testsuite/gcc.dg/vect/vect.exp
@@ -87,6 +87,31 @@ 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=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 {
et-dg-runtest dg-runtest [lsort \
[glob -nocomplain $srcdir/$subdir/pr*.\[cS\]]] \
Which seems to work and do what we want. I haven't checked yet whether the
flags escape
the exp file, but don't think they do but if they do should be easier to deal
with.
Cheers,
Tamar
>
> Thanks,
> Richard.
>
> * gcc.dg/vect/vect.exp: Make VECT_ADDITIONAL_FLAGS global
> and a list of pairs specifying default dg-do and option.
> * lib/target-supports.exp (check_vect_support_and_set_flags):
> For x86 add -mavx to the set of VECT_ADDITIONAL_FLAGS.
> ---
> gcc/testsuite/gcc.dg/vect/vect.exp | 17 +++++++++++++----
> gcc/testsuite/lib/target-supports.exp | 8 ++++++++
> 2 files changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp
> b/gcc/testsuite/gcc.dg/vect/vect.exp
> index 025c3360c0d..dacf7b8c44c 100644
> --- a/gcc/testsuite/gcc.dg/vect/vect.exp
> +++ b/gcc/testsuite/gcc.dg/vect/vect.exp
> @@ -29,6 +29,9 @@ set DEFAULT_VECTCFLAGS ""
> global EFFECTIVE_TARGETS
> set EFFECTIVE_TARGETS ""
>
> +global VECT_ADDITIONAL_FLAGS
> +set VECT_ADDITIONAL_FLAGS [list]
> +
> # If the target system supports vector instructions, the default action
> # for a test is 'run', otherwise it's 'compile'. Save current default.
> # Executing vector instructions on a system without hardware vector support
> @@ -67,12 +70,18 @@ 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 ""]
> +# We iterate over VECT_ADDITIONAL_FLAGS, first the default flags, then
> +# possibly check_vect_support_and_set_flags injected and then with LTO
> +set VECT_ADDITIONAL_FLAGS [list [list ${dg-do-what-default} ""] \
> + {*}$VECT_ADDITIONAL_FLAGS]
> if { [check_effective_target_lto] } {
> - lappend VECT_ADDITIONAL_FLAGS "-flto -ffat-lto-objects"
> + lappend VECT_ADDITIONAL_FLAGS [list ${dg-do-what-default} "-flto -ffat-
> lto-objects"]
> }
> -foreach flags $VECT_ADDITIONAL_FLAGS {
> +
> +# Main loop.
> +foreach optset $VECT_ADDITIONAL_FLAGS {
> + set dg-do-what-default [lindex $optset 0]
> + set flags [lindex $optset 1]
> 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 c8791827556..b3f21558871 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -12510,6 +12510,7 @@ proc check_vect_support_and_set_flags { } {
> global DEFAULT_VECTCFLAGS
> global dg-do-what-default
> global EFFECTIVE_TARGETS
> + global VECT_ADDITIONAL_FLAGS
>
> if [istarget powerpc*-*-*] {
> # Skip targets not supporting -maltivec.
> @@ -12548,6 +12549,13 @@ proc check_vect_support_and_set_flags { } {
> } else {
> set dg-do-what-default compile
> }
> + if { [check_effective_target_avx2] } {
> + if { [check_effective_target_avx2_runtime] } {
> + lappend VECT_ADDITIONAL_FLAGS [list run "-mavx2"]
> + } else {
> + lappend VECT_ADDITIONAL_FLAGS [list compile "-mavx2"]
> + }
> + }
> } elseif { [istarget mips*-*-*]
> && [check_effective_target_nomips16] } {
> if { [check_effective_target_mpaired_single "-mpaired-single"] } {
> --
> 2.51.0