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.

Encoding

Binary Layout
60
0:5
XT
6:10
XA
11:15
XB
16:20
224
21:31
 
Format XX3-form
Opcode 0xF0000700
Extension VSX

Operands

  • XT
    Target
  • XA
    Src A
  • XB
    Src B

Example

xvmaxdp vs1, vs2, vs3

Registers Altered

FPSCR (FX, VXSNAN)

Related

More in VSX

Reference

Description

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].

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.