Vector alignment tracking

Artem Shinkarov
Thu Oct 13 18:26:00 GMT 2011

On Thu, Oct 13, 2011 at 4:54 PM, Andi Kleen <> wrote:
> Artem Shinkarov <> writes:
>> 1) Currently in C we cannot provide information that an array is
>> aligned to a certain number.  The problem is hidden in the fact, that
> Have you considered doing it the other way round: when an optimization
> needs something to be aligned, make the declaration aligned?
> -Andi

Andi, I can't realistically imagine how could it work.  The problem is
that for an arbitrary arr[x], I have no idea whether it should be
aligned or not.

what if

arr = ptr +  5;
v = *(vec *) arr;

I can make arr aligned, because it would be better for performance,
but obviously, the pointer expression breaks this alignment.  But the
code is valid, because unaligned move is still possible.  So I think
that checking is a more conservative approach.

Or I am missing someting?

> --
> -- Speaking for myself only

More information about the Gcc mailing list