User Guide

220 64-Bit Media Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
second operands are either an MMX register and another MMX register or 64-bit memory location, or
an MMX register and an immediate-byte value. The low-order bits that are emptied by the shift
operation are cleared to 0.
In integer arithmetic, left logical shifts effectively multiply unsigned operands by positive powers of 2.
Right Logical Shift
PSRLW—Packed Shift Right Logical Words
PSRLD—Packed Shift Right Logical Doublewords
PSRLQ—Packed Shift Right Logical Quadwords
The PSRLx instructions right-shift each of the 16-bit (PSRLW), 32-bit (PSRLD), or 64-bit (PSRLQ)
values in the first operand by the number of bits specified in the second operand. The instructions then
write each shifted value into the corresponding, same-sized element of the destination. The first and
second operands are either an MMX register and another MMX register or 64-bit memory location, or
an MMX register and an immediate-byte value. The high-order bits that are emptied by the shift
operation are cleared to 0. In integer arithmetic, right logical shifts effectively divide unsigned
operands or positive signed operands by positive powers of 2.
PSRLQ can be used to move the high 32 bits of an MMX register to the low 32 bits of the register.
Right Arithmetic Shift
PSRAW—Packed Shift Right Arithmetic Words
PSRAD—Packed Shift Right Arithmetic Doublewords
The PSRAx instructions right-shifts each of the 16-bit (PSRAW) or 32-bit (PSRAD) values in the first
operand by the number of bits specified in the second operand. The instructions then write each shifted
value into the corresponding, same-sized element of the destination. The high-order bits that are
emptied by the shift operation are filled with the sign bit of the initial value.
In integer arithmetic, right arithmetic shifts effectively divide signed operands by positive powers of 2.
5.6.8 Compare
The integer vector-compare instructions compare two operands, and they either write a mask or they
write the maximum or minimum value.
Compare and Write Mask
PCMPEQB—Packed Compare Equal Bytes
PCMPEQW—Packed Compare Equal Words
PCMPEQD—Packed Compare Equal Doublewords
PCMPGTB—Packed Compare Greater Than Signed Bytes
PCMPGTW—Packed Compare Greater Than Signed Words
PCMPGTD—Packed Compare Greater Than Signed Doublewords