That said, I'm not happy with a builtin function.  I think that we
should make every effort to make
    union { TYPE a[COUNT]; VECTOR v; } u;
    u.v = v;
    x = u.a[0];
use vec_extract, because in the absence of operator[] that is the
natural way for people to extract an element from a vector.

Ok, I am going to extend SRA (or maybe a new pass, I don't know yet)
to produce BIT_FIELD_REF which in turns calls vec_extract patterns.

The other natural way is
    ((TYPE *)&v)[0]
which is technically an aliasing violation but one which gcc
explicitly accepts (search for VECTOR_TYPE in get_alias_set).
Although, since it is not documented, people should probably be
discouraged from doing this.

This currently actually does not produce vec_extract though it might be easy
to extend fold to produce BIT_FIELD_REF for this case.

Thanks,
Andrew Pinski

Reply via email to