User Guide

128-Bit Media and Scientific Programming 155
24592—Rev. 3.15—November 2009 AMD64 Technology
In the above sequence, PCMPGTW, PAND, PANDN, and POR operate, in parallel, on all four
elements of the vectors.
Compare and Write Minimum or Maximum.
PMAXUB—Packed Maximum Unsigned Bytes
PMINUB—Packed Minimum Unsigned Bytes
PMAXSW—Packed Maximum Signed Words
PMINSW—Packed Minimum Signed Words
The PMAXUB and PMINUB instructions compare each of the 8-bit unsigned integer values in the
first operand with the corresponding 8-bit unsigned integer values in the second operand. The
instructions then write the maximum (PMAXUB) or minimum (PMINUB) of the two values for each
comparison into the corresponding byte of the destination.
The PMAXSW and PMINSW instructions perform operations analogous to the PMAXUB and
PMINUB instructions, except on 16-bit signed integer values.
4.5.8 Logical
The vector-logic instructions perform Boolean logic operations, including AND, OR, and exclusive
OR.
And
PAND—Packed Logical Bitwise AND
PANDN—Packed Logical Bitwise AND NOT
The PAND instruction performs a logical bitwise AND of the values in the first and second operands
and writes the result to the destination.
The PANDN instruction inverts the first operand (creating a ones-complement of the operand), ANDs
it with the second operand, and writes the result to the destination. Table 4-9 shows an example.
Table 4-9. Example PANDN Bit Values
Operand1 Bit
Operand1 Bit
(Inverted)
Operand2 Bit
PANDN
Result Bit
1010
1000
0111
0100