Extensions
Forms
12 (4 Legacy, 8 EVEX)
Data
Intel XED v2026.08.23

DIV divides an unsigned dividend twice the operand’s width by the operand: RDX:RAX by a 64-bit divisor, EDX:EAX by a 32-bit one, DX:AX by a 16-bit one, and AX by a byte. The quotient goes to the low half (rAX, or AL) and the remainder to the high half (rDX, or AH), so one DIV yields both a / b and a % b; GCC 14 and Clang 23 at -O2 compile a function that needs both to a single DIV.

Setting up the dividend

Dividing one register by another needs a zero upper half: compilers emit xor edx, edx before div rsi, and for bytes they load the dividend with movzx eax, dil, which clears AH. Signed division is IDIV, after CQO, CDQ or CWD has copied the sign of rAX into every bit of rDX.

Divide errors

DIV raises #DE in two cases: a divisor of 0, and a quotient too wide for the low half, which happens exactly when the upper half of the dividend is not less than the divisor, so a stale value left in RDX gives a wrong result at best and #DE at worst. #DE is a fault: the saved RIP points at the DIV itself, and a handler that returns without changing anything runs it again. Zen 5 raised #DE in the recorded cases of both kinds. Linux 7.3 hands #DE to the program as SIGFPE with si_code FPE_INTDIV, which shells report as “Floating point exception”, the name of that signal, although no floating point is involved.

Division by a constant

When the divisor is known at compile time, compilers avoid DIV and multiply by a scaled reciprocal instead and keep the high bits of the product. GCC 14 and Clang 23 compile x / 10 for a 32-bit unsigned x to a multiplication by 0xCCCCCCCD, which is 2^35 / 10 rounded up, followed by a right shift by 35; the result equals the quotient for every 32-bit x. A power of two needs only a shift: SHR for unsigned values, and for signed ones SAR after a correction that makes the division round toward zero (see CMOVcc).

In the optimization guide

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

Bulldozer to Excavator

  • Integer execution: DIV and IDIV are microcoded, and their time grows with the width of the dividend’s value on Bulldozer and of the quotient’s from Piledriver on, up to 76 and 72 cycles for 64-bit operands, so a division by a constant is best done by multiplying. sources differ

Golden Cove and Raptor Cove

  • Integer execution: Integer division runs on port 1; LLVM’s models give a 32-bit DIV 15 cycles and a 64-bit one 18, the latter three micro-ops that keep port 1 busy for three cycles.

Haswell and Broadwell

  • Integer execution and bypass: A 64-bit integer divide is much slower than a 32-bit one, so LLVM, tuning for Haswell or Broadwell, uses the 32-bit divide when both 64-bit operands turn out positive and below 2^32. sources differ

Ice Lake to Rocket Lake

  • Integer execution: A new integer divider on port 1 makes DIV and IDIV much faster than on Skylake, in latency and in throughput; neither Intel nor Agner Fog gives numbers. sources differ

Jaguar and Puma

  • Integer execution: The radix-4 divider produces two quotient bits a cycle: AMD’s spreadsheet gives DIV and IDIV at most 25 cycles with 32-bit operands and 41 with 64-bit ones, ending early when the quotient is small. sources differ

Sandy Bridge and Ivy Bridge

  • Integer and vector execution: One divider, on port 0, serves integer division and also the square root and floating-point division operations, so only one of them runs at a time; LLVM’s model gives an 8-, 16-, 32- or 64-bit integer divide the same 25-cycle latency and a throughput of one every 10 cycles.

Silvermont to Goldmont Plus

Skylake to Cooper Lake

  • Integer execution: Integer division is slow: LLVM’s models give a 64-bit DIV 76 cycles and 32 micro-ops and a 64-bit IDIV 102 cycles, against 18 on Golden Cove.

Zen and Zen+

  • Integer execution: The divider, on ALU 2, yields two bits of the quotient a cycle: AMD’s spreadsheet gives a 64-bit DIV 41 cycles and a 32-bit one 25, as LLVM’s model does.

Zen 2

  • Integer execution: The divider produces two bits of the quotient a cycle, so division is slow: AMD’s spreadsheet gives a 64-bit DIV 41 cycles and a 32-bit one 25, as LLVM’s model does, far more than on Zen 3.

