xscmpgtdp

VSX Scalar Compare Greater Than Double-Precision

xscmpgtdp XT,XA,XB

Compares two double-precision floating-point values and sets the target vector register based on the comparison.

Details

The xscmpgtdp instruction compares the double-precision floating-point value in doubleword 0 of VSR[XA] with the double-precision floating-point value in doubleword 0 of VSR[XB]. If src1 is greater than src2, the contents of doubleword 0 of VSR[XT] are set to 0xFFFF_FFFF_FFFF_FFFF and doubleword 1 is set to 0x0000_0000_0000_0000. Otherwise, both doublewords of VSR[XT] are set to 0x0000_0000_0000_0000.

Pseudocode Operation

if MSR.VSX=0 then VSX_Unavailable()
src1 ←bfp_CONVERT_FROM_BFP64(VSR[32×AX+A].dword[0])
src2 ←bfp_CONVERT_FROM_BFP64(VSR[32×BX+B].dword[0])
if src1.class.SNaN=1 | src2.class.SNaN=1 then do
    vxsnan_flag ←0b1
    if FPSCR.VE=0 then vxvc_flag ←0b1
end else
    vxvc_flag ←src1.class.QNaN | src2.class.QNaN
vex_flag ←FPSCR.VE & (vxsnan_flag | vxvc_flag)
if vxsnan_flag=1 then SetFX(FPSCR.VXSNAN)
if vxvc_flag=1   then SetFX(FPSCR.VXVC)
if vex_flag=0 then do
    if src1 > src2 then
        VSR[32×TX+T].dword[0] ←0xFFFF_FFFF_FFFF_FFFF
        VSR[32×TX+T].dword[1] ←0x0000_0000_0000_0000
    end else do
        VSR[32×TX+T].dword[0] ←0x0000_0000_0000_0000
        VSR[32×TX+T].dword[1] ←0x0000_0000_0000_0000
    end
end

Programming Note

xscmpgtdp can be used to implement the C/C++/Java conditional operation, RESULT = (x>y) ? a : b. xscmpgtdp fGT,fX,fY xxsel fRESULT,fA,fB,fGT xscmpgtdp can also be used to implement the C/C++/Java conditional operation, RESULT = (x

Example

xscmpgtdp vs1, vs2, vs3

Encoding

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

Operands

  • XT
    Target Vector Register
  • XA
    Source Vector Register
  • XB
    Source Vector Register