Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z

4-70 Vol. 2B
INSTRUCTION SET REFERENCE, N-Z
PEXTRW—Extract Word
Description
Copies the word in the source operand (second operand) specified by the count
operand (third operand) to the destination operand (first operand). The source
operand can be an MMX technology register or an XMM register. The destination
operand is the low word of a general-purpose register. The count operand is an 8-bit
immediate. When specifying a word location in an MMX technology register, the 2
least-significant bits of the count operand specify the location; for an XMM register,
the 3 least-significant bits specify the location. The high word of the destination
operand is cleared (set to all 0s).
In 64-bit mode, using a REX prefix in the form of REX.R permits this instruction to
access additional registers (XMM8-XMM15, R8-15). Use of REX.W permits the use of
64-bit general purpose registers.
Operation
IF (64-Bit Mode and REX.W used and 64-bit register selected)
THEN
FOR (PEXTRW instruction with 64-bit source operand)
{SEL COUNT AND 3H;
TEMP (SRC >> (SEL
16)) AND FFFFH;
r64[15:0] TEMP[15:0];
r64[63:16] ZERO_FILL; };
FOR (PEXTRW instruction with 128-bit source operand)
Opcode Instruction
64-Bit
Mode
Compat/
Leg Mode Description
0F C5 /r ib PEXTRW r32,
mm, imm8
Valid Valid Extract the word specified by
imm8 from mm and move it to
r32, bits 15-0. Zero-extend
the result.
REX.W + 0F C5 /r
ib
PEXTRW r64,
mm, imm8
Valid N.E. Extract the word specified by
imm8 from mm and move it to
r64, bits 15-0. Zero-extend
the result.
66 0F C5 /r ib PEXTRW r32,
xmm, imm8
Valid Valid Extract the word specified by
imm8 from xmm and move it
to r32, bits 15-0. Zero-extend
the result.
REX.W + 66 0F C5
/r ib
PEXTRW r64,
xmm, imm8
Valid N.E. Extract the word specified by
imm8 from xmm and move it
to r64, bits 15-0. Zero-extend
the result.