xscvqpuqz
VSX Scalar Convert with round to zero Quad-Precision to Unsigned Quadword
Converts a quad-precision floating-point value to an unsigned quadword integer, rounding towards zero.
Details
The instruction converts the quad-precision floating-point value in VSR[VRB+32] to an unsigned quadword integer and places the result into VSR[VRT+32]. The conversion rounds towards zero. If the source is a NaN or Infinity, an Invalid Operation exception occurs.
Pseudocode Operation
if MSR.VSX=0 then
VSypX_Unavailable()
else if src.class.QNaN=1 | src.class.SNaN=1 then do
vxsnan_flag ←src.class.SNaN
vxcvi_flag ←1
result ←0x0000_0000_0000_0000_0000_0000_0000_0000
end
else if src.class.Infinity=1 then do
vxcvi_flag ←1
if src.sign=0 then
result ←0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
else
result ←0x0000_0000_0000_0000_0000_0000_0000_0000
end
else if src.class.Zero=1 then
result ←0x0000_0000_0000_0000_0000_0000_0000_0000
else do
rnd ←bfp_ROUND_TO_INTEGER(0b001,src)
if bfp_COMPARE_GT(rnd, +2128-1) then do
result ←0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
vxcvi_flag ←1
end
else if bfp_COMPARE_LT(rnd, 0) then do
result ←0x0000_0000_0000_0000_0000_0000_0000_0000
vxcvi_flag ←1
end
else do
result ←si128_CONVERT_FROM_BFP(rnd)
if xx_flag=1 then SetFX(FPSCR.XX)
end
end
if vxsnan_flag=1 then SetFX(FPSCR.VXSNAN)
if vxcvi_flag=1 then SetFX(FPSCR.VXCVI)
vx_flag ←vxsnan_flag | vxcvi_flag
ex_flag ←FPSCR.VE & vx_flag
if ex_flag=0 then do
VSR[VRT+32] ←result
FPSCR.FPRF ←0bUUUUU
end
FPSCR.FR ←(vx_flag=0) & inc_flag
FPSCR.FI ←(vx_flag=0) & xx_flag
Programming Note
This instruction is used to convert a quad-precision floating-point number to an unsigned quadword integer, rounding towards zero. Be cautious with NaNs and infinities, as they will trigger exceptions. Ensure VSX is enabled in the MSR register before using this instruction.
Example
Encoding
Operands
-
VRT
Target Vector-Scalar Register -
VRB
Source Vector-Scalar Register -
VT
Target Vector-Scalar Register -
VS32
Target Vector Register -
VS31
Source Vector Register