Instruction
MUL
Multiplies unsigned integers, producing a double-width result in rDX:rAX (AX for bytes); APX adds a form that leaves the flags unchanged.
- Extensions
- Forms
- 12 (4 Legacy, 8 EVEX)
- Data
- Intel XED v2026.08.23
MUL is the unsigned multiplication, and it has a single shape: rAX times the operand, with the whole product, twice as wide, in rDX:rAX (in AX for bytes, AH holding the upper half). RDX is written even when the upper half is 0, and no form takes an immediate or another destination.
The upper half
MUL exists for the upper half. When only the lower one is needed,
compilers use the two-operand IMUL, whose low bits are
the same for unsigned numbers and which names its registers freely: GCC
14 and Clang 23 at -O2 compile a * b on uint64_t to imul rax, rsi.
A 32-bit by 32-bit product needs no MUL either, since both factors fit
in 64-bit registers: (uint64_t)a * b with 32-bit a and b becomes two
zero-extending MOVs and a 64-bit IMUL.
The upper half of a 64-bit product is where MUL appears:
(unsigned __int128)a * bbecomes a MOV of one factor into RAX and a MUL by the other, which leaves the product exactly where the System V ABI returns an__int128, in RDX:RAX;((unsigned __int128)a * b) >> 64addsmov rax, rdx.- Unsigned division of a 64-bit value by a constant keeps the upper half
of a product with a scaled reciprocal:
x / 10becomes a MOVABS of 0xCCCCCCCCCCCCCCCD, a MUL, and a right shift of the upper half by 3 (see DIV). __builtin_mul_overflowon twouint64_ts is MUL followed byseto al: MUL sets CF and OF together when the upper half is not 0, that is when the product does not fit in 64 bits.
MULX
MULX from BMI2 is MUL with free choice of its two destination registers, one source still fixed in RDX, and no flags written. With -mbmi2, GCC uses it for the 128-bit product and Clang also for the upper half alone and the division by a constant; an overflow check still needs MUL, for its flags.
On Zen 5, AMD’s guide gives a 64-bit by 64-bit multiplication a latency of 3 cycles, fully pipelined, and one cycle more for the second result of an instruction with two destination registers, such as MUL (Section 2.10.2).
In the optimization guide
What the optimization guide says about MUL, a line per claim. Each links to the claim in the guide, with its sources and where they differ.
Bulldozer to Excavator
- Integer execution: EX1’s pipelined multiplier takes 4 cycles for operands of up to 32 bits, starting one every 2 cycles, and 6 for 64-bit operands, starting one every 4; LLVM’s model agrees.
Golden Cove and Raptor Cove
- Integer execution: A MUL of 64 by 64 bits into RDX:RAX is two micro-ops: the low half on port 1 and the high half on port 5, four cycles in LLVM’s models against three for an IMUL that keeps only the low half.
Jaguar and Puma
- Integer execution: The pipelined multiplier takes 3 cycles for operands of up to 32 bits, one a cycle, and 6 for 64-bit ones, one every 4; a form that writes two registers, such as MUL, adds a cycle to both. sources differ
Sandy Bridge and Ivy Bridge
- Integer and vector execution: Separate multipliers serve general-purpose and vector registers: a general-purpose multiply runs on port 1 at a latency of 3 cycles, a vector one on port 0 at 5 cycles for any precision, and both run one operation a cycle.
Silvermont to Goldmont Plus
- Out-of-order and in-order execution: On Silvermont the widening one-operand mul and imul come from microcode; use the two-operand imul where the high half is not needed.
Skylake to Cooper Lake
- Integer execution: A MUL of 64 by 64 bits into RDX:RAX is two micro-ops on ports 1 and 5 and takes four cycles in LLVM’s models, against three for an IMUL that keeps only the low half.
Zen and Zen+
- Integer execution: One ALU multiplies, up to 64 by 64 bits in three cycles, pipelined; a multiplication with two destination registers delivers the second a cycle later and starts only every other cycle. sources differ
Zen 2
- Integer execution: One ALU multiplies, 64 by 64 bits in three cycles and pipelined; a multiplication that writes two registers delivers the second a cycle later and starts only every other cycle.
Zen 3
- Integer execution: Only ALU 1 multiplies, 64 by 64 bits in three cycles and pipelined; a multiplication that writes two registers delivers the second one a cycle later.
Zen 4
- Integer execution: Only one ALU multiplies, 64 by 64 bits in three cycles and pipelined; a multiplication that writes two registers delivers the second one a cycle later.
Zen 5
- Integer execution: Three ALUs multiply, 64 by 64 bits in three cycles; a multiplication that writes two registers delivers the second one a cycle later.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
MUL m8
MUL_MEMb | F6 /4 | Base instruction set |
MUL r8
MUL_GPR8 | F6 /4 | Base instruction set |
MUL m16/32/64
MUL_MEMv | F7 /4 | Base instruction set |
MUL r16/32/64
MUL_GPRv | F7 /4 | Base instruction set |
MUL r8
MUL_GPR8i8_APX | EVEX.LLZ.NP.MAP4.WIG F6 /4 | APX_F |
MUL m8
MUL_MEMi8_APX | EVEX.LLZ.NP.MAP4.WIG F6 /4 | APX_F |
MUL r8 NF
MUL_GPR8i8_APX_N3 | EVEX.LLZ.NP.MAP4.WIG F6 /4 NF=1 | APX_F + APX_NCI_NDD_NF |
MUL m8 NF
MUL_MEMi8_APX_N3 | EVEX.LLZ.NP.MAP4.WIG F6 /4 NF=1 | APX_F + APX_NCI_NDD_NF |
MUL r16/32/64
MUL_GPRv_APX | EVEX.LLZ.NP.MAP4.SCALABLE F7 /4 | APX_F |
MUL m16/32/64
MUL_MEMv_APX | EVEX.LLZ.NP.MAP4.SCALABLE F7 /4 | APX_F |
MUL r16/32/64 NF
MUL_GPRv_APX_N3 | EVEX.LLZ.NP.MAP4.SCALABLE F7 /4 NF=1 | APX_F + APX_NCI_NDD_NF |
MUL m16/32/64 NF
MUL_MEMv_APX_N3 | EVEX.LLZ.NP.MAP4.SCALABLE F7 /4 NF=1 | APX_F + APX_NCI_NDD_NF |
Latency and throughput
| Model | m8 | r8 | m16 | m32 | m64 | r16 | r32 | r64 |
|---|---|---|---|---|---|---|---|---|
| Sandy Bridge | 8 / 1p1 | 3 / 1p1 | 9 / 1.33p015 | 9 / 1p015 | 9 / 1p01 | 4 / 1.33p015 | 4 / 1p015 | 4 / 1p01 |
| Haswell | 8 / 1p1 | 3 / 1p1 | 9 / 1p0156 | 9 / 1p0156 | 9 / 1p16 | 4 / 1p0156 | 4 / 1p0156 | 4 / 1p16 |
| Broadwell, Skylake, Skylake-SP, Ice Lake | 8 / 1p1 | 3 / 1p1 | 9 / 1p0156 | 9 / 1p0156 | 9 / 1p15 | 4 / 1p0156 | 4 / 1p0156 | 4 / 1p15 |
| Alder Lake, Sapphire Rapids | 8 / 1p1 | 3 / 1p1 | 10 / 1p0 p1 p5 p6 p11 | 9 / 1p0 p1 p5 p6 p11 | 9 / 1p15 | 5 / 1p0 p1 p5 p6 p11 | 4 / 1p0 p1 p5 p6 p11 | 4 / 1p15 |
| Lunar Lake | 7 / 0.33p135 | 3 / 0.33p135 | 9 / 0.67p012345 | 8 / 0.33p012345 | 8 / 0.33p012345 | 5 / 0.67p012345 | 4 / 0.33p012345 | 4 / 0.33p012345 |
| Bonnell | 7 / 7p1 | 7 / 7p01 | 8 / 8p1 | 7 / 7p1 | 12 / 12p1 | 7 / 7p01 | 6 / 6p01 | 12 / 12p01 |
| Silvermont | 8 / 5IEC1 MEC | 5 / 5IEC1 | 8 / 5IEC1 MEC | 8 / 5IEC1 MEC | 10 / 7IEC1 MEC | 5 / 5IEC1 | 5 / 5IEC1 | 7 / 7IEC1 |
| Piledriver | 8 / 4EX1 Mul | 4 / 4EX1 Mul | 8 / 5EX1 Mul | 8 / 4EX1 Mul | 10 / 6EX1 Mul | 4 / 5EX1 Mul | 4 / 4EX1 Mul | 6 / 6EX1 Mul |
| Zen | 8 / 1ALU1 Mul | 4 / 1ALU1 Mul | 8 / 1ALU1 Mul | 8 / 1ALU1 Mul | 9 / 1ALU1 Mul | 3 / 1ALU1 Mul | 3 / 1ALU1 Mul | 4 / 1ALU1 Mul |
| Zen 2 | 8 / 1ALU1 Mul | 4 / 1ALU1 Mul | 7 / 1ALU1 Mul | 7 / 1ALU1 Mul | 8 / 1ALU1 Mul | 3 / 1ALU1 Mul | 3 / 1ALU1 Mul | 4 / 1ALU1 Mul |
| Zen 3, Zen 4 | 7 / 3ALU1 | 3 / 3ALU1 | 7 / 3ALU1 | 7 / 3ALU1 | 7 / 3ALU1 | 3 / 3ALU1 | 3 / 3ALU1 | 3 / 3ALU1 |
| Jaguar | 6 / 1ALU1 Mul | 3 / 1ALU1 Mul | 6 / 3ALU1 Mul | 6 / 2ALU1 Mul | 9 / 4ALU1 Mul | 3 / 3ALU1 Mul | 3 / 2ALU1 Mul | 6 / 4ALU1 Mul |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
p = rAX * src # AL, AX, EAX or RAX times the source: a
# product of 2 * OSIZE bits
if OSIZE == 8:
ax = p # AH:AL
else: # EDX and EAX: bits 63:32 cleared
rDX = p >> OSIZE # the high half
rAX = p # the low half
if not nf: # NF=1 (APX) leaves the flags as they were
cf = of = p >> OSIZE != 0 # the high half is not zero
sf = zf = af = pf = UNDEFINEDRun on AMD Zen 5 (EPYC 9645): 120 cases. The APX forms were not run: none of these processors has APX.
Operands
| Operand | Kind | Action |
|---|---|---|
MUL r/m8 | ||
r/m8 | explicit | read |
AL | implicit | read |
AX | implicit | write |
RFLAGS | implicit | write |
MUL r/m16/32/64 | ||
r/m16/32/64 | explicit | read |
rAX | implicit | read, write |
rDX | implicit | write |
RFLAGS | implicit | write |
MUL r/m8 NF | ||
r/m8 | explicit | read |
AL | implicit | read |
AX | implicit | write |
MUL r/m16/32/64 NF | ||
r/m16/32/64 | explicit | read |
rAX | implicit | read, write |
rDX | implicit | write |
Flags
| OF | SF | ZF | AF | PF | CF |
|---|---|---|---|---|---|
| NF forms | |||||
| Not affected | |||||
| Other forms | |||||
| M | U | U | U | U | M |
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.
| ISA set | CPUID | Processors |
|---|---|---|
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 | Nova Lake, Diamond Rapids |
APX_F_N3 | APX_F + APX_NCI_NDD_NF | Same as APX_F |
More General-purpose instructions
- JCXZ
- JECXZ
- JMP
- JRCXZ
- LDS
- LEA
- LEAVE
- LES
- LFS
- LGS
- LODS
- LOOP
- LOOPE
- LOOPNE
- LSS
- MOV
- MOVS
- MOVSX
- MOVSXD
- MOVZX
- NEG
- NOP
- NOT
- OR
- OUT
- OUTS
- PAUSE
- POP
- POPA
- POPF
- PUSH
- PUSHA
- PUSHF
- RCL
- RCR
- RET
- ROL
- ROR
- SALC
- SAR
All 109 General-purpose instructions
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. - 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 2B, page 4-140 (MUL)
- Intel Advanced Performance Extensions (Intel APX) Architecture Specification, revision 9.0 (355828-009, August 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
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.