https://gcc.gnu.org/g:3d156c9e9bdaf351f77e3348b7d0d75e08f65580
commit r16-139-g3d156c9e9bdaf351f77e3348b7d0d75e08f65580 Author: Jakub Jelinek <ja...@redhat.com> Date: Fri Apr 25 14:42:01 2025 +0200 s390: Allow 5+ argument tail-calls in some -m31 -mzarch special cases [PR119873] Here is a patch to handle the PARALLEL case too. I think we can just use rtx_equal_p there, because it will always use SImode in the EXPR_LIST REGs in that case. 2025-04-25 Jakub Jelinek <ja...@redhat.com> PR target/119873 * config/s390/s390.cc (s390_call_saved_register_used): Don't return true if default definition of PARM_DECL SSA_NAME of the same register is passed in call saved register in the PARALLEL case either. * gcc.target/s390/pr119873-5.c: New test. Diff: --- gcc/config/s390/s390.cc | 12 +++++++++++- gcc/testsuite/gcc.target/s390/pr119873-5.c | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index 0e9140ed5a0a..e3edf8595131 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -14524,7 +14524,17 @@ s390_call_saved_register_used (tree call_expr) gcc_assert (REG_NREGS (r) == 1); if (!call_used_or_fixed_reg_p (REGNO (r))) - return true; + { + rtx parm; + if (TREE_CODE (parameter) == SSA_NAME + && SSA_NAME_IS_DEFAULT_DEF (parameter) + && SSA_NAME_VAR (parameter) + && TREE_CODE (SSA_NAME_VAR (parameter)) == PARM_DECL + && (parm = DECL_INCOMING_RTL (SSA_NAME_VAR (parameter))) + && rtx_equal_p (parm_rtx, parm)) + break; + return true; + } } } } diff --git a/gcc/testsuite/gcc.target/s390/pr119873-5.c b/gcc/testsuite/gcc.target/s390/pr119873-5.c new file mode 100644 index 000000000000..b5a7950d62b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr119873-5.c @@ -0,0 +1,11 @@ +/* PR target/119873 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -m31 -mzarch" } */ + +extern void foo (int x, int y, int z, long long w, int v); + +void +bar (int x, int y, int z, long long w, int v) +{ + [[gnu::musttail]] return foo (x, y, z, w, v); +}