From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AF6543858D33; Sun, 21 May 2023 05:16:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF6543858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684646160; bh=EXhGxnS3HsHlz4RHy6kQd6xs9fJzmaZnnsgOq3rGJ48=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yjuI5PHKZjuUwpjpwEM27A9E/O/WeYQqz0PVE65GvHOBZEiZFg0oJ/tMH6hscpK+0 oAHbTLc6rQTfp/PdBhKzQt2jz4werPHK+dB1X8q0U0Mk331cyrlQYoHz5FD8ETAmlz Y4KGswES1rAGmZ3MOOO+DEPf5KT0aM5U1GLJ4EEA= 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: Sun, 21 May 2023 05:15:59 +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 #15 from Andrew Pinski --- So there is another way of fixing this. take: Trying 6 -> 12: 6: r49:SI=3Dr50:SI>>0x1f REG_DEAD r50:SI 12: r24:QI=3Dr49:SI#0&0x1 REG_DEAD r49:SI Failed to match this instruction: (set (reg/i:QI 24 r24) (neg:QI (subreg:QI (ashiftrt:SI (reg:SI 50) (const_int 31 [0x1f])) 0))) It is correct but maybe the subreg should combine with the shift and change= it just (lshiftrt:QI (subreg:QI (reg:SI 50)) (const_int 7)) . Once combine does that, then maybe that could match ... What is interesting is subreg1 does the splitting for HI mode . Maybe Roger could look improving that since he was touching it recently for= avr IIRC.=