diff options
author | Alexandre Oliva <oliva@adacore.com> | 2025-02-26 07:39:18 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2025-02-26 07:39:18 -0300 |
commit | e6f5fadec5f6a719145ed2ed513209ec3e8eeb2f (patch) | |
tree | 394a3eda21118cef95c9571d2ac59b801195efbf | |
parent | 3b72464ba5e4597d2d559bcdbf150637adeb00b0 (diff) | |
download | gcc-e6f5fadec5f6a719145ed2ed513209ec3e8eeb2f.zip gcc-e6f5fadec5f6a719145ed2ed513209ec3e8eeb2f.tar.gz gcc-e6f5fadec5f6a719145ed2ed513209ec3e8eeb2f.tar.bz2 |
[testsuite] adjust expectations of x86 vect-simd-clone tests
Some vect-simd-clone tests fail when targeting ancient x86 variants,
because the expected transformations only take place with -msse4 or
higher.
So arrange for these tests to take an -msse4 option on x86, so that
the expected vectorization takes place, but decay to a compile test if
vect.exp would enable execution but the target doesn't have an sse4
runtime. This requires the new dg-do-if to override the action on a
target while retaining the default action on others, instead of
disabling the test.
We can count on avx512f compile-time support for these tests, because
vect_simd_clones requires that on x86, and that implies sse4 support,
so we need not complicate the scan conditionals with tests for sse4,
except on the last test.
for gcc/ChangeLog
* doc/sourcebuild.texi (dg-do-if): Document.
for gcc/testsuite/ChangeLog
* lib/target-supports-dg.exp (dg-do-if): New.
* gcc.dg/vect/vect-simd-clone-16f.c: Use -msse4 on x86, and
skip in case execution is enabled but the runtime isn't.
* gcc.dg/vect/vect-simd-clone-17f.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18f.c: Likewise.
* gcc.dg/vect/vect-simd-clone-20.c: Likewise, but only skip
the scan test.
-rw-r--r-- | gcc/doc/sourcebuild.texi | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/lib/target-supports-dg.exp | 29 |
6 files changed, 44 insertions, 2 deletions
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index c0daf02..2833832 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1128,6 +1128,11 @@ by the specified floating-point factor. @subsubsection Skip a test for some targets @table @code +@item @{ dg-do-if @var{action} @{ @var{selector} @} @} +Same as dg-do if the selector matches and the test hasn't already been +marked as unsupported. Use it to override an action on a target while +leaving the default action alone for other targets. + @item @{ dg-skip-if @var{comment} @{ @var{selector} @} [@{ @var{include-opts} @} [@{ @var{exclude-opts} @}]] @} Arguments @var{include-opts} and @var{exclude-opts} are lists in which each element is a string of zero or more GCC options. diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c index 7cd29e8..bb3b081 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-16f.c @@ -1,5 +1,7 @@ +/* { dg-do-if compile { target { sse2_runtime && { ! sse4_runtime } } } } */ /* { dg-require-effective-target vect_simd_clones } */ /* { dg-additional-options "-fopenmp-simd --param vect-epilogues-nomask=0" } */ +/* { dg-additional-options "-msse4" { target sse4 } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ /* { dg-additional-options "-mno-avx512f" { target { { i?86*-*-* x86_64-*-* } && { ! lp64 } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c index 177521d..5044656 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-17f.c @@ -1,5 +1,7 @@ +/* { dg-do-if compile { target { sse2_runtime && { ! sse4_runtime } } } } */ /* { dg-require-effective-target vect_simd_clones } */ /* { dg-additional-options "-fopenmp-simd --param vect-epilogues-nomask=0" } */ +/* { dg-additional-options "-msse4" { target sse4 } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ /* { dg-additional-options "-mno-avx512f" { target { { i?86*-*-* x86_64-*-* } && { ! lp64 } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c index 4dd5138..0c418d4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-18f.c @@ -1,5 +1,7 @@ +/* { dg-do-if compile { target { sse2_runtime && { ! sse4_runtime } } } } */ /* { dg-require-effective-target vect_simd_clones } */ /* { dg-additional-options "-fopenmp-simd --param vect-epilogues-nomask=0" } */ +/* { dg-additional-options "-msse4" { target sse4 } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ /* { dg-additional-options "-mno-avx512f" { target { { i?86*-*-* x86_64-*-* } && { ! lp64 } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c index 9f51a68..3e626fc 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-20.c @@ -1,5 +1,7 @@ +/* { dg-do-if compile { target { sse2_runtime && { ! sse4_runtime } } } } */ /* { dg-require-effective-target vect_simd_clones } */ /* { dg-additional-options "-fopenmp-simd --param vect-epilogues-nomask=0" } */ +/* { dg-additional-options "-msse4" { target sse4 } } */ /* { dg-additional-options "-mavx" { target avx_runtime } } */ /* Test that simd inbranch clones work correctly. */ @@ -80,8 +82,8 @@ main () } /* Ensure the the in-branch simd clones are used on targets that support them. */ -/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { aarch64*-*-* } } } } */ -/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 4 "vect" { target { x86_64*-*-* } } } } */ +/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 2 "vect" { target { aarch64*-*-* || { sse4 && { ! avx_runtime } } } } } } */ +/* { dg-final { scan-tree-dump-times {[\n\r] [^\n]* = foo\.simdclone} 4 "vect" { target { avx_runtime } } } } */ /* The LTO test produces two dump files and we scan the wrong one. */ /* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ diff --git a/gcc/testsuite/lib/target-supports-dg.exp b/gcc/testsuite/lib/target-supports-dg.exp index d4ecd1d..c307258 100644 --- a/gcc/testsuite/lib/target-supports-dg.exp +++ b/gcc/testsuite/lib/target-supports-dg.exp @@ -393,6 +393,35 @@ proc check-flags { args } { return $result } +# Override dg-do action on target, without setting the test as +# unsupported on other targets. Multiple such overriders can be +# present. If the test is already marked as unsupported, it has no +# effect. Otherwise, if the target selector matches, call dg-do, +# otherwise leave dg-do-what alone, so that any earlier setting +# (possibly the default) prevails. + +proc dg-do-if { args } { + set args [lreplace $args 0 0] + # Verify the number of arguments. + if { [llength $args] != 2 } { + error "syntax error, need a single action and target selector" + } + + # Don't bother if we're already skipping the test. + upvar dg-do-what dg-do-what + if { [lindex ${dg-do-what} 1] == "N" } { + return + } + + # Evaluate selector, return if it does not match. + switch [dg-process-target-1 [lindex $args 1]] { + "N" { return } + "P" { return } + } + + eval dg-do $args +} + # Skip the test (report it as UNSUPPORTED) if the target list and # included flags are matched and the excluded flags are not matched. # |