From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7BC2F385DC06; Wed, 27 Mar 2024 11:28:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BC2F385DC06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711538900; bh=nQUupY02tNrspi4l01UuxcXKyf8/I79e/jfvEs0bbGU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Iy7NlGf0IBaK15a6FKxUeAl4wyplCb1UrmQinMBxCFc3fn6f10msK2gPqkZGn9RqB hsJzHzimPoYuc6du09wcpOgQJDG/tA/Ht/dG5dCIUCy5tzjDtNQn4cM0bRS9ddrAvI vcCccJCl8qtPhdclQeDL+919DvyCVpq1vm80ZHI8= From: "Explorer09 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/114490] Optimization: x86 "shl" condition codes never reused Date: Wed, 27 Mar 2024 11:28:20 +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 #4 from Kang-Che Sung --- 1. I just read "AMD64 Architecture Programmer's Manual - Volume 3: General-Purpose and System Instructions" (https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/progr= ammer-references/24594.pdf) It has a clearer wording in the "SAL / SHL" section: "If the shift count is 0, no flags are modified." Just mention for reference. 2. I still don't believe there is no chance of optimizing this thing, but it requires GCC to track the state of the FLAGS register. I don't know if GCC = can do this internally. If GCC can't do this for now, that's OK for me (the exa= mple I posted can be rewritten to another pattern that might produce even smaller code in x86). But maybe label this as a WONTFIX and not INVALID?=