* [PATCH] tree-optimization/110506 - ICE in pattern recog with TYPE_PRECISION
@ 2023-07-03 7:22 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-07-03 7:22 UTC (permalink / raw)
To: gcc-patches
The following re-orders checks to make sure we check TYPE_PRECISION
on an integral type.
Bootstrap and regtest running on x86_6-unknown-linux-gnu.
PR tree-optimization/110506
* tree-vect-patterns.cc (vect_recog_rotate_pattern): Re-order
TYPE_PRECISION access with INTEGRAL_TYPE_P check.
* gcc.dg/pr110506-2.c: New testcase.
---
gcc/testsuite/gcc.dg/pr110506-2.c | 18 ++++++++++++++++++
gcc/tree-vect-patterns.cc | 4 ++--
2 files changed, 20 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/pr110506-2.c
diff --git a/gcc/testsuite/gcc.dg/pr110506-2.c b/gcc/testsuite/gcc.dg/pr110506-2.c
new file mode 100644
index 00000000000..aabca0fa156
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr110506-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+typedef unsigned uint32_t;
+typedef uint32_t uint32x4 __attribute__((vector_size(16)));
+typedef struct {
+ uint32x4 b, d;
+} prng_t;
+prng_t prng_rand_128_r_x;
+int main_flags;
+int main() {
+ uint32_t ref_crc[] = {7, 3};
+ uint32x4 e = (prng_rand_128_r_x.b << 27) + (prng_rand_128_r_x.b >> 32 - 27);
+ prng_rand_128_r_x.d = e;
+ if (ref_crc[main_flags])
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index 25f7f8e1e44..de20e9d59cb 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -3726,8 +3726,8 @@ vect_recog_rotate_pattern (vec_info *vinfo,
return NULL;
if (TREE_CODE (oprnd0) != SSA_NAME
- || TYPE_PRECISION (TREE_TYPE (lhs)) != TYPE_PRECISION (type)
- || !INTEGRAL_TYPE_P (type))
+ || !INTEGRAL_TYPE_P (type)
+ || TYPE_PRECISION (TREE_TYPE (lhs)) != TYPE_PRECISION (type))
return NULL;
stmt_vec_info def_stmt_info;
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-03 7:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 7:22 [PATCH] tree-optimization/110506 - ICE in pattern recog with TYPE_PRECISION Richard Biener
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).