User Guide

222 64-Bit Media Programming
AMD64 Technology 24592—Rev. 3.15—November 2009
5.6.9 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 bitwise logical 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 one’s complement of the operand), ANDs
it with the second operand, and writes the result to the destination, and writes the result to the
destination. Table 5-5 shows an example.
PANDcanbeusedwiththevalue7FFFFFFF7FFFFFFFh to compute the absolute value o f the
elements of a 64-bit media floating-point vector operand. This method is equivalent to the x87 FABS
(floating-point absolute value) instruction.
Or
POR—Packed Logical Bitwise OR
The POR instruction performs a bitwise logical OR of the values in the first and second operands and
writes the result to the destination.
Exclusive Or
PXOR—Packed Logical Bitwise Exclusive OR
The PXOR instruction performs a bitwise l ogical exclusive OR of the values in the first and second
operands and writes the result to the destination. PXOR can be used to clear all bits in an MMX
register by specifying the same register for both operands. PXOR can also used with the value
8000000080000000h to change the sign bits of the elements of a 64-bit media floating-point vector
operand. This method is equivalent to the x87 floating-point change sign (FCHS) instruction.
Table 5-5. Example PANDN Bit Values
Operand1 Bit
Operand1 Bit
(Inverted)
Operand2 Bit
PANDN
Result Bit
1010
1000
0111
0100