Hi,
This patch fixes ICE by loading vector(1) scalar_type if it's 1 element-wise
for VMAT_ELEMENTWISE.
Bootstrap and test on x86_64 and AArch64 ongoing. Is it OK?
Thanks,
bin
2018-05-16 Bin Cheng <bin.ch...@arm.com>
Richard Biener <rguent...@suse.de>
PR tree-optimization/85793
* tree-vect-stmts.c (vectorizable_load): Handle 1 element-wise load
for VMAT_ELEMENTWISE.
gcc/testsuite
2018-05-16 Bin Cheng <bin.ch...@arm.com>
PR tree-optimization/85793
* gcc.dg/vect/pr85793.c: New test.
From 85ef7f0c6ee0cb89804f1cd9d5a39ba26f8aaba3 Mon Sep 17 00:00:00 2001
From: Bin Cheng <binch...@e108451-lin.cambridge.arm.com>
Date: Wed, 16 May 2018 14:30:06 +0100
Subject: [PATCH] pr85793-20180515
---
gcc/testsuite/gcc.dg/vect/pr85793.c | 12 ++++++++++++
gcc/tree-vect-stmts.c | 4 ++++
2 files changed, 16 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/vect/pr85793.c
diff --git a/gcc/testsuite/gcc.dg/vect/pr85793.c b/gcc/testsuite/gcc.dg/vect/pr85793.c
new file mode 100644
index 0000000..9b5d518
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr85793.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_perm } */
+
+int a, c, d;
+long b[6];
+void fn1() {
+ for (; a < 2; a++) {
+ c = 0;
+ for (; c <= 5; c++)
+ d &= b[a * 3];
+ }
+}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 1e8ccbc..64a157d 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -7662,6 +7662,10 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
}
ltype = build_aligned_type (ltype, TYPE_ALIGN (TREE_TYPE (vectype)));
}
+ /* Load vector(1) scalar_type if it's 1 element-wise vectype. */
+ else if (nloads == 1)
+ ltype = vectype;
+
if (slp)
{
/* For SLP permutation support we need to load the whole group,
--
1.9.1