Extensions
Forms
1 (1 Legacy)
Data
Intel XED v2026.08.23

XGETBV is how a program learns which register state the operating system has agreed to save. It reads the extended control register that ECX selects into EDX:EAX, at any privilege level, once the kernel has set CR4.OSXSAVE; before that it raises #UD. ECX = 0 reads XCR0, the set of XSAVE state components that the kernel enabled with XSETBV and switches between tasks. ECX = 1 reads XCR0 ANDed with XINUSE, the components not in their initial state, on processors that report it (CPUID leaf 0DH, sub-leaf 1, EAX bit 2). Any other value raises #GP.

Checking for AVX

A CPUID bit says the processor has AVX; only XCR0 says the kernel saves YMM registers, and without that bit AVX instructions raise #UD. So the check that Intel’s optimization manual gives (Section 5.1.9) is CPUID leaf 1 for OSXSAVE (ECX bit 27) and AVX, then XGETBV with ECX = 0 for bits 1 and 2 (SSE and AVX state) both set. AVX-512 needs bits 5 to 7 as well (opmask and the two halves of the upper ZMM state), 0E6H with the others, and AMX bits 17 and 18, which Linux enables per process only on request. GCC 14 and Clang 23 at -O2 compile (_xgetbv(0) & 6) == 6 to xor ecx, ecx, XGETBV, NOT and TEST; the intrinsic needs -mxsave or an -march that has XSAVE, such as x86-64-v3 or sandybridge.

On Zen 5

The probe’s Linux 7.1 guest set XCR0 to 2E7H: x87, SSE, AVX, the three AVX-512 components and PKRU (bit 9). Zen 5 ignored bits 63:32 of RCX, reading XCR0 for 1673D8DA00000000H, cleared bits 63:32 of RAX and RDX, and raised #GP for ECX = 2. With ECX = 1 it returned 2E7H as well: every enabled component was out of its initial state. Intel’s manual says the high half of RCX is ignored; AMD’s does not mention it. AMD’s Zen 5 guide lists XGETBV as microcoded, so a program reads XCR0 once at start-up and keeps the answer, as it does CPUID’s.

Forms

Every encoding of XGETBV that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
XGETBV XGETBVNP 0F 01 D0XSAVE + OSXSAVE

Latency and throughput

What the scheduling models of LLVM 23.1.2 give for each form, not measurements: latency / reciprocal throughput in cycles, the ports under them. A row is a model, or models that agree; a dash, a form that its processors lack. Memory forms: latency from the address, ports without the load and store units. Which processors each model covers.
ModelXGETBV
Sandy Bridge100 / 0.33p015
Haswell, Broadwell, Skylake, Skylake-SP, Ice Lake2 / 0.5p0156
Alder Lake, Sapphire Rapids4 / 5p0 p1 p5 p6 p11
Lunar Lake4 / 3.33V0 V1 V2 V3 p0 p1 p2 p3 p4 p5
Piledriver100 / 0.5EX0 EX1
Zen, Zen 2100 / 0.25
Zen 3, Zen 4100 / 25ALU0 ALU1 ALU2 ALU3
Jaguar100 / 0.5ALU0 ALU1

Operation

What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.

r = cpuid_leaf(0xD, 1)               # EAX bit 2: ECX may be 1
if ecx == 0:                         # bits 63:32 of RCX do not count
    v = xcr0
elif ecx == 1 and r[0] >> 2 & 1:
    v = xinuse & xcr0
else:
    fault(GP, 0)
eax = v                              # RAX and RDX: bits 63:32 cleared
edx = v >> 32

Run on AMD Zen 5 (EPYC 9645): 3 cases.

Operands

What each form reads and writes, as Intel XED records it: the operands of its syntax, in order, and the implicit ones that the syntax does not name. How to read.
OperandKindAction
XGETBV
ECXimplicitread
EDXimplicitwrite
EAXimplicitwrite
XCR0implicitread

Flags

None: XED records no flag that the forms test or change.

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.

CPUID requirements and processors of the XED ISA sets above. Alternatives are separated by “or”; processors follow XED’s chip model, whose AMD processors end with Zen 2, and the CPU data of this site for Zen 3 to Zen 6.
ISA setCPUIDProcessors
XSAVE

XSAVE + OSXSAVE
CPUID.01H:ECX[26] XSAVE
CPUID.01H:ECX[27] OSXSAVE

XED and Intel’s SDM differ: XED also asks for the OSXSAVE bit, CPUID.01H:ECX[27], besides XSAVE, CPUID.01H:ECX[26], for XSAVE, XRSTOR, XGETBV and XSETBV. The opcode tables of revision 093 of Intel’s SDM name XSAVE alone for XSAVE and XRSTOR and give XGETBV and XSETBV no CPUID column, but the exception lists of all four raise #UD when CR4.OSXSAVE is clear, and its Volume 1 says that the OSXSAVE bit returns CR4.OSXSAVE, so in effect the two agree.

Sources: Intel XED v2026.08.23, datafiles/cpuid.xed.txt; Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026), XSAVE, XRSTOR, XGETBV and XSETBV: the opcode tables and the exception lists, from pages 6-58, 6-49, 6-36 and 6-70; Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026), section 13.3, Enabling the XSAVE Feature Set and XSAVE-Enabled Features, page 13-6.

Sandy Bridge, Ivy Bridge, 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, Goldmont, Goldmont Plus, Tremont, Snow Ridge, Lakefield, Sierra Forest, Clearwater Forest, Knights Landing, Knights Mill, Bulldozer, Piledriver, Zen, Zen+, Zen 2, Zen 3, Zen 4, Zen 5, Zen 6

More XSAVE instructions

Sources

  1. Intel XED v2026.08.23 (commit 0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model.
  2. The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s -march feature sets and AMD’s Processor Programming References, which the page of each processor cites.
  3. LLVM 23.1.2's x86 scheduling models (commit 85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them.
  4. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2D, page 6-36 (XGETBV)
  5. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
  6. Linux kernel documentation: Using XSTATE features in user space applications
  7. Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
  8. AMD64 Architecture Programmer's Manual, Volume 4: 128-Bit, 256-Bit, and 512-Bit Media Instructions (26568, rev. 3.27, July 2026)
  9. Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, October 2026)
  10. 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.