public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hongtao Liu <crazylht@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH][AVX512] Fix ICE for vpexpand*.
Date: Mon, 21 Jun 2021 19:24:42 +0800	[thread overview]
Message-ID: <CAMZc-bz1yARG8AxnuZkRYfNxqMdHWDXW3fTCZxTsVKNtApMSqg@mail.gmail.com> (raw)
In-Reply-To: <CAMZc-bwPJDNfc1VahbvKe8JZFMx=Uao=ZDBW93xG4reaGtWwew@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2674 bytes --]

This is the patch I'm going to push to the trunk.

On Wed, May 12, 2021 at 3:29 PM Hongtao Liu <crazylht@gmail.com> wrote:
>
> ping
>
> On Fri, Apr 30, 2021 at 12:42 PM Hongtao Liu <crazylht@gmail.com> wrote:
> >
> > Hi:
> >   This patch is to fix ice which was introduced by my
> > r11-5696-g35c4c67e6c534ef3d6ba7a7752ab7e0fbc91755b.
> >   Bootstrapped and regtested on x86_64-linux-gnu{-m32,}.
> >   Ok for trunk and backport to GCC11?
> >
> >   gcc/ChangeLog
> >
> >         PR target/100310
> >         * config/i386/i386-expand.c
> >         (ix86_expand_special_args_builtin): Keep constm1_operand only
> >         if it satisfies insn's operand predicate.
> >
> > gcc/testsuite/ChangeLog
> >
> >         PR target/100310
> >         * gcc.target/i386/pr100310.c: New test.
> >
> > Add test
> > ---
> >  gcc/config/i386/i386-expand.c            |  5 +++--
> >  gcc/testsuite/gcc.target/i386/pr100310.c | 12 ++++++++++++
> >  2 files changed, 15 insertions(+), 2 deletions(-)
> >  create mode 100644 gcc/testsuite/gcc.target/i386/pr100310.c
> >
> > diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
> > index 516440eb5c1..b2bb2b1e3a1 100644
> > --- a/gcc/config/i386/i386-expand.c
> > +++ b/gcc/config/i386/i386-expand.c
> > @@ -10862,11 +10862,12 @@ ix86_expand_special_args_builtin (const
> > struct builtin_description *d,
> >
> >           op = fixup_modeless_constant (op, mode);
> >
> > -         /* NB: 3-operands load implied it's a mask load,
> > +         /* NB: 3-operands load implied it's a mask load or v{p}expand*,
> >              and that mask operand shoud be at the end.
> >              Keep all-ones mask which would be simplified by the expander.  */
> >           if (nargs == 3 && i == 2 && klass == load
> > -             && constm1_operand (op, mode))
> > +             && constm1_operand (op, mode)
> > +             && insn_p->operand[i].predicate (op, mode))
> >             ;
> >           else if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
> >             op = copy_to_mode_reg (mode, op);
> > diff --git a/gcc/testsuite/gcc.target/i386/pr100310.c
> > b/gcc/testsuite/gcc.target/i386/pr100310.c
> > new file mode 100644
> > index 00000000000..54ace18531b
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/i386/pr100310.c
> > @@ -0,0 +1,12 @@
> > +/* { dg-do compile } */
> > +/* { dg-options "-mavx512f -O2" } */
> > +#include <immintrin.h>
> > +
> > +double *p;
> > +volatile __m512d x;
> > +volatile __mmask8 m;
> > +
> > +void foo()
> > +{
> > +  x = _mm512_mask_expandloadu_pd (x, 255, p);
> > +}
> > --
> > 2.18.1
> >
> >
> > --
> > BR,
> > Hongtao
>
>
>
> --
> BR,
> Hongtao



-- 
BR,
Hongtao

[-- Attachment #2: 0001-i386-Fix-ICE-for-vpexpand.patch --]
[-- Type: text/x-patch, Size: 2006 bytes --]

From 274325ebab87bd56484a6a55cfeb358dc5189263 Mon Sep 17 00:00:00 2001
From: liuhongt <hongtao.liu@intel.com>
Date: Wed, 28 Apr 2021 14:52:59 +0800
Subject: [PATCH 1/2] [i386] Fix ICE for vpexpand*.

gcc/ChangeLog

	PR target/100310
	* config/i386/i386-expand.c
	(ix86_expand_special_args_builtin): Keep constm1_operand only
	if it satisfies insn's operand predicate.

gcc/testsuite/ChangeLog

	PR target/100310
	* gcc.target/i386/pr100310.c: New test.

Add test
---
 gcc/config/i386/i386-expand.c            |  5 +++--
 gcc/testsuite/gcc.target/i386/pr100310.c | 12 ++++++++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr100310.c

diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c
index 8f4e4e4d884..cc2eaeed8df 100644
--- a/gcc/config/i386/i386-expand.c
+++ b/gcc/config/i386/i386-expand.c
@@ -10969,11 +10969,12 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
 
 	  op = fixup_modeless_constant (op, mode);
 
-	  /* NB: 3-operands load implied it's a mask load,
+	  /* NB: 3-operands load implied it's a mask load or v{p}expand*,
 	     and that mask operand shoud be at the end.
 	     Keep all-ones mask which would be simplified by the expander.  */
 	  if (nargs == 3 && i == 2 && klass == load
-	      && constm1_operand (op, mode))
+	      && constm1_operand (op, mode)
+	      && insn_p->operand[i].predicate (op, mode))
 	    ;
 	  else if (GET_MODE (op) == mode || GET_MODE (op) == VOIDmode)
 	    op = copy_to_mode_reg (mode, op);
diff --git a/gcc/testsuite/gcc.target/i386/pr100310.c b/gcc/testsuite/gcc.target/i386/pr100310.c
new file mode 100644
index 00000000000..54ace18531b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr100310.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-mavx512f -O2" } */
+#include <immintrin.h>
+
+double *p;
+volatile __m512d x;
+volatile __mmask8 m;
+
+void foo()
+{
+  x = _mm512_mask_expandloadu_pd (x, 255, p);
+}
-- 
2.18.1


      reply	other threads:[~2021-06-21 11:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30  4:42 Hongtao Liu
2021-04-30  4:49 ` [PATCH][AVX512] Optimize vpexpand* to mask mov when mask have all ones in it's lower part (including 0 and -1) Hongtao Liu
2021-05-12  7:28   ` Hongtao Liu
2021-06-21 11:46     ` Hongtao Liu
2021-05-12  7:29 ` [PATCH][AVX512] Fix ICE for vpexpand* Hongtao Liu
2021-06-21 11:24   ` Hongtao Liu [this message]

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-bz1yARG8AxnuZkRYfNxqMdHWDXW3fTCZxTsVKNtApMSqg@mail.gmail.com \
    --to=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).