From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 568513858C5F; Mon, 6 Mar 2023 11:07:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 568513858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678100872; bh=sZnMuWwzphR2ZEmSWUUeY5nOPtCK5luN+p595P5Kr8U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HmOIEdbcD8faB2QHmxQl8nQ52Q7mgmXIfMRSNxd9PCdycmsb3eJi/+/n2R4n0GC+g O3t+e2tXETQYyLyNrp+bzbe0j0AX8arTKGiXCmqgdfzERO+UkuLwmW7VpHwr8BYgxp VaXToUHH7y0/ZGdwAtErlrJxHwKc6BoofjP2bQas= From: "jakub 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 11:07:51 +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: jakub 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: cc 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 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #20 from Jakub Jelinek --- (In reply to rsandifo@gcc.gnu.org from comment #19) > 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. >=20 > 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: >=20 > (and (mult (subreg x) (const_int N2)) (const_int N)) > -> (mult (sign_extend X) (const_int N2)) >=20 > 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.) >=20 > Testing a patch for that. Hopefully that should be less > risky than changing the expand/make_compound_operation > dance in stage 4. Complete agreement here, when I was seeing the gcc-patches thread during the weekend that was exactly what I'd try to do if you haven't posted this comm= ent. In the nonzero_bits check for this one needs to verify that: 1) low log2(N2) bits don't really matter in N 2) bits above that if zero in N need to correspond to zero in nonzero_bits after the shift 3) the most significant bit of the SUBREG_REG needs to be clear (so that it doesn't matter if it is zero or sign extension)=