Partilhar via


Macro Function for Shuffle Using Streaming SIMD Extensions 2

Microsoft Specific

The Streaming SIMD Extensions 2 (SSE2) instructions provide a macro function to help create constants that describe shuffle operations. The macro takes two small integers (in the range of 0 to 1) and combines them into a 2-bit immediate value used by the SHUFPD instruction. See the following example.

Shuffle Function Macro

_MM_SHUFFLE2(x, y)
/* expands to the value of */
(x<<1) | y

You can view the two integers as selectors for choosing which two words from the first input operand and which two words from the second are to be put into the result word.

View of Original and Result Words with Shuffle Function Macro

OriginalResultWordsWithSuffleFunctionMacro graphic

See Also

Reference

Streaming SIMD Extensions 2 Instructions