xsmaxjdp

Vector Scalar Maximum of Double-Precision Floating-Point Values with Java Rounding

xsmaxjdp XT, XA, XB

Compares two double-precision floating-point values and returns the larger one, with specific handling for zero and NaN values.

Details

The xsmaxjdp instruction compares the double-precision floating-point values in VSR[XA] and VSR[XB], and places the maximum value into VSR[XT]. The comparison follows Java rounding rules, which handle special cases like NaNs and infinities as specified in the table.

Pseudocode Operation

if 'xsmaxjdp' then
    src1 <- VSR[XA]
    src2 <- VSR[XB]
    if src1 is NaN or src2 is NaN then
        VXSNAN <- 1
        if VE=1, suppress update of VSR[XT]
    else if src1 is +Infinity and src2 is -Infinity then
        T(src2) <- src1
    else if src1 is -Infinity and src2 is +Infinity then
        T(src2) <- src2
    else if src1 is QNaN or SNaN then
        VXSNAN <- 1
        if VE=1, suppress update of VSR[XT]
    else if src1 is +Zero and src2 is -Zero then
        T(src2) <- src1
    else if src1 is -Zero and src2 is +Zero then
        T(src2) <- src2
    else
        T(src2) <- max(src1, src2)
    VSR[XT] <- T(src2)

Programming Note

['xsmaxjdp can be used to implement the Java max() function for single-precision and double-precision arguments.', 'Despite Java not recognizing the concept of exception status, VXSNAN is set to 1 if either operand is an SNaN.']

Example

xsmaxjdp vs1, vs2, vs3

Encoding

Binary Layout
18
0
T
6
A
11
B
16
144
21
AX
29
BX
30
TX
31
 
Format XX3-form
Opcode 0xF00000A0
Extension VSX
Registers Altered FPSCR (FX, VXSNAN)

Operands

  • XT
    Target
  • XA
    Src A
  • XB
    Src B