SSE, Inline assembler, Structs, ...

Jarrett Billingsley kb3ctd2 at yahoo.com
Thu Apr 3 16:06:38 PDT 2008


"Audun Wilhelmsen" <seronor at gmail.com> wrote in message 
news:ft3bdl$1enj$1 at digitalmars.com...
> Sascha Katzner Wrote:
>
>> Audun Wilhelmsen wrote:
>> > Also, this confuses me:
>> > Vec4 v1 = Vec4(1,2,3,4);
>> > // Vec4* p = &v1;
>> > asm {
>> > movaps XMM1, v1[EBP];
>> > }
>> >
>> > if I remove the comment, the program crashes.
>>
>> It seems that this is an data alignment problem, IIRC the "a" in movAps
>> stands for "align" that means the command expects aligned data. You can
>> use movups (unaligned), but that is not as fast. Or you can align your 
>> data.
>>
>> LLAP,
>> Sascha
>
> Well I've tried align, align(4) and align(16) in front of struct Vec4.. 
> Isn't that supposed to align the data?

I think align(n) only works on data alignment within the struct, and not the 
alignment of the struct itself in memory.

I _think_. 




More information about the Digitalmars-d-learn mailing list