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

XTEST tells code whether it is running inside a transaction: it clears ZF inside one, whether XBEGIN started it (RTM) or an XACQUIRE-prefixed lock instruction (HLE, lock elision), and sets ZF outside. CF, OF, SF, PF and AF are cleared either way; no register or memory changes. It is three bytes, 0F 01 D6, with no operands.

Why code asks

Some instructions end every transaction: CPUID and PAUSE on any processor, Intel’s manual says, and on some processors x87 and MMX code, SYSCALL, VZEROUPPER and many more. A function that may be called both inside and outside a transaction, a spin-wait with PAUSE or a call into the kernel, can check XTEST first and take another path, or abort deliberately with XABORT and a code saying why. With HLE, XTEST is the only sign: the elided lock looks taken to the code that holds it, so nothing else shows the difference.

With -mrtm, GCC 14 and Clang 23 at -O2 compile _xtest() to xor eax, eax, xtest and setne al: the intrinsic returns 1 inside a transaction and 0 outside, the opposite sense of ZF.

Which CPUID bit

Intel’s manual lets XTEST run when the processor has either HLE, CPUID.(EAX=7,ECX=0):EBX[4], or RTM, EBX[11], and raises #UD only when both are clear. XED’s records, and with them this page’s CPUID requirement, ask for RTM alone; its Operation section follows Intel’s manual. So on a processor with HLE and no RTM, XTEST is valid even though XBEGIN is not. XBEGIN’s page says where Intel disables TSX.

AMD’s manual defines no XTEST and marks both bits reserved. On this site’s Zen 5, whose CPUID reports neither, #UD was the result of both recorded cases.

Forms

Every encoding of XTEST that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
XTEST XTESTNP 0F 01 D6RTM

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.
ModelXTEST
Haswell, Broadwell, Skylake, Skylake-SP, Ice Lake100 / 0.25p0156
Sapphire Rapids100 / 0.6p0 p1 p5 p6 p11

Operation

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

r = cpuid_leaf(7, 0)[1]
if not r >> 4 & 1 and not r >> 11 & 1:
    fault(UD)                    # CPUID: neither HLE nor RTM
zf = 0 if rtm_active or hle_active else 1
cf = of = sf = pf = af = 0
# inside a transaction ZF is clear. XED's records ask CPUID for RTM
# alone; Intel's manual takes HLE as well

Run on AMD Zen 5 (EPYC 9645): 2 cases. Its cases ran where CPUID reported no RTM, and every one raised an exception.

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
XTEST
RFLAGSimplicitwrite

Flags

M modified, 0 cleared; blank: not affected. How to read.
OFSFZFAFPFCF
All forms
00M000

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.

More RTM 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. LLVM 23.1.2's x86 scheduling models (commit 85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them.
  3. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2D, page 6-73 (XTEST)
  4. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
  5. AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.38, July 2026)

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.