Instruction
VPHMINPOSUW
Finds the smallest unsigned word of an XMM operand and returns it with its index in the low two words; VEX form.
- Extensions
- Forms
- 2 (2 VEX)
- Data
- Intel XED v2026.08.23
VPHMINPOSUW is the VEX encoding of SSE4.1’s PHMINPOSUW, whose page covers the search: the smallest of eight unsigned words lands in word 0 and its index in word 1, the lowest index winning a tie. Unlike most VEX forms it adds no operand and no width. It keeps a single source, both vendors’ manuals raise #UD unless VEX.vvvv is 1111b and VEX.L is 0, and neither AVX2 nor AVX-512 gave it a 256- or 512-bit form or an EVEX encoding. What changes is around the result: the memory operand needs no alignment, and the register is cleared above bit 127.
On Zen 5, the recorded vphminposuw xmm1, xmm2 found zeros in words 3
and 4 and returned 0 with index 3; vphminposuw xmm8, xmmword ptr [mem], with zeros in words 1 and 3, returned index 1. Both cleared
everything above the index, up to bit 511 of the ZMM register.
Wider reductions
With only 128 bits, a wider minimum folds down first. In our builds at
-O2 over a fixed-size uint16_t array, GCC 14 at -march=x86-64-v3
keeps a running VPMINUW in a ymm register, folds its
upper lane onto the lower with VEXTRACTI128 and one more VPMINUW, and
finishes with VPHMINPOSUW; at -v4 it runs the loop on zmm registers
and folds twice. Clang 23 ends the same way at both levels, on ymm
registers, and also bends the unsigned maximum, the signed minimum and
the byte minimum to fit, as PHMINPOSUW’s page describes; at -v4 its
inversion for the maximum is one VPTERNLOGQ. GCC
finishes those three with VPSRLDQ halvings instead.
Neither returns the index: a loop that tracks the position of the
minimum stays scalar.
AMD’s latency spreadsheet for Zen 5 gives the VEX row one macro-op with a latency of 3 cycles, two per cycle, as for the legacy form.
Forms
Latency and throughput
| Model | xmm, m128 | xmm, xmm |
|---|---|---|
| Sandy Bridge, Haswell | 11 / 1p0 | 5 / 1p0 |
| Broadwell | 10 / 1p0 | 5 / 1p0 |
| Skylake, Skylake-SP, Ice Lake | 10 / 1p0 | 4 / 1p0 |
| Alder Lake, Sapphire Rapids | 11 / 1p0 | 4 / 1p0 |
| Lunar Lake | 11 / 0.5V0 V1 | 5 / 0.5V0 V1 |
| Piledriver | 9 / 1.5FPMAL FPU0 | 4 / 1FPMAL FPU0 |
| Zen, Zen 2 | 11 / 1FPU0 | 4 / 1FPU0 |
| Zen 3, Zen 4 | 10 / 0.5FP0 FP1 | 3 / 0.5FP0 FP1 |
| Jaguar | 7 / 1FPU0 FPU1 VALU0 VALU1 | 2 / 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.
Result words 0 and 1 depend on all eight words of the source; words 7 to 2 are 0. Result words 7 to 0: 0, 0, 0, 0, 0, 0, index, min.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
m = src2.w[0]
x = 0
for i in range(1, 8):
if src2.w[i] < m: # the first of equal words stays
m = src2.w[i]
x = i
xmm1.write(x << 16 | m) # words 7 to 2 are zeroed
# xmm1 is zeroed from bit 128 upRun on AMD Zen 5 (EPYC 9645): 2 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
VPHMINPOSUW xmm, xmm/m128 | ||
xmm | explicit | 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.
- All forms
avx-type-4
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to VPHMINPOSUW, 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_minpos_epu16
__m128i _mm_minpos_epu16(__m128i __V) |
|
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 |
|---|---|---|
AVX | AVX | Sandy Bridge, Ivy Bridge, 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, Bulldozer, Piledriver, Zen, Zen+, Zen 2, Zen 3, Zen 4, Zen 5, Zen 6 |
More AVX instructions
- VPCMPEQQ
- VPCMPEQW
- VPCMPESTRI
- VPCMPESTRM
- VPCMPGTB
- VPCMPGTD
- VPCMPGTQ
- VPCMPGTW
- VPCMPISTRI
- VPCMPISTRM
- VPERM2F128
- VPERMILPD
- VPERMILPS
- VPEXTRB
- VPEXTRD
- VPEXTRQ
- VPEXTRW
- VPHADDD
- VPHADDSW
- VPHADDW
- VPHSUBD
- VPHSUBSW
- VPHSUBW
- VPINSRB
- VPINSRD
- VPINSRQ
- VPINSRW
- VPMADDUBSW
- VPMADDWD
- VPMAXSB
- VPMAXSD
- VPMAXSW
- VPMAXUB
- VPMAXUD
- VPMAXUW
- VPMINSB
- VPMINSD
- VPMINSW
- VPMINUB
- VPMINUD
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-298 (PHMINPOSUW)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
- AMD64 Architecture Programmer's Manual, Volume 4: 128-Bit, 256-Bit, and 512-Bit Media Instructions (26568, rev. 3.27, July 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.