This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add define_insn_and_split for combine to detect x < 123U ? -1 : 0 (PR target/88425)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 11 Dec 2018 08:54:16 +0100
- Subject: Re: [PATCH] Add define_insn_and_split for combine to detect x < 123U ? -1 : 0 (PR target/88425)
- References: <20181211072721.GK12380@tucnak> <CAFULd4bME1v7PXsYYgYR=Ta2VdN5OcoLue74KZh6WTyu5MLX9Q@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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