Using inline assembler

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 9 05:54:40 PDT 2014


On Thursday, 9 October 2014 at 12:37:20 UTC, Etienne wrote:
> I'm a bit new to the inline assembler, I'm trying to use the 
> `movdqu` operation to move a 128 bit double quadword from a 
> pointer location into another location like this:
>
> align(16) union __m128i { ubyte[16] data };
>
> void store(__m128i* src, __m128i* dst) {
> 	asm { movdqu [dst], src; }
> }
>
>
> The compiler complains about a "bad type/size of operands 
> 'movdqu'", but these two data segments are 16 byte align so 
> they should be in an XMM# register? Is there something I'm 
> missing here?

I know virtually nothing about SSE, but you can't move directly
from memory to memory, can you? You need go through a register,
no?

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;
      }
}


More information about the Digitalmars-d-learn mailing list