On Thursday, 9 October 2014 at 13:29:27 UTC, Etienne wrote:
On 2014-10-09 8:54 AM, anonymous wrote:
This compiles:

align(16) union __m128i { ubyte[16] data; } /* note the position
of the semicolon */

void store(__m128i* src, __m128i* dst) {
     asm
     {
         movdqu XMM0, [src]; /* note: [src] */
         movdqu [dst], XMM0;
     }
}

Yes, this does compile, but the value from src never ends up stored in dst.

void main() {
        __m128i src;
        src.data[0] = 255;
        __m128i dst;
        writeln(src.data); // shows 255 at offset 0
        store(&src, &dst);
        writeln(dst.data); // remains set as the initial array
}

http://x86.renejeschke.de/html/file_module_x86_id_184.html

Is this how it's meant to be used?

I'm out of my knowledge zone here, but it seems to work when you
move the pointers to registers first:

void store(__m128i* src, __m128i* dst) {
     asm
     {
         mov RAX, src;
         mov RBX, dst;
         movdqu XMM0, [RAX];
         movdqu [RBX], XMM0;
     }
}

Reply via email to