From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D08A1386F463; Mon, 30 May 2022 02:23:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D08A1386F463 From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/55583] Extended shift instruction on x86-64 is not used, producing unoptimal code Date: Mon, 30 May 2022 02:23:14 +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: 4.8.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: crazylht at gmail dot com 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2022 02:23:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55583 --- Comment #7 from Hongtao.liu --- i386 already has 12980(define_insn_and_split "*x86_shrd_2" 12981 [(set (match_operand:SI 0 "nonimmediate_operand") 12982 (ior:SI (lshiftrt:SI (match_dup 0) 12983 (match_operand:QI 2 "nonmemory_operand")) 12984 (ashift:SI (match_operand:SI 1 "register_operand") 12985 (minus:QI (const_int 32) (match_dup 2))))) It need to be extended(or has new pre_reload splitters) to handle 1. op2 is constant, so minus is not necessary here. 2. swap op2 and (minus:QI (const_int 32) (match_dup 2) between lshiftrt and ashift. 3. match_dup 0 is too restrict, we can have a extra emit_move_insn to set D= EST.=