Instruction
MULX
Multiplies rDX by an unsigned operand and writes the high and low halves of the product to two registers without touching the flags.
MULX multiplies RDX, or EDX for 32 bits, by its source, unsigned, and
writes the double-width product to two registers of its choice without
touching the flags. In Intel syntax the register for the high half
comes first: mulx r9, r8, rsi puts the upper 64 bits of RDX * RSI
in R9 and the lower 64 bits in R8. MUL instead takes
its other factor from RAX, always writes RDX:RAX and sets CF and OF.
Why no flags
Multiplying integers of several words adds partial products in carry chains, and the flags MUL writes would break a chain of ADC between two steps. MULX leaves CF and OF alone, so its products can be interleaved with ADC, or with ADCX and ADOX, which carry through CF and OF only and so run two chains at once. Intel’s optimization manual shows such a carry chain and says that MULX can speed up computations on large integers, such as RSA’s, significantly (Section 14.5.1.1). The free choice of destinations also saves the moves that MUL’s fixed registers need.
One register for both halves
If both destinations name the same register, it ends up holding the
high half, as the page’s pseudocode writes it last; Zen 5 did so in
every recorded case. Clang 23 uses this: with -march=x86-64-v3 at
-O2 it compiles the high half of a 64-bit product,
(unsigned __int128)a * b >> 64, to mulx rax, rax, rdi, and does
the same for the multiplication by a reciprocal that replaces
x / 10. GCC 14 keeps MUL for both, and uses MULX for the full
128-bit product. The intrinsic _mulx_u64(a, b, &hi) returns the low
half and stores the high one; both compilers emit MULX and a store.
Speed
The instruction table of AMD’s Zen 5 guide lists MULX as two macro-ops with a latency of four cycles, on the multiplier that three of Zen 5’s integer ALUs have (Section 2.10.2). Intel’s optimization manual places it, with MUL and IMUL, on the single “slow integer” unit of Golden Cove (Table 2-4).
MULX belongs to BMI2, part of x86-64-v3; APX adds an EVEX form that reaches its new registers.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
MULX r32, r32, r32
MULX_GPR32d_GPR32d_GPR32d | VEX.LZ.F2.0F38.W0 F6 /r | BMI2 |
MULX r32, r32, m32
MULX_GPR32d_GPR32d_MEMd | VEX.LZ.F2.0F38.W0 F6 /r | BMI2 |
MULX r64, r64, r64 64-bit mode only
MULX_GPR64q_GPR64q_GPR64q | VEX.LZ.F2.0F38.W1 F6 /r | BMI2 |
MULX r64, r64, m64 64-bit mode only
MULX_GPR64q_GPR64q_MEMq | VEX.LZ.F2.0F38.W1 F6 /r | BMI2 |
MULX r32, r32, r32
MULX_GPR32i32_GPR32i32_GPR32i32_APX | EVEX.LLZ.F2.0F38.W0 F6 /r | APX_F + BMI2 |
MULX r32, r32, m32
MULX_GPR32i32_GPR32i32_MEMi32_APX | EVEX.LLZ.F2.0F38.W0 F6 /r | APX_F + BMI2 |
MULX r64, r64, r64
MULX_GPR64i64_GPR64i64_GPR64i64_APX | EVEX.LLZ.F2.0F38.W1 F6 /r | APX_F + BMI2 |
MULX r64, r64, m64
MULX_GPR64i64_GPR64i64_MEMi64_APX | EVEX.LLZ.F2.0F38.W1 F6 /r | APX_F + BMI2 |
Latency and throughput
| Model | r32, r32, r32 | r32, r32, m32 | r64, r64, r64 | r64, r64, m64 |
|---|---|---|---|---|
| Haswell | 4 / 1p0156 | 9 / 1p0156 | 4 / 1p16 | 9 / 1p16 |
| Broadwell, Skylake, Skylake-SP, Ice Lake | 4 / 1p0156 | 9 / 1p0156 | 4 / 1p15 | 9 / 1p15 |
| Alder Lake, Sapphire Rapids | 4 / 1p0 p1 p5 p6 p11 | 9 / 1p0 p1 p5 p6 p11 | 4 / 1p15 | 9 / 1p15 |
| Lunar Lake | 4 / 0.67p012345 | 8 / 0.67p012345 | 4 / 0.67p135 | 8 / 0.67p135 |
| Zen | 3 / 2ALU1 Mul | 8 / 2ALU1 Mul | 3 / 2ALU1 Mul | 8 / 2ALU1 Mul |
| Zen 2 | 3 / 2ALU1 Mul | 7 / 2ALU1 Mul | 3 / 2ALU1 Mul | 7 / 2ALU1 Mul |
| Zen 3, Zen 4 | 4 / 1ALU1 | 8 / 1ALU1 | 4 / 1ALU1 | 8 / 1ALU1 |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
p = rDX * src # EDX or RDX times the source, unsigned: a
# product of 2 * OSIZE bits
lo.write(p) # the low half, then the high half: when
hi.write(p >> OSIZE) # hi and lo are one register, the high
# half is what stays
# no flag changesRun on AMD Zen 5 (EPYC 9645): 56 cases. The APX forms were not run: none of these processors has APX.
Operands
| Operand | Kind | Action |
|---|---|---|
MULX r32, r32, r/m32 MULX r64, r64, r/m64 64-bit mode only | ||
r32/64 | explicit | write |
r32/64 | explicit | write |
r/m32/64 | explicit | read |
rDX | implicit | read |
Flags
None: XED records no flag that the forms test or change.
Exceptions
The exception class is XED's name for the set of exception conditions that a form follows. How to read.
- VEX forms
- none in XED
- EVEX forms
APX-EVEX-BMI
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to MULX, each with the form it compiles to and the Clang options it needs. The forms come from compiling every intrinsic and decoding the result with Intel XED; all intrinsics A–Z explains the method.
| Intrinsic | Compiles to |
|---|---|
_mulx_u64
unsigned long long _mulx_u64(unsigned long long __X, unsigned long long __Y, unsigned long long *__P) |
|
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 |
|---|---|---|
BMI2 | BMI2 | 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, Sierra Forest, Clearwater Forest, Knights Landing, Knights Mill, Zen, Zen+, Zen 2, Zen 3, Zen 4, Zen 5, Zen 6 |
APX_F_BMI2 | APX_F + BMI2 | Nova Lake, Diamond Rapids |
More BMI2 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. - Clang's x86 intrinsic headers, LLVM 23.1.2 (commit
85ac56026243): the intrinsics, their signatures and doc comments, and the Clang of that release, which compiled each of them. - 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-152 (MULX)
- 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)
- Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, 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 intrinsics and their signatures come from Clang and the timings from LLVM's scheduling models, both part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.