Macro Function for Shuffle Using Streaming SIMD Extensions
SSE provides a macro function to help create constants that describe shuffle operations. The macro takes four small integers (in the range of 0 to 3) and combines them into an 8-bit immediate value used by the SHUFPS instruction. See the following example.
Shuffle Function Macro
_MM_SHUFFLE(z, y, x, w) /* expands to the following value */ (z<<6) | (y<<4) | (x<<2) | w
You can view the four 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