diff options
author | Kewen Lin <linkw@gcc.gnu.org> | 2020-07-29 14:38:39 +0800 |
---|---|---|
committer | Kewen Lin <linkw@linux.ibm.com> | 2020-08-06 00:56:52 -0500 |
commit | dfdf9085d31a1be25cd434328b0ba466c397edb2 (patch) | |
tree | 50358b2e48753081ce6f79663300fa576ea72af5 /gcc/tree-vect-loop-manip.c | |
parent | ea858d09571f3f6dcce92d8bfaf077f9d44c6ad6 (diff) | |
download | gcc-dfdf9085d31a1be25cd434328b0ba466c397edb2.zip gcc-dfdf9085d31a1be25cd434328b0ba466c397edb2.tar.gz gcc-dfdf9085d31a1be25cd434328b0ba466c397edb2.tar.bz2 |
vect/rs6000: Support vector with length cost modeling
This patch is to add the cost modeling for vector with length,
it mainly follows what we generate for vector with length in
functions vect_set_loop_controls_directly and vect_gen_len
at the worst case.
For Power, the length is expected to be in bits 0-7 (high bits),
we have to model the cost of shifting bits, which is implemented
in adjust_vect_cost_per_loop.
Bootstrapped/regtested on powerpc64le-linux-gnu (P9) with explicit
param vect-partial-vector-usage=1.
gcc/ChangeLog:
* config/rs6000/rs6000.c (rs6000_adjust_vect_cost_per_loop): New
function.
(rs6000_finish_cost): Call rs6000_adjust_vect_cost_per_loop.
* tree-vect-loop.c (vect_estimate_min_profitable_iters): Add cost
modeling for vector with length.
(vect_rgroup_iv_might_wrap_p): New function, factored out from...
* tree-vect-loop-manip.c (vect_set_loop_controls_directly): ...this.
Update function comment.
* tree-vect-stmts.c (vect_gen_len): Update function comment.
* tree-vectorizer.h (vect_rgroup_iv_might_wrap_p): New declare.
Diffstat (limited to 'gcc/tree-vect-loop-manip.c')
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 490e7be..47cfa6f 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -412,7 +412,11 @@ vect_maybe_permute_loop_masks (gimple_seq *seq, rgroup_controls *dest_rgm, This means that we cannot guarantee that such an induction variable would ever hit a value that produces a set of all-false masks or zero - lengths for RGC. */ + lengths for RGC. + + Note: the cost of the code generated by this function is modeled + by vect_estimate_min_profitable_iters, so changes here may need + corresponding changes there. */ static tree vect_set_loop_controls_directly (class loop *loop, loop_vec_info loop_vinfo, @@ -711,8 +715,6 @@ vect_set_loop_condition_partial_vectors (class loop *loop, else niters = gimple_convert (&preheader_seq, compare_type, niters); - widest_int iv_limit = vect_iv_limit_for_partial_vectors (loop_vinfo); - /* Iterate over all the rgroups and fill in their controls. We could use the first control from any rgroup for the loop condition; here we arbitrarily pick the last. */ @@ -739,11 +741,7 @@ vect_set_loop_condition_partial_vectors (class loop *loop, /* See whether zero-based IV would ever generate all-false masks or zero length before wrapping around. */ - unsigned nitems_per_iter = rgc->max_nscalars_per_iter * rgc->factor; - bool might_wrap_p - = (iv_limit == -1 - || (wi::min_precision (iv_limit * nitems_per_iter, UNSIGNED) - > compare_precision)); + bool might_wrap_p = vect_rgroup_iv_might_wrap_p (loop_vinfo, rgc); /* Set up all controls for this group. */ test_ctrl = vect_set_loop_controls_directly (loop, loop_vinfo, |