EVEX prefix


The EVEX prefix and corresponding coding scheme is an extension to the 32-bit x86 and 64-bit x86-64 instruction set architecture. EVEX is based on, but should not be confused with the MVEX prefix used by the Knights Corner processor.
The EVEX scheme is a 4-byte extension to the VEX scheme which supports the AVX-512 instruction set and allows addressing new 512-bit ZMM registers and new 64-bit operand mask registers.

Features

EVEX coding can address 8 operand mask registers, 16 general-purpose registers and 32 vector registers in 64-bit mode, and can support up to 4 operands.
Like the VEX coding scheme, the EVEX prefix unifies existing opcode prefixes and escape codes, memory addressing and operand length modifiers of the x86 instruction set.
The following features are carried over from the VEX scheme:
EVEX also extends VEX with additional capabilities:
For example, the EVEX encoding scheme allows conditional vector addition in the form of
VADDPS zmm1, zmm2, zmm3
where modifier next to the destination operand encodes the use of opmask register k1 for conditional processing and updates to destination, and modifier provides the two types of masking, with merging as default when no modifier is attached.

Technical description

The EVEX coding scheme uses a code prefix consisting of 4 bytes; the first byte is always 62h and derives from an unused opcode of the 32-bit BOUND instruction, which is not supported in 64-bit mode.
# of bytes41114 / 11
EVEXOpcodeModR/M /

The ModR/M byte specifies the addressing of the source register with mod and r/m fields, which encode either 8 registers or 24 addressing modes, and the destination register is encoded with reg field. Base-plus-index and scale-plus-index addressing require the SIB byte, which encodes 2-bit scale factor as well as 3-bit index and 3-bit base registers. In certain SIB encodings, Disp32 contains displacements that need to be added to the base address.
The EVEX prefix retains some fields introduced in the VEX prefix:
New functions of the existing fields:
There are several new bit fields:
The encoding of the EVEX prefix is as follows:
76543210
Byte 0 01100010
Byte 1 RXBR’00m1m0P
Byte 2 Wv3v2v1v01p1p0P
Byte 3 zL’LbV’a2a1a0P

The following table lists allowed register addressing combinations :