User Guide

64-Bit Media Programming 209
24592—Rev. 3.15—November 2009 AMD64 Technology
U—Unsigned
US—Unsigned saturation
W—Word
x—One or more variable characters in the mnemonic
For example, the mnemonic for the instruction that packs four words into eight unsigned bytes is
PACKUSWB. In this mnemonic, the PACK designates 2x-to-1x conversion of vector elements, the US
designates unsigned results with saturation, and the WB designates vector elements of the source as
words and those of the result as bytes.
5.6.2 Exit Media State
The exit media state instructions are used to isolate the use of processor resources between 64-bit
media instructions and x87 floating-point instructions.
EMMS—Exit Media State
FEMMS—Fast Exit Media State
These instructions initialize the contents of the x87 floating-point stack registers—called clearing the
MMX state. Software should execute one of these instructions before leaving a 64-bit media procedure.
The EMMS and FEMMS instructions both clear the MMX state, as described in “Mixing Media Code
with x87 Code” on page 233. The instructions differ in one respect: FEMMS leaves the data in the x87
stack registers undefined. By contrast, EMMS leaves the data in each such register as it was defined by
the last x87 or 64-bit media instruction that wrote to the register. The FEMMS instruction is supported
for backward-compatibility. Software that must be compatible with both AMD and non-AMD
processors should use the EMMS instruction.
5.6.3 Data Transfer
The data-transfer instructions copy operands between a 32-bit or 64-bit memory location, an MMX
register, an XMM register, or a GPR. The MOV mnemonic, which stands for move, is a misnomer. A
copy function is actually performed instead of a move.
Move
MOVD—Move Doubleword
MOVQ—Move Quadword
MOVDQ2Q—Move Double Quadword to Quadword
MOVQ2DQ—Move Quadword to Double Quadword
The MOVD instruction copies a 32-bit or 64-bit value from a general-purpose register (GPR) or
memory location to an MMX register, or from an MMX register to a GPR or memory location. If the
source operand is 32 bits and the destination operand is 64 bits, the source is zero-extended to 64 bits
in the destination. If the source is 64 bits and the destination is 32 bits, only the low-order 32 bits of the
source are copied to the destination.