Instruction
PMADDWD
Multiplies packed signed words of MMX or XMM registers and adds adjacent products into doublewords.
PMADDWD multiplies signed words pairwise into full 32-bit products and
adds each even product to the odd one next to it, so a 128-bit register
of eight words becomes four doublewords, each of the form
a0*b0 + a1*b1. It is the instruction for dot products of 16-bit data:
audio samples, fixed-point filter taps, the coefficients of image and
video transforms.
The one overflow
No product of two words is larger than 1,073,741,824 in magnitude, so the sum of two fits a signed doubleword in every case but one: when all four words are 8000h (-32768), the sum is 2,147,483,648, one more than the largest signed doubleword, and it wraps to 80000000h, a negative number. Nothing saturates and no flag reports it. Code that cannot rule this input out keeps one of its operands away from -32768.
In compiled code
GCC 14 at -O2 compiles s += a[i] * b[i] over int16_t arrays to a
loop of PMADDWD and PADDD, with the products of each
pair already added; only the four partial sums need adding at the end.
Clang 23 does the same with -mavx2, but for the SSE2 baseline and with
-msse4.1 it first spreads the words out with a zero next to each, so
every doubleword holds one product, four per instruction instead of
eight. With a vector of ones as the other operand, PMADDWD adds
neighboring signed words into doublewords, which cannot overflow.
Intel’s optimization manual builds a complex multiplication from it: with the coefficient stored as the words Cr, -Ci, Ci, Cr and the value duplicated, one PMADDWD gives the real and the imaginary part (Section 6.6.12).
Its relatives
For byte data, PMADDUBSW multiplies unsigned bytes by signed ones into saturated word sums, and PMADDWD with ones then widens those to doublewords. The VNNI instructions fold such chains into one: VPDPWSSD is PMADDWD plus the accumulating addition, and VPDPBUSD replaces the three-step byte version; Intel’s optimization manual notes that the fused instruction is also more accurate, since it does not saturate a 16-bit middle step (Section 8.2.1). VPMADDWD is the VEX and EVEX form; the legacy SSE2 form needs a memory operand aligned to 16 bytes.
Forms
Data flow
Where the elements of the sources go, element 0 on the right; results that depend on a control value are drawn for an example. How to read.
Result doubleword i comes from words 2i to 2i+1 of xmm1 and xmm2. Result doublewords 3 to 0: sum, sum, sum, sum.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
PMADDWD mm, mm/m64for i in range(2):
x = 0
for j in range(2 * i, 2 * i + 2):
x += mm1.sw[j] * src2.sw[j]
mm1.d[i] = x
# x87: TOP = 0, all tags valid, bits 79:64 of mm1's register all onesRun on AMD Zen 5 (EPYC 9645): 2 cases.
PMADDWD xmm, xmm/m128for i in range(4):
x = 0
for j in range(2 * i, 2 * i + 2):
x += xmm1.sw[j] * src2.sw[j]
xmm1.d[i] = x
# bits 128 and up of the register are unchangedRun on AMD Zen 5 (EPYC 9645): 2 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
PMADDWD mm, mm/m64 | ||
mm | explicit | read, write |
mm/m64 | explicit | read |
PMADDWD xmm, xmm/m128 | ||
xmm | explicit | read, write |
xmm/m128 | explicit | 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.
Attributes
What else XED records about the forms. How to read.
PMADDWD mm, mm/m64- may abort a TSX transaction
PMADDWD xmm, m128- aligned memory operand
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to PMADDWD, 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 |
|---|---|
_mm_madd_epi16
__m128i _mm_madd_epi16(__m128i __a, __m128i __b) |
|
_mm_madd_pi16
__m64 _mm_madd_pi16(__m64 __m1, __m64 __m2) |
|
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.
More MMX instructions
- MOVD
- MOVQ
- PACKSSDW
- PACKSSWB
- PACKUSWB
- PADDB
- PADDD
- PADDSB
- PADDSW
- PADDUSB
- PADDUSW
- PADDW
- PAND
- PANDN
- PCMPEQB
- PCMPEQD
- PCMPEQW
- PCMPGTB
- PCMPGTD
- PCMPGTW
- PMULHW
- PMULLW
- POR
- PSLLD
- PSLLQ
- PSLLW
- PSRAD
- PSRAW
- PSRLD
- PSRLQ
- PSRLW
- PSUBB
- PSUBD
- PSUBSB
- PSUBSW
- PSUBUSB
- PSUBUSW
- PSUBW
- PUNPCKHBW
- PUNPCKHDQ
More SSE2 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. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-313 (PMADDWD)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
- Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, October 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 intrinsics and their signatures come from Clang, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.