# PMAXSW
# Maximum of Packed Signed Word Integers
Opcode | Mnemonic | Description |
---|---|---|
0F EE /r | PMAXSW mm1, mm2/m64 | Compare signed word integers in mm2/m64 and mm1 and return maximum values. |
66 0F EE /r | PMAXSW xmm1, xmm2/m128 | Compare signed word integers in xmm2/m128 and xmm1 and return maximum values. |
# Description
Performs an 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.
# Operation
if(OperandSize == 64) {
//PMAXSW instruction for 64-bit operands:
if(Destination[0..15] <= Source[0..15]) Destination[0..15] = Source[0..15];
if(Destination[16..31] <= Source[16..31]) Destination[16..31] = Source[16..31];
if(Destination[32..47] <= Source[32..47]) Destination[32..47] = Source[32..47];
if(Destination[48..63] <= Source[48..63]) Destination[48..63] = Source[48..63];
}
else {
//PMAXSW instruction for 128-bit operands:
if(Destination[0..15] <= Source[0..15]) Destination[0..15] = Source[0..15];
if(Destination[16..31] <= Source[16..31]) Destination[16..31] = Source[16..31];
if(Destination[32..47] <= Source[32..47]) Destination[32..47] = Source[32..47];
if(Destination[48..63] <= Source[48..63]) Destination[48..63] = Source[48..63];
if(Destination[64..79] <= Source[64..79]) Destination[64..79] = Source[64..79];
if(Destination[80..95] <= Source[80..95]) Destination[80..95] = Source[80..95];
if(Destination[96..111] <= Source[96..111]) Destination[96..111] = Source[96..111];
if(Destination[112..127] <= Source[112..127]) Destination[112..127] = Source[112..127];
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Flags affected
None.
# Protected Mode Exceptions
# Real-Address Mode Exceptions
# Virtual-8086 Mode Exceptions
Same exceptions as in Real Address Mode
#PF(fault-code) | For a page fault. |
#PF(fault-code) | For a page fault. |
# Numeric Exceptions
None.
Instruction | Latency | Throughput | Execution Unit |
---|---|---|---|
CPUID | 0F3n/0F2n | 0F3n/0F2n | 0F2n |
PMAX mm, mm | 2/2 | 1/1 | MMX_ALU |
PMAX xmm, xmm | 2/2 | 2/2 | MMX_ALU |