Instruction
OUT
Writes AL, AX or EAX to an I/O port, given as an immediate or in DX, if IOPL or the TSS permission bitmap allows.
- Extensions
- Forms
- 4 (4 Legacy)
- Data
- Intel XED v2026.08.23
OUT writes AL, AX or EAX to an I/O port: the reverse of IN, with the same port numbers, an immediate byte for ports 0 to FFH or DX for any of the 65,536, and the same rules for wider accesses, which cover consecutive ports. As with IN, REX.W does not widen it: AMD’s manual says a 64-bit operand size still writes 32 bits. OUTS writes a run of elements from memory.
Permission
OUT is I/O-sensitive. In protected and 64-bit mode it runs when CPL is at most IOPL; otherwise every port it writes must have its bit clear in the I/O permission bit map of the task state segment, and anything else raises #GP(0) before the port is touched. The IN page gives the details of the map, which reads and writes share.
The probe runs at CPL 3 with IOPL 0. There, Zen 5 raised #GP for each form at each operand size, with ports 80H and FFH as immediates and 3F8H and FFFFH in DX.
A write that is never buffered
Stores to memory wait in a write buffer; OUT does not. Intel’s Volume 1 says that the processor never buffers writes to the I/O space, and that the instruction after an OUT does not start until the OUT and every earlier store have completed (Section 20.6, Table 20-1). AMD’s Volume 2 says the same of I/O instructions in general (Section 7.5.1). A command written with OUT has thus left the processor before the next instruction runs, although Intel adds that a chipset may still post some I/O writes.
From C
glibc’s <sys/io.h> provides outb(value, port) and its wider
siblings as inline assembly, with the value first, unlike the
instruction’s operand order in Intel syntax. GCC 14 and Clang 23 at -O2
compile outb(v, 0x80) to a move of the value into EAX and an OUT to
the immediate port 80H, and a variable port goes through EDX.
Under a hypervisor, OUT is checked against the same VMX I/O bitmaps or SVM I/O permissions map as IN, and an exit tells the hypervisor the port, the size and the direction. AMD’s Zen 5 guide lists OUT as microcoded.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
OUT imm8, AL
OUT_IMMb_AL | E6 ib | Base instruction set |
OUT imm8, eAX
OUT_IMMb_OeAX | E7 ib | Base instruction set |
OUT DX, AL
OUT_DX_AL | EE | Base instruction set |
OUT DX, eAX
OUT_DX_OeAX | EF | Base instruction set |
Latency and throughput
| Model | imm8, AL | imm8, eAX | imm8, eAX | DX, AL | DX, eAX | DX, eAX |
|---|---|---|---|---|---|---|
| Sandy Bridge | 100 / 0.33p015 | 100 / 0.33p015 | 100 / 0.33p015 | 100 / 0.33p015 | 100 / 0.33p015 | 100 / 0.33p015 |
| Haswell | 36 / 5p0123567 | 36 / 5p0123567 | 36 / 5p0123567 | 36 / 5p0123567 | 36 / 5p0123567 | 36 / 5p0123567 |
| Broadwell, Skylake, Skylake-SP | 35 / 5p0123567 | 35 / 5p0123567 | 35 / 5p0123567 | 35 / 5p0123567 | 35 / 5p0123567 | 35 / 5p0123567 |
| Ice Lake | 35 / 5p01235678 | 35 / 5p01235678 | 35 / 5p01235678 | 35 / 5p01235678 | 35 / 5p01235678 | 35 / 5p01235678 |
| Alder Lake, Sapphire Rapids | 35 / 15.33p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 | 35 / 17p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 | 35 / 18.33p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 | 35 / 15.5p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 | 35 / 16.5p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 | 35 / 18p0 p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 |
| Lunar Lake | 100 / 0.17p012345 | 100 / 0.17p012345 | 100 / 0.17p012345 | 100 / 0.17p012345 | 100 / 0.17p012345 | 100 / 0.17p012345 |
| Bonnell | 72 / 36p01 | 72 / 36p01 | 72 / 36p01 | 68 / 34p01 | 68 / 34p01 | 68 / 34p01 |
| Silvermont | 100 / 1FPC0 | 100 / 1FPC0 | 100 / 1FPC0 | 100 / 1FPC0 | 100 / 1FPC0 | 100 / 1FPC0 |
| Piledriver | 100 / 0.5EX0 EX1 | 100 / 0.5EX0 EX1 | 100 / 0.5EX0 EX1 | 100 / 0.5EX0 EX1 | 100 / 0.5EX0 EX1 | 100 / 0.5EX0 EX1 |
| Zen, Zen 2 | 100 / 0.25 | 100 / 0.25 | 100 / 0.25 | 100 / 0.25 | 100 / 0.25 | 100 / 0.25 |
| Zen 3, Zen 4 | 100 / 25ALU0 ALU1 ALU2 ALU3 | 100 / 25ALU0 ALU1 ALU2 ALU3 | 100 / 25ALU0 ALU1 ALU2 ALU3 | 100 / 25ALU0 ALU1 ALU2 ALU3 | 100 / 25ALU0 ALU1 ALU2 ALU3 | 100 / 25ALU0 ALU1 ALU2 ALU3 |
| Jaguar | 100 / 0.5ALU0 ALU1 | 100 / 0.5ALU0 ALU1 | 100 / 0.5ALU0 ALU1 | 100 / 0.5ALU0 ALU1 | 100 / 0.5ALU0 ALU1 | 100 / 0.5ALU0 ALU1 |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
p = port.read() # imm8: ports 0 to FFH; DX: 0 to FFFFH
n = src.bits # AL, AX or EAX; REX.W does not make
# it RAX
if CPL > iopl and not io_allowed(p, n):
fault(GP, 0) # as in the probe's cases: CPL 3,
# IOPL 0, the port not allowed
io_write(p, n, src)Run on AMD Zen 5 (EPYC 9645): 16 cases. Every one raised an exception, at CPL 3, where the probe runs.
Operands
| Operand | Kind | Action |
|---|---|---|
OUT imm8, AL OUT imm8, eAX | ||
imm8 | explicit | read |
AL, eAX | explicit | read |
RFLAGS | implicit | read |
OUT DX, AL OUT DX, eAX | ||
DX | explicit | read |
AL, eAX | explicit | read |
RFLAGS | implicit | read |
Flags
| IOPL |
|---|
| All forms |
| T |
Attributes
What else XED records about the forms. How to read.
OUT imm8, ALOUT imm8, eAX- may abort a TSX transaction
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
| ISA set | CPUID | Processors |
|---|---|---|
I86 | No CPUID bit: part of the base instruction set. | Every x86-64 processor in XED’s model and Zen 3 to Zen 6 |
More General-purpose instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s
-marchfeature sets and AMD’s Processor Programming References, which the page of each processor cites. - LLVM 23.1.2's x86 scheduling models (commit
85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-171 (OUT)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (325384-093, September 2026)
- AMD64 Architecture Programmer's Manual, Volume 2: System Programming (24593, rev. 3.46, October 2026)
- AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.39, October 2026)
- Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The timings come from LLVM's scheduling models, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.