xvrspim
VSX Vector Round to Single-Precision Integer using round toward -Infinity
Rounds each element of a vector from single-precision floating-point format to integer format, rounding towards negative infinity.
Details
The xvrspim instruction rounds each element of the source vector VSR[XB] from single-precision floating-point format to integer format, using round toward -Infinity. The result is stored in the target vector VSR[XT].
Pseudocode Operation
if MSR.VSX=0 then VSX_Unavailable()
ex_flag ←0b0
do i = 0 to 3
reset_xflags()
src ←bfp_CONVERT_FROM_BFP32(VSR[32×BX+B].word[i])
rnd ←bfp_ROUND_TO_INTEGER(0b011, src)
vresult.word[i] ←bfp32_CONVERT_FROM_BFP(rnd)
if vxsnan_flag=1 then SetFX(FPSCR.VXSNAN)
ex_flag ←ex_flag | (FPSCR.VE & vxsnan_flag)
end
if ex_flag=0 then VSR[32×TX+T] ←vresult
Programming Note
The xvrspim instruction is commonly used for converting single-precision floating-point numbers to integers with rounding towards negative infinity. Ensure that the VSX (Vector Scalar Extensions) are enabled in the MSR register; otherwise, a VSX_Unavailable exception will be raised. Be cautious of NaN values, as they can set the VXSNAN flag in the FPSCR register and trigger an exception if VE is also set.
Example
Encoding
Operands
-
XT
Target Vector Register -
XB
Source Vector Register