Instruction
VPERMPD
Rearranges doubles across the whole register, controlled by an immediate or by an index vector.
VPERMPD rearranges the doubles of a vector across its 128-bit lanes. It is the double-precision twin of VPERMQ, whose page covers the two forms, the common immediates and how Clang picks between the two; the data are only moved, so no floating-point exception or MXCSR flag is possible. There is no 128-bit form: within one xmm register, VPERMILPD does the job.
In code on doubles
GCC 14 and Clang 23 at -O2 with -march=x86-64-v3 use the immediate
form whenever four doubles of a ymm register are rearranged:
- copying an array of doubles backwards is VPERMPD with 0x1B (27), reading straight from memory;
- repeating element 2 of a vector everywhere is 0xAA (170), and rotating the four elements by one is 0x39 (57).
Eight doubles in a zmm register are another matter, because the
immediate form of 512 bits rearranges each 256-bit half on its own.
For reversing a zmm vector, both compilers with -march=x86-64-v4 load
an index vector and use the form that takes it from a register; for
the reversed copy, GCC does the same on zmm registers and Clang keeps
four immediate VPERMPD on ymm ones.
On Zen 5
The cases recorded on Zen 5 show both points:
vpermpd zmm24{k7}, zmm3, 0xA6took elements 2, 1, 2 and 2 of each half of zmm3 for that half, in the elements that k7 selected.vpermpd zmm24{k7}, zmm3, zmm3, with the same register as indices and table, used only the low three bits of each double’s bit pattern as its index: both low elements ended in 7 and became element 7.
AMD’s Zen 5 guide gives VPERMPD the figures of VPERMQ: a latency of 4 cycles, except for the index form on zmm registers, at 5.
In the optimization guide
What the optimization guide says about VPERMPD, a line per claim. Each links to the claim in the guide, with its sources and where they differ.
Crestmont and Gracemont
- Vectors and AVX2: Shuffles that move data across the 128-bit halves are slower: VPERM2I128, VPERM2F128, VPERMD, VPERMQ, VPERMPS and VPERMPD on 256 bits are two micro-ops with a latency of 7 cycles, the second holding a port for two cycles.
Golden Cove and Raptor Cove
- Vectors, AVX-512 and AMX: VPERMD, VPERMQ, VPERMPS, VPERMPD, VPMULLQ,
vrange,vgetmantand the half-precision complex multiplications wait for the old value of their destination, which they then overwrite.
Zen 2
- Vectors and floating point: AMD’s spreadsheet makes the AVX2 permutes that cross the 128-bit lanes, VPERMD,
vpermps,vpermqandvpermpd, microcoded, whilevperm2f128is one macro-op of three cycles on pipe 2. sources differ
Forms
| Instruction | Encoding | Requires |
|---|---|---|
VPERMPD ymm, m256, imm8
VPERMPD_YMMqq_MEMqq_IMMb | VEX.256.66.0F3A.W1 01 /r ib | AVX2 |
VPERMPD ymm, ymm, imm8
VPERMPD_YMMqq_YMMqq_IMMb | VEX.256.66.0F3A.W1 01 /r ib | AVX2 |
VPERMPD zmm {k}{z}, zmm, imm8
VPERMPD_ZMMf64_MASKmskw_ZMMf64_IMM8_AVX512 | EVEX.512.66.0F3A.W1 01 /r ib | AVX10.1 or AVX512F |
VPERMPD zmm {k}{z}, m512/m64bcst, imm8
VPERMPD_ZMMf64_MASKmskw_MEMf64_IMM8_AVX512 | EVEX.512.66.0F3A.W1 01 /r ib | AVX10.1 or AVX512F |
VPERMPD zmm {k}{z}, zmm, zmm
VPERMPD_ZMMf64_MASKmskw_ZMMf64_ZMMf64_AVX512 | EVEX.512.66.0F38.W1 16 /r | AVX10.1 or AVX512F |
VPERMPD zmm {k}{z}, zmm, m512/m64bcst
VPERMPD_ZMMf64_MASKmskw_ZMMf64_MEMf64_AVX512 | EVEX.512.66.0F38.W1 16 /r | AVX10.1 or AVX512F |
VPERMPD ymm {k}{z}, ymm, imm8
VPERMPD_YMMf64_MASKmskw_YMMf64_IMM8_AVX512 | EVEX.256.66.0F3A.W1 01 /r ib | AVX10.1 or AVX512F + AVX512VL |
VPERMPD ymm {k}{z}, m256/m64bcst, imm8
VPERMPD_YMMf64_MASKmskw_MEMf64_IMM8_AVX512 | EVEX.256.66.0F3A.W1 01 /r ib | AVX10.1 or AVX512F + AVX512VL |
VPERMPD ymm {k}{z}, ymm, ymm
VPERMPD_YMMf64_MASKmskw_YMMf64_YMMf64_AVX512 | EVEX.256.66.0F38.W1 16 /r | AVX10.1 or AVX512F + AVX512VL |
VPERMPD ymm {k}{z}, ymm, m256/m64bcst
VPERMPD_YMMf64_MASKmskw_YMMf64_MEMf64_AVX512 | EVEX.256.66.0F38.W1 16 /r | AVX10.1 or AVX512F + AVX512VL |
Latency and throughput
| Model | ymm, m256, imm8 | ymm, ymm, imm8 | zmm {k}{z}, zmm, imm8ymm {k}{z}, ymm, imm8 | zmm {k}{z}, m512/m64bcst, imm8ymm {k}{z}, m256/m64bcst, imm8 | zmm {k}{z}, zmm, zmm | zmm {k}{z}, zmm, m512/m64bcstymm {k}{z}, ymm, m256/m64bcst | ymm {k}{z}, ymm, ymm |
|---|---|---|---|---|---|---|---|
| Haswell, Skylake | 10 / 1p5 | 3 / 1p5 | |||||
| Broadwell | 9 / 1p5 | 3 / 1p5 | |||||
| Skylake-SP, Ice Lake | 10 / 1p5 | 3 / 1p5 | 3 / 1p5 | 10 / 1p5 | 3 / 1p5 | 10 / 1p5 | 3 / 1p5 |
| Alder Lake | 11 / 1p5 | 3 / 1p5 | |||||
| Sapphire Rapids | 11 / 1p5 | 3 / 1p5 | 3 / 1p5 | 11 / 1p5 | 3 / 1p5 | 11 / 1p5 | 3 / 1p5 |
| Lunar Lake | 11 / 0.5V2 V3 | 3 / 0.5V2 V3 | |||||
| Zen | 9 / 1FPU1 FPU2 | 2 / 1FPU1 FPU2 | |||||
| Zen 2 | 9 / 0.5FPU1 FPU2 | 2 / 0.5FPU1 FPU2 | |||||
| Zen 3 | 13 / 2FP1 | 6 / 1FP1 | |||||
| Zen 4 | 11 / 1FP1 | 4 / 1FP1 | 2 / 11FP1 | 9 / 1FP1 | 5 / 1FP1 FP2 | 14 / 1FP1 | 4 / 12FP1 FP2 |
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.
VPERMPD ymm, ymm/m256, imm8 VPERMPD ymm {k}{z}, ymm/m256/m64bcst, imm8 VPERMPD zmm {k}{z}, zmm/m512/m64bcst, imm8Example: imm8 = 0x1E (0001 1110 in binary). The zmm form does this in each 256-bit half. The EVEX forms write under a mask: where its bit is 0, the element keeps its old value, or zeroes it with {z}. With m64bcst, one double from memory stands for every element of ymm2.
With imm8 = 0x1E, result doubles 3 to 0: a0, unchanged (bit 2 of k1 is 0), a3, a2.
VPERMPD ymm {k}{z}, ymm, ymm/m256/m64bcst VPERMPD zmm {k}{z}, zmm, zmm/m512/m64bcstExample index vector in zmm2 (element 0 on the right); only its low 3 bits count. Shown for the zmm form; the ymm form works the same on 4 doubles. The forms write under a mask: where its bit is 0, the element keeps its old value, or zeroes it with {z}.
With the example indices, result doubles 7 to 0: b1, unchanged (bit 6 of k1 is 0), b3, b3, b0, b7, b2, b5.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
VPERMPD ymm, ymm/m256, imm8 VPERMPD ymm {k}{z}, ymm/m256/m64bcst, imm8 VPERMPD zmm {k}{z}, zmm/m512/m64bcst, imm8for i in range(VL // 64):
k = imm8 >> 2 * (i % 4) & 3
j = i - i % 4 + k
if k1[i]: # 1 without a write mask
zmm1.q[i] = src2.q[j]
elif zeroing:
zmm1.q[i] = 0
# else: zmm1.q[i] keeps its value
# m64bcst: src2.f64[i] is the m64 for every i
# zmm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 6 cases.
VPERMPD ymm {k}{z}, ymm, ymm/m256/m64bcst VPERMPD zmm {k}{z}, zmm, zmm/m512/m64bcstn = VL // 64 # 4 in ymm, 8 in zmm
for i in range(n):
if k1[i]:
zmm1.q[i] = src3.q[zmm2.q[i] % n]
elif zeroing:
zmm1.q[i] = 0
# else: zmm1.q[i] keeps its value
# m64bcst: src3.f64[i] is the m64 for every i
# zmm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 4 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
VPERMPD ymm, ymm/m256, imm8 | ||
ymm | explicit | write |
ymm/m256 | explicit | read |
imm8 | explicit | read |
VPERMPD ymm {k}{z}, ymm/m256/m64bcst, imm8 VPERMPD zmm {k}{z}, zmm/m512/m64bcst, imm8 | ||
ymm, zmm | explicit | write (masked) |
{k} | explicit | read (write mask) |
ymm/m256/m64bcst, zmm/m512/m64bcst | explicit | read |
imm8 | explicit | read |
VPERMPD ymm {k}{z}, ymm, ymm/m256/m64bcst VPERMPD zmm {k}{z}, zmm, zmm/m512/m64bcst | ||
ymm, zmm | explicit | write (masked) |
{k} | explicit | read (write mask) |
ymm, zmm | explicit | read |
ymm/m256/m64bcst, zmm/m512/m64bcst | 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.
- VEX forms
avx-type-4- EVEX forms
AVX512-E4NF
Attributes
What else XED records about the forms. How to read.
- EVEX forms
- write masking
- EVEX memory forms
- embedded broadcast (tuple Full)
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to VPERMPD, 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 |
|---|---|
_mm256_permute4x64_pd
__m256d _mm256_permute4x64_pd(__m256d V, const int M) |
|
_mm256_permutex_pd
__m256d _mm256_permutex_pd(__m256d X, const int C) |
|
_mm256_permutexvar_pd
__m256d _mm256_permutexvar_pd(__m256i __X, __m256d __Y) |
|
_mm256_mask_permutex_pd
__m256d _mm256_mask_permutex_pd(__m256d W, __mmask8 U, __m256d X, const int C) |
|
_mm256_mask_permutexvar_pd
__m256d _mm256_mask_permutexvar_pd(__m256d __W, __mmask8 __U, __m256i __X, __m256d __Y) |
|
_mm256_maskz_permutex_pd
__m256d _mm256_maskz_permutex_pd(__mmask8 U, __m256d X, const int C) |
|
_mm256_maskz_permutexvar_pd
__m256d _mm256_maskz_permutexvar_pd(__mmask8 __U, __m256i __X, __m256d __Y) |
|
_mm512_permutex_pd
__m512d _mm512_permutex_pd(__m512d X, const int C) |
|
_mm512_permutexvar_pd
__m512d _mm512_permutexvar_pd(__m512i __X, __m512d __Y) |
|
_mm512_mask_permutex_pd
__m512d _mm512_mask_permutex_pd(__m512d W, __mmask8 U, __m512d X, const int C) |
|
_mm512_mask_permutexvar_pd
__m512d _mm512_mask_permutexvar_pd(__m512d __W, __mmask8 __U, __m512i __X, __m512d __Y) |
|
_mm512_maskz_permutex_pd
__m512d _mm512_maskz_permutex_pd(__mmask8 U, __m512d X, const int C) |
|
_mm512_maskz_permutexvar_pd
__m512d _mm512_maskz_permutexvar_pd(__mmask8 __U, __m512i __X, __m512d __Y) |
|
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 AVX2 instructions
- VPANDN
- VPAVGB
- VPAVGW
- VPBLENDD
- VPBLENDVB
- VPBLENDW
- VPBROADCASTB
- VPBROADCASTD
- VPBROADCASTQ
- VPBROADCASTW
- VPCMPEQB
- VPCMPEQD
- VPCMPEQQ
- VPCMPEQW
- VPCMPGTB
- VPCMPGTD
- VPCMPGTQ
- VPCMPGTW
- VPERM2I128
- VPERMD
- VPERMPS
- VPERMQ
- VPGATHERDD
- VPGATHERDQ
- VPGATHERQD
- VPGATHERQQ
- VPHADDD
- VPHADDSW
- VPHADDW
- VPHSUBD
- VPHSUBSW
- VPHSUBW
- VPMADDUBSW
- VPMADDWD
- VPMASKMOVD
- VPMASKMOVQ
- VPMAXSB
- VPMAXSD
- VPMAXSW
- VPMAXUB
More AVX10.1 instructions
- VPCOMPRESSB
- VPCOMPRESSD
- VPCOMPRESSQ
- VPCOMPRESSW
- VPCONFLICTD
- VPCONFLICTQ
- VPDPBUSD
- VPDPBUSDS
- VPDPWSSD
- VPDPWSSDS
- VPERMB
- VPERMD
- VPERMI2B
- VPERMI2D
- VPERMI2PD
- VPERMI2PS
- VPERMI2Q
- VPERMI2W
- VPERMILPD
- VPERMILPS
- VPERMPS
- VPERMQ
- VPERMT2B
- VPERMT2D
- VPERMT2PD
- VPERMT2PS
- VPERMT2Q
- VPERMT2W
- VPERMW
- VPEXPANDB
- VPEXPANDD
- VPEXPANDQ
- VPEXPANDW
- VPEXTRB
- VPEXTRD
- VPEXTRQ
- VPEXTRW
- VPGATHERDD
- VPGATHERDQ
- VPGATHERQD
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 2C, page 5-522 (VPERMPD)
- Intel Advanced Vector Extensions 10.2 Architecture Specification, revision 7.0 (361050-007, April 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.