Volume 3: General-Purpose and System Instructions - Stanford ...
Volume 3: General-Purpose and System Instructions - Stanford ... Volume 3: General-Purpose and System Instructions - Stanford ...
AMD64 Technology 24594 Rev. 3.10 February 2005A.2.8 rFLAGSCondition Codes forx87 OpcodesTable A-11 shows the rFLAGS condition codes specified by theopcode and ModRM bytes of the FCMOVcc instructions.Table A-11.rFLAGS Condition Codes for FCMOVccOpcode(hex)DADBModRMmodField11ModRMregFieldrFLAGS Value cc Mnemonic Condition000 CF = 1 B Below001 ZF = 1 E Equal010 CF = 1 or ZF = 1 BE Below or Equal011 PF = 1 U Unordered000 CF = 0 NB Not Below001 ZF = 0 NE Not Equal010 CF = 0 and ZF = 0 NBE Not Below or Equal011 PF = 0 NU Not UnorderedA.3 Operand EncodingsRegister and memory operands are encoded using the moderegister-memory(ModRM) and the scale-index-base (SIB) bytesthat follow the opcodes. In some instructions, the ModRM byteis followed by an SIB byte, which defines the instruction’smemory-addressing mode for the complex-addressing modes.A.3.1 ModRMOperand ReferencesFigure A-2 on page 403 shows the format of a ModRM byte.There are three fields—mod, reg, and r/m. The reg field not onlyprovides additional opcode bits—as described above beginningwith “ModRM Extensions to One-Byte and Two-Byte Opcodes”on page 387 and ending with “x87 Encodings” on page 392—but is also used with the other two fields to specify operands.The mod and r/m fields are used together with each other and,in 64-bit mode, with the REX.R and REX.B bits of the REXprefix, to specify the location of the instruction’s operands andcertain of the possible addressing modes (specifically, the noncomplexmodes).402 Appendix A: Opcode and Operand Encodings
24594 Rev. 3.10 February 2005 AMD64 TechnologyBits:76543210modreg r/m ModRMREX.R bit of REX prefix canextend this field to 4 bitsREX.B bit of REX prefix canextend this field to 4 bits513-305.epsFigure A-2.ModRM-Byte FormatThe two sections below describe the ModRM operandencodings, first for 32-bit and 64-bit references, and then for 16-bit references.16-Bit Register and Memory References. Table A-12 shows thenotation and encoding conventions for register references usingthe ModRM reg field. This table is comparable to Table A-14 onpage 406 but applies only when the address-size is 16-bit.Table A-13 on page 404 shows the notation and encodingconventions for 16-bit memory references using the ModRMbyte. This table is comparable to Table A-15 on page 407.Table A-12.ModRM Register References, 16-Bit AddressingMnemonicNotationModRM reg Field/0 /1 /2 /3 /4 /5 /6 /7reg8 AL CL DL BL AH CH DH BHreg16 AX CX DX BX SP BP SI DIreg32 EAX ECX EDX EBX ESP EBP ESI EDImmx MMX0 MMX1 MMX2 MMX3 MMX4 MMX5 MMX6 MMX7xmm XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7sReg ES CS SS DS FS GS iinvalid invalidcReg CR0 CR1 CR2 CR3 CR4 CR5 CR6 CR7dReg DR0 DR1 DR2 DR3 DR4 DR5 DR6 DR7Appendix A: Opcode and Operand Encodings 403
- Page 382 and 383: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 384 and 385: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 386 and 387: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 388 and 389: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 390 and 391: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 392 and 393: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 394 and 395: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 396 and 397: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 398 and 399: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 400 and 401: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 402 and 403: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 404 and 405: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 406 and 407: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 408 and 409: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 410 and 411: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 412 and 413: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 414 and 415: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 416 and 417: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 418 and 419: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 420 and 421: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 422 and 423: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 424 and 425: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 426 and 427: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 428 and 429: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 430 and 431: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 434 and 435: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 436 and 437: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 438 and 439: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 440 and 441: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 442 and 443: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 444 and 445: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 446 and 447: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 448 and 449: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 450 and 451: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 452 and 453: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 454 and 455: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 456 and 457: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 458 and 459: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 460 and 461: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 462 and 463: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 464 and 465: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 466 and 467: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 468 and 469: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 470 and 471: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 472 and 473: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 474 and 475: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 476 and 477: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 478 and 479: AMD64 Technology 24594 Rev. 3.10 Fe
- Page 480 and 481: AMD64 Technology 24594 Rev. 3.10 Fe
AMD64 Technology 24594 Rev. 3.10 February 2005A.2.8 rFLAGSCondition Codes forx87 OpcodesTable A-11 shows the rFLAGS condition codes specified by theopcode <strong>and</strong> ModRM bytes of the FCMOVcc instructions.Table A-11.rFLAGS Condition Codes for FCMOVccOpcode(hex)DADBModRMmodField11ModRMregFieldrFLAGS Value cc Mnemonic Condition000 CF = 1 B Below001 ZF = 1 E Equal010 CF = 1 or ZF = 1 BE Below or Equal011 PF = 1 U Unordered000 CF = 0 NB Not Below001 ZF = 0 NE Not Equal010 CF = 0 <strong>and</strong> ZF = 0 NBE Not Below or Equal011 PF = 0 NU Not UnorderedA.3 Oper<strong>and</strong> EncodingsRegister <strong>and</strong> memory oper<strong>and</strong>s are encoded using the moderegister-memory(ModRM) <strong>and</strong> the scale-index-base (SIB) bytesthat follow the opcodes. In some instructions, the ModRM byteis followed by an SIB byte, which defines the instruction’smemory-addressing mode for the complex-addressing modes.A.3.1 ModRMOper<strong>and</strong> ReferencesFigure A-2 on page 403 shows the format of a ModRM byte.There are three fields—mod, reg, <strong>and</strong> r/m. The reg field not onlyprovides additional opcode bits—as described above beginningwith “ModRM Extensions to One-Byte <strong>and</strong> Two-Byte Opcodes”on page 387 <strong>and</strong> ending with “x87 Encodings” on page 392—but is also used with the other two fields to specify oper<strong>and</strong>s.The mod <strong>and</strong> r/m fields are used together with each other <strong>and</strong>,in 64-bit mode, with the REX.R <strong>and</strong> REX.B bits of the REXprefix, to specify the location of the instruction’s oper<strong>and</strong>s <strong>and</strong>certain of the possible addressing modes (specifically, the noncomplexmodes).402 Appendix A: Opcode <strong>and</strong> Oper<strong>and</strong> Encodings