The guidelines when to use EMMS are:
Do not use on Itanium(TM)-based systems. There are no special registers (or overlay) for the MMX(TM) instructions or Streaming SIMD Extensions on Itanium-based systems even though the intrinsics are supported.
Use _mm_empty( ) after an MMX instruction if the next instruction is a floating-point (FP) instruction–for example, before calculations on float, double or long double. You must be aware of all situations when your code generates an MMX instruction with the Intel® C++ Compiler, i.e.:
when using an MMX technology intrinsic
when using Streaming SIMD Extension integer intrinsics that use the __m64 data type
when referencing an __m64 data type variable
when using an MMX instruction through inline assembly
Do not use _mm_empty() before an MMX instruction, since using _mm_empty() before an MMX instruction incurs an operation with no benefit (no-op).
Use different functions for operations that use FP instructions and those that use MMX instructions. This eliminates the need to empty the multimedia state within the body of a critical loop.
Use _mm_empty() during runtime initialization of __m64 and FP data types. This ensures resetting the register between data type transitions.
See the "Correct Usage" coding example below.
Incorrect Usage | Correct Usage |
---|---|
__m64 x = _m_paddd(y, z); float f = init(); |
__m64 x = _m_paddd(y, z); float f = (_mm_empty(), init()); |
For more documentation on EMMS, visit the http://developer.intel.com web site and search on EMMS: