Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z

B-2 Vol. 2B
INSTRUCTION FORMATS AND ENCODINGS
B.1.1 Legacy Prefixes
The legacy prefixes noted in Figure B-1 include 66H, 67H, F2H and F3H. They are
optional, except when F2H, F3H and 66H are used in new instruction extensions.
Legacy prefixes must be placed before REX prefixes.
Refer to Chapter 2, “Instruction Format,” in the Intel
®
64 and IA-32 Architectures
Software Developer’s Manual, Volume 2A, for more information on legacy prefixes.
B.1.2 REX Prefixes
REX prefixes are a set of 16 opcodes that span one row of the opcode map and
occupy entries 40H to 4FH. These opcodes represent valid instructions (INC or DEC)
in IA-32 operating modes and in compatibility mode. In 64-bit mode, the same
opcodes represent the instruction prefix REX and are not treated as individual
instructions.
Refer to Chapter 2, “Instruction Format,” in the Intel
®
64 and IA-32 Architectures
Software Developer’s Manual, Volume 2A, for more information on REX prefixes.
B.1.3 Opcode Fields
The primary opcode for an instruction is encoded in one to three bytes of the instruc-
tion. Within the primary opcode, smaller encoding fields may be defined. These fields
vary according to the class of operation being performed.
Almost all instructions that refer to a register and/or memory operand have a
register and/or address mode byte following the opcode. This byte, the ModR/M byte,
consists of the mod field (3 bits), the reg field (3 bits; this field is sometimes an
opcode extension), and the R/M field (2 bits). Certain encodings of the ModR/M byte
indicate that a second address mode byte, the SIB byte, must be used.
If the addressing mode specifies a displacement, the displacement value is placed
immediately following the ModR/M byte or SIB byte. Possible sizes are 8, 16, or 32
bits. If the instruction specifies an immediate value, the immediate value follows any
displacement bytes. The immediate, if specified, is always the last field of the
instruction.
Refer to Chapter 2, “Instruction Format,” in the Intel
®
64 and IA-32 Architectures
Software Developer’s Manual, Volume 2A, for more information on opcodes.
B.1.4 Special Fields
Table B-1 lists bit fields that appear in certain instructions, sometimes within the
opcode bytes. All of these fields (except the d bit) occur in the general-purpose
instruction formats in Table B-13.