align(16) struct member throws an exception with movdqa

Kapps opantm2+spam at gmail.com
Sat Jun 16 19:52:55 PDT 2012


On Monday, 11 June 2012 at 03:19:08 UTC, ixid wrote:
>     struct a
>     {   align(16) int[4] test = [1,2,3,4];
>     }
>     a test;
>
>     asm
>     {
>             movdqa XMM0, test   ;
>             addps XMM0, XMM0    ;
>             movdpa test, XMM0   ;
>     }
>
> This works fine with unaligned movdqu but throws an access 
> violation exception with movdqa. Why isn't align letting me do 
> an aligned read? How should I do an aligned read?

IIRC, you're supposed to be able to do something like align(16) 
struct a, but it doesn't work when a is created on the stack. 
That was the conclusion I found when trying to implement my own 
vector type a year ago anyways.


More information about the Digitalmars-d-learn mailing list