[Bug target/55583] Extended shift instruction on x86-64 is not used, producing unoptimal code

crazylht at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon May 30 02:23:14 GMT 2022


--- Comment #7 from Hongtao.liu <crazylht at gmail dot com> ---
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
3. match_dup 0 is too restrict, we can have a extra emit_move_insn to set DEST.

More information about the Gcc-bugs mailing list