Instruction
INVPCID
Invalidates TLB entries and paging-structure caches for one address, one process-context identifier or all of them, as the type in a register selects.
INVPCID drops translations from this logical processor’s TLBs and paging-structure caches by process-context identifier (PCID), the 12-bit tag that CR3 carries while CR4.PCIDE is set, so that the TLB can hold the translations of several address spaces at once. INVLPG reaches only the current PCID; INVPCID names its own in a 16-byte descriptor in memory, with the PCID in bits 11:0, zeros in bits 63:12 and a linear address in bits 127:64. The register operand, 64 bits in 64-bit mode and 32 bits outside it, gives the type.
Four types
- 0: one address under one PCID, global translations kept.
- 1: every translation of one PCID, global ones kept.
- 2: every translation of every PCID, global ones too.
- 3: every translation of every PCID except global ones.
Each drops every entry of a page held as several smaller entries, and types 0, 1 and 3 may drop more than they name. A type above 3, a set bit in 63:12 or, for type 0, a non-canonical address raises #GP(0). With CR4.PCIDE clear, the processor caches PCID 0 alone: types 0 and 1 then need PCID 0 or raise #GP(0), and types 2 and 3 reach only PCID 0.
Where the vendors differ
AMD documents the same encoding, 66 0F 38 82, the same types and the same CPUID bit, leaf 7, EBX bit 10. Its manual makes INVPCID serializing; Intel’s list of serializing instructions does not name it. AMD’s makes it raise #UD in real mode, where Intel’s lets it run, and in virtual-8086 mode, where Intel’s gives #GP(0). Under VMX, a guest gets #UD unless its hypervisor sets the “enable INVPCID” control.
In Linux
Linux 7.3 names the four types in arch/x86/include/asm/invpcid.h. With page-table isolation, a process has a kernel PCID and a user PCID, and arch/x86/mm/tlb.c follows INVLPG with a type 0 for the user one; it flushes global pages with type 2 rather than two writes to CR4.
Running it
INVPCID runs only at CPL 0. The Zen 5 behind this site’s recorded cases
reports it in CPUID, and raised #GP in both cases, at CPL 3, with types
0 and 3. AMD’s Zen 5 guide lists INVPCID as microcoded, and says that
support for it varies by model. GNU as 2.44 assembles it, but GCC 14 has
neither an intrinsic nor an option for it; Clang 23 provides
_invpcid(type, descriptor) with -minvpcid and zero-extends the 32-bit
type into RAX.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
INVPCID r64, m128 64-bit mode only
INVPCID_GPR64_MEMdq | 66 0F 38 82 /r | INVPCID |
INVPCID r32, m128 not in 64-bit mode
INVPCID_GPR32_MEMdq | 66 0F 38 82 /r | INVPCID |
INVPCID r64, m128
INVPCID_GPR64i64_MEMi128_APX | EVEX.LLZ.F3.MAP4.WIG F2 /r | APX_F + INVPCID |
Latency and throughput
| Model | r64, m128 |
|---|---|
| Haswell, Broadwell, Skylake, Skylake-SP, Ice Lake, Alder Lake, Sapphire Rapids | 100 / 0.25p0156 |
| Zen 3, Zen 4 | 100 / 25ALU0 ALU1 ALU2 ALU3 |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
if CPL > 0:
fault(GP, 0)
t = kind.read() # 64 bits; 32 outside 64-bit mode
d = desc.read() # 128 bits
if t > 3:
fault(GP, 0)
if d >> 12 & 0xFFFFFFFFFFFFF:
fault(GP, 0) # bits 63:12 must be 0
pcid = d & 0xFFF # bits 11:0
a = d >> 64 # bits 127:64, for type 0
if t < 2 and pcid and not cr4 >> 17 & 1:
fault(GP, 0) # without PCIDs, PCID 0 alone
if t == 0 and not canonical(a):
fault(GP, 0)
# type 0 drops the translations of address a under the PCID, but
# global ones; 1 all of the PCID's but global ones; 2 every one, of
# every PCID, global ones too; 3 every one but global ones. Each may
# drop moreRun on AMD Zen 5 (EPYC 9645): 2 cases. Every one raised an exception, at CPL 3, where the probe runs. The APX forms were not run: none of these processors has APX. The forms that 64-bit mode lacks were not run: the probe runs in 64-bit mode.
Operands
| Operand | Kind | Action |
|---|---|---|
INVPCID r32, m128 not in 64-bit mode INVPCID r64, m128 64-bit mode only | ||
r32/64 | explicit | read |
m128 | explicit | read |
Flags
None: XED records no flag that the forms test or change.
Exceptions
The exception class is XED's name for the set of exception conditions that a form follows. How to read.
- Legacy forms
- none in XED
- EVEX forms
APX-EVEX-INVPCID
Attributes
What else XED records about the forms. How to read.
- All forms
- privileged: CPL 0 only; may abort a TSX transaction
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to INVPCID, each with the form it compiles to and the Clang options it needs. The forms come from compiling every intrinsic and decoding the result with Intel XED; all intrinsics A–Z explains the method.
| Intrinsic | Compiles to |
|---|---|
_invpcid
void _invpcid(unsigned int __type, void *__descriptor) |
|
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 |
|---|---|---|
INVPCID | INVPCID | Haswell, Broadwell, Skylake, Comet Lake, Cannon Lake, Ice Lake (client), Tiger Lake, Alder Lake, Arrow Lake, Panther Lake, Nova Lake, Skylake-SP, Cascade Lake, Cooper Lake, Ice Lake (server), Sapphire Rapids, Emerald Rapids, Granite Rapids, Diamond Rapids, Sierra Forest, Clearwater Forest, Zen 3, Zen 4, Zen 5, Zen 6 |
APX_F_INVPCID | APX_F + INVPCID | Nova Lake, Diamond Rapids |
More APX 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. - Clang's x86 intrinsic headers, LLVM 23.1.2 (commit
85ac56026243): the intrinsics, their signatures and doc comments, and the Clang of that release, which compiled each of them. - 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 2A, page 3-487 (INVPCID)
- Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (325384-093, September 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
- Linux 7.3: arch/x86/mm/tlb.c, arch/x86/include/asm/tlb.h and invpcid.h, arch/x86/kernel/cpu/amd.c (TLB flushes with INVPCID, INVLPGB and TLBSYNC)
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 intrinsics and their signatures come from Clang and the timings from LLVM's scheduling models, both part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.