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

VSHA512MSG2 finishes one step of SHA-512’s message schedule: it adds the sigma1 term of FIPS 180-4’s recurrence,

W[t] = sigma1(W[t-2]) + W[t-7] + sigma0(W[t-15]) + W[t-16]

to four partial sums, as SHA256MSG2 does for SHA-256. For SHA-512, sigma1(x) is the XOR of x rotated right by 19, x rotated right by 61 and x shifted right by 6. The first operand, a YMM register, holds W[t-16] + sigma0(W[t-15]) + W[t-7] for t to t+3, that is, the result of VSHA512MSG1 with the W[t-7] terms added by software. The second holds the last four words, W[t-4] to W[t-1]; only its qwords 2 and 3 are read. The four finished words replace the first operand.

Why it comes last

W[t+2] needs sigma1(W[t]), and W[t+3] needs sigma1(W[t+1]): two of the four new words depend on the other two. VSHA512MSG2 works them out in order inside the instruction, which is why it is the last part of a step. The schedule for SHA-512 has 64 such words per block, in sixteen steps, against 48 in twelve for SHA-256; VSHA512MSG1’s page shows a whole step and what GCC 14 and Clang 23 make of it.

Both operands are registers, and the result is the whole YMM register. GCC 14 and Clang 23 provide _mm256_sha512msg2_epi64(sums, last4) with -msha512. Zen 5 has no SHA512 extension, and its recorded case raised #UD.

Forms

Every encoding of VSHA512MSG2 that Intel XED knows, one row per XED instruction form (iform). How to read the notation.
InstructionEncodingRequires
VSHA512MSG2 ymm, ymm VSHA512MSG2_YMMu64_YMMu64VEX.256.F2.0F38.W0 CD /rSHA512 + 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:
    fault(UD)                    # CPUID: no SHA512
# ymm1: W[i-16] + sigma0(W[i-15]) + W[i-7]
# for i from t to t + 3; ymm2: W[t-4] to
# W[t-1]; the result: W[t] to W[t+3]
src1 = ymm1.read()
u = ymm2.q[2]              # W[t-2]
v = ymm2.q[3]              # W[t-1]
for i in range(4):
    w = low(src1.q[i] + sigma1(u, 64), 64)
    ymm1.q[i] = w          # W[t+i]
    u = v
    v = w
# ymm1 is zeroed from bit 256 up

Run on AMD Zen 5 (EPYC 9645): 1 case. It ran where CPUID reported no SHA512, and 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
VSHA512MSG2 ymm, ymm
ymmexplicitread, write
ymmexplicitread

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-6

Intrinsics

The C intrinsics of Clang 23.1.2 that compile to VSHA512MSG2, 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
_mm256_sha512msg2_epi64 __m256i _mm256_sha512msg2_epi64(__m256i __A, __m256i __B)

VSHA512MSG2 ymm, ymm VEX.256 -msha512

VSHA512MSG2 ymm, ymm VEX.256 -msha512 -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
SHA512

SHA512 + AVX
CPUID.(EAX=07H,ECX=1):EAX[0] SHA512
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 SHA512 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-746 (VSHA512MSG2)
  4. Intel Architecture Instruction Set Extensions and Future Features Programming Reference (319433-062, June 2026)
  5. NIST FIPS 180-4: Secure Hash Standard (SHS) (August 2015)

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.