Instruction
VPERMPS
Rearranges singles across the whole register using an index vector.
VPERMPS takes singles from anywhere in a vector: element i of the result is the element of the table that element i of the index vector numbers, using its low three bits for ymm registers and four for zmm. It is the single-precision twin of VPERMD, whose page covers the operand order (indices in the second operand, the table in the third, the other way round in the AVX2 intrinsic), left-packing and the two-table forms. The two give the same bits: the data are moved, not computed on, so no floating-point exception or MXCSR flag is possible. Like VPERMD it has no 128-bit form; within one xmm register, VPERMILPS does the job. The EVEX forms add masking and a broadcast single as the table.
Which one compilers pick
For float vectors, the choice between VPERMPS and VPERMD is the
compiler’s. _mm256_permutevar8x32_ps becomes VPERMPS in GCC 14 and
Clang 23 at -O2, but for shuffles written with
__builtin_shufflevector on eight floats with -march=x86-64-v3 they
part ways:
- reversing the eight elements is VPERMPS with a constant index vector in Clang, and VPERMD in GCC;
- repeating element 3 everywhere is a broadcast index and VPERMPS in Clang, and VPERMILPS within each lane followed by VPERM2F128 to copy the low lane up in GCC.
AMD’s Zen 5 guide lists VPERMPS and VPERMD alike: one macro-op with a latency of 4 cycles for ymm and 5 for zmm registers, so the choice costs nothing there. Shuffles that stay within 128-bit lanes are cheaper: VPERMILPS with an immediate has a latency of 1 cycle.
In the optimization guide
What the optimization guide says about VPERMPS, 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 |
|---|---|---|
VPERMPS ymm, ymm, m256
VPERMPS_YMMqq_YMMqq_MEMqq | VEX.256.66.0F38.W0 16 /r | AVX2 |
VPERMPS ymm, ymm, ymm
VPERMPS_YMMqq_YMMqq_YMMqq | VEX.256.66.0F38.W0 16 /r | AVX2 |
VPERMPS zmm {k}{z}, zmm, zmm
VPERMPS_ZMMf32_MASKmskw_ZMMf32_ZMMf32_AVX512 | EVEX.512.66.0F38.W0 16 /r | AVX10.1 or AVX512F |
VPERMPS zmm {k}{z}, zmm, m512/m32bcst
VPERMPS_ZMMf32_MASKmskw_ZMMf32_MEMf32_AVX512 | EVEX.512.66.0F38.W0 16 /r | AVX10.1 or AVX512F |
VPERMPS ymm {k}{z}, ymm, ymm
VPERMPS_YMMf32_MASKmskw_YMMf32_YMMf32_AVX512 | EVEX.256.66.0F38.W0 16 /r | AVX10.1 or AVX512F + AVX512VL |
VPERMPS ymm {k}{z}, ymm, m256/m32bcst
VPERMPS_YMMf32_MASKmskw_YMMf32_MEMf32_AVX512 | EVEX.256.66.0F38.W0 16 /r | AVX10.1 or AVX512F + AVX512VL |
Latency and throughput
| Model | ymm, ymm, m256 | ymm, ymm, ymm | zmm {k}{z}, zmm, zmm | zmm {k}{z}, zmm, m512/m32bcstymm {k}{z}, ymm, m256/m32bcst | 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 |
| Alder Lake | 11 / 1p5 | 3 / 1p5 | |||
| Sapphire Rapids | 11 / 1p5 | 3 / 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 | 14 / 2FP1 | 7 / 1FP1 | |||
| Zen 4 | 11 / 1FP1 | 4 / 1FP1 | 5 / 1FP1 FP2 | 14 / 1FP1 | 4 / 11FP1 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.
Example index vector in zmm2 (element 0 on the right); only its low 4 bits count. Shown for the zmm form; the ymm form works the same on 8 singles. The EVEX 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 singles 15 to 0: b8, unchanged (bit 14 of k1 is 0), b7, b10, b1, b5, b12, b5, b15, b2, b9, b6, b14, b0, b11, b3.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
n = VL // 32 # 8 in ymm, 16 in zmm
for i in range(n):
if k1[i]: # 1 without a write mask
zmm1.d[i] = src3.d[zmm2.d[i] % n]
elif zeroing:
zmm1.d[i] = 0
# else: zmm1.d[i] keeps its value
# m32bcst: src3.f32[i] is the m32 for every i
# zmm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 6 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
VPERMPS ymm, ymm, ymm/m256 | ||
ymm | explicit | write |
ymm | explicit | read |
ymm/m256 | explicit | read |
VPERMPS ymm {k}{z}, ymm, ymm/m256/m32bcst VPERMPS zmm {k}{z}, zmm, zmm/m512/m32bcst | ||
ymm, zmm | explicit | write (masked) |
{k} | explicit | read (write mask) |
ymm, zmm | explicit | read |
ymm/m256/m32bcst, zmm/m512/m32bcst | 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 VPERMPS, 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_permutevar8x32_ps
__m256 _mm256_permutevar8x32_ps(__m256 __a, __m256i __b) |
|
_mm256_permutexvar_ps
__m256 _mm256_permutexvar_ps(__m256i A, __m256 B) |
|
_mm256_mask_permutexvar_ps
__m256 _mm256_mask_permutexvar_ps(__m256 __W, __mmask8 __U, __m256i __X, __m256 __Y) |
|
_mm256_maskz_permutexvar_ps
__m256 _mm256_maskz_permutexvar_ps(__mmask8 __U, __m256i __X, __m256 __Y) |
|
_mm512_permutexvar_ps
__m512 _mm512_permutexvar_ps(__m512i __X, __m512 __Y) |
|
_mm512_mask_permutexvar_ps
__m512 _mm512_mask_permutexvar_ps(__m512 __W, __mmask16 __U, __m512i __X, __m512 __Y) |
|
_mm512_maskz_permutexvar_ps
__m512 _mm512_maskz_permutexvar_ps(__mmask16 __U, __m512i __X, __m512 __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
- VPAVGB
- VPAVGW
- VPBLENDD
- VPBLENDVB
- VPBLENDW
- VPBROADCASTB
- VPBROADCASTD
- VPBROADCASTQ
- VPBROADCASTW
- VPCMPEQB
- VPCMPEQD
- VPCMPEQQ
- VPCMPEQW
- VPCMPGTB
- VPCMPGTD
- VPCMPGTQ
- VPCMPGTW
- VPERM2I128
- VPERMD
- VPERMPD
- VPERMQ
- VPGATHERDD
- VPGATHERDQ
- VPGATHERQD
- VPGATHERQQ
- VPHADDD
- VPHADDSW
- VPHADDW
- VPHSUBD
- VPHSUBSW
- VPHSUBW
- VPMADDUBSW
- VPMADDWD
- VPMASKMOVD
- VPMASKMOVQ
- VPMAXSB
- VPMAXSD
- VPMAXSW
- VPMAXUB
- VPMAXUD
More AVX10.1 instructions
- VPCOMPRESSD
- VPCOMPRESSQ
- VPCOMPRESSW
- VPCONFLICTD
- VPCONFLICTQ
- VPDPBUSD
- VPDPBUSDS
- VPDPWSSD
- VPDPWSSDS
- VPERMB
- VPERMD
- VPERMI2B
- VPERMI2D
- VPERMI2PD
- VPERMI2PS
- VPERMI2Q
- VPERMI2W
- VPERMILPD
- VPERMILPS
- VPERMPD
- VPERMQ
- VPERMT2B
- VPERMT2D
- VPERMT2PD
- VPERMT2PS
- VPERMT2Q
- VPERMT2W
- VPERMW
- VPEXPANDB
- VPEXPANDD
- VPEXPANDQ
- VPEXPANDW
- VPEXTRB
- VPEXTRD
- VPEXTRQ
- VPEXTRW
- VPGATHERDD
- VPGATHERDQ
- VPGATHERQD
- VPGATHERQQ
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-526 (VPERMPS)
- 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.