]> git.ipfire.org Git - thirdparty/gcc.git/commit
gcc: testsuite: Fix builtin-speculation-overloads[14].C testism
authorMatthew Malcomson <mmalcomson@nvidia.com>
Mon, 10 Feb 2025 16:24:20 +0000 (16:24 +0000)
committerMatthew Malcomson <mmalcomson@nvidia.com>
Mon, 17 Feb 2025 11:09:51 +0000 (11:09 +0000)
commit9335ff73a509a1f203de691052d600facd07c3f8
tree8d73392a5875217f6904dbce995e548d4a86035f
parentb57e6e1b38cdaf7a982474d93ebede1cc30f1d46
gcc: testsuite: Fix builtin-speculation-overloads[14].C testism

When making warnings trigger a failure in template substitution I
could not find any way to trigger the warning about builtin speculation
not being available on the given target.

Turns out I misread the code -- this warning happens when the
speculation_barrier pattern is not defined.

Here we add an effective target to represent
"__builtin_speculation_safe_value is available on this target" and use
that to adjust our test on SFINAE behaviour accordingly.
N.b. this means that we get extra testing -- not just that things work
on targets which support __builtin_speculation_safe_value, but also that
the behaviour works on targets which don't support it.

Tested with AArch64 native, AArch64 cross compiler, and RISC-V cross
compiler (just running the tests that I've changed).

Ok for trunk?

gcc/testsuite/ChangeLog:

PR target/117991
* g++.dg/template/builtin-speculation-overloads.def: SUCCESS
argument in SPECULATION_ASSERTS now uses a macro `true_def`
instead of the literal `true` for arguments which should work
with `__builtin_speculation_safe_value`.
* g++.dg/template/builtin-speculation-overloads1.C: Define
`true_def` macro on command line to compiler according to the
effective target representing that
`__builtin_speculation_safe_value` does something on this
target.
* g++.dg/template/builtin-speculation-overloads4.C: Likewise.
* lib/target-supports.exp
(check_effective_target_speculation_barrier_defined): New.

Signed-off-by: Matthew Malcomson <mmalcomson@nvidia.com>
gcc/testsuite/g++.dg/template/builtin-speculation-overloads.def
gcc/testsuite/g++.dg/template/builtin-speculation-overloads1.C
gcc/testsuite/g++.dg/template/builtin-speculation-overloads4.C
gcc/testsuite/lib/target-supports.exp