]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[aarch64/match.pd] Fix ICE observed in PR110280.
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Fri, 23 Jun 2023 09:57:17 +0000 (15:27 +0530)
committerPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Fri, 23 Jun 2023 09:58:11 +0000 (15:28 +0530)
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.

gcc/match.pd
gcc/testsuite/gcc.target/aarch64/sve/pr110280.c [new file with mode: 0644]

index 48b76e6a05105accf752479f741eac2e5a044d41..33ccda3e7b6bdb863ddc475ff8e133b519501272 100644 (file)
@@ -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 (file)
index 0000000..d3279f3
--- /dev/null
@@ -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" } } */