# EMMS Usage Guidelines

Here are guidelines for when to use the EMMS instruction:

- Use `_mm_empty()` after an MMX™ instruction if the next instruction is a floating-point (FP) instruction. For example, you should use the EMMS instruction before performing calculations on float, double or long double. You must be aware of all situations in which your code generates an MMX™ instruction:

  - when using an MMX™ technology intrinsic

  - when using Intel® Streaming SIMD Extensions (Intel® SSE) integer intrinsics that use the `__m64` data type

  - when referencing an `__m64` data type variable

  - when using an MMX™ instruction through inline assembly

- Use different functions for operations that use floating point instructions and those that use MMX™ instructions. This action 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.

- 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).

- See the Correct Usage and Incorrect Usage coding examples in the following table.

Incorrect Usage | Correct Usage
--- | ---
__m64 x = _m_paddd(y, z); float f = init(); | __m64 x = _m_paddd(y, z); float f = ( _mm_empty(), init());

Parent topic: Intrinsics for MMX™ Technology