AESIMC: Perform the AES "Inverse Mix Columns" Transformation

For information about interpreting this page, see the help page.
Opcode and MnemonicEncoding16 bit Mode32 bit Mode64 bit ModeCPUID Feature FlagDescription
66 0F 38 DB /r
AESIMC xmm1, xmm2/m128
RMInvalidValidValidAESPerforms the "inverse mix columns" transformation on a 128 bit round key from xmm2/m128. Stores the result in xmm1.
VEX.128.66.0F38.WIG DB /r
VAESIMC xmm1, xmm2/m128
RMInvalidValidValidAES
AVX
Performs the "inverse mix columns" transformation on a 128 bit round key from xmm2/m128. Stores the result in xmm1.

Encoding

EncodingOperand 1Operand 2
RMModRM.reg[w]ModRM.r/m[r]

Description

The (V)AESIMC instruction performs the "inverse mix columns" (InvMixColumns) transformation on a round key stored in the source operand. The result is stored in in the destination operand.

This instruction should be applied to the expanded AES round keys (excepting the first and last) to prepare them for decryption using the "Equivalent Inverse Cipher" (see FIPS 197).

The VEX form of this instruction reserves VEX.vvvv (i.e. it must be set to 0b1111). Failure to do so will result in a #UD exception.

Operation

This pseudo-code uses C# syntax. A list of the types used is available here.
public void AESIMC(SimdU128 dest, SimdU128 src)
{
  dest[0] = AesInvMixColumns(src[0]);
  // dest[1..Simd.MAX] (unmodified)
}

public void VAESIMC_Vex128(SimdU128 dest, SimdU128 src)
{
  dest[0] = AesInvMixColumns(src[0]);
  dest[1..Simd.MAX] = 0;
}

C Intrinsics

Exceptions

SIMD Floating-Point

None

Other

See Exceptions Type 4.

#UD
If VEX.vvvv is not 0b1111.