public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] PR116080: Fix tail call dejagnu checks
@ 2024-07-25 22:55 Andi Kleen
  2024-07-25 22:55 ` [PATCH v1 2/2] PR116019: Improve tail call error message Andi Kleen
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Andi Kleen @ 2024-07-25 22:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andi Kleen

From: Andi Kleen <ak@gcc.gnu.org>

- Run the target_effective tail_call checks without optimization to
match the actual test cases.
- Add an extra check for external tail calls to handle targets like
powerpc that cannot tail call between different object files.
This one will also cover templates.

gcc/testsuite/ChangeLog:

	PR testsuite/116080
	* g++.dg/musttail10.C: Use external tail call target check.
	* g++.dg/musttail6.C: Dito.
	* lib/target-supports.exp: Add external_tail_call. Disable
	optimization for tail call checks.
---
 gcc/testsuite/g++.dg/musttail10.C     |  2 +-
 gcc/testsuite/g++.dg/musttail6.C      |  2 +-
 gcc/testsuite/lib/target-supports.exp | 14 +++++++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/g++.dg/musttail10.C b/gcc/testsuite/g++.dg/musttail10.C
index ff7fcc7d8755..bd75affa2220 100644
--- a/gcc/testsuite/g++.dg/musttail10.C
+++ b/gcc/testsuite/g++.dg/musttail10.C
@@ -8,7 +8,7 @@ double g() { [[gnu::musttail]] return f<int>(); } /* { dg-error "cannot tail-cal
 
 template <class T>
 __attribute__((noinline, noclone, noipa))
-T g1() { [[gnu::musttail]] return f<T>(); } /* { dg-error "target is not able" "" { target powerpc*-*-* } } */
+T g1() { [[gnu::musttail]] return f<T>(); } /* { dg-error "target is not able" "" { target { external_tail_call } } } */
 
 template <class T>
 __attribute__((noinline, noclone, noipa))
diff --git a/gcc/testsuite/g++.dg/musttail6.C b/gcc/testsuite/g++.dg/musttail6.C
index 5c6f69407ddb..81f6d9f3ca77 100644
--- a/gcc/testsuite/g++.dg/musttail6.C
+++ b/gcc/testsuite/g++.dg/musttail6.C
@@ -1,6 +1,6 @@
 /* { dg-do compile { target { struct_tail_call } } } */
+/* { dg-require-effective-target external_tail_call } */
 /* A lot of architectures will not build this due to PR115606 and PR115607 */
-/* { dg-skip-if "powerpc does not support sibcall to templates" { powerpc*-*-* } } */
 /* { dg-options "-std=gnu++11" } */
 /* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index d368251ef9a4..0a3946e82d4b 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -12741,7 +12741,15 @@ proc check_effective_target_tail_call { } {
     return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand {
 	__attribute__((__noipa__)) void foo (void) { }
 	__attribute__((__noipa__)) void bar (void) { foo(); }
-    } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
+    } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
+}
+
+# Return 1 if the target can perform tail-calls for externals
+proc check_effective_target_external_tail_call { } {
+    return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand {
+	extern __attribute__((__noipa__)) void foo (void);
+	__attribute__((__noipa__)) void bar (void) { foo(); }
+    } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
 }
 
 # Return 1 if the target can perform tail-call optimizations for structures
@@ -12751,9 +12759,9 @@ proc check_effective_target_struct_tail_call { } {
     return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand {
 	// C++
 	struct foo { int a, b; };
-	__attribute__((__noipa__)) struct foo foo (void) { return {}; }
+	extern __attribute__((__noipa__)) struct foo foo (void);
 	__attribute__((__noipa__)) struct foo bar (void) { return foo(); }
-    } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
+    } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
 }
 
 # Return 1 if the target's calling sequence or its ABI
-- 
2.45.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2024-07-29 17:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-25 22:55 [PATCH v1 1/2] PR116080: Fix tail call dejagnu checks Andi Kleen
2024-07-25 22:55 ` [PATCH v1 2/2] PR116019: Improve tail call error message Andi Kleen
2024-07-26 11:33   ` Richard Biener
2024-07-25 23:08 ` [PATCH v1 1/2] PR116080: Fix tail call dejagnu checks Sam James
2024-07-25 23:14   ` Andrew Pinski
2024-07-26 11:34 ` Richard Biener
2024-07-29 10:22 ` Thomas Schwinge
2024-07-29 16:03   ` Andi Kleen
2024-07-29 17:14     ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).