13.07.2015 Views

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

Volume 3: General-Purpose and System Instructions - Stanford ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

24594 Rev. 3.10 February 2005 AMD64 TechnologyREX.B: Base. The REX.B bit either adds a 1-bit (high) extensionto the base in the ModRM r/m field or SIB base field, or it adds a1-bit (high) extension to the opcode reg field used for accessingGPRs. (See Table 2-2 on page 47 for more about the REX.B bit.)Encoding Examples. Figure 1-3 on page 18 shows four examples ofhow the R, X, <strong>and</strong> B bits of REX prefixes are concatenated withfields from the ModRM byte, SIB byte, <strong>and</strong> opcode to specifyregister <strong>and</strong> memory addressing. The R, X, <strong>and</strong> B bits aredescribed in Table 1-11 on page 16.Byte-Register Addressing. In the legacy architecture, the byteregisters (AH, AL, BH, BL, CH, CL, DH, <strong>and</strong> DL, shown inFigure 2-2 on page 30) are encoded in the ModRM reg or r/mfield or in the opcode reg field as registers 0 through 7. The REXprefix provides an additional byte-register addressingcapability that makes the least-significant byte of any GPRavailable for byte operations (Figure 2-3 on page 31). Thisprovides a uniform set of byte, word, doubleword, <strong>and</strong>quadword registers better suited for register allocation bycompilers.Special Encodings for Registers. Readers who need to know thedetails of instruction encodings should be aware that certaincombinations of the ModRM <strong>and</strong> SIB fields have specialmeaning for register encodings. For some of thesecombinations, the instruction fields exp<strong>and</strong>ed by the REXprefix are not decoded (treated as don’t cares), thereby creatingaliases of these encodings in the extended registers. Table 1-12on page 19 describes how each of these cases behaves.Implications for INC <strong>and</strong> DEC <strong>Instructions</strong>. The REX prefix values aretaken from the 16 single-byte INC <strong>and</strong> DEC instructions, one foreach of the eight GPRs. Therefore, these single-byte opcodes forINC <strong>and</strong> DEC are not available in 64-bit mode, although theyare available in legacy <strong>and</strong> compatibility modes. Thefunctionality of these INC <strong>and</strong> DEC instructions is stillavailable in 64-bit mode, however, using the ModRM forms ofthose instructions (opcodes FF /0 <strong>and</strong> FF /1).Chapter 1: Instruction Formats 17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!