3-548
INSTRUCTION SET REFERENCE
PSHUFWPacked Shuffle Word
Description
The PSHUF instruction uses the imm8 operand to select which of the four words in MM2/Mem
will be placed in each of the words in MM1. Bits 1 and 0 of imm8 encode the source for desti-
nation word 0 (MM1[15-0]), bits 3 and 2 encode for word 1, bits 5 and 4 encode for word 2, and
bits 7 and 6 encode for word 3 (MM1[63-48]). Similarly, the two-bit encoding represents which
source word is to be used, e.g., a binary encoding of 10 indicates that source word 2
(MM2/Mem[47-32]) will be used.
Figure 3-76. Operation of the PSHUFW Instruction
Operation
DEST[15-0] = (SRC/m64 >> (imm8[1-0] * 16) )[15-0]
DEST[31-16] = (SRC/m64 >> (imm8[3-2] * 16) )[15-0]
DEST[47-32] = (SRC/m64 >> (imm8[5-4] * 16) )[15-0]
DEST[63-48] = (SRC/m64 >> (imm8[7-6] * 16) )[15-0]
OpcodeInstruction
Description
0F,70,/r,ibPSHUFW mm1, mm2/m64, imm8Shuffle the words in MM2/Mem based on the
encoding in imm8 and store in MM1.
mm1
mm2/
m64
mm1
=
=
=
=