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.

AMD64 Technology 24594 Rev. 3.10 February 20051.3 OpcodeEach instruction has a unique opcode, although assemblers cansupport multiple mnemonics for a single instruction opcode.The opcode specifies the operation that the instructionperforms <strong>and</strong>, in certain cases, the kinds of oper<strong>and</strong>s it uses. Anopcode consists of one or two bytes, but certain 128-bit mediainstructions also use a prefix byte in a special way to modify theopcode. The 3-bit reg field of the ModRM byte (“ModRM <strong>and</strong>SIB Bytes” on page 20) is also used in certain instructionseither for three additional opcode bits or for a registerspecification.128-Bit <strong>and</strong> 64-Bit Media Instruction Opcodes. Many 128-bit <strong>and</strong> 64-bitmedia instructions include a 66h, F2h, or F3h prefix byte in aspecial way to modify the opcode. These same byte values canbe used in certain general-purpose <strong>and</strong> x87 instructions tomodify oper<strong>and</strong> size (66h) or repeat the operation (F2h, F3h). In128-bit <strong>and</strong> 64-bit media instructions, however, such prefixbytes modify the opcode. If a 128-bit or 64-bit media instructionuses one of these three prefixes, <strong>and</strong> also includes any otherprefix in the 66h, F2h, <strong>and</strong> F3h group, the result isunpredictable.All opcodes for 64-bit media instructions begin with a 0Fh byte.In the case of 64-bit floating-point (3DNow!) instructions, the0Fh byte is followed by a second 0Fh opcode byte. A thirdopcode byte occupies the same position at the end of a 3DNow!instruction as would an immediate byte. The value of theimmediate byte is shown as the third opcode byte-value in thesyntax for each instruction in “64-Bit Media InstructionReference” in <strong>Volume</strong> 5. The format is:0Fh 0Fh ModRM [SIB] [displacement] 3DNow!_third_opcode_byteFor details on opcode encoding, see Appendix A, “Opcode <strong>and</strong>Oper<strong>and</strong> Encodings.”1.4 ModRM <strong>and</strong> SIB BytesThe ModRM byte is used in certain instruction encodings to:• Define a register reference.• Define a memory reference.20 Chapter 1: Instruction Formats

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

Saved successfully!

Ooh no, something went wrong!