Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you move 128-bit values between XMM registers?

Tags:

assembly

simd

sse

Seemingly trivial problem in assembly: I want to copy the whole XMM0 register to XMM3. I've tried

movdq xmm3, xmm0

but MOVDQ cannot be used to move values between two XMM registers. What should I do instead?

like image 843
lampak Avatar asked Dec 29 '11 17:12

lampak


1 Answers

It's movapd, movaps, or movdqa

movaps xmm3, xmm0

They all do the same thing, but there's a catch:

  • movapd and movaps operate in the floating-point domain.
  • movdqa operates in the integer domain

Use the appropriate one according to your datatype to avoid domain-changing stalls.

Also, there's no reason to use movapd. Always use movaps instead because movapd takes an extra byte to encode.

like image 140
Mysticial Avatar answered Oct 13 '22 20:10

Mysticial