Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between MOVDQA and MOVAPS x86 instructions?

I'm looking Intel datasheet: Intel® 64 and IA-32 Architectures Software Developer’s Manual and I can't find the difference between

  • MOVDQA: Move Aligned Double Quadword
  • MOVAPS: Move Aligned Packed Single-Precision

In Intel datasheet I can find for both instructions:

This instruction can be used to load an XMM register from a 128-bit memory location, to store the contents of an XMM register into a 128-bit memory location, or to move data between two XMM registers.

The only difference is:

To move a double quadword to or from unaligned memory locations, use the MOVDQU instruction.

and

To move packed single-precision floating-point values to or from unaligned memory locations, use the MOVUPS instruction.

But I can't find the reason why two different instructions?

So can anybody explain the difference?

like image 204
GJ. Avatar asked Jul 13 '11 11:07

GJ.


1 Answers

In functionality, they are identical.

On some (but not all) micro-architectures, there are timing differences due to "domain crossing penalties". For this reason, one should generally use movdqa when the data is being used with integer SSE instructions, and movaps when the data is being used with floating-point instructions. For more information on this subject, consult the Intel Optimization Manual, or Agner Fog's excellent microarchitecture guide. Note that these delays are most often associated with register-register moves instead of loads or stores.

like image 80
Stephen Canon Avatar answered Sep 30 '22 16:09

Stephen Canon