This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][1/n] Reduction vectorization improvements
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 May 2015 15:49:47 +0200 (CEST)
- Subject: [PATCH][1/n] Reduction vectorization improvements
- Authentication-results: sourceware.org; auth=none
I'm at the moment tearing apart a large patch that adds support for
vectorizing reductions in basic-blocks as well as making loop
vectorizing reduction chains with patterns work.
This is a first piece - allow the reduction patterns be detected
when reduction detection didn't run and remove an assert in favor
of a check.
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
Richard.
2015-05-21 Richard Biener <rguenther@suse.de>
* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Replace
assert with guard, remove check on detected reduction.
(vect_recog_sad_pattern): Likewise.
(vect_recog_widen_sum_pattern): Likewise.
Index: gcc/tree-vect-patterns.c
===================================================================
--- gcc/tree-vect-patterns.c (revision 223470)
+++ gcc/tree-vect-patterns.c (working copy)
@@ -318,6 +318,11 @@ vect_recog_dot_prod_pattern (vec<gimple>
loop = LOOP_VINFO_LOOP (loop_info);
+ /* We don't allow changing the order of the computation in the inner-loop
+ when doing outer-loop vectorization. */
+ if (loop && nested_in_vect_loop_p (loop, last_stmt))
+ return NULL;
+
if (!is_gimple_assign (last_stmt))
return NULL;
@@ -366,8 +371,6 @@ vect_recog_dot_prod_pattern (vec<gimple>
{
gimple def_stmt;
- if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_reduction_def)
- return NULL;
oprnd0 = gimple_assign_rhs1 (last_stmt);
oprnd1 = gimple_assign_rhs2 (last_stmt);
if (!types_compatible_p (TREE_TYPE (oprnd0), type)
@@ -469,10 +472,6 @@ vect_recog_dot_prod_pattern (vec<gimple>
dump_printf (MSG_NOTE, "\n");
}
- /* We don't allow changing the order of the computation in the inner-loop
- when doing outer-loop vectorization. */
- gcc_assert (!nested_in_vect_loop_p (loop, last_stmt));
-
return pattern_stmt;
}
@@ -533,6 +532,11 @@ vect_recog_sad_pattern (vec<gimple> *stm
loop = LOOP_VINFO_LOOP (loop_info);
+ /* We don't allow changing the order of the computation in the inner-loop
+ when doing outer-loop vectorization. */
+ if (loop && nested_in_vect_loop_p (loop, last_stmt))
+ return NULL;
+
if (!is_gimple_assign (last_stmt))
return NULL;
@@ -586,8 +590,6 @@ vect_recog_sad_pattern (vec<gimple> *stm
{
gimple def_stmt;
- if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_reduction_def)
- return NULL;
plus_oprnd0 = gimple_assign_rhs1 (last_stmt);
plus_oprnd1 = gimple_assign_rhs2 (last_stmt);
if (!types_compatible_p (TREE_TYPE (plus_oprnd0), sum_type)
@@ -703,10 +705,6 @@ vect_recog_sad_pattern (vec<gimple> *stm
dump_printf (MSG_NOTE, "\n");
}
- /* We don't allow changing the order of the computation in the inner-loop
- when doing outer-loop vectorization. */
- gcc_assert (!nested_in_vect_loop_p (loop, last_stmt));
-
return pattern_stmt;
}
@@ -1201,6 +1199,11 @@ vect_recog_widen_sum_pattern (vec<gimple
loop = LOOP_VINFO_LOOP (loop_info);
+ /* We don't allow changing the order of the computation in the inner-loop
+ when doing outer-loop vectorization. */
+ if (loop && nested_in_vect_loop_p (loop, last_stmt))
+ return NULL;
+
if (!is_gimple_assign (last_stmt))
return NULL;
@@ -1219,9 +1222,6 @@ vect_recog_widen_sum_pattern (vec<gimple
if (gimple_assign_rhs_code (last_stmt) != PLUS_EXPR)
return NULL;
- if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_reduction_def)
- return NULL;
-
oprnd0 = gimple_assign_rhs1 (last_stmt);
oprnd1 = gimple_assign_rhs2 (last_stmt);
if (!types_compatible_p (TREE_TYPE (oprnd0), type)
@@ -1255,10 +1255,6 @@ vect_recog_widen_sum_pattern (vec<gimple
dump_printf (MSG_NOTE, "\n");
}
- /* We don't allow changing the order of the computation in the inner-loop
- when doing outer-loop vectorization. */
- gcc_assert (!nested_in_vect_loop_p (loop, last_stmt));
-
return pattern_stmt;
}