0

I'm getting a compile error of Error: operand type mismatch for 'movaps', and googling hasn't revealed a solution. movups and addps also give the same error.

Here's a relevant excerpt:

# load address into %eax movaps %eax, %mm0 

For completeness, I'm compiling the .s file with -m32.

5
  • I don't think there's a 64 bit (MMX) version of movaps, so it probably needs to be movaps %eax, %xmm0 ? Commented Sep 19, 2013 at 11:38
  • @KerrekSB I wasn't aware of this. (movapsd isn't recognized by gcc). I'm looking through Oracle's x86 reference manual now. @PaulR Adding the x didn't seem to help. Commented Sep 19, 2013 at 11:40
  • Are you trying to use old MMX (64 bit) vectors or is this supposed to be SSE (128 bits) ? Also, why asm, why not use intrinsics ? Commented Sep 19, 2013 at 11:42
  • Does the assignment specifically say you can't use intrinsics ? FWIW I looked at some gcc-generated asm and I see movaps instructions of the form movaps (%ecx,%eax,4), %xmm0 - I'm not familiar with the syntax but I'm guessing that you may be missing a level of indirection on the first parameter. Commented Sep 19, 2013 at 11:47
  • @al92: Never mind, that was just a poor guess; I should have checked the manual. Deleted. Commented Sep 19, 2013 at 12:42

1 Answer 1

1

You are missing a level of indirection on the first argument, and the second argument needs to be an XMM register (i.e. 128 bit SSE), not an MM register (old 64 bit MMX):

movaps (%eax), %xmm0 

If you can use intrinsics in C or C++ rather than writing raw asm then you can do this kind of thing a lot more easily, e.g.

__m128 v = _mm_load_ps(ptr); 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I was missing the () too.