Zen 3

  • Integer execution: Division runs on ALU 0 and takes about 8 cycles plus 1 for every 9 bits of the quotient, and a typical 64-bit division can start every 8 cycles. sources differ

Zen 4

  • Integer execution: xor edx, edx before DIV, or CDQ or CQO before IDIV, with the same operand size and a divisor in a register other than rDX, saves a macro-op: the pair is dispatched as one fewer.
  • Integer execution: Division takes about 8 cycles plus 1 for every 9 bits of the quotient, and a typical 64-bit division can start every 8 cycles. sources differ

Zen 5

  • Integer execution: Division takes about 8 cycles plus 1 for every 9 bits of the quotient, and a typical 64-bit division can start every 8 cycles.

Vulnerability mitigations

Mitigations of these processor vulnerabilities use DIV:

Forms

Every encoding of DIV that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
DIV m8 DIV_MEMbF6 /6Base instruction set
DIV r8 DIV_GPR8F6 /6Base instruction set
DIV m16/32/64 DIV_MEMvF7 /6Base instruction set
DIV r16/32/64 DIV_GPRvF7 /6Base instruction set
DIV r8 DIV_GPR8i8_APXEVEX.LLZ.NP.MAP4.WIG F6 /6APX_F
DIV m8 DIV_MEMi8_APXEVEX.LLZ.NP.MAP4.WIG F6 /6APX_F
DIV r8 NF DIV_GPR8i8_APX_N3EVEX.LLZ.NP.MAP4.WIG F6 /6 NF=1APX_F + APX_NCI_NDD_NF
DIV m8 NF DIV_MEMi8_APX_N3EVEX.LLZ.NP.MAP4.WIG F6 /6 NF=1APX_F + APX_NCI_NDD_NF
DIV r16/32/64 DIV_GPRv_APXEVEX.LLZ.NP.MAP4.SCALABLE F7 /6APX_F
DIV m16/32/64 DIV_MEMv_APXEVEX.LLZ.NP.MAP4.SCALABLE F7 /6APX_F
DIV r16/32/64 NF DIV_GPRv_APX_N3EVEX.LLZ.NP.MAP4.SCALABLE F7 /6 NF=1APX_F + APX_NCI_NDD_NF
DIV m16/32/64 NF DIV_MEMv_APX_N3EVEX.LLZ.NP.MAP4.SCALABLE F7 /6 NF=1APX_F + APX_NCI_NDD_NF

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.
Modelm8r8m16m32m64r16r32r64
Sandy Bridge30 / 10SBDivider p025 / 10SBDivider p030 / 10SBDivider p030 / 10SBDivider p030 / 10SBDivider p025 / 10SBDivider p025 / 10SBDivider p025 / 10SBDivider p0
Haswell29 / 10HWDivider p022 / 1p015629 / 10HWDivider p029 / 10HWDivider p029 / 10HWDivider p098 / 8p015698 / 8p015698 / 8p0156
Broadwell34 / 2p015625 / 10BWDivider p034 / 2p015634 / 2p015634 / 2p015680 / 8p015680 / 8p015680 / 8p0156
Skylake29 / 10SKLDivider p025 / 10SKLDivider p029 / 10SKLDivider p029 / 10SKLDivider p029 / 10SKLDivider p076 / 8p015676 / 8p015676 / 8p0156
Skylake-SP29 / 10SKXDivider p025 / 10SKXDivider p029 / 10SKXDivider p029 / 10SKXDivider p029 / 10SKXDivider p076 / 8p015676 / 8p015676 / 8p0156
Ice Lake29 / 10ICXDivider p025 / 10ICXDivider p029 / 10ICXDivider p029 / 10ICXDivider p029 / 10ICXDivider p076 / 8p015676 / 8p015676 / 8p0156
Alder Lake, Sapphire Rapids22 / 3p117 / 3p120 / 3p0 p1 p5 p6 p1119 / 3p0 p1 p5 p6 p1123 / 3p116 / 3p0 p1 p5 p6 p1115 / 3p0 p1 p5 p6 p1118 / 3p1
Lunar Lake22 / 3p117 / 3p120 / 3p01234519 / 3p01234522 / 3p116 / 3p01234515 / 3p01234518 / 3p1
Bonnell68 / 68p150 / 50p0150 / 50p150 / 50p1130 / 130p150 / 50p0150 / 50p01130 / 130p01
Silvermont29 / 25SLMDivider25 / 25IEC0 IEC1 SLMDivider29 / 25SLMDivider29 / 25SLMDivider29 / 25SLMDivider25 / 25IEC0 IEC1 SLMDivider25 / 25IEC0 IEC1 SLMDivider25 / 25IEC0 IEC1 SLMDivider
Piledriver16 / 12Div EX112 / 12Div EX119 / 15Div EX118 / 14Div EX118 / 14Div EX115 / 15Div EX114 / 14Div EX114 / 14Div EX1
Zen, Zen 219 / 15ALU2 Divider15 / 15ALU2 Divider21 / 17ALU2 Divider29 / 25ALU2 Divider45 / 41ALU2 Divider17 / 17ALU2 Divider25 / 25ALU2 Divider41 / 41ALU2 Divider
Zen 314 / 10ALU010 / 10ALU015 / 11ALU017 / 13ALU021 / 17ALU011 / 11ALU013 / 13ALU017 / 17ALU0
Zen 413 / 9ALU09 / 9ALU014 / 10ALU016 / 12ALU022 / 18ALU010 / 10ALU012 / 12ALU018 / 18ALU0
Jaguar15 / 12ALU1 Div12 / 12ALU1 Div20 / 17ALU1 Div28 / 25ALU1 Div44 / 41ALU1 Div17 / 17ALU1 Div25 / 25ALU1 Div41 / 41ALU1 Div

