https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117860
Hongtao Liu <liuhongt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |liuhongt at gcc dot gnu.org
--- Comment #3 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #2)
> (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")))
>
> (BTW: I'm not sure APX constraints are correct).
Better with
> - (match_operand:SWI48 2 "nonimmediate_operand" "r,rm,r,m")))
> + (match_operand:SWI48 2 "x86_64_general_operand" "r,rme,re,m")))
APX NDD also support adc reg, mem, imm