From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 542323858D39; Mon, 6 Mar 2023 10:38:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 542323858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678099121; bh=2TVGaaF4TsHVSjXwTb9gU8WSFOYYnNVR97w0vXRsZ/Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EeHNTtCUzxTsvEn6reIwk626tjZY+JvP9x39yiGrgHrFx/gPCSrWkPhX6QJTjT7r5 pehcIrjVD1mGAX6+VKIOtyPcY1nPpbHyiRMNK50ojXZ3clMOWdmuz/azF5+beFq8k3 HHfSx34lSi4haALW/1LtLL+nNwoaIpV77UZ9uexc= From: "rsandifo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/106594] [13 Regression] sign-extensions no longer merged into addressing mode Date: Mon, 06 Mar 2023 10:38:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: rsandifo at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106594 --- Comment #19 from rsandifo at gcc dot gnu.org --- I completely agree with comment 18. See: https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601472.html for some more on a similar theme. make_compound_operation_int already has code to convert (and (subreg X) (const_int N)) into (zero_extend X) when nonzero_bits indicates that that's safe. I think the AArch64 regression can be fixed by extending that to: (and (mult (subreg x) (const_int N2)) (const_int N)) -> (mult (sign_extend X) (const_int N2)) for power-of-N2, with the nonzero_bits test adjusted for N2. (mult is the canonical form here, since it's part of an address.) Testing a patch for that. Hopefully that should be less risky than changing the expand/make_compound_operation dance in stage 4.=