aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuhongt <hongtao.liu@intel.com>2024-06-11 10:23:27 +0800
committerliuhongt <hongtao.liu@intel.com>2024-06-12 08:16:39 +0800
commit1d496d2cd1d5d8751a1637abca89339d6f9ddd3b (patch)
tree803b244ac97bad5b0a72cd553c531e60302118ce
parent0cf68222d2df3af7fefad28a82fcd51d8b40a192 (diff)
downloadgcc-1d496d2cd1d5d8751a1637abca89339d6f9ddd3b.zip
gcc-1d496d2cd1d5d8751a1637abca89339d6f9ddd3b.tar.gz
gcc-1d496d2cd1d5d8751a1637abca89339d6f9ddd3b.tar.bz2
Fix ICE in rtl check due to CONST_WIDE_INT in CONST_VECTOR_DUPLICATE_P
The patch add extra check to make sure the component of CONST_VECTOR is CONST_INT_P. gcc/ChangeLog: PR target/115384 * simplify-rtx.cc (simplify_context::simplify_binary_operation_1): Only do the simplification of (AND (ASHIFTRT A imm) mask) to (LSHIFTRT A imm) when the component of const_vector is CONST_INT_P. gcc/testsuite/ChangeLog: * gcc.target/i386/pr115384.c: New test.
-rw-r--r--gcc/simplify-rtx.cc6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr115384.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc
index 9bc3ef9..3ee95f7 100644
--- a/gcc/simplify-rtx.cc
+++ b/gcc/simplify-rtx.cc
@@ -4072,9 +4072,11 @@ simplify_context::simplify_binary_operation_1 (rtx_code code,
if (VECTOR_MODE_P (mode) && GET_CODE (op0) == ASHIFTRT
&& (CONST_INT_P (XEXP (op0, 1))
|| (GET_CODE (XEXP (op0, 1)) == CONST_VECTOR
- && CONST_VECTOR_DUPLICATE_P (XEXP (op0, 1))))
+ && CONST_VECTOR_DUPLICATE_P (XEXP (op0, 1))
+ && CONST_INT_P (XVECEXP (XEXP (op0, 1), 0, 0))))
&& GET_CODE (op1) == CONST_VECTOR
- && CONST_VECTOR_DUPLICATE_P (op1))
+ && CONST_VECTOR_DUPLICATE_P (op1)
+ && CONST_INT_P (XVECEXP (op1, 0, 0)))
{
unsigned HOST_WIDE_INT shift_count
= (CONST_INT_P (XEXP (op0, 1))
diff --git a/gcc/testsuite/gcc.target/i386/pr115384.c b/gcc/testsuite/gcc.target/i386/pr115384.c
new file mode 100644
index 0000000..31dd6f4
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr115384.c
@@ -0,0 +1,12 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O" } */
+
+typedef __attribute__((__vector_size__(sizeof(__int128)))) __int128 W;
+
+W w;
+
+void
+foo()
+{
+ w = w >> 4 & 18446744073709551600llu;
+}