diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-04 15:06:44 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-04 15:06:44 +0000 |
commit | f77a1eec66f4c47d01572e112d91ba3760793026 (patch) | |
tree | 0c901052e51eec2dc4b4dd82f3082695c9b8e2f6 /gcc/tree-vect-slp.c | |
parent | a0ae08f729ab7107cc731c2a84bf5107a8fc898f (diff) | |
download | gcc-f77a1eec66f4c47d01572e112d91ba3760793026.tar.gz |
2013-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/56826
* tree-vect-slp.c (vect_build_slp_tree): Compute ncopies
more accurately.
* gcc.dg/vect/pr56826.c: New testcase.
* gcc.dg/vect/O3-pr36098.c: Adjust.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197486 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r-- | gcc/tree-vect-slp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index a9cf6920cf6..4a5317dc3ce 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -470,7 +470,6 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, tree lhs; bool stop_recursion = false, need_same_oprnds = false; tree vectype, scalar_type, first_op1 = NULL_TREE; - unsigned int ncopies; optab optab; int icode; enum machine_mode optab_op2_mode; @@ -577,8 +576,6 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, vectorization_factor = *max_nunits; } - ncopies = vectorization_factor / TYPE_VECTOR_SUBPARTS (vectype); - if (is_gimple_call (stmt)) { rhs_code = CALL_EXPR; @@ -741,12 +738,15 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, else { /* Load. */ + unsigned unrolling_factor + = least_common_multiple + (*max_nunits, group_size) / group_size; /* FORNOW: Check that there is no gap between the loads and no gap between the groups when we need to load multiple groups at once. ??? We should enhance this to only disallow gaps inside vectors. */ - if ((ncopies > 1 + if ((unrolling_factor > 1 && GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) == stmt && GROUP_GAP (vinfo_for_stmt (stmt)) != 0) || (GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) != stmt @@ -767,6 +767,8 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo, /* Check that the size of interleaved loads group is not greater than the SLP group size. */ + unsigned ncopies + = vectorization_factor / TYPE_VECTOR_SUBPARTS (vectype); if (loop_vinfo && GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) == stmt && ((GROUP_SIZE (vinfo_for_stmt (stmt)) |