Instruction
VSM3MSG1
Performs the first part of the SM3 message expansion for the next four message words.
- Extensions
- Forms
- 2 (2 VEX)
- Data
- Intel XED v2026.08.23
VSM3MSG1 starts one step of SM3’s message expansion, four words at a time. SM3 extends a block’s 16 words to 68, each new one as
W[j] = P1(W[j-16] ^ W[j-9] ^ (W[j-3] <<< 15)) ^ (W[j-13] <<< 7) ^ W[j-6]
where <<< rotates left and P1(x) is x XOR x rotated left by 15 XOR x
rotated left by 23. VSM3MSG1 computes the P1 part for four consecutive
j. Its third operand, a register or 16 bytes of memory, holds W[j-16] to
W[j-13], dword 0 the oldest; the first, W[j-9] to W[j-6]; the second,
W[j-3] to W[j-1] in dwords 0 to 2. The four results replace the first
operand.
The missing term
The fourth word needs W[j] rotated, the first word of this very step, which does not exist yet. VSM3MSG1 leaves that term out, and VSM3MSG2 adds it at the end. That works because P1 is built from rotations and XOR alone: P1 of a sum by XOR is the XOR of the P1s, and P1 of W[j] rotated by 15 is the XOR of W[j] rotated by 6, 15 and 30, which is what VSM3MSG2 folds into its last word.
One step
With the last sixteen words in four registers, oldest first, as m0 to
m3, the operands are m0 and two pieces cut with byte shifts: W[j-9]
to W[j-6] are _mm_alignr_epi8(m2, m1, 12), and W[j-3] to W[j-1] are
m3 shifted right by four bytes. VSM3MSG2 needs two more such pieces.
GCC 14 and Clang 23 at -O2 (-msm3) compile the whole step to three
VPALIGNRs, a VPSRLDQ, the two SM3 instructions and
one register move. Thirteen steps make the 52 words after the first 16,
which the rounds of VSM3RNDS2 use as W[j] and as
W[j] XOR W[j+4].
Zen 5 has no SM3 extension (CPUID leaf 7, subleaf 1, EAX bit 1), and both its recorded cases raised #UD.
Forms
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
if not cpuid_leaf(7, 1)[0] >> 1 & 1:
fault(UD) # CPUID: no SM3
# xmm1: W[j-9] to W[j-6]; xmm2: W[j-3] to
# W[j-1]; src3: W[j-16] to W[j-13]; each
# dword i: P1 of W[j+i-16] ^ W[j+i-9] ^
# rol(W[j+i-3], 15), that of dword 3 yet
# without W[j]
for i in range(4):
x = xmm1.d[i] ^ src3.d[i]
if i < 3:
x ^= rol(xmm2.d[i], 15, 32)
xmm1.d[i] = sm3_p1(x)
# xmm1 is zeroed from bit 128 upRun on AMD Zen 5 (EPYC 9645): 2 cases. Its cases ran where CPUID reported no SM3, and every one raised an exception.
Operands
| Operand | Kind | Action |
|---|---|---|
VSM3MSG1 xmm, xmm, xmm/m128 | ||
xmm | explicit | read, write |
xmm | 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.
- All forms
avx-type-4
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to VSM3MSG1, 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_sm3msg1_epi32
__m128i _mm_sm3msg1_epi32(__m128i __A, __m128i __B, __m128i __C) |
|
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 |
|---|---|---|
SM3 | SM3 + AVX | Arrow Lake, Panther Lake, Nova Lake, Diamond Rapids, Clearwater Forest Note: Intel's extensions reference introduces these instructions with Arrow Lake S, and GCC's -march=arrowlake, which it selects for Arrow Lake H and U, leaves them out. |
More SM3 instructions
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - 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. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2C, page 5-755 (VSM3MSG1)
- Intel Architecture Instruction Set Extensions and Future Features Programming Reference (319433-062, June 2026)
- IETF draft-sca-cfrg-sm3-02: The SM3 Cryptographic Hash Function (January 2018)
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, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.