Instruction
VPSLLQ
Shifts quadwords left by one count from a register or an immediate.
VPSLLQ shifts each quadword left by one shared count, filling with zeros: the VEX and EVEX form of PSLLQ, whose page covers the operation and why bits never cross from one quadword to the next. The forms are those of VPSLLD: three operands, VEX.128 for AVX and VEX.256 for AVX2, EVEX (AVX-512F) with masking, the 512-bit width and a memory source for the immediate form, here whole or as one broadcast quadword. The count is an immediate or the low quadword of an XMM register or of memory, and anything above 63 clears the element.
Zen 5’s recorded cases: vpsllq ymm1, ymm2, xmm3 took its count, 3,
from the low quadword of XMM3 and ignored the random bits above it,
turning FFFFFFFFFFFFFFFFh into FFFFFFFFFFFFFFF8h in both lanes; {evex} vpsllq ymm9, ymm9, [mem], whose count was 8000000000000000h, cleared
all four quadwords; and vpsllq zmm0{k5}, qword bcst [mem], 0xff
cleared the four elements k5 selects and kept the other four.
In compiled code
In our builds at -O2 over uint64_t arrays, b[i] << 3 is VPSLLQ by 3
with -march=x86-64-v3 in GCC 14 and Clang 23, read straight from
memory with -march=x86-64-v4. AVX2 has no 64-bit multiply, and
b[i] * c[i] at -v3 is built from 32-bit products in both compilers:
two VPSRLQ by 32 bring the high halves down, three
VPMULUDQ form the partial products, and VPSLLQ by 32
moves the sum of the cross products up before the last
VPADDQ. At -v4 it is one
VPMULLQ, from AVX512DQ.
Intel’s optimization manual names VPSLLQ with VPMULUDQ, VPADDQ, VPSRLQ, VPBROADCASTQ and VPERMQ as the AVX2 instructions for vectorized modular multiplication, with numbers held as 29-bit digits in doublewords so that the 64-bit products leave room for carries (Section 15.16.2). 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 |
|---|---|---|
VPSLLQ xmm, xmm, m128
VPSLLQ_XMMdq_XMMdq_MEMdq | VEX.128.66.0F.WIG F3 /r | AVX |
VPSLLQ xmm, xmm, xmm
VPSLLQ_XMMdq_XMMdq_XMMdq | VEX.128.66.0F.WIG F3 /r | AVX |
VPSLLQ xmm, xmm, imm8
VPSLLQ_XMMdq_XMMdq_IMMb | VEX.128.66.0F.WIG 73 /6 ib | AVX |
VPSLLQ ymm, ymm, m128
VPSLLQ_YMMqq_YMMqq_MEMdq | VEX.256.66.0F.WIG F3 /r | AVX2 |
VPSLLQ ymm, ymm, xmm
VPSLLQ_YMMqq_YMMqq_XMMq | VEX.256.66.0F.WIG F3 /r | AVX2 |
VPSLLQ ymm, ymm, imm8
VPSLLQ_YMMqq_YMMqq_IMMb | VEX.256.66.0F.WIG 73 /6 ib | AVX2 |
VPSLLQ zmm {k}{z}, zmm, xmm
VPSLLQ_ZMMu64_MASKmskw_ZMMu64_XMMu64_AVX512 | EVEX.512.66.0F.W1 F3 /r | AVX10.1 or AVX512F |
VPSLLQ zmm {k}{z}, zmm, m128
VPSLLQ_ZMMu64_MASKmskw_ZMMu64_MEMu64_AVX512 | EVEX.512.66.0F.W1 F3 /r | AVX10.1 or AVX512F |
VPSLLQ zmm {k}{z}, zmm, imm8
VPSLLQ_ZMMu64_MASKmskw_ZMMu64_IMM8_AVX512 | EVEX.512.66.0F.W1 73 /6 ib | AVX10.1 or AVX512F |
VPSLLQ zmm {k}{z}, m512/m64bcst, imm8
VPSLLQ_ZMMu64_MASKmskw_MEMu64_IMM8_AVX512 | EVEX.512.66.0F.W1 73 /6 ib | AVX10.1 or AVX512F |
VPSLLQ xmm {k}{z}, xmm, imm8
VPSLLQ_XMMu64_MASKmskw_XMMu64_IMM8_AVX512 | EVEX.128.66.0F.W1 73 /6 ib | AVX10.1 or AVX512F + AVX512VL |
VPSLLQ xmm {k}{z}, m128/m64bcst, imm8
VPSLLQ_XMMu64_MASKmskw_MEMu64_IMM8_AVX512 | EVEX.128.66.0F.W1 73 /6 ib | AVX10.1 or AVX512F + AVX512VL |
VPSLLQ xmm {k}{z}, xmm, xmm
VPSLLQ_XMMu64_MASKmskw_XMMu64_XMMu64_AVX512 | EVEX.128.66.0F.W1 F3 /r | AVX10.1 or AVX512F + AVX512VL |
VPSLLQ xmm {k}{z}, xmm, m128
VPSLLQ_XMMu64_MASKmskw_XMMu64_MEMu64_AVX512 | EVEX.128.66.0F.W1 F3 /r | AVX10.1 or AVX512F + AVX512VL |
VPSLLQ ymm {k}{z}, ymm, imm8
VPSLLQ_YMMu64_MASKmskw_YMMu64_IMM8_AVX512 | EVEX.256.66.0F.W1 73 /6 ib | AVX10.1 or AVX512F + AVX512VL |
VPSLLQ ymm {k}{z}, m256/m64bcst, imm8
VPSLLQ_YMMu64_MASKmskw_MEMu64_IMM8_AVX512 | EVEX.256.66.0F.W1 73 /6 ib | AVX10.1 or AVX512F + AVX512VL |
VPSLLQ ymm {k}{z}, ymm, xmm
VPSLLQ_YMMu64_MASKmskw_YMMu64_XMMu64_AVX512 | EVEX.256.66.0F.W1 F3 /r | AVX10.1 or AVX512F + AVX512VL |
VPSLLQ ymm {k}{z}, ymm, m128
VPSLLQ_YMMu64_MASKmskw_YMMu64_MEMu64_AVX512 | EVEX.256.66.0F.W1 F3 /r | AVX10.1 or AVX512F + AVX512VL |
Latency and throughput
| Model | xmm, xmm, m128xmm {k}{z}, xmm, m128 | xmm, xmm, xmmxmm {k}{z}, xmm, xmm | xmm, xmm, imm8 | ymm, ymm, m128ymm {k}{z}, m256/m64bcst, imm8ymm {k}{z}, ymm, m128 | ymm, ymm, xmmymm {k}{z}, ymm, xmm | ymm, ymm, imm8 | zmm {k}{z}, zmm, xmm | zmm {k}{z}, zmm, m128zmm {k}{z}, m512/m64bcst, imm8 | zmm {k}{z}, zmm, imm8 | xmm {k}{z}, xmm, imm8ymm {k}{z}, ymm, imm8 | xmm {k}{z}, m128/m64bcst, imm8 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 | 4 / 1p05 | 8 / 1p0 | 1 / 1p0 | 1 / 0.5p01 | 7 / 0.5p01 |
| Ice Lake | 7 / 0.5p01 | 2 / 0.67p015 | 1 / 0.5p01 | 8 / 0.5p01 | 4 / 1p015 | 1 / 0.5p01 | 4 / 1p05 | 8 / 1p0 | 1 / 1p0 | 1 / 0.5p01 | 7 / 0.5p01 |
| 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 | 4 / 1p05 | 9 / 1p0 | 1 / 1p0 | 1 / 0.5p01 | 8 / 0.5p01 |
| 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 / 11FP0 FP1 | 1 / 0.5FP1 FP2 | 8 / 0.5FP1 FP2 | 2 / 12FP0 FP1 | 1 / 0.5FP1 FP2 | 2 / 1FP0 FP1 | 8 / 1FP1 FP2 | 1 / 0.5FP0 FP1 | 1 / 0.5FP0 FP1 | 8 / 0.5FP1 FP2 |
| 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.
VPSLLQ xmm, xmm, xmm/m128 VPSLLQ ymm, ymm, xmm/m128 VPSLLQ xmm {k}{z}, xmm, xmm/m128 VPSLLQ ymm {k}{z}, ymm, xmm/m128 VPSLLQ zmm {k}{z}, zmm, xmm/m128Every quadword works alike: 2, 4 and 8 quadwords 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 quadword i comes from quadword i of xmm2 and the count in xmm3. Result quadwords 1 to 0: r1, r0.
VPSLLQ xmm, xmm, imm8 VPSLLQ ymm, ymm, imm8 VPSLLQ xmm {k}{z}, xmm/m128/m64bcst, imm8 VPSLLQ ymm {k}{z}, ymm/m256/m64bcst, imm8 VPSLLQ zmm {k}{z}, zmm/m512/m64bcst, imm8Every quadword works alike: 2, 4 and 8 quadwords 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}. With m64bcst, one quadword from memory stands for every element of the last source.
Result quadword i comes from quadword i of xmm2. Result quadwords 1 to 0: r1, r0.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
VPSLLQ xmm, xmm, xmm/m128 VPSLLQ ymm, ymm, xmm/m128 VPSLLQ xmm {k}{z}, xmm, xmm/m128 VPSLLQ ymm {k}{z}, ymm, xmm/m128 VPSLLQ zmm {k}{z}, zmm, xmm/m128count = src3.q[0]
for i in range(VL // 64):
if k1[i]: # 1 without a write mask
a = zmm2.q[i]
if count < 64:
zmm1.q[i] = a << count
else:
zmm1.q[i] = 0
elif zeroing:
zmm1.q[i] = 0
# else: zmm1.q[i] keeps its value
# zmm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 10 cases.
VPSLLQ xmm, xmm, imm8 VPSLLQ ymm, ymm, imm8 VPSLLQ xmm {k}{z}, xmm/m128/m64bcst, imm8 VPSLLQ ymm {k}{z}, ymm/m256/m64bcst, imm8 VPSLLQ zmm {k}{z}, zmm/m512/m64bcst, imm8for i in range(VL // 64):
if k1[i]: # 1 without a write mask
a = src2.q[i]
if imm8 < 64:
zmm1.q[i] = a << imm8
else:
zmm1.q[i] = 0
elif zeroing:
zmm1.q[i] = 0
# else: zmm1.q[i] keeps its value
# m64bcst: src2.q[i] is the m64 for every i
# zmm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 8 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
VPSLLQ xmm, xmm, xmm/m128 VPSLLQ ymm, ymm, xmm/m128 | ||
xmm, ymm | explicit | write |
xmm, ymm | explicit | read |
xmm/m128 | explicit | read |
VPSLLQ xmm, xmm, imm8 VPSLLQ ymm, ymm, imm8 | ||
xmm, ymm | explicit | write |
xmm, ymm | explicit | read |
imm8 | explicit | read |
VPSLLQ xmm {k}{z}, xmm, xmm/m128 VPSLLQ ymm {k}{z}, ymm, xmm/m128 VPSLLQ 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 |
VPSLLQ xmm {k}{z}, xmm/m128/m64bcst, imm8 VPSLLQ ymm {k}{z}, ymm/m256/m64bcst, imm8 VPSLLQ zmm {k}{z}, zmm/m512/m64bcst, imm8 | ||
xmm, ymm, zmm | explicit | write (masked) |
{k} | explicit | read (write mask) |
xmm/m128/m64bcst, ymm/m256/m64bcst, zmm/m512/m64bcst | explicit | read |
imm8 | 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.
VPSLLQ xmm, xmm, xmm/m128VPSLLQ xmm, xmm, imm8VPSLLQ ymm, ymm, imm8avx-type-7VPSLLQ ymm, ymm, xmm/m128avx-type-4VPSLLQ xmm {k}{z}, xmm, xmm/m128VPSLLQ ymm {k}{z}, ymm, xmm/m128VPSLLQ zmm {k}{z}, zmm, xmm/m128AVX512-E4NFVPSLLQ xmm {k}{z}, xmm/m128/m64bcst, imm8VPSLLQ ymm {k}{z}, ymm/m256/m64bcst, imm8VPSLLQ zmm {k}{z}, zmm/m512/m64bcst, imm8AVX512-E4
Attributes
What else XED records about the forms. How to read.
- EVEX forms
- write masking
VPSLLQ xmm {k}{z}, m128/m64bcst, imm8VPSLLQ ymm {k}{z}, m256/m64bcst, imm8VPSLLQ zmm {k}{z}, m512/m64bcst, imm8- embedded broadcast (tuple Full); memory fault suppression
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to VPSLLQ, 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_epi64
__m128i _mm_sll_epi64(__m128i __a, __m128i __count) |
|
_mm_slli_epi64
__m128i _mm_slli_epi64(__m128i __a, int __count) |
|
_mm_mask_sll_epi64
__m128i _mm_mask_sll_epi64(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) |
|
_mm_mask_slli_epi64
__m128i _mm_mask_slli_epi64(__m128i __W, __mmask8 __U, __m128i __A, unsigned int __B) |
|
_mm_maskz_sll_epi64
__m128i _mm_maskz_sll_epi64(__mmask8 __U, __m128i __A, __m128i __B) |
|
_mm_maskz_slli_epi64
__m128i _mm_maskz_slli_epi64(__mmask8 __U, __m128i __A, unsigned int __B) |
|
_mm256_sll_epi64
__m256i _mm256_sll_epi64(__m256i __a, __m128i __count) |
|
_mm256_slli_epi64
__m256i _mm256_slli_epi64(__m256i __a, int __count) |
|
_mm256_mask_sll_epi64
__m256i _mm256_mask_sll_epi64(__m256i __W, __mmask8 __U, __m256i __A, __m128i __B) |
|
_mm256_mask_slli_epi64
__m256i _mm256_mask_slli_epi64(__m256i __W, __mmask8 __U, __m256i __A, unsigned int __B) |
|
_mm256_maskz_sll_epi64
__m256i _mm256_maskz_sll_epi64(__mmask8 __U, __m256i __A, __m128i __B) |
|
_mm256_maskz_slli_epi64
__m256i _mm256_maskz_slli_epi64(__mmask8 __U, __m256i __A, unsigned int __B) |
|
_mm512_sll_epi64
__m512i _mm512_sll_epi64(__m512i __A, __m128i __B) |
|
_mm512_slli_epi64
__m512i _mm512_slli_epi64(__m512i __A, unsigned int __B) |
|
_mm512_mask_sll_epi64
__m512i _mm512_mask_sll_epi64(__m512i __W, __mmask8 __U, __m512i __A, __m128i __B) |
|
_mm512_mask_slli_epi64
__m512i _mm512_mask_slli_epi64(__m512i __W, __mmask8 __U, __m512i __A, unsigned int __B) |
|
_mm512_maskz_sll_epi64
__m512i _mm512_maskz_sll_epi64(__mmask8 __U, __m512i __A, __m128i __B) |
|
_mm512_maskz_slli_epi64
__m512i _mm512_maskz_slli_epi64(__mmask8 __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
- VPMOVZXWD
- VPMOVZXWQ
- VPMULDQ
- VPMULHRSW
- VPMULHUW
- VPMULHW
- VPMULLD
- VPMULLW
- VPMULUDQ
- VPOR
- VPSADBW
- VPSHUFB
- VPSHUFD
- VPSHUFHW
- VPSHUFLW
- VPSIGNB
- VPSIGND
- VPSIGNW
- VPSLLD
- VPSLLDQ
- VPSLLW
- VPSRAD
- VPSRAW
- VPSRLD
- VPSRLDQ
- VPSRLQ
- VPSRLW
- VPSUBB
- VPSUBD
- VPSUBQ
- VPSUBSB
- VPSUBSW
- VPSUBUSB
- VPSUBUSW
- VPSUBW
- VPTEST
- VPUNPCKHBW
- VPUNPCKHDQ
- VPUNPCKHQDQ
- VPUNPCKHWD
More AVX2 instructions
- VPMOVZXWD
- VPMOVZXWQ
- VPMULDQ
- VPMULHRSW
- VPMULHUW
- VPMULHW
- VPMULLD
- VPMULLW
- VPMULUDQ
- VPOR
- VPSADBW
- VPSHUFB
- VPSHUFD
- VPSHUFHW
- VPSHUFLW
- VPSIGNB
- VPSIGND
- VPSIGNW
- VPSLLD
- VPSLLDQ
- VPSLLVD
- VPSLLVQ
- VPSLLW
- VPSRAD
- VPSRAVD
- VPSRAW
- VPSRLD
- VPSRLDQ
- VPSRLQ
- VPSRLVD
- VPSRLVQ
- VPSRLW
- VPSUBB
- VPSUBD
- VPSUBQ
- VPSUBSB
- VPSUBSW
- VPSUBUSB
- VPSUBUSW
- VPSUBW
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)
- Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, October 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.