Introduction
An opcode map gives, for each value of the opcode byte, the instruction it starts. x86
has several: the one-byte map, the two-byte map reached through the escape byte
0F, and the three-byte maps reached through 0F 38 and
0F 3A. VEX, EVEX and XOP name a map in their own fields instead of using
escape bytes. The tables below follow Intel’s manual (volume 2, appendix A) and AMD’s
(volume 3, appendix A), and are checked against the explorer’s disassembler tables
(map0.js, map0f.js and the others). Like Intel’s, each map is
printed in two halves: the low opcodes of each row (x0 to x7), then the high ones (x8 to
xF). Every mnemonic links to its instruction.
The operands are in Intel’s notation: an upper-case letter for where the operand comes from and lower-case letters for its size.
| Letter | The operand | Letter | The operand |
|---|---|---|---|
A | A far address in the instruction | M | Memory only, from ModRM |
B | A general register in VEX.vvvv | N | An MMX register in ModRM.rm |
C | A control register in ModRM.reg | O | A memory offset in the instruction (moffs) |
D | A debug register in ModRM.reg | P | An MMX register in ModRM.reg |
E | A general register or memory, from ModRM.rm | Q | An MMX register or memory, from ModRM.rm |
F | The flags register | R | A general register in ModRM.rm (mod 11) |
G | A general register in ModRM.reg | S | A segment register in ModRM.reg |
H | A vector register in VEX.vvvv | U | A vector register in ModRM.rm (mod 11) |
I | An immediate | V | A vector register in ModRM.reg |
J | A relative branch displacement | W | A vector register or memory, from ModRM.rm |
L | A vector register in imm8 bits 7–4 | X, Y | Memory at DS:rSI and ES:rDI, for the string instructions |
The sizes are b byte, w word, d doubleword,
q quadword, dq 16 bytes, v the operand size (16,
32 or 64), z 16 or 32 (32 for a 64-bit operand size), y 32 or
64, p a far pointer, a a pair of bounds, ps and
pd packed single and double precision, ss and sd
scalars, x a full vector. A register name such as rAX or
eAX follows the operand size, and Zv is the register in the
opcode’s low three bits. Marks: i64 invalid in 64-bit mode,
o64 only in 64-bit mode, d64 64-bit operand size by
default in 64-bit mode, f64 always 64-bit there.
The one-byte map
Rows are the high digit of the opcode, columns the low digit.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|---|
| 0 | add Eb, Gb | add Ev, Gv | add Gb, Eb | add Gv, Ev | add AL, Ib | add rAX, Iz | push ES · i64 | pop ES · i64 |
| 1 | adc Eb, Gb | adc Ev, Gv | adc Gb, Eb | adc Gv, Ev | adc AL, Ib | adc rAX, Iz | push SS · i64 | pop SS · i64 |
| 2 | and Eb, Gb | and Ev, Gv | and Gb, Eb | and Gv, Ev | and AL, Ib | and rAX, Iz | ES: prefix | daa i64 |
| 3 | xor Eb, Gb | xor Ev, Gv | xor Gb, Eb | xor Gv, Ev | xor AL, Ib | xor rAX, Iz | SS: prefix | aaa i64 |
| 4 | inc eAX · i64 | inc eCX · i64 | inc eDX · i64 | inc eBX · i64 | inc eSP · i64 | inc eBP · i64 | inc eSI · i64 | inc eDI · i64 |
| 5 | push rAX/r8 · d64 | push rCX/r9 | push rDX/r10 | push rBX/r11 | push rSP/r12 | push rBP/r13 | push rSI/r14 | push rDI/r15 |
| 6 | pushaw, pushal i64 | popaw, popal i64 | bound Gv, Ma · i64 EVEX | arpl Ew, Gw · i64 movsxd Gv, Ed · o64 | FS: prefix | GS: prefix | operand size prefix | address size prefix |
| 7 | jo Jb | jno Jb | jb Jb | jae Jb | je Jb | jne Jb | jbe Jb | ja Jb |
| 8 | Group 1 Eb, Ib | Group 1 Ev, Iz | Group 1 Eb, Ib · i64 | Group 1 Ev, Ib | test Eb, Gb | test Ev, Gv | xchg Eb, Gb | xchg Ev, Gv |
| 9 | nop F3: pause REX.B: xchg r8, rAX | xchg rCX/r9, rAX | xchg rDX/r10, rAX | xchg rBX/r11, rAX | xchg rSP/r12, rAX | xchg rBP/r13, rAX | xchg rSI/r14, rAX | xchg rDI/r15, rAX |
| A | mov AL, Ob | mov rAX, Ov REX2: jmpabs | mov Ob, AL | mov Ov, rAX | movsb Yb, Xb | movsw, movsd, movsq Yv, Xv | cmpsb Xb, Yb | cmpsw, cmpsd, cmpsq Xv, Yv |
| B | mov AL/r8b, Ib | mov CL/r9b, Ib | mov DL/r10b, Ib | mov BL/r11b, Ib | mov AH/r12b, Ib | mov CH/r13b, Ib | mov DH/r14b, Ib | mov BH/r15b, Ib |
| C | Group 2 Eb, Ib | Group 2 Ev, Ib | ret Iw · d64 | ret d64 | les Gz, Mp · i64 VEX (3 bytes) | lds Gz, Mp · i64 VEX (2 bytes) | Group 11 Eb, Ib | Group 11 Ev, Iz |
| D | Group 2 Eb, 1 | Group 2 Ev, 1 | Group 2 Eb, CL | Group 2 Ev, CL | aam Ib · i64 | aad Ib · i64 REX2 | salc i64 | xlatb |
| E | loopne Jb · f64 | loope Jb · f64 | loop Jb · f64 | jcxz, jecxz, jrcxz Jb · f64 | in AL, Ib | in eAX, Ib | out Ib, AL | out Ib, eAX |
| F | LOCK prefix | int1 | REPNE prefix | REP, REPE prefix | hlt | cmc | Group 3 Eb | Group 3 Ev |
| 8 | 9 | A | B | C | D | E | F | |
|---|---|---|---|---|---|---|---|---|
| 0 | or Eb, Gb | or Ev, Gv | or Gb, Eb | or Gv, Ev | or AL, Ib | or rAX, Iz | push CS · i64 | 0F escape two-byte map |
| 1 | sbb Eb, Gb | sbb Ev, Gv | sbb Gb, Eb | sbb Gv, Ev | sbb AL, Ib | sbb rAX, Iz | push DS · i64 | pop DS · i64 |
| 2 | sub Eb, Gb | sub Ev, Gv | sub Gb, Eb | sub Gv, Ev | sub AL, Ib | sub rAX, Iz | CS: prefix | das i64 |
| 3 | cmp Eb, Gb | cmp Ev, Gv | cmp Gb, Eb | cmp Gv, Ev | cmp AL, Ib | cmp rAX, Iz | DS: prefix | aas i64 |
| 4 | dec eAX · i64 | dec eCX · i64 | dec eDX · i64 | dec eBX · i64 | dec eSP · i64 | dec eBP · i64 | dec eSI · i64 | dec eDI · i64 |
| 5 | pop rAX/r8 · d64 | pop rCX/r9 | pop rDX/r10 | pop rBX/r11 | pop rSP/r12 | pop rBP/r13 | pop rSI/r14 | pop rDI/r15 |
| 6 | push Iz · d64 | imul Gv, Ev, Iz | push Ib · d64 | imul Gv, Ev, Ib | insb Yb, DX | insw, insd Yz, DX | outsb DX, Xb | outsw, outsd DX, Xz |
| 7 | js Jb | jns Jb | jp Jb | jnp Jb | jl Jb | jge Jb | jle Jb | jg Jb |
| 8 | mov Eb, Gb | mov Ev, Gv | mov Gb, Eb | mov Gv, Ev | mov Ev, Sw | lea Gv, M | mov Sw, Ew | Group 1A Ev XOP |
| 9 | cbw, cwde, cdqe | cwd, cdq, cqo | lcall Ap · i64 | wait | pushf Fv · d64 | popf Fv · d64 | sahf | lahf |
| A | test AL, Ib | test rAX, Iz | stosb Yb, AL | stosw, stosd, stosq Yv, rAX | lodsb AL, Xb | lodsw, lodsd, lodsq rAX, Xv | scasb AL, Yb | scasw, scasd, scasq rAX, Yv |
| B | mov rAX/r8, Iv | mov rCX/r9, Iv | mov rDX/r10, Iv | mov rBX/r11, Iv | mov rSP/r12, Iv | mov rBP/r13, Iv | mov rSI/r14, Iv | mov rDI/r15, Iv |
| C | enter Iw, Ib · d64 | leave d64 | retf Iw | retf | int3 | int Ib | into i64 | iret, iretd, iretq |
| D | x87 escapes D8 to DF: the floating-point instructions, picked by the opcode, ModRM.reg and, for register operands, the whole ModRM byte | |||||||
| E | call Jz · f64 | jmp Jz · f64 | ljmp Ap · i64 | jmp Jb · f64 | in AL, DX | in eAX, DX | out DX, AL | out DX, eAX |
| F | clc | stc | cli | sti | cld | std | Group 4 Eb | Group 5 Ev |
In 64-bit mode, 40 to 4F are the
REX prefix, A0 to
A3 take an 8-byte address and are shown as
movabs, as is
B8+r with REX.W, and C4, C5, 62 and
D5 always start VEX, EVEX and REX2. Outside 64-bit mode, C4,
C5 and 62 start VEX and EVEX only when the next byte is
C0 or above. 8F starts XOP when the next byte’s low five bits
are 8 or more.
The one-byte map’s groups
In a group, ModRM.reg picks the instruction.
| Group | Opcodes | /0 | /1 | /2 | /3 | /4 | /5 | /6 | /7 |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 80–83 | add | or | adc | sbb | and | sub | xor | cmp |
| 1A | 8F | pop Ev · d64 | –; the byte values that would put 1 to 7 here are XOP prefixes | ||||||
| 2 | C0, C1, D0–D3 | rol | ror | rcl | rcr | shl | shr | shl (undocumented copy) | sar |
| 3 | F6, F7 | test E, I | test (undocumented copy) | not | neg | mul | imul | div | idiv |
| 4 | FE | inc Eb | dec Eb | – | |||||
| 5 | FF | inc Ev | dec Ev | call Ev · f64 | lcall Mp | jmp Ev · f64 | ljmp Mp | push Ev · d64 | – |
| 11 | C6, C7 | mov E, I | – | with ModRM F8: xabort Ib (C6) and xbegin Jz (C7) | |||||
The two-byte map (0F)
Many cells hold one instruction per mandatory prefix: none, 66, F3 or F2, written
before each name. Most of the SSE instructions also have a VEX form, the same mnemonic
with a v in front and an extra source operand (H), in VEX map 1; and with a
VEX prefix, some of the CMOVcc and SETcc cells hold the AVX-512 mask instructions
(kandw, kmovw …). Empty cells are invalid,
and the disassembler shows them as (bad).
In row 2 the control and debug register moves take Rq, Cq and
Dq in 64-bit mode. Row C holds xadd at C0 and C1, and the
byte swaps at C8 to CF in the second half.
The two-byte map’s groups
As in the one-byte map, ModRM.reg picks the instruction; some groups also depend on whether the operand is memory or a register (mod 11), and on the mandatory prefix.
| Group | Opcode | Memory forms | Register forms (mod 11) |
|---|---|---|---|
| 6 | 0F 00 | /0 sldt, /1 str, /2 lldt, /3 ltr, /4 verr, /5 verw, /6 with F2 lkgs (o64) | |
| 7 | 0F 01 | /0 sgdt, /1 sidt, /2 lgdt, /3 lidt (outside 64-bit mode named by operand size: sgdtw, sgdtd …), /4 smsw, /5 with F3 rstorssp, /6 lmsw, /7 invlpg | By the whole ModRM byte: C0 enclv; C1–C4 vmcall, vmlaunch, vmresume, vmxoff; C5 pconfig; C6 wrmsrns (F2 rdmsrlist, F3 wrmsrlist); C7 pbndkb; C8, C9 monitor, mwait; CA clac (F2 erets, F3 eretu); CB stac; CC–CF with 66 tdcall, seamret, seamops, seamcall; CF encls; D0, D1 xgetbv, xsetbv; D4 vmfunc; D5, D6 xend, xtest; D7 enclu; D8–DF vmrun, vmmcall, vmload, vmsave, stgi, clgi, skinit, invlpga; E0–E7 smsw; E8 serialize (F3 setssbsy, F2 xsusldtrk); E9 with F2 xresldtrk; EA with F3 saveprevssp; EC, ED with F3 uiret, testui; EE, EF rdpkru, wrpkru (F3 clui, stui); F0–F7 lmsw; F8 swapgs (o64); F9 rdtscp; FA monitorx (F3 mcommit); FB mwaitx; FC clzero; FD rdpru (F3 rmpquery); FE invlpgb (F3 rmpadjust, F2 rmpupdate); FF tlbsync (F3 psmash, F2 pvalidate). Several of the prefixed forms exist only in 64-bit mode. |
| 8 | 0F BA | /4 bt, /5 bts, /6 btr, /7 btc, each Ev, Ib | |
| 9 | 0F C7 | /1 cmpxchg8b (REX.W cmpxchg16b), /3 xrstors, /4 xsavec, /5 xsaves, /6 vmptrld (66 vmclear, F3 vmxon), /7 vmptrst | /6 rdrand (F3 in 64-bit mode senduipi), /7 rdseed (F3 rdpid) |
| 12, 13, 14 | 0F 71, 72, 73 | – | Shifts by an immediate, Nq, Ib (66: Ux, Ib): 71 /2 psrlw, /4 psraw, /6 psllw; 72 /2 psrld, /4 psrad, /6 pslld; 73 /2 psrlq, /3 with 66 psrldq, /6 psllq, /7 with 66 pslldq |
| 15 | 0F AE | /0 fxsave, /1 fxrstor, /2 ldmxcsr, /3 stmxcsr, /4 xsave (F3 ptwrite), /5 xrstor, /6 xsaveopt (66 clwb, F3 clrssbsy), /7 clflush (66 clflushopt); with REX.W the 64-bit forms fxsave64, xsave64 … | F3 /0–/3 rdfsbase, rdgsbase, wrfsbase, wrgsbase (o64); F3 /4 ptwrite; /5 lfence (F3 incsspd); /6 mfence (66 tpause, F3 umonitor, F2 umwait); /7 sfence |
| 16 | 0F 18 | /0 prefetchnta, /1 prefetcht0, /2 prefetcht1, /3 prefetcht2, /4 prefetchrst2, /6 and /7 with a RIP-relative address prefetchit1, prefetchit0; otherwise a hint NOP | Hint NOPs |
| P | 0F 0D | /0 prefetch, /1 prefetchw, /2 prefetchwt1 | – |
The three-byte maps, 0F 38 and 0F 3A
These two maps hold the later SIMD instructions and several general-purpose ones. Almost every entry needs a mandatory prefix, usually 66. Every instruction in 0F 3A takes an immediate byte. Many opcodes exist only in VEX form (VEX maps 2 and 3); the lists below give the ranges, and each family page has the instructions.
| 0F 38 | Legacy (and most also in VEX) | VEX only |
|---|---|---|
00–0F | 00–0B SSSE3 (pshufb, phaddw … pmulhrsw), with an MMX form without 66 | 0C–0F vpermilps, vpermilpd, vtestps, vtestpd (AVX) |
10–1F | 10, 14, 15 pblendvb, blendvps, blendvpd; 17 ptest (SSE4.1); 1C–1E pabsb, pabsw, pabsd (SSSE3) | 13 vcvtph2ps (F16C); 16 vpermps; 18–1A vbroadcastss, vbroadcastsd, vbroadcastf128 |
20–2F | 20–25 pmovsx*; 28 pmuldq; 29 pcmpeqq; 2A movntdqa; 2B packusdw (SSE4.1) | 2C–2F vmaskmovps, vmaskmovpd |
30–3F | 30–35 pmovzx*; 37 pcmpgtq (SSE4.2); 38–3F pminsb … pmaxud (SSE4.1) | 36 vpermd |
40–5F | 40 pmulld; 41 phminposuw (SSE4.1) | 45–47 vpsrlvd/q, vpsravd, vpsllvd/q (AVX2); 48–4B and 5C–5F the AMX tile instructions; 50–53 AVX-VNNI and AVX-VNNI-INT8; 58–5A vpbroadcastd, vpbroadcastq, vbroadcasti128 |
60–7F | – | 6B–6F AMX-COMPLEX and AMX-TRANSPOSE; 72 vcvtneps2bf16; 78, 79 vpbroadcastb, vpbroadcastw |
80–8F | 80–82 invept, invvpid, invpcid; 8A, 8B movrs (o64) | 8C, 8E vpmaskmovd/q |
90–BF | – | 90–93 the AVX2 gathers; 96–BF the FMA3 instructions; B0, B1 AVX-NE-CONVERT; B4, B5 AVX-IFMA |
C0–DF | C8–CD SHA (no prefix); CF gf2p8mulb (GFNI); D8 and DC–DF with F3 Key Locker; DB–DF aesimc, aesenc, aesenclast, aesdec, aesdeclast (AES) | CB–CD with F2 SHA512; D2, D3 AVX-VNNI-INT16; DA SM3 and SM4 |
E0–FF | F0, F1 movbe (no prefix) and crc32 (F2); F5, F6 wrussd/q, wrssd/q (CET); F6 adcx (66), adox (F3); F8 movdir64b (66), enqcmd (F2), enqcmds (F3), and urdmsr, uwrmsr in register form; F9 movdiri; FA, FB encodekey128, encodekey256; FC aadd, aand, axor, aor (RAO-INT) | E0–EF CMPccXADD (o64); F2, F3, F5–F7 BMI1 and BMI2 (andn, blsr, blsmsk, blsi, bzhi, pext, pdep, mulx, bextr, shlx, sarx, shrx) |
| 0F 3A | Legacy (and most also in VEX) | VEX only |
|---|---|---|
00–0F | 08–0D roundps, roundpd, roundss, roundsd, blendps, blendpd; 0E pblendw (SSE4.1); 0F palignr (SSSE3) | 00, 01 vpermq, vpermpd; 02 vpblendd (AVX2); 04–06 vpermilps, vpermilpd, vperm2f128 (AVX) |
10–2F | 14–17 pextrb, pextrw, pextrd/q, extractps; 20–22 pinsrb, insertps, pinsrd/q (SSE4.1) | 18, 19 vinsertf128, vextractf128; 1D vcvtps2ph (F16C) |
30–4F | 40–42 dpps, dppd, mpsadbw (SSE4.1); 44 pclmulqdq | 30–33 kshiftr/kshiftl (AVX-512 masks); 38, 39 vinserti128, vextracti128; 46 vperm2i128; 48, 49 vpermil2ps, vpermil2pd (AMD); 4A–4C vblendvps, vblendvpd, vpblendvb |
50–7F | 60–63 pcmpestrm, pcmpestri, pcmpistrm, pcmpistri (SSE4.2) | 5C–5F and 68–7F the FMA4 instructions (AMD) |
C0–FF | CC sha1rnds4 (SHA); CE, CF gf2p8affineqb, gf2p8affineinvqb (GFNI); DF aeskeygenassist (AES); F0 with F3 hreset | DE vsm3rnds2 (SM3); F0 with F2 rorx (BMI2) |
How the VEX, EVEX and XOP maps relate
VEX and EVEX do not have maps of their own so much as new forms of the legacy ones: VEX and EVEX map 1 hold the AVX and AVX-512 forms of the 0F map’s SIMD instructions, at the same opcodes, and maps 2 and 3 those of 0F 38 and 0F 3A. The later maps are new.
| Map | Legacy | VEX | EVEX | Other |
|---|---|---|---|---|
| 0 | The one-byte map | – | – | REX2 with M0 = 0 |
| 1 | 0F | The AVX forms of the SSE instructions; the AVX-512 mask instructions in rows 4 and 9 | The AVX-512 and AVX10 forms | REX2 with M0 = 1 |
| 2 | 0F 38 | AVX, AVX2, FMA3, BMI, AMX … | AVX-512 and AVX10, and APX’s EVEX forms of BMI, CMPccXADD and the AMX loads | – |
| 3 | 0F 3A | AVX, AVX2, FMA4 … | AVX-512 and AVX10, and APX’s RORX | – |
| 4 | – | – | APX: the promoted legacy instructions of maps 0 and 1, with new destinations and no-flags forms, and APX’s new instructions | – |
| 5 | – | AMX-FP8 and AMX-MOVRS | AVX-512 FP16 (the half-precision forms of the 0F map’s floating-point instructions) and AVX10.2 | – |
| 6 | – | – | AVX-512 FP16 (the half-precision forms of 0F 38: FMAs, VSCALEF, VGETEXP …) and AVX10.2 | – |
| 7 | – | The MSR-IMM forms of RDMSR, WRMSRNS, URDMSR and UWRMSR | – | – |
| 8, 9, 10 | – | – | – | XOP (AMD): map 8 with an immediate, 9 without, 10 with a 32-bit immediate; TBM and LWP in 9 and 10 |
Two more opcode spaces sit inside the legacy maps: the x87
escapes D8 to DF, where ModRM picks among about a hundred
floating-point instructions, and AMD’s 3DNow! at
0F 0F, where a byte after the operands is the opcode.
Links
Reference
- Intel 64 and IA-32 Architectures Software Developer’s Manuals – volume 2, appendix A, has Intel’s opcode maps and the operand notation used here
- AMD64 Architecture Programmer’s Manual, Volume 3 – appendix A has AMD’s opcode maps, with the XOP and 3DNow! maps
- Intel Advanced Performance Extensions (Intel APX) – Intel’s introduction to APX, with a link to its architecture specification and its map 4
- x86 and amd64 instruction reference – Félix Cloutier’s web copy of the instruction pages of Intel’s manual