background image

Vol. 3A 13-11

SYSTEM PROGRAMMING FOR INSTRUCTION SET EXTENSIONS AND PROCESSOR EXTENDED STATES

13.8.1 

Intel® Advanced Vector Extensions (Intel® AVX)

Intel AVX instructions comprises of 256-bit and 128-bit instructions that operates on 256-bit YMM registers. The 
XSAVE feature set allows software to save and restore the state of these registers. See Chapter 13 of the Intel® 
64 and IA-32 Architectures Software Developer’s Manual, Volume 1
.
For processors that support YMM states, the YMM state exists in all operating modes. However, the available 
instruction interfaces to access YMM states may vary in different modes. 
Operating systems must use the XSAVE feature set for YMM state management. The XSAVE feature set also 
provides flexible and efficient interface to manage XMM/MXCSR states and x87 FPU states in conjunction with 
newer processor extended states like YMM states. Operating systems may need to be aware of the following when 
supporting AVX.

•

Saving/Restoring AVX state in non-compacted format without SSE state will also save/restore MXCSR even 
though MXCSR is not part of AVX state. This does not happen when compacted format is used. 

•

Few AVX instructions such as VZEROUPPER/VZEROALL may operate on future expansion of YMM registers.

An operating system must enable its YMM state management to support AVX and any 256-bit extensions that 
operate on YMM registers. Otherwise, an attempt to execute an instruction in AVX extensions (including an 
enhanced 128-bit SIMD instructions using VEX encoding) will cause a #UD exception. 
AVX instructions may generate SIMD floating-point exceptions. An OS must enable SIMD floating-point exception 
support by setting CR4.OSXMMEXCPT[bit 10]=1.

13.8.2 

Intel® Advanced Vector Extensions 512 (Intel® AVX-512)

Intel AVX-512 instructions are encoded using EVEX prefix. The EVEX encoding scheme can support 512-bit, 256-
bit and 128-bit instructions that operate on opmask, ZMM, YMM and XMM registers.
For processors that support the Intel AVX-512 family of instructions, the extended processor states (ZMM and 
opmask registers) exist in all operating modes. However, the access to these states may vary in different modes. 
The processor's support for instruction extensions that employ EVEX prefix encoding is independent of the 
processor's support for using XSAVE feature set on those states.
Instructions requiring EVEX prefix encoding are generally supported in 64-bit, 32-bit modes, and 16-bit protected 
mode. They are not supported in Real mode, Virtual-8086 mode or entering into SMM mode. Note that bits 
MAX_VL-1:256 (511:256) of ZMM register state are maintained across transitions into and out of these modes. 
Because the XSAVE feature set instruction can operate in all operating modes, it is possible that the processor's 
ZMM register state can be modified by software in any operating mode by executing XRSTOR.
Operating systems must use the XSAVE/XRSTOR/XSAVEOPT instructions for ZMM and opmask state management. 
An OS must enable its ZMM and opmask state management to support Intel AVX-512 Foundation instructions. 
Otherwise, an attempt to execute an instruction in Intel AVX-512 Foundation instructions (including a scalar 128-
bit SIMD instructions using EVEX encoding) will cause a #UD exception. An operating system, which enables the 
AVX-512 state to support Intel AVX-512 Foundation instructions, is also sufficient to support the rest of the Intel 
AVX-512 family of instructions. Note that even though ZMM8-ZMM31 are not accessible in 32 bit mode, a 32 bit OS 
is still required to allocate memory for the entire ZMM state.
Intel AVX-512 Foundation instructions may generate SIMD floating-point exceptions. An OS must enable SIMD 
floating point exception support by setting CR4.OSXMMEXCPT[bit 10]=1.