From: liuhongt <hongtao.liu@intel.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] [i386] Fix ICE caused by wrong condition.
Date: Fri, 13 May 2022 19:42:59 +0800 [thread overview]
Message-ID: <20220513114259.19129-1-hongtao.liu@intel.com> (raw)
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.
Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
Ok for trunk?
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.
---
gcc/config/i386/i386-expand.cc | 9 ++-------
gcc/testsuite/gcc.target/i386/pr105587.c | 11 +++++++++++
2 files changed, 13 insertions(+), 7 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/i386/pr105587.c
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];
+}
+
--
2.18.1
next reply other threads:[~2022-05-13 11:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 11:42 liuhongt [this message]
2022-05-13 14:00 ` Uros Bizjak
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=20220513114259.19129-1-hongtao.liu@intel.com \
--to=hongtao.liu@intel.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).