xsmaxcqp

VSX Scalar Maximum Type-C Quad-Precision

xsmaxcqp vD, vA, vB

Compares two quad-precision floating-point values and selects the maximum.

Details

The xsmaxcqp instruction compares the contents of VSR[VRA+32] (src1) and VSR[VRB+32] (src2). It places the greater of the two values into VSR[XT] in quad-precision format. If either operand is a signaling NaN (SNaN), the VXSNAN flag is set, and if VE=1, the update to VSR[VRT+32] is suppressed.

Pseudocode 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 ←(src1.class.SNaN=1) | (src2.class.SNaN=1)

if (src1.class.SNaN=1) | (src1.class.QNaN=1) | (src2.class.SNaN=1) | (src2.class.QNaN=1) then
    result ←VSR[VRB+32]
else if bfp_COMPARE_GT(src1,src2) then
    result ←VSR[VRA+32]
else
    result ←VSR[VRB+32]

vex_flag ←FPSCR.VE & vxsnan_flag

if vxsnan_flag=1 then SetFX(VXSNAN)
if vex_flag=0 then VSR[VRT+32] ←result

Programming Note

xsmaxcqp can be used to implement the C/C++ conditional operation (x>y)?x:y for quad-precision arguments. VSR[VRT+32] ←result

Example

xsmaxcqp vd, va, vb

Encoding

Binary Layout
63
0
FRT
6
FRA
11
FRB
16
674
21
Rc
31
 
Format X-form
Opcode 0xFC000544
Extension VSX
Registers Altered FPSCR (FX, VXSNAN)

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B
  • VRT
    Target Vector-Scalar Register
  • VRA
    Source Vector-Scalar Register
  • VRB
    Source Vector-Scalar Register
  • XT
    Target Vector Register