Intel 64 and IA-32 Architectures Software Developers Manual Volume 1, Basic Architecture
Vol. 1 9-9
PROGRAMMING WITH INTEL® MMX™ TECHNOLOGY
The PMULHW (multiply packed signed integers and store high result) and PMULLW
(multiply packed signed integers and store low result) instructions perform a signed
multiply of the corresponding words of the source and destination operands and write
the high-order or low-order 16 bits of each of the results, respectively, to the desti-
nation operand.
The PMADDWD (multiply and add packed integers) instruction computes the products
of the corresponding signed words of the source and destination operands. The four
intermediate 32-bit doubleword products are summed in pairs (high-order pair and
low-order pair) to produce two 32-bit doubleword results.
9.4.3 Comparison Instructions
The PCMPEQB/PCMPEQW/PCMPEQD (compare packed data for equal) instructions
and the PCMPGTB/PCMPGTW/PCMPGTD (compare packed signed integers for greater
than) instructions compare the corresponding signed data elements (bytes, words,
or doublewords) in the source and destination operands for equal to or greater than,
respectively.
These instructions generate a mask of ones or zeros which are written to the destina-
tion operand. Logical operations can use the mask to select packed elements. This
can be used to implement a packed conditional move operation without a branch or a
set of branch instructions. No flags in the EFLAGS register are affected.
9.4.4 Conversion Instructions
The PACKSSWB (pack words into bytes with signed saturation) and PACKSSDW (pack
doublewords into words with signed saturation) instructions convert signed words
into signed bytes and signed doublewords into signed words, respectively, using
signed saturation.
PACKUSWB (pack words into bytes with unsigned saturation) converts signed words
into unsigned bytes, using unsigned saturation.
9.4.5 Unpack Instructions
The PUNPCKHBW/PUNPCKHWD/PUNPCKHDQ (unpack high-order data elements)
instructions and the PUNPCKLBW/PUNPCKLWD/PUNPCKLDQ (unpack low-order data
elements) instructions unpack bytes, words, or doublewords from the high- or low-
order data elements of the source and destination operands and interleave them in
the destination operand. By placing all 0s in the source operand, these instructions
can be used to convert byte integers to word integers, word integers to doubleword
integers, or doubleword integers to quadword integers.