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

RDTSC reads a clock without a system call or a device access. The result arrives split, the high half in EDX and the low half in EAX; GCC 14 and Clang 23 at -O2 compile the __rdtsc() intrinsic to RDTSC followed by shl rdx, 32 and or rax, rdx.

What the counter counts:

  • On processors with an invariant TSC (CPUID 80000007H, EDX bit 8, the same bit on Intel and AMD), it ticks at a constant rate in every power and sleep state, so the operating system may use it as its clock.
  • That rate is not the core’s current clock. Intel’s optimization manual notes that on Skylake it runs at the guaranteed (P1) frequency whatever the turbo state, and Intel’s manual recommends the performance counters (see RDPMC) for counting core cycles.
  • Each logical processor has its own counter, which privileged software can write, so two of them need not agree. RDTSCP also returns a value that the operating system keeps per processor (Linux stores the CPU and node number), so a program can tell whether it moved between two readings.

RDTSC waits for nothing: it may read the counter before earlier instructions finish, and later ones may start before it reads. To time a piece of code on Intel’s processors, surround each RDTSC with LFENCEs: the one before makes the read wait for the code ahead of it, the one after keeps the code behind it from starting early. RDTSCP waits for earlier instructions by itself, so RDTSCP; LFENCE serves at the end. LFENCE does this on AMD’s processors only where it is dispatch serializing, as on Zen 5. To wait for earlier stores as well, Intel’s manual puts an MFENCE before the LFENCE; AMD’s counts MFENCE as serializing on its own.

The operating system can forbid RDTSC outside ring 0 by setting CR4.TSD, which makes it raise #GP there. Under virtualization the guest reads the host’s counter scaled and offset by values the hypervisor sets (TSC offsetting and scaling in Intel’s VMX, the TSC offset and ratio in AMD’s SVM), unless the hypervisor makes RDTSC exit to it.

In the optimization guide

What the optimization guide says about RDTSC, a line per claim. Each links to the claim in the guide, with its sources and where they differ.

Measuring

Forms

Every encoding of RDTSC that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
RDTSC RDTSC0F 31Base instruction set

Operation

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

if CPL > 0 and cr4 >> 2 & 1:     # CR4.TSD: only CPL 0 may read the
    fault(GP, 0)                 # counter
t = tsc()                        # the count at this moment: time's,
                                 # not an input of the instruction
edx = t >> 32                    # the high half; bits 63:32 of RDX
eax = low(t, 32)                 # and RAX cleared
# 66 and REX.W change nothing. Not serializing: the counter may be
# read before earlier instructions are done, or after later ones
# have started (Intel's manual: an LFENCE before or after orders it)

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
RDTSC
EAXimplicitwrite
EDXimplicitwrite
TSCimplicitread

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
PENTIUMREAL

No CPUID bit: part of the base instruction set.

Every x86-64 processor in XED’s model and Zen 3 to Zen 6

More System 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. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-559 (RDTSC)
  4. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (325384-093, September 2026)
  5. AMD64 Architecture Programmer's Manual, Volume 2: System Programming (24593, rev. 3.42, March 2024), Wayback Machine copy of AMD's PDF
  6. AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.36, March 2024), Wayback Machine copy of AMD's PDF
  7. Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, October 2026)
  8. Linux arch/x86/include/asm/segment.h: the CPU and node number in IA32_TSC_AUX

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 text is our own.