Intel 64 and IA-32 Architectures Software Developers Manual Volume 2B, Instruction Set Reference, N-Z

Vol. 2B 4-163
INSTRUCTION SET REFERENCE, N-Z
PSIGNB/PSIGNW/PSIGND — Packed SIGN
Description
PSIGNB/PSIGNW/PSIGND negates each data element of the destination operand
(the first operand) if the sign of the corresponding data element in the source
operand (the second operand) is less than zero. If the sign of a data element in the
source operand is positive, the corresponding data element in the destination
operand is unchanged. If a data element in the source operand is zero, the corre-
sponding data element in the destination operand is set to zero.
PSIGNB operates on signed bytes. PSIGNW operates on 16-bit signed words.
PSIGND operates on signed 32-bit integers. Both operands can be MMX register or
XMM registers. When the source operand is a 128bit memory operand, the operand
must be aligned on a 16-byte boundary or a general-protection exception (#GP) will
be generated.
In 64-bit mode, use the REX prefix to access additional registers.
Operation
PSIGNB with 64 bit operands:
if (SRC[7..0] < 0 )
DEST[7...0] <- Neg(DEST[7...0])
else if(SRC[7..0] == 0 )
Opcode Instruction
64-Bit
Mode
Compat/
Leg Mode Description
0F 38 08 /r PSIGNB mm1,
mm2/m64
Valid Valid Negate packed byte integers in mm1
if the corresponding sign in
mm2/m64 is less than zero.
66 0F 38 08
/r
PSIGNB
xmm1,
xmm2/m128
Valid Valid Negate packed byte integers in
xmm1 if the corresponding sign in
xmm2/m128 is less than zero.
0F 38 09 /r PSIGNW
mm1,
mm2/m64
Valid Valid Negate packed 16-bit integers in
mm1 if the corresponding sign in
mm2/m64 is less than zero.
66 0F 38 09
/r
PSIGNW
xmm1,
xmm2/m128
Valid Valid Negate packed 16-bit integers in
xmm1 if the corresponding sign in
xmm2/m128 is less than zero.
0F 38 0A /r PSIGND mm1,
mm2/m64
Valid Valid Negate packed doubleword integers
in mm1 if the corresponding sign in
mm2/m64 is less than zero.
66 0F 38 0A
/r
PSIGND
xmm1,
xmm2/m128
Valid Valid Negate packed doubleword integers
in xmm1 if the corresponding sign in
xmm2/m128 is less than zero.