public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hongtao Liu <crazylht@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Kirill Yukhin <kirill.yukhin@gmail.com>,
	"H. J. Lu" <hjl.tools@gmail.com>
Subject: Re: [PATCH] [AVX512] Fix ICE: Convert integer mask to vector in ix86_expand_fp_vec_cmp/ix86_expand_int_vec_cmp [PR98537]
Date: Thu, 14 Jan 2021 19:16:41 +0800	[thread overview]
Message-ID: <CAMZc-byz-XEmRfTUBtEvjdQ2rKFw_9aZK_VssXMiWh2Wv9Oeyw@mail.gmail.com> (raw)
In-Reply-To: <CAMZc-bxQAL8RPp14nPCVEo+9TGmNUxf42LFDRwFsri2YX2O=9A@mail.gmail.com>

ping.

On Thu, Jan 7, 2021 at 1:22 PM Hongtao Liu <crazylht@gmail.com> wrote:
>
> On Wed, Jan 6, 2021 at 10:39 PM Jakub Jelinek <jakub@redhat.com> wrote:
> >
> > On Wed, Jan 06, 2021 at 02:49:13PM +0800, Hongtao Liu wrote:
> > >   ix86_expand_fp_vec_cmp/ix86_expand_int_vec_cmp are used by vec_cmpmn
> > > for vector comparison to vector mask, but ix86_expand_sse_cmp(which is
> > > called in upper 2 functions.) may return integer mask whenever integer
> > > mask is available, so convert integer mask back to vector mask if
> > > needed.
> > >
> > > gcc/ChangeLog:
> > >
> > >         PR target/98537
> > >         * config/i386/i386-expand.c (ix86_expand_fp_vec_cmp):
> > >         When cmp is integer mask, convert it to vector.
> > >         (ix86_expand_int_vec_cmp): Ditto.
> > >
> > > gcc/testsuite/ChangeLog:
> > >
> > >         PR target/98537
> > >         * g++.target/i386/avx512bw-pr98537-1.C: New test.
> > >         * g++.target/i386/avx512vl-pr98537-1.C: New test.
> > >         * g++.target/i386/avx512vl-pr98537-2.C: New test.
> >
> > Do we optimize it then to an AVX/AVX2 comparison if possible?
> >
> When i'm looking at the code, i find there's other places which
> require comparison dest to be vector(i.e. ix86_expand_sse_unpack,
> ix86_expand_mul_widen_evenodd). It's a potential bug.
> So I fix this bug in another way which won't generate an integer mask
> when the comparison dest is required to a vector mask.
>
> Update patch:
>   ix86_expand_sse_cmp/ix86_expand_int_sse_cmp is used for vector
> comparison, considering that avx512 introduces integer mask, but some
> original callers require the dest of comparison to be a vector.
> So add a new parameter vector_mask_p to control the result
> of vector comparison to be vector or not.
>   regtested/bootstrapped on x86_64-linux-gnu{-m32,}.
>
> gcc/ChangeLog:
>
>         PR target/98537
>         * config/i386/i386-expand.c (ix86_expand_sse_cmp): Add a new
>         parameter vector_mask_p to control whether the comparison
>         result should be a vector or not.
>         (ix86_expand_int_sse_cmp): Ditto.
>         (ix86_expand_sse_movcc): cmpmode should be MODE_INT.
>         (ix86_expand_fp_movcc): Allow vector comparison dest as
>         integer mask.
>         (ix86_expand_fp_vcond): Ditto.
>         (ix86_expand_int_vcond): Ditto.
>         (ix86_expand_fp_vec_cmp): Require vector comparison dest as
>         vector.
>         (ix86_expand_int_vec_cmp): Ditto.
>         (ix86_expand_sse_unpack): Ditto.
>         (ix86_expand_mul_widen_evenodd): Ditto.
>
> gcc/testsuite/ChangeLog:
>
>         PR target/98537
>         * g++.target/i386/avx512bw-pr98537-1.C: New test.
>         * g++.target/i386/avx512vl-pr98537-1.C: New test.
>         * g++.target/i386/avx512vl-pr98537-2.C: New test.
>
>
> > @@ -4024,8 +4025,18 @@ ix86_expand_fp_vec_cmp (rtx operands[])
> >      cmp = ix86_expand_sse_cmp (operands[0], code, operands[2], operands[3],
> >                                operands[1], operands[2]);
> >
> > -  if (operands[0] != cmp)
> > -    emit_move_insn (operands[0], cmp);
> > +    if (operands[0] != cmp)
> > +    {
> >
> > The indentation of the if above looks wrong.
> > Otherwise LGTM.
> >
> >         Jakub
> >
>
>
> --
> BR,
> Hongtao



-- 
BR,
Hongtao

  reply	other threads:[~2021-01-14 11:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06  6:49 Hongtao Liu
2021-01-06 14:39 ` Jakub Jelinek
2021-01-07  5:22   ` Hongtao Liu
2021-01-14 11:16     ` Hongtao Liu [this message]
2021-01-26  5:30       ` Hongtao Liu
2021-02-04  5:31         ` Hongtao Liu
2021-02-04 12:00           ` Jakub Jelinek
2021-02-05  1:52             ` Hongtao Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMZc-byz-XEmRfTUBtEvjdQ2rKFw_9aZK_VssXMiWh2Wv9Oeyw@mail.gmail.com \
    --to=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.com \
    --cc=jakub@redhat.com \
    --cc=kirill.yukhin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).