xvcvspsxds
Vector Convert with round to zero Single-Precision to Signed Doubleword format XX2-form
Converts single-precision floating-point values in a vector to signed doublewords, rounding towards zero.
Details
The xvcvspsxds instruction converts the single-precision floating-point value in word element i of VSR[XB] (where i∈{0,2}) to a signed doubleword integer and places it in doubleword element i of VSR[XT] (where i∈{0,1}). If the result is out of range for a signed doubleword integer, it is saturated.
Pseudocode Operation
for i = {0, 2} do
src <- VSR[XB][i]
if src is a QNaN then
T(Nmin), fx(VXCVI)
else if src is a SNaN then
T(Nmin), fx(VXCVI), fx(VXSNAN)
else if src ≤ Nmin-1 then
T(Nmin), fx(VXCVI)
else if Nmin-1 < src < Nmin then
if FPSCR.VE = 0 then
T(Nmin), fx(XX)
else
fx(XX), error()
else if src = Nmin then
T(Nmin)
else if Nmin < src < Nmax then
if FPSCR.XE = 0 then
T(f2i(trunc(src))), fx(XX)
else
fx(XX), error()
else if src = Nmax then
Note: This case cannot occur as Nmax is not representable in SP format but is included here for completeness.
else if Nmax < src < Nmax+1 then
if FPSCR.VE = 0 then
T(Nmax), fx(XX)
else
fx(XX), error()
else if src ≥ Nmax+1 then
T(Nmin), fx(VXCVI)
end if
end for
Programming Note
xvcvspsxds rounds using Round towards Zero rounding mode. For other rounding modes, software must use a Round to Single-Precision Integer instruction that corresponds to the desired rounding mode, including xvrspic which uses the rounding mode specified by RN.
Example
Encoding
Operands
-
XT
Target -
XB
Source