xsmaxcdp
VSX Scalar Maximum Type-C Double-Precision
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
Encoding
Operands
-
XT
Target -
XA
Src A -
XB
Src B