From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9BA123858C60; Sun, 22 Aug 2021 09:20:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BA123858C60 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/64537] Aarch64 redundant sxth instruction gets generated Date: Sun, 22 Aug 2021 09:20:23 +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: 5.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status resolution target_milestone 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Aug 2021 09:20:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D64537 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |NEW Resolution|FIXED |--- Target Milestone|9.0 |--- --- Comment #8 from Andrew Pinski --- Well it was just this case that was fixed. here is another one which is still broken: unsigned int adds_shift_ext ( unsigned long long a, unsigned short b, unsigned c) { unsigned long long d =3D (a - ((unsigned long long)b << 3)); if (d =3D=3D 0) return a + c + b; else return b + d + c; } Note I think there is a missed reassociation/code hoisting too. [local count: 536870913]: _3 =3D (unsigned int) a_11(D); _4 =3D _3 + c_13(D); _15 =3D _4 + _8; goto ; [100.00%] [local count: 536870913]: _7 =3D (unsigned int) d_12; _17 =3D _8 + c_13(D); _14 =3D _7 + _17; c_13(D) + _8 is full redundant here=