On Tue, Jul 21, 2020 at 7:52 AM Kewen.Lin <li...@linux.ibm.com> wrote:
>
> 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!

I don't like the introduction of an extra target hook for this.  All
vectorizer cost modeling should ideally go through
init_cost/add_stmt_cost/finish_cost.  If the extra costing is
not per stmt then either init_cost or finish_cost is appropriate.
Currently init_cost only gets a struct loop while we should
probably give it a vec_info * parameter so targets can
check LOOP_VINFO_USING_PARTIAL_VECTORS_P and friends.

Richard.

> 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.

Reply via email to