aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2023-06-23 15:27:17 +0530
committerPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2023-06-23 15:28:11 +0530
commit85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04 (patch)
treea5386e66452bc25079b09286ff5430112ffbc731 /gcc
parent4f2fcf21d4c939831c299cb884cbeaca1d33fa8e (diff)
downloadgcc-85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04.zip
gcc-85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04.tar.gz
gcc-85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04.tar.bz2
[aarch64/match.pd] Fix ICE observed in PR110280.
gcc/ChangeLog: PR tree-optimization/110280 * match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector using build_vector_from_val with the element of input operand, and mask's type if operand and mask's types don't match. gcc/testsuite/ChangeLog: PR tree-optimization/110280 * gcc.target/aarch64/sve/pr110280.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/match.pd9
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/pr110280.c12
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 48b76e6..33ccda3 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -8672,7 +8672,14 @@ and,
(simplify
(vec_perm vec_same_elem_p@0 @0 @1)
- @0)
+ (if (types_match (type, TREE_TYPE (@0)))
+ @0
+ (with
+ {
+ tree elem = uniform_vector_p (@0);
+ }
+ (if (elem)
+ { build_vector_from_val (type, elem); }))))
/* Push VEC_PERM earlier if that may help FMA perception (PR101895). */
(simplify
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
new file mode 100644
index 0000000..d3279f3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+
+#include "arm_sve.h"
+
+svuint32_t l()
+{
+ _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
+ return svld1rq_u32(svptrue_b8(), lanes);
+}
+
+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */