Hi, 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. To allow other targets not suffer this, I used one target hook to describe this extra cost, I'm not sure if it's a correct way. Bootstrapped/regtested on powerpc64le-linux-gnu (P9) with explicit param vect-partial-vector-usage=1. Any comments/suggestions are highly appreciated! BR, Kewen ----- gcc/ChangeLog: * config/rs6000/rs6000.c (TARGET_VECTORIZE_EXTRA_LENGTH_COST): New macro. * doc/tm.texi: Regenerate. * doc/tm.texi.in (TARGET_VECTORIZE_EXTRA_LENGTH_COST): New target hook. * target.def (extra_length_cost): Likewise. * tree-vect-loop.c (vect_estimate_min_profitable_iters): Add cost modeling for vector with length.