On Fri, Oct 21, 2011 at 11:19:32AM +0200, Richard Guenther wrote:
> I'll try to poke at that a bit, thus support general bit-precision types for
> loads and stores and the few operations that are safe on them.  If you
> have a store to a bool like
> 
> int *a, *b;
> _Bool *c;
> 
> for (;;)
>   c[i] = a[i] < b[i];
> 
> will the compare choose an int vector type and then demote it to
> char for the store?

Yes.  The pattern recognizer would turn this into:
int *a, *b;
for (;;)
  {
    int tmp = a[i] < b[i] ? 1 : 0;
    ((char *)c)[i] = (char) tmp;  // Still using _Bool for TBAA purposes
  }

>  I suppose trying to generally handle loads/stores
> for these types shouldn't interfere too much with this.  But I'll see ...

If you manage to get the generic stuff working (remove the condition from
get_vectype_from_scalar_type about TYPE_PRECISION and handle what is
needed), then vect_recog_bool_pattern would need to be adjusted slightly
(to not start on a cast from some kind of bool to another kind of bool,
which now results in return NULL because get_vectype_from_scalar_type
returns NULL_TREE) and from the patch I've posted we'd need just the
tree-vect-patterns.c bits (adjusted as you say to unconditionally create
VCE instead of special casing MEM_REF, and additionally attempting to use
signed instead of unsigned type to avoid unnecessary casts) and something
in vectorizable_store so that it doesn't fail on VCEs, at least not
in pattern stmts.

        Jakub

Reply via email to