xvmaxdp

Vector Scalar Maximum Double-Precision Floating Point

xvmaxdp XT, XA, XB

Compares two double-precision floating-point values and selects the maximum value for each element.

Details

For xvmaxdp, the instruction compares the double-precision floating-point values in the elements of VSR[XA] and VSR[XB], and places the maximum value into the corresponding elements of VSR[XT].

Pseudocode Operation

for i in {0, 1} do
    src1 <- VSR[XA][i]
    src2 <- VSR[XB][i]
    if src1 is QNaN or src2 is QNaN then
        T(Q(src2))
    else if src1 is SNaN or src2 is SNaN then
        fx(VXSNAN)
    else if src1 is +Infinity and src2 is -Infinity then
        T(src1)
    else if src1 is -Infinity and src2 is +Infinity then
        T(src2)
    else if src1 is NZF and src2 is Zero then
        T(src1)
    else if src1 is Zero and src2 is NZF then
        T(src2)
    else if src1 is NZF and src2 is NZF then
        T(M(src1,src2))
    else if src1 is +Zero and src2 is +Zero then
        T(src1)
    else if src1 is -Zero and src2 is -Zero then
        T(src2)
    else if src1 is +Infinity and src2 is +Infinity then
        T(src1)
    else if src1 is -Infinity and src2 is -Infinity then
        T(src2)
    else if src1 is QNaN or SNaN then
        T(src2)
    end if
end for

Programming Note

This instruction compares two double-precision floating-point vectors element-wise and stores the maximum value in each corresponding element of the destination vector. Be cautious with NaN values, as they can trigger exceptions or propagate through the operation. Ensure that the input vectors are properly aligned to avoid performance penalties.

Example

xvmaxdp vs1, vs2, vs3

Encoding

Binary Layout
60
0
XT
6
XA
11
XB
16
224
21
 
Format XX3-form
Opcode 0xF00000E0
Extension VSX
Registers Altered FPSCR (FX, VXSNAN)

Operands

  • XT
    Target
  • XA
    Src A
  • XB
    Src B