xscmpgtqp

VSX Scalar Compare Greater Than Quad-Precision X-form

xscmpgtqp VRT,VRA,VRB

Compares two quad-precision floating-point values and sets the target vector register to all 1s if the first value is greater than the second, otherwise all 0s.

Encoding

Binary Layout
18
0:5
VRT
6:10
VRA
11:15
VRB
16:31
 
Format X-form
Opcode 0xFC0001C8
Extension VSX

Operands

  • VRT
    Target Vector Register
  • VRA
    Source Vector Register
  • VRB
    Source Vector Register

Example

xscmpgtqp v1, v2, v3

Registers Altered

FPSCR, VXSNAN, VXVC

Related

More in VSX

Reference

Description

The instruction compares the contents of VSR[VRA+32] (src1) with the contents of VSR[VRB+32] (src2). If src1 is greater than src2, VSR[VRT+32] is set to all 1s; otherwise, it is set to all 0s. NaN comparisons result in false for the predicate.

Operation

if MSR.VSX=0 then VSX_Unavailable()
src1 ←bfp_CONVERT_FROM_BFP128(VSR[VRA+32])
src2 ←bfp_CONVERT_FROM_BFP128(VSR[VRB+32])
vxsnan_flag ←0b0
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 bfp_COMPARE_GT(src1, src2)=1 then
        VSR[VRT+32] ← 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
    else
        VSR[VRT+32] ← 0x0000_0000_0000_0000_0000_0000_0000_0000
end

Programming Note

xscmpgtqp can be used to implement the C/C++ conditional operation, RESULT = (x>y) ? a : b. xscmpgtqp vGT,vX,vY xxsel vRESULT,vA,vB,vGT xscmpgtqp can also be used to implement the C/C++ conditional operation, RESULT = (x<y) ? a : b. xscmpgtqp vLT,vY,vX xxsel vRESULT,vA,vB,vLT