# MAXSD
# Return Maximum Scalar Double-Precision Floating-Point Value
Opcode | Mnemonic | Description |
---|---|---|
F2 0F 5F /r | MAXSD xmm1, xmm2/m64 | Return the maximum scalar double-precision floating-point |
# Description
Compares the low double-precision floating-point values in the destination operand (first operand) and the source operand (second operand), and returns the maximum value to the low quadword of the destination operand. The source operand can be an XMM register or a 64-bit memory location. The destination operand is an XMM register. When the source operand is a memory operand, only 64 bits are accessed. The high quadword of the destination operand remains unchanged.
If the values being compared are both 0.0s (of either sign), the value in the second operand (source operand) is returned. If a value in the second operand is an SNaN, that SNaN is returned unchanged to the destination (that is, a QNaN version of the SNaN is not returned).
If only one value is a NaN (SNaN or QNaN) for this instruction, the second operand (source operand), either a NaN or a valid floating-point value, is written to the result. If instead of this behavior, it is required that the NaN source operand (from either the first or second operand) be returned, the action of MAXSD can be emulated using a sequence of instructions, such as, a comparison followed by AND, ANDN and OR.
# Operation
if((Destination[0..63] == 0.0 && Source[0..63] == 0.0) || IsSNaN(Destination[0..63]) || IsSNaN(Source[0..63]) || Destination[0..63] <= Source[0..63]) Destination[0..63] = Source[0..63];
//Destination[64..127] is unchanged
2
3
# SIMD Floating-Point Exceptions
Invalid | (including QNaN source operand), Denormal. value between xmm2/mem64 and xmm1. |
# 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. |
Instruction | Latency | Throughput | Execution Unit |
---|---|---|---|
CPUID | 0F3n/0F2n/069n | 0F3n/0F2n/069n | 0F2n |
MAXSD xmm, xmm | 5/4/3 | 2/2/1 | FP_ADD |