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

PSHUFW rearranges the four words of an MMX register or a 64-bit memory operand into an MMX register, as an immediate says: bits 1:0 choose the source word for word 0, and so on up to bits 7:6 for word 3, and a word may be chosen more than once. It does not read its destination. It came with SSE, among the 64-bit integer instructions of Intel’s Volume 1, chapter 10, and AMD’s manual calls it an AMD extension to MMX as well. SSE2 carried the idea to XMM registers in three parts: PSHUFLW and PSHUFHW for words and PSHUFD for doublewords, whose page has a table of the usual immediates. Like every MMX instruction it switches the x87 unit to MMX use, as MOVD’s page explains.

On Zen 5, pshufw mm3, mm3, 6Ah, whose fields read 1, 2, 2, 2 from the top, made word 3 a copy of word 1 and words 2 to 0 copies of word 2, all taken from MM3’s old value: a register may shuffle itself.

In compiled code

The intrinsic is _mm_shuffle_pi16. In 64-bit code, GCC 14 and Clang 23 at -O2 keep __m64 values in XMM registers and compile it to PSHUFLW, which shuffles the low quadword the same way. Only with -m32 does GCC emit PSHUFW, from a register or straight from memory inside a loop; Clang 23 uses PSHUFLW there too.

Intel’s entry says that a REX.R prefix lets this instruction reach XMM8-XMM15, though its operands are MMX registers, MM0 to MM7. AMD’s Zen 5 guide lists PSHUFW as one macro-op on any of the four FP pipes.

Forms

Every encoding of PSHUFW that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
PSHUFW mm, m64, imm8 PSHUFW_MMXq_MEMq_IMMbNP 0F 70 /r ibSSE
PSHUFW mm, mm, imm8 PSHUFW_MMXq_MMXq_IMMbNP 0F 70 /r ibSSE

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.
Modelmm, m64, imm8mm, mm, imm8
Sandy Bridge, Haswell, Broadwell, Skylake, Skylake-SP, Ice Lake6 / 1p51 / 1p5
Alder Lake, Sapphire Rapids9 / 1p51 / 1p5
Lunar Lake9 / 0.5V2 V31 / 0.5V2 V3
Bonnell1 / 1p01 / 1p0
Silvermont4 / 1FPC01 / 1FPC0
Piledriver7 / 1.5FPU1 FPXBR2 / 1FPU1 FPXBR
Zen, Zen 28 / 0.5FPU1 FPU21 / 0.5FPU1 FPU2
Zen 3, Zen 48 / 0.5FP1 FP21 / 0.5FP1 FP2
Jaguar6 / 1FPU0 FPU1 VALU0 VALU11 / 0.5FPU0 FPU1 VALU0 VALU1

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.

Shuffle by immediate: two bits of imm8 per result word pick one of the four words of the source.
PSHUFW with imm8 = 0x61With imm8 = 0x61, result words 3 to 0: a1, a2, a0, a1.0123mm2or m64aa1a0a2a1mm101001001imm80x61

Example: imm8 = 0x61 (0110 0001 in binary).

With imm8 = 0x61, result words 3 to 0: a1, a2, a0, a1.

Operation

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

for i in range(4):
    j = imm8 >> 2 * i & 3
    mm1.w[i] = src2.w[j]
# x87: TOP = 0, all tags valid, bits 79:64 of mm1's register all ones

Run on AMD Zen 5 (EPYC 9645): 2 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
PSHUFW mm, mm/m64, imm8
mmexplicitwrite
mm/m64explicitread
imm8explicitread

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.

All forms
mmx-mem

Attributes

What else XED records about the forms. How to read.

All forms
may abort a TSX transaction

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
SSE

SSE
CPUID.01H:EDX[25] SSE

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

More SSE instructions

All 65 SSE 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 2B, page 4-436 (PSHUFW)
  5. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
  6. AMD64 Architecture Programmer's Manual, Volume 5: 64-Bit Media and x87 Floating-Point Instructions (26569, rev. 3.16, November 2021), Wayback Machine copy of AMD's PDF
  7. 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.