After commit
e16f90be2dc8af6c371fe79044c3e668fa3dda62
"testsuite: Fix up lra effective target", we get for nvptx target:
-PASS: gcc.c-torture/compile/asmgoto-2.c -O0 (test for excess errors)
+ERROR: gcc.c-torture/compile/asmgoto-2.c -O0 : no files matched glob pattern "lra1020113.c.[0-9][0-9][0-9]r.reload" for " dg-do 2 compile { target lra } "
Etc.
However, nvptx appears to support 'asm goto' with outputs, including the
new execution test case:
PASS: gcc.dg/pr107385.c execution test
Therefore, generally use new effective-target 'asm_goto_with_outputs' instead
of 'lra'. One exceptions is 'gcc.dg/pr110079.c', which doesn't use 'asm goto'
with outputs, and continues using effective-target 'lra', with special-casing
nvptx target, to avoid ERROR for 'lra'.
gcc/
* doc/sourcebuild.texi (Effective-Target Keywords): Document
'asm_goto_with_outputs'. Add comment to 'lra'.
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_lra): Add
comment.
(check_effective_target_asm_goto_with_outputs): New.
* gcc.c-torture/compile/asmgoto-2.c: Use it.
* gcc.c-torture/compile/asmgoto-5.c: Likewise.
* gcc.c-torture/compile/asmgoto-6.c: Likewise.
* gcc.c-torture/compile/pr98096.c: Likewise.
* gcc.dg/pr100590.c: Likewise.
* gcc.dg/pr107385.c: Likewise.
* gcc.dg/pr108095.c: Likewise.
* gcc.dg/pr97954.c: Likewise.
* gcc.dg/torture/pr100329.c: Likewise.
* gcc.dg/torture/pr100398.c: Likewise.
* gcc.dg/torture/pr100519.c: Likewise.
* gcc.dg/torture/pr110422.c: Likewise.
* gcc.dg/pr110079.c: Special-case nvptx target.
@item R_flag_in_section
Target supports the 'R' flag in .section directive in assembly inputs.
+@item asm_goto_with_outputs
+Target supports 'asm goto' with outputs.
+
@item automatic_stack_alignment
Target supports automatic stack alignment.
@item lra
Target supports local register allocator (LRA).
+This must not be called (results in @code{ERROR}) for targets that
+don't do register allocation, and therefore neither use nor don't use
+LRA.
@item lto
Compiler has been configured to support link-time optimization (LTO).
/* This test should be switched off for a new target with less than 4 allocatable registers */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
int
foo (void)
{
/* Test to generate output reload in asm goto on x86_64. */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
/* { dg-skip-if "no O0" { { i?86-*-* x86_64-*-* } && { ! ia32 } } { "-O0" } { "" } } */
#if defined __x86_64__
-
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
/* PR middle-end/110420 */
/* PR middle-end/103979 */
/* PR middle-end/98619 */
/* Test for correct naming of label operands in asm goto in case of presence of
input/output operands. */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
int i, j;
int f(void) {
asm goto ("# %0 %2" : "+r" (i) ::: jmp);
/* PR rtl-optimization/100590 */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
/* { dg-options "-O1 -fno-dce -w" } */
int
/* PR middle-end/107385 */
-/* { dg-do run { target lra } } */
+/* { dg-do run { target asm_goto_with_outputs } } */
/* { dg-options "-O2" } */
__attribute__((noipa)) int
/* PR tree-optimization/108095 */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
/* { dg-options "-Os -g" } */
int v;
/* PR rtl-optimization/110079 */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target { nvptx-*-* || lra } } } */
/* { dg-options "-O2" } */
/* { dg-additional-options "-freorder-blocks-and-partition" { target freorder } } */
/* PR rtl-optimization/97954 */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
/* { dg-options "-O2" } */
int
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
/* { dg-additional-options "--param tree-reassoc-width=2" } */
unsigned int a0;
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
int
test5_limit (void)
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
/* { dg-additional-options "--param tree-reassoc-width=2" } */
unsigned int foo_a1, foo_a2;
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
struct T { int x; };
int foo(void) {
}]
}
-# return 1 if LRA is supported.
+# Return 1 if LRA is supported. This must not be called (results in ERROR) for
+# targets that don't do register allocation, and therefore neither use nor
+# don't use LRA.
proc check_effective_target_lra { } {
# Start with heavily used targets which are known to always use LRA.
} {-O2 -fdump-rtl-reload-details}] ;# LRA notes requires a detailed dump.
}
+# Return 1 if 'asm goto' with outputs is supported, 0 otherwise.
+
+proc check_effective_target_asm_goto_with_outputs { } {
+ if { [istarget nvptx-*-*] } {
+ return 1
+ }
+ return [check_effective_target_lra]
+}
+
# Test whether optimizations are enabled ('__OPTIMIZE__') per the
# 'current_compiler_flags' (thus don't cache).