On Fri, Apr 21, 2017 at 12:41 PM, James Greenhalgh
<james.greenha...@arm.com> wrote:
> On Tue, Apr 18, 2017 at 05:38:48PM -0500, Bill Schmidt wrote:
>> Hi,
>>
>> While investigating a performance issue, I happened to notice that vectorized
>> COND_EXPRs were not contributing to the vectorizer cost model.  This patch
>> addresses that.
>>
>> Bootstrapped and tested on powerpc64le-unknown-linux-gnu.  Is this ok for
>> trunk, or should it wait for GCC 8?
>
> Hi Bill,
>
> I had a similar patch sitting in my tree waiting for GCC 8, with a few
> differences. The main one is that you don't record the cost of the
> vector conditional itself, only of the then/else branches.
>
> I've attached what I was working on. In my patch I first generalize
> vect_model_simple_cost to fix the FORNOW: Assuming maximum 2 args per
> stmts, and to cost the broadcast as a broadcast rather than a vector
> statiement as the conditionals need a judgement on the prologue cost
> of 4 args. That means taking an extra argument for the number of arguments
> a statement needs to cost which in turn means updating the rest of the
> functions which call vect_model_simple_cost.
>
> I haven't hacked on the vector cost model before, and your patch acheieves
> the main part of what I was looking to do, but if you think any parts of
> this are still valuable after your change, I'd be happy to rebase it once
> the branch opens.
>
> My patch was bootstrapped and tested on aarch64-none-linux-gnu with no
> issues, with a ChangeLog which looks like:

Looks good to me as well.

Thanks,
Richard.

> gcc/
>
> 2017-04-21  James Greenhalgh  <james.greenha...@arm.com>
>
>         * tree-vect-stmts.c (vect_model_simple_cost): Model the cost
>         of all arguments to a statement as scalar_to_vec operations.
>         (vectorizable_call): Adjust call to vect_model_simple_cost for
>         new parameter.
>         (vectorizable_conversion): Likewise.
>         (vectorizable_assignment): Likewise.
>         (vectorizable_shift): Likewise.
>         (vectorizable_operation): Likewise.
>         (vectorizable_comparison): Likewise.
>         (vect_is_simple_cond): Record the def types for operands.
>         (vectorizable_condition): Likewise, call vect_model_simple_cost.
>         * tree-vectorizer.h (vect_model_simple_cost): Add new parameter
>         for statement argument count.
>
> Thanks,
> James
>

Reply via email to