Extensions
Forms
2 (2 VEX)
Data
Intel XED v2026.08.23

VSM3MSG2 finishes one step of SM3’s message expansion, whose recurrence is

W[j] = P1(W[j-16] ^ W[j-9] ^ (W[j-3] <<< 15)) ^ (W[j-13] <<< 7) ^ W[j-6]

with <<< a left rotation. Its first operand holds the P1 parts that VSM3MSG1 computed for four consecutive j; the second, W[j-13] to W[j-10]; the third, a register or 16 bytes of memory, W[j-6] to W[j-3]. VSM3MSG2 XORs in each word’s W[j-13] rotated left by 7 and its W[j-6], and the four finished words replace the first operand.

The last word

VSM3MSG1 could not include, in the fourth word, the rotation of W[j], the first word of the same step. Once that word is finished, VSM3MSG2 adds the missing part to the fourth: W[j] rotated left by 6, by 15 and by 30, the P1 of W[j] rotated by 15, which may be added late because P1 uses only rotations and XOR. So the four words come out complete, and the next step can use them at once.

Around it

Both operands for VSM3MSG2 come from byte shifts of the last sixteen words: in registers m0 to m3, oldest first, W[j-13] to W[j-10] are _mm_alignr_epi8(m1, m0, 12) and W[j-6] to W[j-3] are _mm_alignr_epi8(m3, m2, 8). VSM3MSG1’s page lists what GCC 14 and Clang 23 make of a whole step. Unlike SHA-256’s SHA256MSG2, SM3’s schedule has no additions, only XOR and rotations, and it produces 68 words where the rounds of VSM3RNDS2 number 64: the last four serve only in the XORs W[j] ^ W[j+4] of rounds 60 to 63.

GCC 14 and Clang 23 provide _mm_sm3msg2_epi32(p1s, w13, w6) with -msm3. Zen 5 has no SM3 extension, and both its recorded cases raised #UD.

Forms

Every encoding of VSM3MSG2 that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
VSM3MSG2 xmm, xmm, xmm VSM3MSG2_XMMu32_XMMu32_XMMu32VEX.128.66.0F38.W0 DA /rSM3 + AVX
VSM3MSG2 xmm, xmm, m128 VSM3MSG2_XMMu32_XMMu32_MEMu32VEX.128.66.0F38.W0 DA /rSM3 + AVX

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: VSM3MSG1's result; xmm2: W[j-13]
# to W[j-10]; src3: W[j-6] to W[j-3]; the
# result: W[j] to W[j+3]
for i in range(4):
    x = xmm1.d[i] ^ src3.d[i]
    x ^= rol(xmm2.d[i], 7, 32)
    if i == 0:
        w = x              # W[j]
    elif i == 3:           # W[j]'s part
        x ^= sm3_p1(rol(w, 15, 32))
    xmm1.d[i] = x
# xmm1 is zeroed from bit 128 up

Run on AMD Zen 5 (EPYC 9645): 2 cases. Its cases ran where CPUID reported no SM3, and every one raised an exception.

Operands

What each form reads and writes, as Intel XED records it: the operands of its syntax, in order, and the implicit ones that the syntax does not name. How to read.
OperandKindAction
VSM3MSG2 xmm, xmm, xmm/m128
xmmexplicitread, write
xmmexplicitread
xmm/m128explicitread

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 VSM3MSG2, 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.

IntrinsicCompiles to
_mm_sm3msg2_epi32 __m128i _mm_sm3msg2_epi32(__m128i __A, __m128i __B, __m128i __C)

VSM3MSG2 xmm, xmm, xmm VEX.128 -msm3

VSM3MSG2 xmm, xmm, xmm VEX.128 -msm3 -mavxwith AVX enabled

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.

CPUID requirements and processors of the XED ISA sets above. Alternatives are separated by “or”; processors follow XED’s chip model, whose AMD processors end with Zen 2, and the CPU data of this site for Zen 3 to Zen 6.
ISA setCPUIDProcessors
SM3

SM3 + AVX
CPUID.(EAX=07H,ECX=1):EAX[1] SM3
CPUID.01H:ECX[28] 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

  1. Intel XED v2026.08.23 (commit 0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model.
  2. 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.
  3. Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2C, page 5-757 (VSM3MSG2)
  4. Intel Architecture Instruction Set Extensions and Future Features Programming Reference (319433-062, June 2026)
  5. 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.