On Thu, Dec 3, 2020 at 2:22 AM Jakub Jelinek <ja...@redhat.com> wrote:
>
> On Tue, Dec 01, 2020 at 12:49:03PM +0800, Hongtao Liu via Gcc-patches wrote:
> > +    bool neq_p = INTVAL (operands[4]) >> 2;
> > +    /* LE: 2, NLT: 5, NLE: 6, LT: 1  */
> > +    rtx cmp_predicate = neq_p ? GEN_INT (6) : GEN_INT (2);
> > +    if (MEM_P (operands[1]))
> > +      {
> > +     std::swap (operands[1], operands[2]);
> > +     cmp_predicate = neq_p ? GEN_INT (1) : GEN_INT (5);
> > +      }
> > +    emit_insn (gen_<avx512>_ucmp<mode>3 (operands[0], operands[1],
> > +                                     operands[2], cmp_predicate));
>
> I'd suggest instead:
> +    /* LE: 2, NLT: 5, NLE: 6, LT: 1  */
> +    int cmp_predicate = 2; /* LE  */
> +    if (MEM_P (operands[1]))
> +      {
> +       std::swap (operands[1], operands[2]);
> +       cmp_predicate = 5; /* NLT (GE)  */
> +      }
> +    if ((INTVAL (operands[4]) & 4) != 0)
> +      cmp_predictate ^= 4; /* Invert the comparison to NLE (GT) or LT.  */
> +    emit_insn (gen_<avx512>_ucmp<mode>3 (operands[0], operands[1], 
> operands[2],
> +                                        GEN_INT (cmp_predicate)));
> so that you don't create the rtx CONST_INTs in 4 places and don't do that
> unnecessarily when you will need another constant.
Thanks for the review,committed.
>
> Otherwise LGTM, thanks.
>
>         Jakub
>


-- 
BR,
Hongtao

Reply via email to