Paul Pluzhnikov wrote:
> Alan Woodland <[EMAIL PROTECTED]> writes:

[snipped]

>>- I'm using template specialization to facilitate this, so I
>>added the following asserts just before the offending code:
>>
>>assert(__alignof__(__m128) == __alignof__(this->data[0]));
>>assert(__alignof__(__m128) == __alignof__(o.data[0]));
> 
> 
> These assert()s aren't good. From "info gcc":
> 

[snipped]

Thanks for the reply.

I've looked into why data[0] wouldn't be aligned right, and produced a
simple example below:

   __m128 a,b;

   __m128 *c = new __m128[10];

   std::cout << c << std::endl;
   std::cout << &a << ", " << &b << std::endl;

   _mm_add_ps(a,b);

   _mm_add_ps(c[0], c[1]);

This code segfaults on the last line quoted here, which isn't surprising
because c isn't aligned correctly. My question now is twofold:
a) Why isn't c aligned how __m128 needs to be? and
b) How to work around it? Is it even possible to get an array of __m128s
aligned correctly?

Thanks,
Alan
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to