[Bug target/106220] x86-64 optimizer forgets about shrd peephole optimization pattern when faced with more than one in close proximity

crazylht at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Nov 11 05:05:52 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106220

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
Try to add combine splitter

(define_insn_and_split "*x86_64_shrd_lshiftrtti"
  [(set (match_operand:DI 0 "nonimmediate_operand")
        (subreg:DI (lshiftrt:TI (match_operand:TI 1 "nonimmediate_operand")
                                (subreg:QI
                                  (and:SI
                                    (match_operand:SI 2 "register_operand")
                                    (const_int 63)) 0)) 0))
   (clobber (reg:CC FLAGS_REG))]

 but failed if there's more than 2 shrd insns since there's flags clobber in
the first shrd which prevent the second shrd to be combined. By the time it's
splitted after reload, it's too later to optimize off redudant cmovne.


More information about the Gcc-bugs mailing list