From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 10F1B158091 for ; Wed, 18 Jun 2025 21:17:23 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id E6C64340FFC for ; Wed, 18 Jun 2025 21:17:22 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id B720F1104DC; Wed, 18 Jun 2025 21:17:21 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id A71F41104DC for ; Wed, 18 Jun 2025 21:17:21 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 521A3340D77 for ; Wed, 18 Jun 2025 21:17:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B46A82935 for ; Wed, 18 Jun 2025 21:17:19 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1750281436.e97115ef72070c3d8de00572572f632aae9e94f0.sam@gentoo> Subject: [gentoo-commits] proj/gcc-patches:master commit in: 16.0.0/gentoo/ X-VCS-Repository: proj/gcc-patches X-VCS-Files: 16.0.0/gentoo/86_all_PR120689-expand-Align-PARM_DECLs-again-to-at-least-BITS_PER_W.patch X-VCS-Directories: 16.0.0/gentoo/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: e97115ef72070c3d8de00572572f632aae9e94f0 X-VCS-Branch: master Date: Wed, 18 Jun 2025 21:17:19 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a318af87-8197-499f-a102-1345f92b327b X-Archives-Hash: 86475e2cce1e9e5e6ac58f20d7574c0c commit: e97115ef72070c3d8de00572572f632aae9e94f0 Author: Sam James gentoo org> AuthorDate: Wed Jun 18 21:16:43 2025 +0000 Commit: Sam James gentoo org> CommitDate: Wed Jun 18 21:17:16 2025 +0000 URL: https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e97115ef 16.0.0: add expand bloat fix I need to rebuild for something else so may as well throw it in. Bug: https://gcc.gnu.org/PR120689 Signed-off-by: Sam James gentoo.org> ...n-PARM_DECLs-again-to-at-least-BITS_PER_W.patch | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/16.0.0/gentoo/86_all_PR120689-expand-Align-PARM_DECLs-again-to-at-least-BITS_PER_W.patch b/16.0.0/gentoo/86_all_PR120689-expand-Align-PARM_DECLs-again-to-at-least-BITS_PER_W.patch new file mode 100644 index 0000000..b160593 --- /dev/null +++ b/16.0.0/gentoo/86_all_PR120689-expand-Align-PARM_DECLs-again-to-at-least-BITS_PER_W.patch @@ -0,0 +1,105 @@ +From a483146d61698559fbe3adad9a536b3eb509ecaa Mon Sep 17 00:00:00 2001 +Message-ID: +From: Jakub Jelinek +Date: Wed, 18 Jun 2025 21:47:22 +0200 +Subject: [PATCH] expand: Align PARM_DECLs again to at least BITS_PER_WORD if + possible [PR120689] + +Hi! + +The following testcase shows a regression caused by the r10-577 change +made for cris. Before that change, the MEM holding (in this case 3 byte) +struct parameter was BITS_PER_WORD aligned, now it is just BITS_PER_UNIT +aligned and that causes significantly worse generated code. +So, the MAX (DECL_ALIGN (parm), BITS_PER_WORD) extra alignment clearly +doesn't help just STRICT_ALIGNMENT targets, but other targets as well. +Of course, it isn't worth doing stack realignment in the rare case of +MAX_SUPPORTED_STACK_ALIGNMENT < BITS_PER_WORD targets like cris, so the +patch only bumps the alignment if it won't go the +> MAX_SUPPORTED_STACK_ALIGNMENT path because of that optimization. + +The change on the testcase is: +bar: +- movl %edi, %eax +- movzbl %dil, %r8d +- movl %esi, %ecx +- movzbl %sil, %r10d +- movl %edx, %r9d +- movzbl %dl, %r11d +- shrl $16, %edi +- andl $65280, %ecx +- shrl $16, %esi +- shrl $16, %edx +- andl $65280, %r9d +- orq %r10, %rcx +- movzbl %dl, %edx +- movzbl %sil, %esi +- andl $65280, %eax +- movzbl %dil, %edi +- salq $16, %rdx +- orq %r11, %r9 +- salq $16, %rsi +- orq %r8, %rax +- salq $16, %rdi +- orq %r9, %rdx +- orq %rcx, %rsi +- orq %rax, %rdi + jmp foo + +Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? + +2025-06-18 Jakub Jelinek + + PR target/120689 + * function.cc (assign_parm_setup_block): Align parm to at least + word alignment even on !STRICT_ALIGNMENT targets, as long as + BITS_PER_WORD is not larger than MAX_SUPPORTED_STACK_ALIGNMENT. + + * gcc.target/i386/pr120689.c: New test. +--- + gcc/function.cc | 2 +- + gcc/testsuite/gcc.target/i386/pr120689.c | 17 +++++++++++++++++ + 2 files changed, 18 insertions(+), 1 deletion(-) + create mode 100644 gcc/testsuite/gcc.target/i386/pr120689.c + +diff --git a/gcc/function.cc b/gcc/function.cc +index a5b245a98e91..a3a74b44b916 100644 +--- a/gcc/function.cc ++++ b/gcc/function.cc +@@ -2937,7 +2937,7 @@ assign_parm_setup_block (struct assign_parm_data_all *all, + if (stack_parm == 0) + { + HOST_WIDE_INT parm_align +- = (STRICT_ALIGNMENT ++ = ((STRICT_ALIGNMENT || BITS_PER_WORD <= MAX_SUPPORTED_STACK_ALIGNMENT) + ? MAX (DECL_ALIGN (parm), BITS_PER_WORD) : DECL_ALIGN (parm)); + + SET_DECL_ALIGN (parm, parm_align); +diff --git a/gcc/testsuite/gcc.target/i386/pr120689.c b/gcc/testsuite/gcc.target/i386/pr120689.c +new file mode 100644 +index 000000000000..cd10cdb487df +--- /dev/null ++++ b/gcc/testsuite/gcc.target/i386/pr120689.c +@@ -0,0 +1,17 @@ ++/* PR target/120689 */ ++/* { dg-do compile { target lp64 } } */ ++/* { dg-options "-O2 -mtune=generic -fno-stack-protector -masm=att" } */ ++/* { dg-final { scan-assembler-not "\t\(movzbl\|shrl\|salq\|orq\)\t" } } */ ++ ++struct S { char a, b, c; }; ++ ++[[gnu::noipa]] ++void foo (struct S x, struct S y, struct S z) ++{ ++} ++ ++void ++bar (struct S x, struct S y, struct S z) ++{ ++ [[gnu::musttail]] return foo (x, y, z); ++} + +base-commit: 9cc6cfdca980a508f72865830a09b353140e738e +-- +2.50.0 +