From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3BFD23858C52; Sat, 20 May 2023 00:46:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BFD23858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684543610; bh=yu8aDdfFRl+zLy2uN5Ux6Ce7GNhWhVtbcGc8RWPCoO0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dlqR+O6X9R65kOu3MCoEXq7onlEueX2D+3NizdGsL74QVnzGQjjsHsv+mEhkorHc7 IJ1DIJW55jfl0sEOWK+yG4ju41kzp+TINiUMuofAL+i8nlXVwXpTdAwENha7032r0f xZ/k/t8zSL62Cfx7xoV5wazrC9MUPdXRLLXCuYlY= 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, 20 May 2023 00:46:48 +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: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia 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 #9 from Andrew Pinski --- (In reply to Georg-Johann Lay from comment #6) > Quite impressive improvement. Maybe the last step can be achieved with a > combiner pattern that combines extzv with a bit flip. >=20 > One problem is usually that there is no canonical form (sometimes > zero_extract, sometimes shift+and, sometimes with subregs for extraction = or > paradoxical subregs for wider types, different behaviour for MSB, etc.). Right, In this case combine tries: (set (reg/i:QI 24 r24) (zero_extract:QI (xor:QI (reg:QI 54) (const_int 64 [0x40])) (const_int 1 [0x1]) (const_int 6 [0x6]))) Which puts the xor inside the zero_extract even but I think you could handle that once my patch set goes in.=