xsmaxcdp

VSX Scalar Maximum Type-C Double-Precision

xsmaxcdp XT, XA, XB

Computes the maximum of two double-precision floating-point values and stores the result in a vector scalar register.

Details

The xsmaxcdp instruction compares two double-precision floating-point values from vector scalar registers XA and XB, and stores the larger value into the doubleword 0 of vector scalar register XT. The doubleword 1 of the destination register is set to zero.

Pseudocode Operation

if MSR.VSX=0 then VSX_Unavailable()
reset_xflags()
src1 ← VSR[32×AX+A].dword[0]
src2 ← VSR[32×BX+B].dword[0]
result ← bfp64_MAXIMUM_TYPE_C(src1, src2)
if vxsnan_flag=1 then SetFX(FPSCR.VXSNAN)
vex_flag ← FPSCR.VE & vxsnan_flag
if vex_flag=0 then
do
    VSR[32×TX+T].dword[0] ← result
    VSR[32×TX+T].dword[1] ← 0x0000_0000_0000_0000
end

Programming Note

['xsmaxcdp can be used to implement the C/C++/Java conditional operation (x>y)?x:y for single-precision and double-precision arguments.', 'Previous versions of the architecture allowed the contents of doubleword 1 of the result register to be undefined. However, all processors that support this instruction write 0s into doubleword 1 of the result register, as is required by this version of the architecture.']

Example

xsmaxcdp vs1, vs2, vs3

Encoding

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

Operands

  • XT
    Target
  • XA
    Src A
  • XB
    Src B