From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5712B385841A; Tue, 26 Mar 2024 23:52:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5712B385841A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711497125; bh=CeFnfS4oVkEWtV5PvNtkPGA8SxLnR3v1zarUB1M4bTI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=awo9kpvd7qQct7flPBzI5SVFs6nYviE1JzSdVuL5KjkgSCA6qpnlZ0DnR9h7kExxf GaIyDuJ4M8QvHCGwaPR+5hfHUrKw5PxagA85sQh8txK87ihGAMfLMnbXMAorqbDcJ+ kfe1SAba1YAzpM61bdhkn3YKWCgzSlLONyqDYsaU= From: "Explorer09 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114490] Optimization: x86 "shl" condition codes never reused Date: Tue, 26 Mar 2024 23:52:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: Explorer09 at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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=3D114490 --- Comment #3 from Kang-Che Sung --- (In reply to Andrew Pinski from comment #2) >=20 > Basically if you are shifting by 0, then the CF bit never changes from the > previous and this can't be done. >=20 > So the comment in the backend is correct and there is no way to remove the > test (unless you know ch can't be 0). What if I had the CF cleared to 0 already before the shift? Even when the flags don't change when the value in the CL register is zero,= if I had the flags in a known state, the optimization can still be done. And my suggested 'my_isxdigit_2' code worked before I know the caveat of the shift instructions... ("xorl %eax, %eax" -> CF =3D SF =3D 0)=