Instruction
VPSLLW
Shifts words left by one count from a register or an immediate.
VPSLLW is the VEX and EVEX form of PSLLW, whose page covers the shift and its count: one for every word, from an immediate or the low quadword of an XMM register or of memory, and anything above 15 clears the word. VEX.128 needs AVX and VEX.256 AVX2; the EVEX forms need AVX512BW (with AVX512VL below 512 bits) or AVX10.1, not AVX-512F, and add masking, the 512-bit width and, in the immediate form only, a source read from memory, though never a broadcast one.
On Zen 5, {evex} vpsllw ymm24, ymm3, xmmword ptr [mem] took its
count, 1, from the low quadword and ignored the random one above it,
turning 7FFFh into FFFEh in both lanes; vpsllw ymm0, ymm13, xmm9,
with a count of 100000001h, cleared all sixteen words; and
vpsllw zmm9{k7}, zmm9, xmmword ptr [mem], whose count was
8000000000000000h, cleared the words K7 selects and kept the rest.
In compiled code
In our builds at -O2 over uint16_t arrays, b[i] << 3 is VPSLLW by
3 with -march=x86-64-v3 in GCC 14 and Clang 23; with
-march=x86-64-v4 both shift straight from memory, which only EVEX
can, GCC in zmm and Clang in ymm registers. c[i] ? b[i] << 3 : b[i]
shifts and blends with VPBLENDVB at -v3; at -v4
GCC masks the shift itself, while Clang merges afterwards with a masked
VMOVDQU16.
AMD’s latency spreadsheet for Zen 5 gives the EVEX immediate form one cycle on pipes FP2 and FP3 and the count from a register two cycles on FP0 and FP1, the figure its one row for the VEX forms gives them all.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
VPSLLW xmm, xmm, m128
VPSLLW_XMMdq_XMMdq_MEMdq | VEX.128.66.0F.WIG F1 /r | AVX |
VPSLLW xmm, xmm, xmm
VPSLLW_XMMdq_XMMdq_XMMdq | VEX.128.66.0F.WIG F1 /r | AVX |
VPSLLW xmm, xmm, imm8
VPSLLW_XMMdq_XMMdq_IMMb | VEX.128.66.0F.WIG 71 /6 ib | AVX |
VPSLLW ymm, ymm, m128
VPSLLW_YMMqq_YMMqq_MEMdq | VEX.256.66.0F.WIG F1 /r | AVX2 |
VPSLLW ymm, ymm, xmm
VPSLLW_YMMqq_YMMqq_XMMq | VEX.256.66.0F.WIG F1 /r | AVX2 |
VPSLLW ymm, ymm, imm8
VPSLLW_YMMqq_YMMqq_IMMb | VEX.256.66.0F.WIG 71 /6 ib | AVX2 |
VPSLLW xmm {k}{z}, xmm, imm8
VPSLLW_XMMu16_MASKmskw_XMMu16_IMM8_AVX512 | EVEX.128.66.0F.WIG 71 /6 ib | AVX10.1 or AVX512BW + AVX512VL |
VPSLLW xmm {k}{z}, m128, imm8
VPSLLW_XMMu16_MASKmskw_MEMu16_IMM8_AVX512 | EVEX.128.66.0F.WIG 71 /6 ib | AVX10.1 or AVX512BW + AVX512VL |
VPSLLW xmm {k}{z}, xmm, xmm
VPSLLW_XMMu16_MASKmskw_XMMu16_XMMu16_AVX512 | EVEX.128.66.0F.WIG F1 /r | AVX10.1 or AVX512BW + AVX512VL |
VPSLLW xmm {k}{z}, xmm, m128
VPSLLW_XMMu16_MASKmskw_XMMu16_MEMu16_AVX512 | EVEX.128.66.0F.WIG F1 /r | AVX10.1 or AVX512BW + AVX512VL |
VPSLLW ymm {k}{z}, ymm, imm8
VPSLLW_YMMu16_MASKmskw_YMMu16_IMM8_AVX512 | EVEX.256.66.0F.WIG 71 /6 ib | AVX10.1 or AVX512BW + AVX512VL |
VPSLLW ymm {k}{z}, m256, imm8
VPSLLW_YMMu16_MASKmskw_MEMu16_IMM8_AVX512 | EVEX.256.66.0F.WIG 71 /6 ib | AVX10.1 or AVX512BW + AVX512VL |
VPSLLW ymm {k}{z}, ymm, xmm
VPSLLW_YMMu16_MASKmskw_YMMu16_XMMu16_AVX512 | EVEX.256.66.0F.WIG F1 /r | AVX10.1 or AVX512BW + AVX512VL |
VPSLLW ymm {k}{z}, ymm, m128
VPSLLW_YMMu16_MASKmskw_YMMu16_MEMu16_AVX512 | EVEX.256.66.0F.WIG F1 /r | AVX10.1 or AVX512BW + AVX512VL |
VPSLLW zmm {k}{z}, zmm, imm8
VPSLLW_ZMMu16_MASKmskw_ZMMu16_IMM8_AVX512 | EVEX.512.66.0F.WIG 71 /6 ib | AVX10.1 or AVX512BW |
VPSLLW zmm {k}{z}, m512, imm8
VPSLLW_ZMMu16_MASKmskw_MEMu16_IMM8_AVX512 | EVEX.512.66.0F.WIG 71 /6 ib | AVX10.1 or AVX512BW |
VPSLLW zmm {k}{z}, zmm, xmm
VPSLLW_ZMMu16_MASKmskw_ZMMu16_XMMu16_AVX512 | EVEX.512.66.0F.WIG F1 /r | AVX10.1 or AVX512BW |
VPSLLW zmm {k}{z}, zmm, m128
VPSLLW_ZMMu16_MASKmskw_ZMMu16_MEMu16_AVX512 | EVEX.512.66.0F.WIG F1 /r | AVX10.1 or AVX512BW |
Latency and throughput
| Model | xmm, xmm, m128xmm {k}{z}, xmm, m128no mask | xmm, xmm, xmmxmm {k}{z}, xmm, xmmno mask | xmm, xmm, imm8 | ymm, ymm, m128ymm {k}{z}, m256, imm8no maskymm {k}{z}, ymm, m128no mask | ymm, ymm, xmmymm {k}{z}, ymm, xmmno mask | ymm, ymm, imm8 | xmm {k}{z}, xmm, imm8no maskymm {k}{z}, ymm, imm8no mask | xmm {k}{z}, xmm, imm8with a mask, zeroingymm {k}{z}, ymm, imm8with a mask, zeroing | xmm {k}{z}, m128, imm8no mask | xmm {k}{z}, m128, imm8with a mask, zeroing | xmm {k}{z}, xmm, xmmwith a mask, zeroing | xmm {k}{z}, xmm, m128with a mask, zeroing | ymm {k}{z}, m256, imm8with a mask, zeroingymm {k}{z}, ymm, m128with a mask, zeroing | ymm {k}{z}, ymm, xmmwith a mask, zeroing | zmm {k}{z}, zmm, imm8no mask | zmm {k}{z}, zmm, imm8with a mask, zeroing | zmm {k}{z}, m512, imm8no maskzmm {k}{z}, zmm, m128no mask | zmm {k}{z}, m512, imm8with a mask, zeroingzmm {k}{z}, zmm, m128with a mask, zeroing | zmm {k}{z}, zmm, xmmno mask | zmm {k}{z}, zmm, xmmwith a mask, zeroing |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sandy Bridge | 8 / 1p015 | 2 / 1p015 | 1 / 1p0 | |||||||||||||||||
| Haswell | 8 / 1p0 | 2 / 1p05 | 1 / 1p0 | 8 / 1p0 | 4 / 1p05 | 1 / 1p0 | ||||||||||||||
| Broadwell | 7 / 1p0 | 2 / 1p05 | 1 / 1p0 | 7 / 1p0 | 4 / 1p05 | 1 / 1p0 | ||||||||||||||
| Skylake | 7 / 0.5p01 | 2 / 1p015 | 1 / 0.5p01 | 8 / 0.5p01 | 4 / 1p015 | 1 / 0.5p01 | ||||||||||||||
| Skylake-SP | 7 / 0.5p01 | 2 / 1p015 | 1 / 0.5p01 | 8 / 0.5p01 | 4 / 1p015 | 1 / 0.5p01 | 1 / 0.5p01 | 1 / 0.5p01 | 7 / 0.5p01 | 7 / 0.5p01 | 2 / 1p015 | 7 / 0.5p01 | 8 / 0.5p01 | 4 / 1p015 | 1 / 1p0 | 1 / 1p0 | 8 / 1p0 | 8 / 1p0 | 4 / 1p05 | 4 / 1p05 |
| Ice Lake | 7 / 0.5p01 | 2 / 0.67p015 | 1 / 0.5p01 | 8 / 0.5p01 | 4 / 1p015 | 1 / 0.5p01 | 1 / 0.5p01 | 1 / 0.5p01 | 7 / 0.5p01 | 7 / 0.5p01 | 2 / 0.67p015 | 7 / 0.5p01 | 8 / 0.5p01 | 4 / 1p015 | 1 / 1p0 | 1 / 1p0 | 8 / 1p0 | 8 / 1p0 | 4 / 1p05 | 4 / 1p05 |
| Alder Lake | 8 / 0.5p01 | 2 / 0.67p015 | 1 / 0.5p01 | 9 / 0.5p01 | 4 / 1p015 | 1 / 0.5p01 | ||||||||||||||
| Sapphire Rapids | 8 / 0.5p01 | 2 / 0.67p015 | 1 / 0.5p01 | 9 / 0.5p01 | 4 / 1p015 | 1 / 0.5p01 | 1 / 0.5p01 | 3 / 0.5p01 | 8 / 0.5p01 | 11 / 0.5p01 | 4 / 0.67p015 | 11 / 0.5p01 | 11 / 0.5p01 | 6 / 1p015 | 1 / 1p0 | 3 / 1p0 | 9 / 1p0 | 11 / 1p0 | 4 / 1p05 | 6 / 1p05 |
| Lunar Lake | 8 / 0.5V0 V1 | 2 / 0.5V0 V1 V2 V3 | 1 / 0.5V0 V1 | 9 / 2.33V0 V1 | 4 / 0.5V0 V1 V2 V3 | 1 / 0.5V0 V1 | ||||||||||||||
| Piledriver | 8 / 1.5FPU1 FPXBR | 3 / 1FPU1 FPXBR | 2 / 1FPU1 FPXBR | |||||||||||||||||
| Zen | 8 / 1FPU2 | 1 / 1FPU2 | 1 / 1FPU2 | 8 / 2FPU2 | 1 / 2FPU2 | 1 / 2FPU2 | ||||||||||||||
| Zen 2 | 8 / 1FPU2 | 1 / 1FPU2 | 1 / 1FPU2 | 8 / 1FPU2 | 1 / 1FPU2 | 1 / 1FPU2 | ||||||||||||||
| Zen 3 | 8 / 0.5FP1 FP2 | 1 / 0.5FP1 FP2 | 1 / 0.5FP1 FP2 | 8 / 0.5FP1 FP2 | 1 / 0.5FP1 FP2 | 1 / 0.5FP1 FP2 | ||||||||||||||
| Zen 4 | 9 / 1FP1 FP2 | 2 / 1FP0 FP1 | 1 / 0.5FP1 FP2 | 8 / 0.5FP1 FP2 | 2 / 1FP0 FP1 | 1 / 0.5FP1 FP2 | 1 / 0.5FP0 FP1 | 1 / 0.5FP0 FP1 | 8 / 0.5FP1 FP2 | 8 / 0.5FP1 FP2 | 2 / 1FP0 FP1 | 9 / 1FP1 FP2 | 8 / 0.5FP1 FP2 | 2 / 1FP0 FP1 | 1 / 0.5FP0 FP1 | 1 / 0.5FP0 FP1 | 8 / 1FP1 FP2 | 8 / 1FP1 FP2 | 2 / 1FP0 FP1 | 2 / 1FP0 FP1 |
| Jaguar | 7 / 1FPU0 FPU1 VALU0 VALU1 | 2 / 0.5FPU0 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.
VPSLLW xmm, xmm, xmm/m128 VPSLLW ymm, ymm, xmm/m128 VPSLLW xmm {k}{z}, xmm, xmm/m128 VPSLLW ymm {k}{z}, ymm, xmm/m128 VPSLLW zmm {k}{z}, zmm, xmm/m128Every word works alike: 8, 16 and 32 words in the xmm, ymm and zmm forms. The EVEX forms write under a mask: where its bit is 0, the element keeps its old value, or zeroes it with {z}.
Result word i comes from word i of xmm2 and the count in xmm3. Result words 7 to 0: r7, unchanged (bit 6 of k1 is 0), r5, r4, r3, r2, r1, r0.
VPSLLW xmm, xmm, imm8 VPSLLW ymm, ymm, imm8 VPSLLW xmm {k}{z}, xmm/m128, imm8 VPSLLW ymm {k}{z}, ymm/m256, imm8 VPSLLW zmm {k}{z}, zmm/m512, imm8Every word works alike: 8, 16 and 32 words in the xmm, ymm and zmm forms. The EVEX forms write under a mask: where its bit is 0, the element keeps its old value, or zeroes it with {z}.
Result word i comes from word i of xmm2. Result words 7 to 0: r7, unchanged (bit 6 of k1 is 0), r5, r4, r3, r2, r1, r0.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
VPSLLW xmm, xmm, xmm/m128 VPSLLW ymm, ymm, xmm/m128 VPSLLW xmm {k}{z}, xmm, xmm/m128 VPSLLW ymm {k}{z}, ymm, xmm/m128 VPSLLW zmm {k}{z}, zmm, xmm/m128count = src3.q[0]
for i in range(VL // 16):
if k1[i]: # 1 without a write mask
a = zmm2.w[i]
if count < 16:
zmm1.w[i] = a << count
else:
zmm1.w[i] = 0
elif zeroing:
zmm1.w[i] = 0
# else: zmm1.w[i] keeps its value
# zmm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 10 cases.
VPSLLW xmm, xmm, imm8 VPSLLW ymm, ymm, imm8 VPSLLW xmm {k}{z}, xmm/m128, imm8 VPSLLW ymm {k}{z}, ymm/m256, imm8 VPSLLW zmm {k}{z}, zmm/m512, imm8for i in range(VL // 16):
if k1[i]: # 1 without a write mask
a = src2.w[i]
if imm8 < 16:
zmm1.w[i] = a << imm8
else:
zmm1.w[i] = 0
elif zeroing:
zmm1.w[i] = 0
# else: zmm1.w[i] keeps its value
# zmm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 8 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
VPSLLW xmm, xmm, xmm/m128 VPSLLW ymm, ymm, xmm/m128 | ||
xmm, ymm | explicit | write |
xmm, ymm | explicit | read |
xmm/m128 | explicit | read |
VPSLLW xmm, xmm, imm8 VPSLLW ymm, ymm, imm8 | ||
xmm, ymm | explicit | write |
xmm, ymm | explicit | read |
imm8 | explicit | read |
VPSLLW xmm {k}{z}, xmm/m128, imm8 VPSLLW ymm {k}{z}, ymm/m256, imm8 VPSLLW zmm {k}{z}, zmm/m512, imm8 | ||
xmm, ymm, zmm | explicit | write (masked) |
{k} | explicit | read (write mask) |
xmm/m128, ymm/m256, zmm/m512 | explicit | read |
imm8 | explicit | read |
VPSLLW xmm {k}{z}, xmm, xmm/m128 VPSLLW ymm {k}{z}, ymm, xmm/m128 VPSLLW zmm {k}{z}, zmm, xmm/m128 | ||
xmm, ymm, zmm | explicit | write (masked) |
{k} | explicit | read (write mask) |
xmm, ymm, zmm | explicit | read |
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.
VPSLLW xmm, xmm, xmm/m128VPSLLW xmm, xmm, imm8VPSLLW ymm, ymm, imm8avx-type-7VPSLLW ymm, ymm, xmm/m128avx-type-4VPSLLW xmm {k}{z}, xmm/m128, imm8VPSLLW ymm {k}{z}, ymm/m256, imm8VPSLLW zmm {k}{z}, zmm/m512, imm8AVX512-E4VPSLLW xmm {k}{z}, xmm, xmm/m128VPSLLW ymm {k}{z}, ymm, xmm/m128VPSLLW zmm {k}{z}, zmm, xmm/m128AVX512-E4NF
Attributes
What else XED records about the forms. How to read.
- EVEX forms
- write masking
VPSLLW xmm {k}{z}, m128, imm8VPSLLW ymm {k}{z}, m256, imm8VPSLLW zmm {k}{z}, m512, imm8- memory fault suppression
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to VPSLLW, 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_sll_epi16
__m128i _mm_sll_epi16(__m128i __a, __m128i __count) |
|
_mm_slli_epi16
__m128i _mm_slli_epi16(__m128i __a, int __count) |
|
_mm_mask_sll_epi16
__m128i _mm_mask_sll_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) |
|
_mm_mask_slli_epi16
__m128i _mm_mask_slli_epi16(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B) |
|
_mm_maskz_sll_epi16
__m128i _mm_maskz_sll_epi16(__mmask8 __U, __m128i __A, __m128i __B) |
|
_mm_maskz_slli_epi16
__m128i _mm_maskz_slli_epi16(__mmask8 __U, __m128i __A, unsigned int __B) |
|
_mm256_sll_epi16
__m256i _mm256_sll_epi16(__m256i __a, __m128i __count) |
|
_mm256_slli_epi16
__m256i _mm256_slli_epi16(__m256i __a, int __count) |
|
_mm256_mask_sll_epi16
__m256i _mm256_mask_sll_epi16(__m256i __W, __mmask16 __U, __m256i __A, __m128i __B) |
|
_mm256_mask_slli_epi16
__m256i _mm256_mask_slli_epi16(__m256i __W, __mmask16 __U, __m256i __A, unsigned int __B) |
|
_mm256_maskz_sll_epi16
__m256i _mm256_maskz_sll_epi16(__mmask16 __U, __m256i __A, __m128i __B) |
|
_mm256_maskz_slli_epi16
__m256i _mm256_maskz_slli_epi16(__mmask16 __U, __m256i __A, unsigned int __B) |
|
_mm512_sll_epi16
__m512i _mm512_sll_epi16(__m512i __A, __m128i __B) |
|
_mm512_slli_epi16
__m512i _mm512_slli_epi16(__m512i __A, unsigned int __B) |
|
_mm512_mask_sll_epi16
__m512i _mm512_mask_sll_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m128i __B) |
|
_mm512_mask_slli_epi16
__m512i _mm512_mask_slli_epi16(__m512i __W, __mmask32 __U, __m512i __A, unsigned int __B) |
|
_mm512_maskz_sll_epi16
__m512i _mm512_maskz_sll_epi16(__mmask32 __U, __m512i __A, __m128i __B) |
|
_mm512_maskz_slli_epi16
__m512i _mm512_maskz_slli_epi16(__mmask32 __U, __m512i __A, unsigned int __B) |
|
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 AVX instructions
- VPMOVZXWQ
- VPMULDQ
- VPMULHRSW
- VPMULHUW
- VPMULHW
- VPMULLD
- VPMULLW
- VPMULUDQ
- VPOR
- VPSADBW
- VPSHUFB
- VPSHUFD
- VPSHUFHW
- VPSHUFLW
- VPSIGNB
- VPSIGND
- VPSIGNW
- VPSLLD
- VPSLLDQ
- VPSLLQ
- VPSRAD
- VPSRAW
- VPSRLD
- VPSRLDQ
- VPSRLQ
- VPSRLW
- VPSUBB
- VPSUBD
- VPSUBQ
- VPSUBSB
- VPSUBSW
- VPSUBUSB
- VPSUBUSW
- VPSUBW
- VPTEST
- VPUNPCKHBW
- VPUNPCKHDQ
- VPUNPCKHQDQ
- VPUNPCKHWD
- VPUNPCKLBW
More AVX2 instructions
- VPMULHRSW
- VPMULHUW
- VPMULHW
- VPMULLD
- VPMULLW
- VPMULUDQ
- VPOR
- VPSADBW
- VPSHUFB
- VPSHUFD
- VPSHUFHW
- VPSHUFLW
- VPSIGNB
- VPSIGND
- VPSIGNW
- VPSLLD
- VPSLLDQ
- VPSLLQ
- VPSLLVD
- VPSLLVQ
- VPSRAD
- VPSRAVD
- VPSRAW
- VPSRLD
- VPSRLDQ
- VPSRLQ
- VPSRLVD
- VPSRLVQ
- VPSRLW
- VPSUBB
- VPSUBD
- VPSUBQ
- VPSUBSB
- VPSUBSW
- VPSUBUSB
- VPSUBUSW
- VPSUBW
- VPUNPCKHBW
- VPUNPCKHDQ
- VPUNPCKHQDQ
More AVX10.1 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. - 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-443 (PSLLW/
PSLLD/ PSLLQ) - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 2026)
- 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.