summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-28 13:29:41 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-28 13:29:41 +0000
commit34563054a91e00a2bfeb4a5ad346bdbc73b924ad (patch)
treee58d06abd6645dd0965c136f0078b9ac6a74f784 /gcc/tree-vect-slp.c
parent779ac154febb3f8de5891e44cd887a2d1f9dee8f (diff)
downloadgcc-34563054a91e00a2bfeb4a5ad346bdbc73b924ad.tar.gz
2015-05-28 Richard Biener <rguenther@suse.de>
* tree-vect-loop.c (vect_fixup_reduc_chain): New function. (vect_fixup_scalar_cycles_with_patterns): Likewise. (vect_analyze_loop_2): Call vect_fixup_scalar_cycles_with_patterns after pattern recog. (vect_create_epilog_for_reduction): Properly handle reductions with patterns. (vectorizable_reduction): Likewise. * tree-vect-slp.c (vect_analyze_slp_instance): Properly mark reduction chains. (vect_get_constant_vectors): Create the correct number of initial values for reductions. (vect_schedule_slp_instance): Handle reduction chains that are type changing properly. * tree-vect-stmts.c (vect_analyze_stmt): Adjust. * gcc.dg/vect/slp-reduc-sad.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223818 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 9137144e67a..f38191d9884 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1793,6 +1793,11 @@ vect_analyze_slp_instance (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
scalar_stmts.safe_push (next);
next = GROUP_NEXT_ELEMENT (vinfo_for_stmt (next));
}
+ /* Mark the first element of the reduction chain as reduction to properly
+ transform the node. In the reduction analysis phase only the last
+ element of the chain is marked as reduction. */
+ if (!STMT_VINFO_GROUPED_ACCESS (vinfo_for_stmt (stmt)))
+ STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) = vect_reduction_def;
}
else
{
@@ -2738,7 +2743,7 @@ vect_get_constant_vectors (tree op, slp_tree slp_node,
(s1, s2, ..., s8). We will create two vectors {s1, s2, s3, s4} and
{s5, s6, s7, s8}. */
- number_of_copies = least_common_multiple (nunits, group_size) / group_size;
+ number_of_copies = nunits * number_of_vectors / group_size;
number_of_places_left_in_vector = nunits;
elts = XALLOCAVEC (tree, nunits);
@@ -3383,8 +3388,14 @@ vect_schedule_slp_instance (slp_tree node, slp_instance instance,
for the scalar stmts in each node of the SLP tree. Number of vector
elements in one vector iteration is the number of scalar elements in
one scalar iteration (GROUP_SIZE) multiplied by VF divided by vector
- size. */
- vec_stmts_size = (vectorization_factor * group_size) / nunits;
+ size.
+ Unless this is a SLP reduction in which case the number of vector
+ stmts is equal to the number of vector stmts of the children. */
+ if (GROUP_FIRST_ELEMENT (stmt_info)
+ && !STMT_VINFO_GROUPED_ACCESS (stmt_info))
+ vec_stmts_size = SLP_TREE_NUMBER_OF_VEC_STMTS (SLP_TREE_CHILDREN (node)[0]);
+ else
+ vec_stmts_size = (vectorization_factor * group_size) / nunits;
if (!SLP_TREE_VEC_STMTS (node).exists ())
{