User Guide
42 General-Purpose Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
In most instructions that take two operands, the first (left-most) operand is both a source operand and
the destination operand. The second (right-most) operand serves only as a source. Instructions can
have one or more prefixes that modify default instruction functions or operand properties. These
prefixes are summarized in Section 3.5, “Instruction Prefixes,” on page 71. Instructions that access
64-bit operands in a general-purpose register (GPR) or any of the extended G PR or XMM registers
require a REX instruction prefix.
Unless otherwise stated in this section, the word register means a general-purpose register (GPR).
Several instructions affect the flag bits in the RFLAGS register. “Instruction Effects on RFLAGS” in
Volume 3 summarizes the effects that instructions have on rFLAGS bits.
3.3.2 Data Transfer
The data-transfer instructions copy data between registers and memory.
Move
• MOV—Move
• MOVSX—Move with Sign-Extend
• MOVZX—Move with Zero-Extend
• MOVD—Move Doubleword or Quadword
• MOVNTI—Move Non-Temporal Doubleword or Quadword
MOVx copies a byte, word, doubleword, or quadword from a register or memory location to a register
or memory location. The source and destination cannot both be memory locations. An immediate
constant can be used as a source operand with the MOV instruction. For MOV, the destination must be
of the same size as the source, but the MOVSX and MOVZX instructions copy values of smaller size to
a larger size by using sign-extension or zero-extension. The MOVD instruction copies a doubleword or
quadword between a general-purpose register or memory and an XMM or MMX register.
The MOV instruction is in many aspects similar to the assignment operator in high-level languages.
The simplest example of their use is to initialize variables. To initialize a register to 0, rather than using
a MOV instruction it may be more efficient to use the XOR instruction with identical destination and
source operands.
The MOVNTI instruction stores a doubleword or quadword from a register into memory as “non-
temporal” data, which assumes a single access (as opposed to frequent subsequent accesses of
“temporal data”). The operation therefore minimizes cache pollution. The exact method by which
cache pollution is minimized depends on the hardware implementation of the instruction. For further
information, see Section 3.9, “Memory Optimization,” on page 92.
Conditional Move
• CMOVcc—Conditional Move If condition
The CMOVcc instructions conditionally copy a word, doubleword, or quadword from a register or
memory location to a register location. The source and destination must be of the same size.