Operation

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

d = src.read()
if d == 0:
    fault(DE)                    # a divide by zero
if OSIZE == 8:
    n = ax                       # the dividend: AX, DX:AX, EDX:EAX or
else:                            # RDX:RAX
    n = rDX << OSIZE | rAX
q = n // d
if q >> OSIZE != 0:
    fault(DE)                    # the quotient does not fit in rAX
if OSIZE == 8:
    al = q
    ah = n % d                   # the remainder
else:                            # EAX and EDX: bits 63:32 cleared
    rAX = q
    rDX = n % d                  # the remainder
if not nf:                       # NF=1 (APX) leaves the flags as they were
    of = sf = zf = af = pf = cf = UNDEFINED

Run on AMD Zen 5 (EPYC 9645): 72 cases. The APX forms were not run: none of these processors has APX.

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
DIV r/m8
r/m8explicitread
AXimplicitread, write
RFLAGSimplicitwrite
DIV r/m16/32/64
r/m16/32/64explicitread
rAXimplicitread, write
rDXimplicitread, write
RFLAGSimplicitwrite
DIV r/m8 NF
r/m8explicitread
AXimplicitread, write
DIV r/m16/32/64 NF
r/m16/32/64explicitread
rAXimplicitread, write
rDXimplicitread, write

Flags

U undefined; blank: not affected. How to read.
OFSFZFAFPFCF
NF forms
Not affected
Other forms
UUUUUU

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-INT

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
I86

No CPUID bit: part of the base instruction set.

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

APX_F
CPUID.(EAX=07H,ECX=1):EDX[21] APX_F

Nova Lake, Diamond Rapids
APX_F_N3

APX_F + APX_NCI_NDD_NF
CPUID.(EAX=07H,ECX=1):EDX[21] APX_F
CPUID.(EAX=29H,ECX=0):EBX[0] APX_NCI_NDD_NF

Same as APX_F

More General-purpose instructions

All 109 General-purpose instructions

More APX instructions

All 88 APX 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 2A, page 3-264 (DIV)
  5. Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 2026)
  6. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3 (325384-093, September 2026)
  7. AMD64 Architecture Programmer's Manual, Volume 3: General-Purpose and System Instructions (24594, rev. 3.39, October 2026)
  8. Linux 7.3: arch/x86/kernel/traps.c, lines 375-384 (#DE becomes SIGFPE with FPE_INTDIV)

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.