On Wed, Jun 14, 2023 at 04:45:48PM +0200, Uros Bizjak wrote: > +;; Helper peephole2 for the addcarry<mode> and subborrow<mode> > +;; peephole2s, to optimize away nop which resulted from uaddc/usubc > +;; expansion optimization. > +(define_peephole2 > + [(set (match_operand:SWI48 0 "general_reg_operand") > + (match_operand:SWI48 1 "memory_operand")) > + (const_int 0)] > + "" > + [(set (match_dup 0) (match_dup 1))]) > > Is this (const_int 0) from a recent patch from Roger that introduced:
The first one I see is the one immediately above that: ;; Pre-reload splitter to optimize ;; *setcc_qi followed by *addqi3_cconly_overflow_1 with the same QI ;; operand and no intervening flags modifications into nothing. (define_insn_and_split "*setcc_qi_addqi3_cconly_overflow_1_<mode>" [(set (reg:CCC FLAGS_REG) (compare:CCC (neg:QI (geu:QI (reg:CC_CCC FLAGS_REG) (const_int 0))) (ltu:QI (reg:CC_CCC FLAGS_REG) (const_int 0))))] "ix86_pre_reload_split ()" "#" "&& 1" [(const_int 0)]) And you're right, the following incremental patch (I'd integrate it into the full patch with (*setcc_qi_addqi3_cconly_overflow_1_<mode>, *setccc, *setcc_qi_negqi_ccc_1_<mode>, *setcc_qi_negqi_ccc_2_<mode>): Split into NOTE_INSN_DELETED note rather than nop instruction. added to ChangeLog) passes all the new tests as well: --- gcc/config/i386/i386.md 2023-06-14 12:21:38.668657604 +0200 +++ gcc/config/i386/i386.md 2023-06-14 17:12:31.742625193 +0200 @@ -7990,16 +7990,6 @@ (set_attr "pent_pair" "pu") (set_attr "mode" "<MODE>")]) -;; Helper peephole2 for the addcarry<mode> and subborrow<mode> -;; peephole2s, to optimize away nop which resulted from uaddc/usubc -;; expansion optimization. -(define_peephole2 - [(set (match_operand:SWI48 0 "general_reg_operand") - (match_operand:SWI48 1 "memory_operand")) - (const_int 0)] - "" - [(set (match_dup 0) (match_dup 1))]) - (define_peephole2 [(parallel [(set (reg:CCC FLAGS_REG) (compare:CCC @@ -8641,7 +8631,8 @@ "ix86_pre_reload_split ()" "#" "&& 1" - [(const_int 0)]) + [(const_int 0)] + "emit_note (NOTE_INSN_DELETED); DONE;") ;; Set the carry flag from the carry flag. (define_insn_and_split "*setccc" @@ -8650,7 +8641,8 @@ "ix86_pre_reload_split ()" "#" "&& 1" - [(const_int 0)]) + [(const_int 0)] + "emit_note (NOTE_INSN_DELETED); DONE;") ;; Set the carry flag from the carry flag. (define_insn_and_split "*setcc_qi_negqi_ccc_1_<mode>" @@ -8659,7 +8651,8 @@ "ix86_pre_reload_split ()" "#" "&& 1" - [(const_int 0)]) + [(const_int 0)] + "emit_note (NOTE_INSN_DELETED); DONE;") ;; Set the carry flag from the carry flag. (define_insn_and_split "*setcc_qi_negqi_ccc_2_<mode>" @@ -8669,7 +8662,8 @@ "ix86_pre_reload_split ()" "#" "&& 1" - [(const_int 0)]) + [(const_int 0)] + "emit_note (NOTE_INSN_DELETED); DONE;") ;; Overflow setting add instructions Jakub