is -O2 breaking sse2 alignment?

Andrew Haley aph@redhat.com
Sat Mar 15 09:49:00 GMT 2008


Brian Budge wrote:
> Hi -
> 
> I think this might be a little simpler:
> 
> void test_add_long1(long * result, long * a, long * b, long size) {
>     __m128i *A = (__m128i*)a;
>     __m128i *B = (__m128i*)b;
>     __m128i *end = A + size/2;
>     __m128i *R = (__m128i*)result;
> 
>     for(; A < end; ++A, ++B, ++R) {
>         *R = _mm_add_epi64(*A, *B);
>     }
> }

This has the same aliasing problems.

Andrew.



More information about the Gcc-help mailing list