xvcvspsxws
Vector Convert with round to zero Single-Precision to Signed Word format
xvcvspsxws XT,XB
Converts a vector of single-precision floating-point numbers to signed integers using round towards zero.
Details
The xvcvspsxws instruction converts each element of the source vector VSR[XB] from single-precision floating-point format to a 32-bit signed integer, rounding towards zero. The result is stored in the corresponding element of 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(0b001, src)
vresult.word[i] ←si32_CONVERT_FROM_BFP(rnd)
if vxsnan_flag=1 then SetFX(FPSCR.VXSNAN)
if vxcvi_flag=1 then SetFX(FPSCR.VXCVI)
if xx_flag=1 then SetFX(FPSCR.XX)
ex_flag ←ex_flag | (FPSCR.VE & vxsnan_flag) | (FPSCR.XE & xx_flag)
end
if ex_flag=0 then VSR[32×TX+T] ←vresult
Programming Note
xvcvspsxws 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.
Example
xvcvspsxws vs1, vs3
Encoding
Binary Layout
18
0
T
6
B
11
152
16
BX
21
TX
26
Operands
-
XT
Target Vector Register -
XB
Source Vector Register