On Mon, 6 Jun 2016, Jakub Jelinek wrote:

> On Mon, Jun 06, 2016 at 10:05:57AM +0200, Richard Biener wrote:
> > So this ends up generating { a ? -1 : 0, b ? -1 : 0, ... }.  That
> 
> Yes, that is already what we do now for loop vectorization.
> 
> > might be less optimal than doing { a, b, ... } ? { -1, -1 ... } : { 0, 0, 
> > .. }
> 
> Well, it would need to be
> { a, b, ... } != { 0, 0, ... } ? { -1, -1, ... } : { 0, 0, ... }
> then, doesn't VEC_COND_EXPR assume the condition is in canonical
> VECTOR_BOOLEAN_TYPE_P form?
> 
> Anyway, if something like the above would be faster, perhaps generic vector
> lowering or some similar pass could detect that case post-vectorization and
> optimize?

Yeah.  OTOH an "ideal" vectorizer would already consider the smaller
prologue cost for its cost modeling.

Richard.

Reply via email to