aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-stmts.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-09-04 15:33:19 +0200
committerRichard Biener <rguenther@suse.de>2020-09-07 09:47:36 +0200
commit095d42feed09f880f835ed74d0aa7b1ad7abd03c (patch)
treeac7563d6514c5e7d246968efe8c9653d7b79fbf0 /gcc/tree-vect-stmts.c
parentd30869a8d4886aee4020be3b28b15b1b15c8d9ad (diff)
downloadgcc-095d42feed09f880f835ed74d0aa7b1ad7abd03c.zip
gcc-095d42feed09f880f835ed74d0aa7b1ad7abd03c.tar.gz
gcc-095d42feed09f880f835ed74d0aa7b1ad7abd03c.tar.bz2
code generate live lanes in basic-block vectorization
The following adds the capability to code-generate live lanes in basic-block vectorization using lane extracts from vector stmts rather than keeping the original scalar code around for those. This eventually makes previously not profitable vectorizations profitable (the live scalar code was appropriately costed so are the lane extracts now), without considering the cost model this patch doesn't add or remove any basic-block vectorization capabilities. The patch re/ab-uses STMT_VINFO_LIVE_P in basic-block vectorization mode to tell whether a live lane is vectorized or whether it is provided by means of keeping the scalar code live. The patch is a first step towards vectorizing sequences of stmts that do not end up in stores or vector constructors though. Bootstrapped and tested on x86_64-unknown-linux-gnu. 2020-09-04 Richard Biener <rguenther@suse.de> * tree-vectorizer.h (vectorizable_live_operation): Adjust. * tree-vect-loop.c (vectorizable_live_operation): Vectorize live lanes out of basic-block vectorization nodes. * tree-vect-slp.c (vect_bb_slp_mark_live_stmts): New function. (vect_slp_analyze_operations): Analyze live lanes and their vectorization possibility after the whole SLP graph is final. (vect_bb_slp_scalar_cost): Adjust for vectorized live lanes. * tree-vect-stmts.c (can_vectorize_live_stmts): Adjust. (vect_transform_stmt): Call can_vectorize_live_stmts also for basic-block vectorization. * gcc.dg/vect/bb-slp-46.c: New testcase. * gcc.dg/vect/bb-slp-47.c: Likewise. * gcc.dg/vect/bb-slp-32.c: Adjust.
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r--gcc/tree-vect-stmts.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index c733967..a7ffe72 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -10532,7 +10532,7 @@ vectorizable_comparison (vec_info *vinfo,
GSI and VEC_STMT_P are as for vectorizable_live_operation. */
static bool
-can_vectorize_live_stmts (loop_vec_info loop_vinfo,
+can_vectorize_live_stmts (vec_info *vinfo,
stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
slp_tree slp_node, slp_instance slp_node_instance,
bool vec_stmt_p,
@@ -10545,7 +10545,7 @@ can_vectorize_live_stmts (loop_vec_info loop_vinfo,
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (slp_node), i, slp_stmt_info)
{
if (STMT_VINFO_LIVE_P (slp_stmt_info)
- && !vectorizable_live_operation (loop_vinfo,
+ && !vectorizable_live_operation (vinfo,
slp_stmt_info, gsi, slp_node,
slp_node_instance, i,
vec_stmt_p, cost_vec))
@@ -10553,7 +10553,7 @@ can_vectorize_live_stmts (loop_vec_info loop_vinfo,
}
}
else if (STMT_VINFO_LIVE_P (stmt_info)
- && !vectorizable_live_operation (loop_vinfo, stmt_info, gsi,
+ && !vectorizable_live_operation (vinfo, stmt_info, gsi,
slp_node, slp_node_instance, -1,
vec_stmt_p, cost_vec))
return false;
@@ -10923,10 +10923,8 @@ vect_transform_stmt (vec_info *vinfo,
/* Handle stmts whose DEF is used outside the loop-nest that is
being vectorized. */
- if (is_a <loop_vec_info> (vinfo))
- done = can_vectorize_live_stmts (as_a <loop_vec_info> (vinfo),
- stmt_info, gsi, slp_node,
- slp_node_instance, true, NULL);
+ done = can_vectorize_live_stmts (vinfo, stmt_info, gsi, slp_node,
+ slp_node_instance, true, NULL);
gcc_assert (done);
return false;