summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-22 13:52:58 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-22 13:52:58 +0000
commit423475a33ff10499d78df5f17fde6cb6b77816b1 (patch)
tree35a4f605b4e8a0babddaaffa6508778d9e240c87 /gcc/tree-vect-slp.c
parent5292f25c06a9c47e2265b1168212794492df1227 (diff)
downloadgcc-423475a33ff10499d78df5f17fde6cb6b77816b1.tar.gz
2015-05-22 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (struct _slp_oprnd_info): Add second_pattern member. * tree-vect-loop.c (vect_analyze_loop_operations): Look at patterns when determining whether SLP is pure. (vect_is_slp_reduction): Remove check for pattern stmts. (vect_is_simple_reduction_1): Remove dead code. * tree-vect-slp.c (vect_create_oprnd_info): Initialize second_pattern. (vect_get_and_check_slp_defs): Pass in the stmt number. Allow the first def in a reduction to be not a pattern stmt when the rest of the stmts def are patterns. (vect_build_slp_tree_1): Allow tcc_expression codes like SAD_EXPR and DOT_PROD_EXPR. (vect_build_slp_tree): Adjust. (vect_analyze_slp): Refactor and move BB vect error message ... (vect_slp_analyze_bb_1): ... here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223574 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 21489b3ed3a..1c519903153 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -183,6 +183,7 @@ vect_create_oprnd_info (int nops, int group_size)
oprnd_info->first_dt = vect_uninitialized_def;
oprnd_info->first_op_type = NULL_TREE;
oprnd_info->first_pattern = false;
+ oprnd_info->second_pattern = false;
oprnds_info.quick_push (oprnd_info);
}
@@ -242,7 +243,7 @@ vect_get_place_in_interleaving_chain (gimple stmt, gimple first_stmt)
static int
vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
- gimple stmt, bool first,
+ gimple stmt, unsigned stmt_num,
vec<slp_oprnd_info> *oprnds_info)
{
tree oprnd;
@@ -256,6 +257,8 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
int first_op_idx = 1;
bool commutative = false;
bool first_op_cond = false;
+ bool first = stmt_num == 0;
+ bool second = stmt_num == 1;
if (loop_vinfo)
loop = LOOP_VINFO_LOOP (loop_vinfo);
@@ -326,7 +329,11 @@ again:
&& !STMT_VINFO_LIVE_P (vinfo_for_stmt (def_stmt)))
{
pattern = true;
- if (!first && !oprnd_info->first_pattern)
+ if (!first && !oprnd_info->first_pattern
+ /* Allow different pattern state for the defs of the
+ first stmt in reduction chains. */
+ && (oprnd_info->first_dt != vect_reduction_def
+ || (!second && !oprnd_info->second_pattern)))
{
if (i == 0
&& !swapped
@@ -377,6 +384,9 @@ again:
}
}
+ if (second)
+ oprnd_info->second_pattern = pattern;
+
if (first)
{
oprnd_info->first_dt = dt;
@@ -892,7 +902,7 @@ vect_build_slp_tree_1 (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
/* Not memory operation. */
if (TREE_CODE_CLASS (rhs_code) != tcc_binary
&& TREE_CODE_CLASS (rhs_code) != tcc_unary
- && rhs_code != COND_EXPR
+ && TREE_CODE_CLASS (rhs_code) != tcc_expression
&& rhs_code != CALL_EXPR)
{
if (dump_enabled_p ())
@@ -1033,7 +1043,7 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (*node), i, stmt)
{
switch (vect_get_and_check_slp_defs (loop_vinfo, bb_vinfo,
- stmt, (i == 0), &oprnds_info))
+ stmt, i, &oprnds_info))
{
case 0:
break;
@@ -1910,17 +1920,7 @@ vect_analyze_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
max_tree_size))
ok = true;
- if (bb_vinfo && !ok)
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Failed to SLP the basic block.\n");
-
- return false;
- }
-
- if (loop_vinfo
- && LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo).length () > 0)
+ if (reduc_chains.length () > 0)
{
/* Find SLP sequences starting from reduction chains. */
FOR_EACH_VEC_ELT (reduc_chains, i, first_element)
@@ -1936,7 +1936,7 @@ vect_analyze_slp (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
}
/* Find SLP sequences starting from groups of reductions. */
- if (loop_vinfo && LOOP_VINFO_REDUCTIONS (loop_vinfo).length () > 1
+ if (reductions.length () > 1
&& vect_analyze_slp_instance (loop_vinfo, bb_vinfo, reductions[0],
max_tree_size))
ok = true;
@@ -2443,9 +2443,13 @@ vect_slp_analyze_bb_1 (basic_block bb)
if (!vect_analyze_slp (NULL, bb_vinfo, n_stmts))
{
if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "not vectorized: failed to find SLP opportunities "
- "in basic block.\n");
+ {
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Failed to SLP the basic block.\n");
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "not vectorized: failed to find SLP opportunities "
+ "in basic block.\n");
+ }
destroy_bb_vec_info (bb_vinfo);
return NULL;