Instruction
VAESKEYGENASSIST
Computes the substituted and rotated words, with a round constant from an immediate, that AES key expansion needs; VEX form.
- Extensions
- Forms
- 2 (2 VEX)
- Data
- Intel XED v2026.08.23
VAESKEYGENASSIST is the VEX form of AESKEYGENASSIST, whose page covers SubWord, RotWord, the round constant and the shuffles and XORs that finish a step of the key expansion. It needs AES and AVX, reads one 128-bit source, register or memory at any alignment, clears the destination above bit 127 and raises #UD unless VEX.vvvv is 1111b. Like VAESIMC it has no 256-bit and no EVEX form: VAES widened only the rounds, and a key schedule is computed once, one key at a time.
Recorded on Zen 5
- From the cipher key of FIPS-197’s AES-128 example, 000102030405060708090A0B0C0D0E0F, with the round constant 01h, dword 3 of the result held the bytes D6 AB 76 FE; XORed with the key’s first word, 00 01 02 03, they give D6 AA 74 FD, the first word of round key 1 in the standard.
- From a zero source, the immediate 80h gave the bytes E3 63 63 63 in dwords 1 and 3 and 63 in every other byte: the constant changes only the lowest byte of each rotated word.
- All four recorded cases cleared bits 511:128.
In compiled code
The three-operand forms around it remove the register copies of the
legacy sequence. In our builds at -O2, three steps of an AES-128 key
expansion written with _mm_aeskeygenassist_si128, _mm_shuffle_epi32
and three _mm_slli_si128 and XOR pairs take GCC 14 thirteen
instructions per step with -maes alone, three of them MOVDQA, and ten
with -march=x86-64-v3 -maes, where VPSLLDQ writes a
new register and nothing is copied. Clang 23 drops its copies the same
way.
AMD’s latency spreadsheet for Zen 5 gives VAESKEYGENASSIST one row, the VEX one: a latency of 4 cycles, two per cycle on pipes FP0 and FP1, as for AESKEYGENASSIST.
Forms
Latency and throughput
| Model | xmm, xmm, imm8 | xmm, m128, imm8 |
|---|---|---|
| Sandy Bridge | 8 / 3.67p015 | 14 / 3.33p015 |
| Haswell | 29 / 7p015 | 34 / 7p015 |
| Broadwell | 29 / 7p015 | 33 / 7p015 |
| Skylake, Skylake-SP, Ice Lake | 20 / 6p015 | 25 / 6p015 |
| Alder Lake, Sapphire Rapids | 7 / 4p0156 | 12 / 4p0156 |
| Piledriver | 5 / 1FPMMA FPU0 | 10 / 1.5FPMMA FPU0 |
| Zen, Zen 2 | 4 / 0.5FPU0 FPU1 | 11 / 0.5FPU0 FPU1 |
| Zen 3, Zen 4 | 4 / 0.5FP0 FP1 | 11 / 0.5FP0 FP1 |
| Jaguar | 2 / 1FPU0 VIMUL | 7 / 1FPU0 VIMUL |
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
x1 = sub_word(src2.d[1]) # SubWord: each byte
x3 = sub_word(src2.d[3]) # through the S-box
xmm1.d[0] = x1
xmm1.d[1] = ror(x1, 8, 32) ^ imm8 # RotWord turns byte 1
xmm1.d[2] = x3 # into byte 0; imm8 is
xmm1.d[3] = ror(x3, 8, 32) ^ imm8 # zero-extended
# xmm1 is zeroed from bit 128 upRun on AMD Zen 5 (EPYC 9645): 4 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
VAESKEYGENASSIST xmm, xmm/m128, imm8 | ||
xmm | explicit | write |
xmm/m128 | 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.
- All forms
avx-type-4
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 |
|---|---|---|
AVXAES | AES + AVX | Sandy Bridge, Ivy Bridge, Haswell, Broadwell, Skylake, Comet Lake, Cannon Lake, Ice Lake (client), Tiger Lake, Alder Lake, Arrow Lake, Panther Lake, Nova Lake, Skylake-SP, Cascade Lake, Cooper Lake, Ice Lake (server), Sapphire Rapids, Emerald Rapids, Granite Rapids, Diamond Rapids, Sierra Forest, Clearwater Forest, Knights Landing, Knights Mill, Bulldozer, Piledriver, Zen, Zen+, Zen 2, Zen 3, Zen 4, Zen 5, Zen 6 |
More AES-NI 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. - 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 2A, page 3-58 (AESKEYGENASSIST)
- 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 timings come from LLVM's scheduling models, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.