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.

Details

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].

Pseudocode 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.

Example

xvcvsxwsp vs1, vs3

Encoding

Binary Layout
60
0
XT
6
0
11
XB
16
168
21
 
Format XX2-form
Opcode 0xF00000A8
Extension VSX
Registers Altered FPSCR.FX, FPSCR.XX

Operands

  • XT
    Target
  • XB
    Source