https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117860
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Andrew Pinski from comment #1) > Confirmed. > > I think it should be easy to support it with a slight change to this pattern: > ``` > (define_insn "addcarry<mode>" > [(set (reg:CCC FLAGS_REG) > (compare:CCC > (zero_extend:<DWI> > (plus:SWI48 > (plus:SWI48 > (match_operator:SWI48 5 "ix86_carry_flag_operator" > [(match_operand 3 "flags_reg_operand") (const_int 0)]) > (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,rm,r")) > (match_operand:SWI48 2 "nonimmediate_operand" "r,rm,r,m"))) > (plus:<DWI> > (zero_extend:<DWI> (match_dup 2)) > (match_operator:<DWI> 4 "ix86_carry_flag_operator" > [(match_dup 3) (const_int 0)])))) > (set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r,r,r") > (plus:SWI48 (plus:SWI48 (match_op_dup 5 > [(match_dup 3) (const_int 0)]) > (match_dup 1)) > (match_dup 2)))] > "ix86_binary_operator_ok (PLUS, <MODE>mode, operands, TARGET_APX_NDD)" > "@ > adc{<imodesuffix>}\t{%2, %0|%0, %2} > adc{<imodesuffix>}\t{%2, %0|%0, %2} > adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2} > adc{<imodesuffix>}\t{%2, %1, %0|%0, %1, %2}" > [(set_attr "isa" "*,*,apx_ndd,apx_ndd") > (set_attr "type" "alu") > (set_attr "use_carry" "1") > (set_attr "pent_pair" "pu") > (set_attr "mode" "<MODE>")]) > ``` > > > operand 2 would need to change. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index ffbb10730c0..f91cb97232a 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -9034,7 +9034,7 @@ (define_insn "addcarry<mode>" (match_operator:SWI48 5 "ix86_carry_flag_operator" [(match_operand 3 "flags_reg_operand") (const_int 0)]) (match_operand:SWI48 1 "nonimmediate_operand" "%0,0,rm,r")) - (match_operand:SWI48 2 "nonimmediate_operand" "r,rm,r,m"))) + (match_operand:SWI48 2 "x86_64_general_operand" "r,rme,r,me"))) (plus:<DWI> (zero_extend:<DWI> (match_dup 2)) (match_operator:<DWI> 4 "ix86_carry_flag_operator" The above does not work, because: Trying 15 -> 19: 15: r112:DI=0x5 19: {flags:CCC=cmp(zero_extend(ltu(flags:CCC,0)+r107:DI+r112:DI),zero_extend(r112:DI)+ltu(flags:CCC,0));r114:DI=ltu(flags:CCC,0)+r107:DI+r112:DI;} REG_DEAD r112:DI REG_DEAD r107:DI Failed to match this instruction: (parallel [ (set (reg:CC 17 flags) (compare:CC (plus:TI (ltu:TI (reg:CCC 17 flags) (const_int 0 [0])) (const_int 5 [0x5])) (zero_extend:TI (plus:DI (plus:DI (ltu:DI (reg:CCC 17 flags) (const_int 0 [0])) (reg/v:DI 107 [ a_hi ])) (const_int 5 [0x5]))))) (set (reg:DI 114) (plus:DI (plus:DI (ltu:DI (reg:CCC 17 flags) (const_int 0 [0])) (reg/v:DI 107 [ a_hi ])) (const_int 5 [0x5]))) ]) Combine creates (compare:CC) from (compare:CCC) RTX even for simple constant propagation and fails instruction match. (BTW: I'm not sure APX constraints are correct).