User Guide

General-Purpose Programming 39
24592—Rev. 3.15—November 2009 AMD64 Technology
3.2.2 Operand Sizes and Overrides
Default Operand Size. In legacy and compatibility modes, the default operand size is either 16 bits
or 32 bits, as determined by the default-size (D) bit in the current code-segment descriptor (for details,
see “Segmented Virtual Memory” in Volume 2). In 64-bit mode, the default operand size for most
instructions is 32 bits.
Application software can override the default operand size by using an operand-size instruction prefix.
Table 3-3 shows the instruction prefixes for operand-size overrides in all operating modes. In 64-bit
mode, the default operand size for most instructions is 32 bits. A REX prefix (see Section 3.5.2, “REX
Prefixes,” on page 74) specifies a 64-bit operand size, and a 66h prefix specifies a 16-bit operand size.
The REX prefix takes precedence over the 66h prefix.
There are several exceptions to the 32-bit operand-size default in 64-bit mode, including near branches
and instructions that implicitly reference the RSP stack pointer. For example, the near CALL, near
JMP, Jcc, LOOPcc, POP, and PUSH instructions all default to a 64-bit operand size in 64-bit mode.
Such instructions do not need a REX prefix for the 64-bit operand size. For details, see “General-
Purpose Instructions in 64-Bit Mode” in Volume 3.
Effective Operand Size. The term effective operand size describes the operand size for the current
instruction, after accounting for the instruction’s default operand size and any operand-size override or
REX prefix that is used with the instruction.
Table 3-3. Operand-Size Overrides
Operating Mode
Default
Operand
Size (Bits)
Effective
Operand
Size
(Bits)
Instruction Prefix
66h
1
REX
Long
Mode
64-Bit
Mode
32
2
64 x yes
32 no no
16 yes no
Compatibility
Mode
32
32 no
Not
Applicable
16 yes
16
32 yes
16 no
Legacy Mode
(Protected, Virtual-8086,
or Real Mode)
32
32 no
16 yes
16
32 yes
16 no
Note:
1. A “no” indicates that the default operand size is used. An “x” means “don’t care.”
2. Near branches, instructions that implicitly reference the stack pointer, and certain
other instructions default to 64-bit operand size. See “General-Purpose Instructions
in 64-Bit Mode” in Volume 3