Original Post
MMX Documentation:
Quote:I don't understand how the immediate byte parameter works. By experimentation I've found that the nybble hexidecimal masks 4, C, E ...maybe others? are indentity masks when working with two 32bit values in the 64bit MMX registers, and for example 0x4C, 0xEC swaps the values. These masks don't make much masking sense to me though. 0xC = 0b1100 makes sense in a way, but the others don't. Can someone explain how you map your desired shuffle to this byte and vice versa?
PSHUFW mmreg1, mmreg2, imm8 PSHUFW mmreg, mem64, imm8 ... The PSHUFW instruction selects from the four words of the source operand (an MMX register or a 64-bit memory location) in one of 256 possible ways as defined by an immediate byte.