User Guide
146 128-Bit Media and Scientific Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
Figure 4-25. Arithmetic Operation on Vectors of Bytes
Addition.
• PADDB—Packed Add Bytes
• PADDW—Packed Add Words
• PADDD—Packed Add Doublewords
• PADDQ—Packed Add Quadwords
• PADDSB—Packed Add with Saturation Bytes
• PADDSW—Packed Add with Saturation Words
• PADDUSB—Packed Add Unsigned with Saturation Bytes
• PADDUSW—Packed Add Unsigned with Saturation Words
The PADDB, PADDW, PADDD, and PADDQ instructions add each packed 8-bit (PADDB), 16-bit
(PADDW), 32-bit (PADDD), or 64-bit (PADDQ) integer element in the second operand to the
corresponding, same-sized integer element in the first operand and write the integer result to the
corresponding, same-sized element of the destination. Figure 4-25 shows a PADDB operation. These
instructions operate on both signed and unsigned integers. However, if the result overflows, the carry is
ignored and only the low-order byte, word, doubleword, or quadword of each result is written to the
destination. The PADDD instruction can be used together with PMADDWD (page 149) to implement
dot products.
The PADDSB and PADDSW instructions add each 8-bit (PADDSB) or 16-bit (PADDSW) signed
integer element in the second operand to the corresponding, same-sized signed integer element in the
first operand and write the signed integer result to the corresponding, same-sized element of the
destination. For each result in the destination, if the result is larger than the largest, or smaller than the
smallest, representable 8-bit (PADDSB) or 16-bit (PADDSW) signed integer, the result is saturated to
the largest or smallest representable value, respectively.
operand 1
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
. . . . . . . . . . . . . .
127 0
operand 2
127 0
operation
operation
513-163.eps
result
127 0