https://gcc.gnu.org/g:0d2dd04d09c9c210ac0a38c0d6a0f19aea9a28cb

commit 0d2dd04d09c9c210ac0a38c0d6a0f19aea9a28cb
Author: Alexandre Oliva <[email protected]>
Date:   Tue Mar 10 04:18:33 2026 -0300

    testsuite: ppc: drop struct that requires 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/msttail32.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 49fe3052e530..cc3f8a74d9b0 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -13694,6 +13694,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 { } {

Reply via email to