Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z
Vol. 2B 4-145
INSTRUCTION SET REFERENCE, N-Z
PSADBW—Compute Sum of Absolute Differences
Description
Computes the absolute value of the difference of 8 unsigned byte integers from the
source operand (second operand) and from the destination operand (first operand).
These 8 differences are then summed to produce an unsigned word integer result
that is stored in the destination operand. The source operand can be an MMX tech-
nology register or a 64-bit memory location or it can be an XMM register or a 128-bit
memory location. The destination operand can be an MMX technology register or an
XMM register. Figure 4-5 shows the operation of the PSADBW instruction when using
64-bit operands.
When operating on 64-bit operands, the word integer result is stored in the low word
of the destination operand, and the remaining bytes in the destination operand are
cleared to all 0s.
When operating on 128-bit operands, two packed results are computed. Here, the 8
low-order bytes of the source and destination operands are operated on to produce a
word result that is stored in the low word of the destination operand, and the 8 high-
order bytes are operated on to produce a word result that is stored in bits 64 through
79 of the destination operand. The remaining bytes of the destination operand are
cleared.
In 64-bit mode, using a REX prefix in the form of REX.R permits this instruction to
access additional registers (XMM8-XMM15).
Opcode Instruction
64-
Bit
Mode
Compat/
Leg Mode Description
0F F6 /r PSADBW mm1,
mm2/m64
Valid Valid Computes the absolute differences of the
packed unsigned byte integers from mm2
/m64 and mm1; differences are then
summed to produce an unsigned word
integer result.
66 0F
F6 /r
PSADBW xmm1,
xmm2/m128
Valid Valid Computes the absolute differences of the
packed unsigned byte integers from xmm2
/m128 and xmm1; the 8 low differences
and 8 high differences are then summed
separately to produce two unsigned word
integer results.