public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-468] Fix ICE caused by wrong condition.
@ 2022-05-16  0:30 hongtao Liu
  0 siblings, 0 replies; only message in thread
From: hongtao Liu @ 2022-05-16  0:30 UTC (permalink / raw)
  To: gcc-cvs

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];
+}
+


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-16  0:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16  0:30 [gcc r13-468] Fix ICE caused by wrong condition hongtao Liu

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).