AMD amd64 architecture User Manual

Page of 336
General-Purpose Programming
71
24592—Rev. 3.15—November 2009
AMD64 Technology
size override prefix for 64-bit mode. For details on the operand-size prefix, see “Instruction Prefixes”in Volume 3.
For details on near branches, see “Near Branches in 64-Bit Mode” on page 85. For details on
instructions that implicitly reference RSP, see “Stack Operand-Size in 64-Bit Mode” on page 77.
For details on opcodes and operand-size overrides, see “General-Purpose Instructions in 64-Bit Mode”in Volume 3.
3.5
Instruction Prefixes
An instruction prefix is a byte that precedes an instruction’s opcode and modifies the instruction’s
operation or operands. Instruction prefixes are of two types:
Legacy Prefixes
REX Prefixes
Legacy prefixes are organized into five groups, in which each prefix has a unique value. REX prefixes,
which enable use of the AMD64 register extensions in 64-bit mode, are organized as a single group in
which the value of the prefix indicates the combination of register-extension features to be enabled.
3.5.1 Legacy Prefixes
Table 3-7 on page 72 shows the legacy prefixes. These are organized into five groups, as shown in the
left-most column of the table. Each prefix has a unique hexadecimal value. The legacy prefixes can
appear in any order in the instruction, but only one prefix from each of the five groups can be used in a
single instruction. The result of using multiple prefixes from a single group is undefined.
There are several restrictions on the use of prefixes. For example, the address-size prefix changes
address size only for a memory operand, and only a single memory operand can be overridden in an
instruction. In general, the operand-size prefix cannot be used with x87 floating-point instructions, and
when used with 128-bit or 64-bit media instructions that prefix acts in a special way to modify the
opcode. The repeat prefixes cause repetition only with certain string instructions, and when used with
128-bit or 64-bit media instructions the prefixes act in a special way to modify the opcode. The lock
prefix can be used with only a small number of general-purpose instructions.
Table 3-7 on page 72 summarizes the functionality of instruction prefixes. Details about the prefixes
and their restrictions are given in “Instruction Prefixes” in Volume 3.