aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2016-09-06 14:41:14 +0200
committerYvan Roux <yvan.roux@linaro.org>2016-09-07 22:09:04 +0200
commitf648c88b12ab498c8a60fb16eaccbdeff68ce927 (patch)
tree39508b883f94a329710e17720515ec8e3069c8be
parent430ac51a896311655eaf4e9f96458497db09ad55 (diff)
gcc/
Backport from trunk r236632. 2016-05-24 Richard Sandiford <richard.sandiford@arm.com> * tree-vect-stmts.c (vectorizable_load): Reorder checks so that load_lanes/grouped_load classification comes first. Don't check whether the vectorization factor is a multiple of the group size for load_lanes. gcc/testsuite/ Backport from trunk r236632. 2016-05-24 Richard Sandiford <richard.sandiford@arm.com> * gcc.dg/vect/vect-load-lanes-peeling-1.c: New test. Change-Id: I990689cf9c5b4f1d721e51c4d76157d5670b97e5
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-load-lanes-peeling-1.c13
-rw-r--r--gcc/tree-vect-stmts.c25
2 files changed, 25 insertions, 13 deletions
diff --git a/gcc/testsuite/gcc.dg/vect/vect-load-lanes-peeling-1.c b/gcc/testsuite/gcc.dg/vect/vect-load-lanes-peeling-1.c
new file mode 100644
index 00000000000..c9cd104e8e5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-load-lanes-peeling-1.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target vect_load_lanes } */
+
+void
+f (int *__restrict a, int *__restrict b)
+{
+ for (int i = 0; i < 96; ++i)
+ a[i] = b[i * 3] + b[i * 3 + 1] + b[i * 3 + 2];
+}
+
+/* { dg-final { scan-tree-dump-not "Data access with gaps" "vect" } } */
+/* { dg-final { scan-tree-dump-not "epilog loop required" "vect" } } */
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index f765f6ee6bc..44b2e138326 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -6323,6 +6323,17 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
gcc_assert (!nested_in_vect_loop && !STMT_VINFO_GATHER_SCATTER_P (stmt_info));
first_stmt = GROUP_FIRST_ELEMENT (stmt_info);
+ group_size = GROUP_SIZE (vinfo_for_stmt (first_stmt));
+
+ if (!slp
+ && !PURE_SLP_STMT (stmt_info)
+ && !STMT_VINFO_STRIDED_P (stmt_info))
+ {
+ if (vect_load_lanes_supported (vectype, group_size))
+ load_lanes_p = true;
+ else if (!vect_grouped_load_supported (vectype, group_size))
+ return false;
+ }
/* If this is single-element interleaving with an element distance
that leaves unused vector loads around punt - we at least create
@@ -6350,7 +6361,7 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
if (loop_vinfo
&& ! STMT_VINFO_STRIDED_P (stmt_info)
&& (GROUP_GAP (vinfo_for_stmt (first_stmt)) != 0
- || (!slp && vf % GROUP_SIZE (vinfo_for_stmt (first_stmt)) != 0)))
+ || (!slp && !load_lanes_p && vf % group_size != 0)))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -6370,8 +6381,6 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
if (slp && SLP_TREE_LOAD_PERMUTATION (slp_node).exists ())
slp_perm = true;
- group_size = GROUP_SIZE (vinfo_for_stmt (first_stmt));
-
/* ??? The following is overly pessimistic (as well as the loop
case above) in the case we can statically determine the excess
elements loaded are within the bounds of a decl that is accessed.
@@ -6384,16 +6393,6 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt,
return false;
}
- if (!slp
- && !PURE_SLP_STMT (stmt_info)
- && !STMT_VINFO_STRIDED_P (stmt_info))
- {
- if (vect_load_lanes_supported (vectype, group_size))
- load_lanes_p = true;
- else if (!vect_grouped_load_supported (vectype, group_size))
- return false;
- }
-
/* Invalidate assumptions made by dependence analysis when vectorization
on the unrolled body effectively re-orders stmts. */
if (!PURE_SLP_STMT (stmt_info)