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

4-176 Vol. 2B
INSTRUCTION SET REFERENCE, N-Z
The destination operand may be an MMX technology register or an XMM register; the
count operand can be either an MMX technology register or an 64-bit memory loca-
tion, an XMM register or a 128-bit memory location, or an 8-bit immediate. Note that
only the first 64-bits of a 128-bit count operand are checked to compute the count.
The PSRAW instruction shifts each of the words in the destination operand to the
right by the number of bits specified in the count operand, and the PSRAD instruction
shifts each of the doublewords in the destination operand.
In 64-bit mode, using a REX prefix in the form of REX.R permits this instruction to
access additional registers (XMM8-XMM15).
Operation
PSRAW instruction with 64-bit operand:
IF (COUNT > 15)
THEN COUNT 16;
FI;
DEST[15:0] SignExtend(DEST[15:0]
>> COUNT);
(* Repeat shift operation for 2nd and 3rd words *)
DEST[63:48] SignExtend(DEST[63:48]
>> COUNT);
PSRAD instruction with 64-bit operand:
IF (COUNT > 31)
THEN COUNT 32;
FI;
DEST[31:0] SignExtend(DEST[31:0]
>> COUNT);
DEST[63:32] SignExtend(DEST[63:32]
>> COUNT);
PSRAW instruction with 128-bit operand:
COUNT COUNT_SOURCE[63:0];
Figure 4-9. PSRAW and PSRAD Instruction Operation Using a 64-bit Operand
DEST
DEST
Pre-Shift
Post-Shift
Shift Right
X0
X0
>> COUNT
X3 X2 X1
X1 >> COUNTX2 >> COUNTX3 >> COUNT
with Sign
Extension