From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E72BA3858401; Sat, 27 May 2023 04:02:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E72BA3858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685160159; bh=CC8nO9TXdcEdLqQZCCzkLHM3kd6Do0D2w1JhhLP5RmA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uAn0By92TfhZLQZpKxi6MJ8TWzlusxsno3xYA5nQivd8j5MFrdI3bJ2cZ5xuHeRuY L6VX7nXsFDe7lkCKG+I5JDzxZYwDKCcR/mLN9daJdpzXcxR1N2NyvCf+OVhXRnbloD cq6DgkBrJ0AJyqg0DkbMw0XvA2CH2QVurxHieSb8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109907] Missed optimization for bit extraction (uses shift instead of single bit-test) Date: Sat, 27 May 2023 04:02:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal 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: 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=3D109907 --- Comment #28 from Andrew Pinski --- (In reply to Andrew Pinski from comment #26) > (In reply to Andrew Pinski from comment #25) > > Created attachment 55175 [details] > > Patch which fixes `signed < 0` > >=20 > > This patch improves comment #20 . >=20 > Note this patch does not work for the case of normalizep =3D=3D -1 but I = have a > fix for that. Also note this patch improves (a lot): ``` unsigned char f(long long t) { return t < 0; } ``` Down to: ``` f: /* prologue: function */ /* frame size =3D 0 */ /* stack size =3D 0 */ .L__stack_usage =3D 0 mov r24,r25 rol r24 clr r24 rol r24 /* epilogue start */ ret ``` Rather than what it was in GCC 13: ``` f: push r16 ldi r16,lo8(63) rcall __lshrdi3 mov r24,r18 pop r16 ret ```=