
SSE extension, the part of single-byte prefixes, namely, 0xf2 , 0xf3 , 0x66 in some cases, the part of the opcode became meaningful. Appeared the so-called mandatory prefixes (persistent . Mandatory prefixes). Examples of such instructions are given below.| Encoding | Instruction | Mandatory prefix | 
|---|---|---|
0x0f 0x10 | MOVUPS | - | 
0xf2 0x0f 0x10 | MOVSD | 0xf2 | 
0xf3 0x0f 0x10 | MOVSS | 0xf3 | 
0x66 0x0f 0x10 | MOVUPD | 0x66 | 
0x0f 0x10 . At the same time, the semantics of these instructions is different. For example, MOVSD copies 64 bits from one operand to another, and 128 bits from MOVUPD .REX . This prefix is also single-byte, and has the form 0x4* . Its bits are used to extend the already existing fields encoded in the Mod_R/M byte, as well as the width of the operand. The figure shows an example of using the REX prefix to address registers.
0x4* corresponds to the prefix only in the 64-bit mode, in all other modes it corresponds to the variants of the INC/DEC instructions. An interesting feature of this prefix is that it must be located immediately before the opcode byte, otherwise it is ignored. If the REX prefix is used together with an instruction requiring the presence of another mandatory prefix, it must be located between that prefix and the opcode byte.AVX extension, a new prefix called VEX appeared in the IA-32 command system. It is no longer single byte. It can consist of either two or three bytes, depending on the first byte of the prefix. 0xc4 and 0xc5 respectively.
R , X , B , W fields carry the same meaning as the corresponding REX prefix fields. The pp field provides functionality equivalent to the mandatory SIMD prefixes (for example, b01 = 0x66 ). And the m-mmmm field can correspond to two whole bytes of the opcode (for example, 0b00011 = 0x0f 0x3a ). The L field defines the length of the vector: 0 - 128 bits, 1 - 256 bits.VEX prefix provides the following benefits:XMM registers and 256-bit YMM registers.REX prefix to address general purpose registers ( R8 - R15 ), vector registers XMM8 - XMM15 ( YMM8 - YMM15 ). VEX allows you to encode the same fields as REX , and, in addition, several new ones.VEX prefix together with some single-byte prefixes ( 0xf0 , 0x66 , 0xf2 , 0xf3 , REX ) is prohibited and results in a #UD exception.AVX3 or AVX512 . With the advent of this extension, a new prefix has also appeared, called EVEX . Its description can be found in the Intel Architecture Instruction Set Extensions Programming Reference .
VEX prefix, has a length of 4 bytes and starts with byte 0x62 , which in all modes except 64-bit corresponds to the BOUND , rarely used in modern programs.EVEX prefix:LL` - necessary to support vectors of 128, 256 and 512 bits in size.ZMM8 - ZMM31 .EVEX.aaa .EVEX.mm is the equivalent of the VEX.m-mmmm field, but takes two bits instead of five.Source: https://habr.com/ru/post/200598/
All Articles