vect/rs6000: Support vector with length cost modeling
authorKewen Lin <linkw@gcc.gnu.org>
Wed, 29 Jul 2020 06:38:39 +0000 (14:38 +0800)
committerKewen Lin <linkw@linux.ibm.com>
Thu, 6 Aug 2020 05:56:52 +0000 (00:56 -0500)
commitdfdf9085d31a1be25cd434328b0ba466c397edb2
tree50358b2e48753081ce6f79663300fa576ea72af5
parentea858d09571f3f6dcce92d8bfaf077f9d44c6ad6
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.
gcc/config/rs6000/rs6000.c
gcc/tree-vect-loop-manip.c
gcc/tree-vect-loop.c
gcc/tree-vect-stmts.c
gcc/tree-vectorizer.h