[gcc(refs/users/aoliva/heads/testme)] testsuite: ppc: add struct_parm_musttail for required caller copying
Alexandre Oliva
aoliva@gcc.gnu.org
Sat Mar 28 08:43:37 GMT 2026
https://gcc.gnu.org/g:dca2816a5aeef338cc893da8f795575a33529127
commit dca2816a5aeef338cc893da8f795575a33529127
Author: Alexandre Oliva <oliva@adacore.com>
Date: Tue Mar 10 04:18:33 2026 -0300
testsuite: ppc: add struct_parm_musttail for required caller copying
On powerpc-elf, a number of musttail tests fail because of passing
structs as arguments. They require caller copying.
The struct_musttail effective target, that checks for support for
returning structs, isn't enough to cover these uses, so I'm adding
struct_parm_musttail. It's undocumented in the manual, like the other
musttail effective targets. There doesn't seem to be a subsubsection
where they'd fit.
for gcc/testsuite/ChangeLog
* c-c++-common/musttail32.c: Require struct_parm_musttail.
* g++.dg/opt/musttail2.C: Likewise.
* g++.dg/opt/musttail3.C: Likewise.
* g++.dg/opt/musttail5.C: Likewise.
* g++.dg/opt/pr119613.C: Likewise.
* lib/target-supports.exp
(check_effective_target_struct_parm_musttail): New.
Diff:
---
gcc/testsuite/c-c++-common/musttail32.c | 2 +-
gcc/testsuite/g++.dg/opt/musttail2.C | 2 +-
gcc/testsuite/g++.dg/opt/musttail3.C | 2 +-
gcc/testsuite/g++.dg/opt/musttail5.C | 2 +-
gcc/testsuite/g++.dg/opt/pr119613.C | 2 +-
gcc/testsuite/lib/target-supports.exp | 10 ++++++++++
6 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/gcc/testsuite/c-c++-common/musttail32.c b/gcc/testsuite/c-c++-common/musttail32.c
index f1b7052fe906..0b0fbbd030c9 100644
--- a/gcc/testsuite/c-c++-common/musttail32.c
+++ b/gcc/testsuite/c-c++-common/musttail32.c
@@ -1,5 +1,5 @@
/* PR ipa/121023 */
-/* { dg-do compile { target musttail } } */
+/* { dg-do compile { target struct_parm_musttail } } */
/* { dg-options "-O2" } */
struct S { int a, b; };
diff --git a/gcc/testsuite/g++.dg/opt/musttail2.C b/gcc/testsuite/g++.dg/opt/musttail2.C
index d12fcb2e397d..e4082e6858f3 100644
--- a/gcc/testsuite/g++.dg/opt/musttail2.C
+++ b/gcc/testsuite/g++.dg/opt/musttail2.C
@@ -1,5 +1,5 @@
// PR ipa/119376
-// { dg-do compile { target musttail } }
+// { dg-do compile { target struct_parm_musttail } }
// { dg-options "-O2 -fno-early-inlining -fdump-tree-optimized" }
// { dg-final { scan-tree-dump-times " \[^\n\r]* = foo \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } }
diff --git a/gcc/testsuite/g++.dg/opt/musttail3.C b/gcc/testsuite/g++.dg/opt/musttail3.C
index a2db4479ec17..06f6e903e145 100644
--- a/gcc/testsuite/g++.dg/opt/musttail3.C
+++ b/gcc/testsuite/g++.dg/opt/musttail3.C
@@ -1,5 +1,5 @@
// PR tree-optimization/119491
-// { dg-do compile { target { external_musttail && { c++11 && { ! using_sjlj_exceptions } } } } }
+// { dg-do compile { target { { external_musttail && struct_parm_musttail } && { c++11 && { ! using_sjlj_exceptions } } } } }
// { dg-options "-O2" }
struct A {
diff --git a/gcc/testsuite/g++.dg/opt/musttail5.C b/gcc/testsuite/g++.dg/opt/musttail5.C
index 10e8d940dbb6..0ff1cec9d035 100644
--- a/gcc/testsuite/g++.dg/opt/musttail5.C
+++ b/gcc/testsuite/g++.dg/opt/musttail5.C
@@ -1,5 +1,5 @@
// PR tree-optimization/119491
-// { dg-do compile { target { external_musttail && { c++11 && { ! using_sjlj_exceptions } } } } }
+// { dg-do compile { target { { external_musttail && struct_parm_musttail } && { c++11 && { ! using_sjlj_exceptions } } } } }
// { dg-options "-O2" }
struct A {
diff --git a/gcc/testsuite/g++.dg/opt/pr119613.C b/gcc/testsuite/g++.dg/opt/pr119613.C
index c3657eb4f984..fe3da02bacad 100644
--- a/gcc/testsuite/g++.dg/opt/pr119613.C
+++ b/gcc/testsuite/g++.dg/opt/pr119613.C
@@ -1,5 +1,5 @@
// PR middle-end/119613
-// { dg-do compile { target { musttail && { c++11 && { ! using_sjlj_exceptions } } } } }
+// { dg-do compile { target { struct_parm_musttail && { c++11 && { ! using_sjlj_exceptions } } } } }
// { dg-options "-O0" }
struct S { S () {} };
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index f9bd4bc779c4..56c64ef62872 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -13692,6 +13692,16 @@ proc check_effective_target_struct_musttail { } {
} {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
}
+# Return 1 if the target can perform musttail optimizations for
+# structures passed as arguments. powerpc-elf for one can't.
+proc check_effective_target_struct_parm_musttail { } {
+ return [check_no_messages_and_pattern struct_parm_musttail ",SIBCALL" rtl-expand {
+ struct foo { int a, b; };
+ extern __attribute__((__noipa__)) int foo (struct foo bar);
+ __attribute__((__noipa__)) int bar (struct foo bar) { [[gnu::musttail]] return foo(bar); }
+ } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
+}
+
# Return 1 if the target's calling sequence or its ABI
# create implicit stack probes at or prior to function entry.
proc check_effective_target_caller_implicit_probes { } {
More information about the Gcc-cvs
mailing list