On Tue, Dec 11, 2018 at 08:44:00AM +0100, Uros Bizjak wrote:
> > --- gcc/config/i386/i386.md.jj  2018-11-22 10:40:31.179683319 +0100
> > +++ gcc/config/i386/i386.md     2018-12-10 11:24:49.785830186 +0100
> > @@ -17195,6 +17195,24 @@ (define_insn "*x86_mov<mode>cc_0_m1_neg"
> >     (set_attr "mode" "<MODE>")
> >     (set_attr "length_immediate" "0")])
> >
> > +(define_insn_and_split "*x86_mov<SWI48:mode>cc_0_m1_neg_leu<SWI:mode>"
> > +  [(set (match_operand:SWI48 0 "register_operand" "=r")
> > +       (neg:SWI48
> > +         (leu:SWI48
> > +           (match_operand:SWI 1 "nonimmediate_operand" "<SWI:r>m")
> > +           (match_operand:SWI 2 "<SWI:immediate_operand>" "<SWI:i>"))))
> 
> You can use const_int_operand predicate with "n" constraint here.

The point was to disallow 64-bit constants, so if I use const_int_operand
above, I'd need to replace CONST_INT_P (operands[2]) test with
trunc_int_for_mode (INTVAL (operands[2]), SImode) == INTVAL (operands[2])
or similar, perhaps do it for the 64-bit mode only, so
  (<SWI:MODE>mode != DImode
   || (trunc_int_for_mode (INTVAL (operands[2]), SImode)
       == INTVAL (operands[2])))

> > +   (clobber (reg:CC FLAGS_REG))]
> > +  "CONST_INT_P (operands[2])
> > +   && INTVAL (operands[2]) != -1
> > +   && INTVAL (operands[2]) != 2147483647"
> 
> Can UINTVAL be used here?

Just for the latter, or for both?  For the first one it would
require UINTVAL (operands[2]) != HOST_WIDE_INT_M1U
or so.

        Jakub

Reply via email to