summaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-31 13:57:05 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-31 13:57:05 +0000
commitc8a2b4ff9b521b6b455caf9b45137c7153738a64 (patch)
tree724d536345f0d153b316b5c50064d6336fea231b /gcc/tree-vect-loop.c
parentfc08b993096e47f63278b70ea0df4e3ae54115cc (diff)
downloadgcc-c8a2b4ff9b521b6b455caf9b45137c7153738a64.tar.gz
* tree.c (tree_ctz): New function.
* tree.h (tree_ctz): New prototype. * tree-ssanames.h (get_range_info, get_nonzero_bits): Change first argument from tree to const_tree. * tree-ssanames.c (get_range_info, get_nonzero_bits): Likewise. * tree-vectorizer.h (vect_generate_tmps_on_preheader): New prototype. * tree-vect-loop-manip.c (vect_generate_tmps_on_preheader): No longer static. * expr.c (highest_pow2_factor): Reimplemented using tree_ctz. * tree-vect-loop.c (vect_analyze_loop_operations, vect_transform_loop): Don't force scalar loop for bound just because number of iterations is unknown, only do it if it is not known to be a multiple of vectorization_factor. * builtins.c (get_object_alignment_2): Use tree_ctz on offset. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204257 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 296b7b24cc4..1da87c7201e 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1586,9 +1586,9 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo, bool slp)
return false;
}
- if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- || LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0
- || LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo))
+ if (LOOP_PEELING_FOR_ALIGNMENT (loop_vinfo)
+ || ((int) tree_ctz (LOOP_VINFO_NITERS (loop_vinfo))
+ < exact_log2 (vectorization_factor)))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "epilog loop required.\n");
@@ -5656,15 +5656,20 @@ vect_transform_loop (loop_vec_info loop_vinfo)
will remain scalar and will compute the remaining (n%VF) iterations.
(VF is the vectorization factor). */
- if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- || (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)
- && LOOP_VINFO_INT_NITERS (loop_vinfo) % vectorization_factor != 0)
- || LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo))
+ if ((int) tree_ctz (LOOP_VINFO_NITERS (loop_vinfo))
+ < exact_log2 (vectorization_factor)
+ || LOOP_VINFO_PEELING_FOR_GAPS (loop_vinfo))
vect_do_peeling_for_loop_bound (loop_vinfo, &ratio,
th, check_profitability);
- else
+ else if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
ratio = build_int_cst (TREE_TYPE (LOOP_VINFO_NITERS (loop_vinfo)),
LOOP_VINFO_INT_NITERS (loop_vinfo) / vectorization_factor);
+ else
+ {
+ tree ni_name, ratio_mult_vf;
+ vect_generate_tmps_on_preheader (loop_vinfo, &ni_name, &ratio_mult_vf,
+ &ratio, NULL);
+ }
/* 1) Make sure the loop header has exactly two entries
2) Make sure we have a preheader basic block. */