Introduction
x86 is the instruction set of Intel’s 8086 and of every processor that has run its programs since: Intel’s and AMD’s 80286, 386, 486, Pentium, Athlon, Core, Xeon, Ryzen and EPYC, and those of VIA, Cyrix and others. It has never broken with its past. A program for the 8086 of 1978 still runs on a processor of today, and each generation added registers, instructions and wider operands on top of the last, with new prefixes to reach them. x86-64, AMD’s 64-bit extension of 2003, is the form most code uses now, on Windows, Linux and older Macs.
The instructions vary in length from 1 to 15 bytes. Programs on fileformats.org that hold x86 code, the .EXE family above all, open in the explorer, which disassembles them with its own decoder: see How the explorer disassembles a program. This reference covers every instruction that decoder knows, from the 8086 to AVX10.2 and APX: how they are encoded, the opcode maps, and each instruction by family.
History
| Year | Processor | What it added |
|---|---|---|
| 1978 | Intel 8086 | The instruction set: eight 16-bit general registers, segmented addresses reaching 1 MB, string instructions, the one-byte opcode map. The 8088 of 1979, with an 8-bit bus, went into the IBM PC in 1981. |
| 1980 | Intel 8087 | The floating-point coprocessor: the x87 instructions and their register stack. |
| 1982 | Intel 80186 and 80286 | The 80186 added PUSHA, POPA, ENTER, LEAVE, BOUND, INS, OUTS and immediate forms. The 80286 added 16-bit protected mode, with descriptor tables, privilege levels and 16 MB of memory. |
| 1985 | Intel 80386 | 32 bits: 32-bit registers and addressing with the SIB byte, paging, virtual-8086 mode, FS and GS, MOVZX, MOVSX, the bit tests, SETcc and the 0F map’s long conditional jumps. |
| 1989 | Intel 80486 | The floating-point unit on the chip, BSWAP, XADD and CMPXCHG. |
| 1993 | Intel Pentium | CPUID, RDTSC, RDMSR and WRMSR, and CMPXCHG8B. |
| 1995 | Intel Pentium Pro | CMOVcc, FCMOVcc, FCOMI and UD2. |
| 1997 | Intel Pentium MMX | MMX: integer SIMD in eight 64-bit registers that share the x87 registers. |
| 1998 | AMD K6-2 | 3DNow!: single-precision SIMD on the MMX registers. |
| 1999 | Intel Pentium III | SSE: eight 128-bit xmm registers for single precision. |
| 2000 | Intel Pentium 4 | SSE2: double precision and integers in xmm registers. |
| 2003 | AMD Opteron and Athlon 64 | x86-64 (AMD64), which Intel adopted as EM64T, now Intel 64, in 2004: 64-bit registers and addresses, eight more general and xmm registers through the REX prefix, RIP-relative addressing and long mode. |
| 2004–2008 | Intel Pentium 4, Core 2, Core i7 | SSE3 and SSSE3, then SSE4.1 and SSE4.2, with three-byte opcodes in 0F 38 and 0F 3A; hardware virtualisation from Intel and AMD. |
| 2010–2011 | Intel Westmere and Sandy Bridge; AMD Bulldozer | AES-NI; AVX, with the VEX prefix, 256-bit ymm registers and three-operand forms; AMD’s XOP and FMA4. |
| 2013 | Intel Haswell | AVX2, FMA3, BMI1 and BMI2, and TSX. |
| 2016–2017 | Intel Xeon Phi (Knights Landing) and Skylake-SP | AVX-512, with the EVEX prefix: 32 zmm registers of 512 bits, the opmask registers, broadcast, rounding control. |
| 2023 | Intel Sapphire Rapids | AMX, matrix tiles for machine learning, and AVX-512 FP16. |
| 2023 onward | Intel (announced) | AVX10, a single numbered version of AVX-512’s features (AVX10.1 came with Xeon 6 in 2024; AVX10.2 adds new instructions), and APX, which adds sixteen more general registers, R16 to R31, through the REX2 prefix and an extended EVEX, with three-operand integer instructions and forms that leave the flags alone. Both are announced for Intel’s Nova Lake and Diamond Rapids. |
Modes
An x86 processor runs code in one of several modes, and the same bytes decode differently in each. For a disassembler what matters is the default operand and address size, 16, 32 or 64 bits:
- Real mode is the 8086’s: an address is a segment value × 16 plus a 16-bit offset, reaching about 1 MB, with no protection. Every x86 processor starts in it. MS-DOS programs run here. Code is 16-bit.
- 16-bit protected mode came with the 80286: segment registers hold selectors into descriptor tables, with privilege levels 0 to 3. Windows 3.x programs (NE) run here. Code is 16-bit.
- 32-bit protected mode came with the 80386, with 32-bit segments and paging. Segments are usually flat, starting at 0 and covering 4 GB. 32-bit Windows (PE32), OS/2 and DOS-extender programs (LE, LX) run here. Code is 32-bit, though a protected-mode system can also run 16-bit segments and, in virtual-8086 mode, real-mode programs.
- Long mode came with x86-64. In its 64-bit sub-mode code is 64-bit: addresses are 64 bits, operands 32 bits by default, segmentation is mostly gone, and RIP-relative addressing is the norm (PE32+). Its compatibility sub-mode runs 32-bit and 16-bit protected-mode code under a 64-bit system.
System management mode, entered by an interrupt and left with RSM, runs firmware out of sight of the operating system. The Instruction encoding page gives the operand and address size rules for each mode.
Registers
| Registers | Size | What they are | Came with |
|---|---|---|---|
| AX, BX, CX, DX, SI, DI, BP, SP | 16 bits | The general registers. AX to DX also split into bytes: AL and AH, BL and BH … Several have fixed uses: CX counts, SI and DI point into strings, SP is the stack pointer and BP the frame pointer. | 8086 |
| EAX … ESP | 32 bits | The same, widened. | 80386 |
| RAX … RSP, R8 to R15 | 64 bits | The same, widened, and eight more, reached with REX. SPL, BPL, SIL and DIL become usable as bytes. | x86-64 |
| R16 to R31 | 64 bits | Sixteen more general registers, reached with REX2 or EVEX. | APX |
| IP, EIP, RIP | 16, 32, 64 bits | The instruction pointer. | 8086 |
| FLAGS, EFLAGS, RFLAGS | 16, 32, 64 bits | The status flags (carry, zero, sign, overflow …) and control flags; see Flags and miscellaneous. | 8086 |
| CS, DS, ES, SS; FS, GS | 16 bits | The segment registers. In 64-bit mode only FS and GS still have a base, which operating systems use for thread-local data. | 8086; FS and GS 80386 |
| ST(0) to ST(7) | 80 bits | The x87 register stack, with its control, status and tag words. | 8087 |
| MM0 to MM7 | 64 bits | The MMX registers, which are the low 64 bits of the x87 registers. | Pentium MMX |
| XMM0 to XMM7; to XMM15; to XMM31 | 128 bits | The SSE registers, with the MXCSR control and status register; sixteen with x86-64, thirty-two with AVX-512. | Pentium III; x86-64; AVX-512 |
| YMM0 to YMM15; to YMM31 | 256 bits | The AVX registers, whose low halves are the xmm registers. | AVX; AVX-512 |
| ZMM0 to ZMM31 | 512 bits | The AVX-512 registers, whose low halves are the ymm registers. | AVX-512 |
| K0 to K7 | 16 or 64 bits | The AVX-512 opmask registers, one bit per vector element; 64 bits from AVX-512 BW. | AVX-512 |
| TMM0 to TMM7 | up to 1 KB | The AMX tile registers, each up to 16 rows of 64 bytes, shaped by a tile configuration. | AMX |
| BND0 to BND3 | 128 bits | The MPX bound registers; MPX has since been withdrawn. | MPX |
| CR0, CR2, CR3, CR4, CR8; DR0 to DR7 | 32 or 64 bits | The control registers (protection, paging, the page-table base, feature switches, the task priority) and the debug registers, used by the operating system. | 80386 (the 80286 had CR0’s low half as the MSW); CR4 Pentium; CR8 x86-64 |
| GDTR, IDTR, LDTR, TR | – | Where the descriptor tables and the task state segment are. | 80286 |
Processors also have hundreds of model-specific registers (MSRs), read and written with RDMSR and WRMSR, which configure everything from system calls to performance counters.
How this reference is organised
Two pages explain how instructions are put together: the Instruction encoding, byte by byte, and the Opcode maps. The instructions themselves are on one page per family. The general-purpose ones, which every processor since the 8086 has gathered, are grouped by what they do; the extensions, by set. Each family page gives, for every mnemonic the disassembler can show, its operand forms, its encoding in Intel’s notation, what it does, and the set and processor that brought it. The explorer links each instruction it shows to its row.
Instruction encoding
Prefixes, REX, REX2, VEX, EVEX, XOP, ModRM, SIB, displacements and immediates.
Opcode maps
The one-byte and 0F maps cell by cell, the groups, and how the other maps fit.
Data transfer
MOV, CMOVcc, XCHG, CMPXCHG, PUSH and POP, far pointers and I/O ports.
Arithmetic
ADD, SUB, CMP, MUL, DIV, the decimal adjustments and APX’s CCMP.
Logic, shifts and bits
AND, OR, XOR, TEST, the shifts and rotates, BT, BSF, BSR and SETcc.
Control transfer
JMP, Jcc, LOOP, CALL, RET, INT and IRET.
String instructions
MOVS, CMPS, SCAS, LODS, STOS, INS and OUTS, and the REP prefixes.
Flags and miscellaneous
The flag instructions, CPUID, RDRAND, LEA, NOP and UD2.
Bit manipulation
POPCNT, LZCNT, TZCNT, BMI1, BMI2, AMD’s TBM and ADX.
System instructions
Descriptor tables, control registers, MSRs, system calls and saving processor state.
Virtualisation
Intel VMX and AMD SVM.
Security
CET, SGX, TDX, SEV-SNP, SMX and MPX.
Transactions and synchronisation
TSX, MONITOR and MWAIT, WAITPKG, user interrupts, RAO-INT and CMPccXADD.
Cache and memory ordering
Fences, cache flushes and prefetches.
x87 floating point
The 8087’s floating-point instructions and their register stack.
MMX
Integer SIMD in the 64-bit mm registers.
3DNow!
AMD’s single-precision SIMD on the MMX registers.
SSE
Single-precision SIMD in the xmm registers.
SSE2
Double precision and 128-bit integer SIMD.
SSE3 and SSSE3
Horizontal operations, shuffles and absolute values.
SSE4
SSE4.1, SSE4.2 with its string compares and CRC32, and AMD’s SSE4a.
Cryptography
AES, SHA, GFNI, SM3, SM4, Key Locker and VIA PadLock.
AVX and F16C
256-bit ymm vectors and the VEX encoding.
AVX2 and later VEX
256-bit integers, gathers, and the later VEX extensions such as AVX-VNNI.
FMA3 and FMA4
Fused multiply-add, Intel’s and AMD’s.
XOP
AMD’s extended operations in the XOP maps.
AVX-512 Foundation
512-bit zmm vectors with masking, broadcast and rounding.
AVX-512 mask registers
The instructions on k0 to k7.
AVX-512 BW, DQ and CD
Bytes and words, doublewords and quadwords, conflict detection.
Later AVX-512
VBMI, VNNI, BITALG, BF16 and the rest, and the Xeon Phi sets.
AVX-512 FP16
Half-precision arithmetic in EVEX maps 5 and 6.
AVX10
The instructions AVX10.2 adds.
AMX
Tile registers and matrix multiplication.
APX
The extended general registers and APX’s own instructions.
How the explorer disassembles a program
Drop a program on any page of fileformats.org and the explorer opens it. Beside its structure and its resources, a program’s Code section lists its code regions (each executable section of a PE file, each code segment of an NE file, each object of an LE or LX file, the load module of an MZ file), with the address, size and mode of each. The mode comes from the file: 16-bit for MZ and for the DOS stub of a newer program, 16-bit for NE segments unless a segment is flagged as 32-bit, 16- or 32-bit for LE and LX by the object’s flags, 32-bit for PE32 and 64-bit for PE32+. Opening a region shows its disassembly.
Most disassemblers decode the first instruction, then the one after it, and so on. That shows one reading of the bytes, but x86 instructions have no fixed length or alignment, and code can jump into the middle of an instruction, which then reads as something else. Obfuscated code and copy protection do it on purpose, and data mixed into code makes a linear reading lose step. So the explorer decodes an instruction at every byte, and lays them out in columns, one row per byte:
- going through the bytes in order, each instruction goes in the lowest column that is free at its first byte;
- it holds that column for as many rows as it has bytes;
- so column 0 is the plain disassembly from the start of the region, and the other columns hold the instructions that start inside an instruction to their left. Since an instruction is at most 15 bytes long, there are never more than 15 columns.
Here are nine bytes of 32-bit code at 0x401000, a well-known trick: a short jump over
one junk byte, E8, which a linear disassembler takes as the start of a
call.
| Address | Byte | Column 0 | Column 1 | Column 2 | Column 3 |
|---|---|---|---|---|---|
401000 | EB | jmp 0x401003 | |||
401001 | 01 | add eax, ebp | |||
401002 | E8 | call 0x4011bf | |||
401003 | B8 | mov eax, 0x1 | |||
401004 | 01 | add dword ptr [eax], eax | |||
401005 | 00 | add byte ptr [eax], al | |||
401006 | 00 | add byte ptr [eax], al | |||
401007 | 00 | add bl, al | |||
401008 | C3 | ret |
EB 01 E8 B8 01 00 00 00 C3: each instruction spans the rows of its bytes. Column 0 reads jmp, call, add bl, al, the misleading linear disassembly. The jump goes to 0x401003, and column 1 there holds what really runs: mov eax, 0x1 and ret.In the explorer, selecting an instruction shows its address and bytes, its text, the
instruction set it belongs to and the processor that brought it, any problem with it
(such as a LOCK prefix it cannot take), and a link to its row in this reference. For a
jump or call, Go to target scrolls to the target and selects the instruction that starts
there, in whichever column it is: here the mov in column 1. Enter follows a
branch and Backspace goes back. Entry points, exports and imported functions are named
where instructions point at them.
The decoder is fileformats.org’s own, written for the explorer from Intel’s and AMD’s manuals and the extensions’ specifications. Its text matches llvm-objdump’s Intel syntax, and it was tested against LLVM over the whole opcode space in 16-, 32- and 64-bit code; the few deliberate differences are listed on the Instruction encoding page.
Links
Reference
- Intel 64 and IA-32 Architectures Software Developer’s Manuals – Intel’s manuals: volume 1 for the architecture, volume 2 for each instruction and the opcode maps, volume 3 for system programming
- AMD64 Architecture Programmer’s Manual, Volume 3 – AMD’s reference to the general-purpose and system instructions, with the opcode maps
- AMD64 Architecture Programmer’s Manual, Volume 1 – AMD’s overview of the architecture, its modes and registers
- Intel Advanced Performance Extensions (Intel APX) – Intel’s introduction to APX, with a link to its architecture specification
- x86 and amd64 instruction reference – Félix Cloutier’s web copy of the instruction pages of Intel’s manual