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

Vol. 2B 4-95
INSTRUCTION SET REFERENCE, N-Z
PMAXSW—Maximum of Packed Signed Word Integers
Description
Performs a SIMD compare of the packed signed word integers in the destination
operand (first operand) and the source operand (second operand), and returns the
maximum value for each pair of word integers to the destination operand. The source
operand can be an MMX technology register or a 64-bit memory location, or it can be
an XMM register or a 128-bit memory location. The destination operand can be an
MMX technology register or an XMM register.
In 64-bit mode, using a REX prefix in the form of REX.R permits this instruction to
access additional registers (XMM8-XMM15).
Operation
PMAXSW instruction for 64-bit operands:
IF DEST[15:0] > SRC[15:0]) THEN
DEST[15:0] DEST[15:0];
ELSE
DEST[15:0] SRC[15:0]; FI;
(* Repeat operation for 2nd and 3rd words in source and destination operands *)
IF DEST[63:48] > SRC[63:48]) THEN
DEST[63:48] DEST[63:48];
ELSE
DEST[63:48] SRC[63:48]; FI;
PMAXSW instruction for 128-bit operands:
IF DEST[15:0] > SRC[15:0]) THEN
DEST[15:0] DEST[15:0];
ELSE
DEST[15:0] SRC[15:0]; FI;
(* Repeat operation for 2nd through 7th words in source and destination operands *)
Opcode Instruction
64-
Bit
Mode
Compat/
Leg Mode Description
0F EE /r PMAXSW mm1,
mm2/m64
Valid Valid Compare signed word integers in
mm2/m64 and mm1 and return
maximum values.
66 0F EE /r PMAXSW xmm1,
xmm2/m128
Valid Valid Compare signed word integers in
xmm2/m128 and xmm1 and return
maximum values.