xsminjdp
Vector Scalar Minimum of Double-Precision Floating-Point Values
Compares two double-precision floating-point values and selects the minimum value, handling special cases like NaNs and zeros.
Details
Computes the minimum of two double-precision floating-point scalar values using Java-compliant semantics, where +0.0 is less than -0.0, and NaN handling follows Java rules. The result is stored in the target VSR. This instruction is part of the VSX category and does not update CR or XER.
Pseudocode Operation
XT_dp ← minj_dp(XA_dp, XB_dp)
Programming Note
xsminjdp can be used to implement the Java min() function for single-precision and double-precision arguments. Java only recognizes the concept of a NaN, but does not distinguish any difference between different NaN encodings, including between a QNaN and a SNaN. As a result, a SNaN operand is propagated as a SNaN (i.e., not converted to a QNaN). Despite Java not recognizing the concept of exception status, VXSNAN is set to 1 if either operand is a SNaN. Previous versions of the architecture allowed the contents of doubleword 1 of the result register to be undefined. However, all processors that support this instruction write 0s into doubleword 1 of the result register, as is required by this version of the architecture.
Example
Encoding
Operands
-
XT
Target -
XA
Src A -
XB
Src B