]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
New effective-target 'asm_goto_with_outputs'
authorThomas Schwinge <tschwinge@baylibre.com>
Mon, 4 Mar 2024 15:04:11 +0000 (16:04 +0100)
committerThomas Schwinge <tschwinge@baylibre.com>
Mon, 8 Apr 2024 20:08:00 +0000 (22:08 +0200)
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.

15 files changed:
gcc/doc/sourcebuild.texi
gcc/testsuite/gcc.c-torture/compile/asmgoto-2.c
gcc/testsuite/gcc.c-torture/compile/asmgoto-5.c
gcc/testsuite/gcc.c-torture/compile/asmgoto-6.c
gcc/testsuite/gcc.c-torture/compile/pr98096.c
gcc/testsuite/gcc.dg/pr100590.c
gcc/testsuite/gcc.dg/pr107385.c
gcc/testsuite/gcc.dg/pr108095.c
gcc/testsuite/gcc.dg/pr110079.c
gcc/testsuite/gcc.dg/pr97954.c
gcc/testsuite/gcc.dg/torture/pr100329.c
gcc/testsuite/gcc.dg/torture/pr100398.c
gcc/testsuite/gcc.dg/torture/pr100519.c
gcc/testsuite/gcc.dg/torture/pr110422.c
gcc/testsuite/lib/target-supports.exp

index 7ef82fc9b00a62a9760644d9583f5db8c291a994..7c0df90e82236ebe4f7db7e75a0229a813ff5487 100644 (file)
@@ -2871,6 +2871,9 @@ Target supports weak undefined symbols
 @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.
 
@@ -2945,6 +2948,9 @@ Target is using an LLVM assembler and/or linker, instead of GNU Binutils.
 
 @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).
index 43e597bc59f8fa04425979d59322fe2af82fd859..234c90e52951ca15a3ea99aeab6abe030058d4ff 100644 (file)
@@ -1,5 +1,5 @@
 /* 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)
 {
index e1574a2903afcc9691079de560f0760c8a591723..af1ba5a700155f862c05a31883fbeada929c7577 100644 (file)
@@ -1,5 +1,5 @@
 /* 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__
index 6799b83c20a0c1212655a9d00a6a0b565d74c217..cb3c7d711a6d13dfe4c69dc6f1d578e7c3152bc3 100644 (file)
@@ -1,5 +1,4 @@
-
-/* { 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 */
index bba3fa5c619069e5c32ad455644110e5b94cdcd6..3a1b6159c2e58dff2fb3a458c9e13dd25a9b9cd5 100644 (file)
@@ -1,6 +1,6 @@
 /* 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);
index 8d1e1a0d3064f3bfaf867d4258c8ecd677be4649..64cb717ed0eec806bd8c6734b3bb61ecab205bd8 100644 (file)
@@ -1,5 +1,5 @@
 /* PR rtl-optimization/100590 */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
 /* { dg-options "-O1 -fno-dce -w" } */
 
 int
index 0cc0655d84834b5477f75ac6e371c95b1c977a9e..690ad3c1b5e524b4bc7a12f23a6c8add86da2b96 100644 (file)
@@ -1,5 +1,5 @@
 /* PR middle-end/107385 */
-/* { dg-do run { target lra } } */
+/* { dg-do run { target asm_goto_with_outputs } } */
 /* { dg-options "-O2" } */
 
 __attribute__((noipa)) int
index 0a487cf614a1143bb3f5b87be16821bdd75bf911..115ea73e39b482f01c7f22006699db02221611f1 100644 (file)
@@ -1,5 +1,5 @@
 /* PR tree-optimization/108095 */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
 /* { dg-options "-Os -g" } */
 
 int v;
index 1682f9c2344457b8e34acc3108a1d459ea560cda..f87064d5f2ce50e5f3a3e89b54e79e96ad607282 100644 (file)
@@ -1,5 +1,5 @@
 /* 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 } } */
 
index 0be60f500b663f6f850b31b41bcb56dd5f39e5db..619bed3b40c39876d3abe658ce3809ddd4d17669 100644 (file)
@@ -1,5 +1,5 @@
 /* PR rtl-optimization/97954 */
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
 /* { dg-options "-O2" } */
 
 int
index 2a4331ba7127cbd7ae05da9446ea3e5a02d32f65..5759131a6cae76700f7f4a84462eb9e10f12f7cf 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
 /* { dg-additional-options "--param tree-reassoc-width=2" } */
 
 unsigned int a0;
index 4fc1168d22fddeb3153cc47bff1762d25cd7b3e8..eeeaf98e15bc6450135ba2c8b7b1af4e7666238b 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
 
 int
 test5_limit (void)
index 89dff668a970eda3d7e83ee87ffb97ea3313c698..b82ce46c5293315f2ab0dbfcd13c9171d757cec8 100644 (file)
@@ -1,4 +1,4 @@
-/* { 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;
index 2a653bdfce3eefc647679e173f74ea93ff894c15..34de7a2980fbecca85f68666801e362fbb4b4e37 100644 (file)
@@ -1,4 +1,4 @@
-/* { dg-do compile { target lra } } */
+/* { dg-do compile { target asm_goto_with_outputs } } */
 
 struct T { int x; };
 int foo(void) {
index 45435586de2181b38e52e0569e2d0737f6c98248..49f2482686a2a22216b2d48d3ae3906dc6c21532 100644 (file)
@@ -13204,7 +13204,9 @@ proc check_effective_target_powerpc_as_p10_htm { } {
     }]
 }
 
-# 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.
@@ -13220,6 +13222,15 @@ proc check_effective_target_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).