xvcvsxwsp
VSX Vector Convert with round Signed Word to Single-Precision format
xvcvsxwsp XT, XB
Converts a signed integer in each word of the source vector to single-precision floating-point and rounds it.
Encoding
Binary Layout
60
0:5
XT
6:10
0
11:15
XB
16:20
168
21:31
Operands
-
XT
Target -
XB
Source
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
For xvcvsxwsp, each word element of VSR[XB] is converted from a signed integer to an unbounded-precision floating-point value, rounded to single-precision using the rounding mode specified by RN, and placed into the corresponding word element of VSR[XT].
Operation
if MSR.VSX=0 then VSX_Unavailable()
ex_flag ←0b0
do i = 0 to 3
reset_xflags()
src ←bfp_CONVERT_FROM_SI32(VSR[32×BX+B].word[i])
rnd ←bfp_ROUND_TO_BFP32(FPSCR.RN,src)
vresult.word[i] ←bfp32_CONVERT_FROM_BFP(rnd)
if xx_flag=1 then SetFX(FPSCR.XX)
ex_flag ←ex_flag | (FPSCR.XE & xx_flag)
end
if ex_flag=0 then VSR[32×TX+T] ←vresult
Programming Note
This instruction is commonly used for converting signed integer values to single-precision floating-point numbers in vector operations. Ensure that the VSX (Vector Scalar Extensions) are enabled by checking and setting MSR.VSX if necessary. Be aware of rounding modes specified by FPSCR.RN, as they can affect the precision of the conversion. Handle exceptions properly by checking FPSCR.XX and FPSCR.XE after execution.