AMD amd64 architecture User Manual

Page of 336
26
General-Purpose Programming
AMD64 Technology
24592—Rev. 3.15—November 2009
3.1.2 64-Bit-Mode Registers
In 64-bit mode, eight new GPRs are added to the eight legacy GPRs, all 16 GPRs are 64 bits wide, and
the low bytes of all registers are accessible. Figure 3-3 on page 27 shows the GPRs, flags register, and
instruction-pointer register available in 64-bit mode. The GPRs include:
Sixteen 8-bit low-byte registers (AL, BL, CL, DL, SIL, DIL, BPL, SPL, R8B, R9B, R10B, R11B,
R12B, R13B, R14B, R15B).
Four 8-bit high-byte registers (AH, BH, CH, DH), addressable only when no REX prefix is used.
Sixteen 16-bit registers (AX, BX, CX, DX, DI, SI, BP, SP, R8W, R9W, R10W, R11W, R12W,
R13W, R14W, R15W).
Sixteen 32-bit registers (EAX, EBX, ECX, EDX, EDI, ESI, EBP, ESP, R8D, R9D, R10D, R11D,
R12D, R13D, R14D, R15D).
Sixteen 64-bit registers (RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, R8, R9, R10, R11, R12,
R13, R14, R15).
The size of register used by an instruction depends on the effective operand size or, for certain
instructions, the opcode, address size, or stack size. For most instructions, access to the extended GPRs
requires a REX prefix (Section 3.5.2, “REX Prefixes,” on page 74). The four high-byte registers (AH,
BH, CH, DH) available in legacy mode are not addressable when a REX prefix is used.
In general, byte and word operands are stored in the low 8 or 16 bits of GPRs without modifying their
high 56 or 48 bits, respectively. Doubleword operands, however, are normally stored in the low 32 bits
of GPRs and zero-extended to 64 bits.
The 64-bit RFLAGS register, shown in Figure 3-3 on page 27, contains the legacy EFLAGS in its low
32-bit range. The high 32 bits are reserved. They can be written with anything but they always read as
zero (RAZ). The 64-bit RIP instruction-pointer register contains the address of the next instruction to
be executed, as described in Section 3.1.5, “Instruction Pointer Register,” on page 36.