public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: hongtao Liu <liuhongt@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-468] Fix ICE caused by wrong condition.
Date: Mon, 16 May 2022 00:30:50 +0000 (GMT)	[thread overview]
Message-ID: <20220516003050.810F43858C50@sourceware.org> (raw)

https://gcc.gnu.org/g:69c4b5c519f0df37e4903992644cc29682721bc1

commit r13-468-g69c4b5c519f0df37e4903992644cc29682721bc1
Author: liuhongt <hongtao.liu@intel.com>
Date:   Fri May 13 15:48:01 2022 +0800

    Fix ICE caused by wrong condition.
    
    When d->perm[i] == d->perm[i-1] + 1 and d->perm[i] == nelt, it's not
    continuous. It should fail if there's more than 2 continuous areas.
    
    gcc/ChangeLog:
    
            PR target/105587
            * config/i386/i386-expand.cc
            (expand_vec_perm_pslldq_psrldq_por): Fail when (d->perm[i] ==
            d->perm[i-1] + 1) && d->perm[i] == nelt && start != -1.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/i386/pr105587.c: New test.

Diff:
---
 gcc/config/i386/i386-expand.cc           |  9 ++-------
 gcc/testsuite/gcc.target/i386/pr105587.c | 11 +++++++++++
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 0fd3028c205..806e1f5aaa3 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -20963,7 +20963,8 @@ expand_vec_perm_pslldq_psrldq_por (struct expand_vec_perm_d *d, bool pandn)
   start1 = d->perm[0];
   for (i = 1; i < nelt; i++)
     {
-      if (d->perm[i] != d->perm[i-1] + 1)
+      if (d->perm[i] != d->perm[i-1] + 1
+	  || d->perm[i] == nelt)
 	{
 	  if (start2 == -1)
 	    {
@@ -20973,12 +20974,6 @@ expand_vec_perm_pslldq_psrldq_por (struct expand_vec_perm_d *d, bool pandn)
 	  else
 	    return false;
 	}
-      else if (d->perm[i] >= nelt
-	       && start2 == -1)
-	{
-	  start2 = d->perm[i];
-	  end1 = d->perm[i-1];
-	}
     }
 
   clear_op0 = end1 != nelt - 1;
diff --git a/gcc/testsuite/gcc.target/i386/pr105587.c b/gcc/testsuite/gcc.target/i386/pr105587.c
new file mode 100644
index 00000000000..a5b6ab2a016
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr105587.c
@@ -0,0 +1,11 @@
+#/* { dg-do compile } */
+/* { dg-options "-O3 -msse2 -mno-ssse3" } */
+
+extern short arr_108[][4][2][24][12], arr_110[][4][2][24][12];
+void test() {
+  for (unsigned a = 0; a < 2; a += 2)
+    for (unsigned b = 4; b < 22; b++)
+      for (int c = 1; c < 11; c++)
+        arr_110[0][0][a][b][c] = (unsigned char)arr_108[0][0][a][b][c];
+}
+


                 reply	other threads:[~2022-05-16  0:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220516003050.810F43858C50@sourceware.org \
    --to=liuhongt@gcc.gnu.org \
    --cc=gcc-cvs@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).