xvrspic

VSX Vector Round to Single-Precision Integer

xvrspic XT,XB

Rounds each single-precision floating-point element of a vector to an integer using the current rounding mode.

Details

For xvrspic, each single-precision floating-point operand in word elements i (0 to 3) of VSR[XB] is rounded to an integer value using the rounding mode specified by RN. The result is placed into word element i of VSR[XT]. If a trap-enabled exception occurs, no results are written to 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])
    if FPSCR.RN=0b00 then rnd ←bfp_ROUND_TO_INTEGER(0b000, src)
    if FPSCR.RN=0b01 then rnd ←bfp_ROUND_TO_INTEGER(0b001, src)
    if FPSCR.RN=0b10 then rnd ←bfp_ROUND_TO_INTEGER(0b010, src)
    if FPSCR.RN=0b11 then rnd ←bfp_ROUND_TO_INTEGER(0b011, src)

    vresult.word[i] ←bfp32_CONVERT_FROM_BFP(rnd)

    if vxsnan_flag=1 then SetFX(FPSCR.VXSNAN)
    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

This instruction rounds each single-precision floating-point element in the source vector to an integer using the rounding mode specified by FPSCR.RN. Ensure that VSX is enabled (MSR.VSX=1) before use. Be cautious of exceptions; if any occur, no results are written to the destination vector. Check the VXSNAN and XX flags for specific exception conditions.

Example

xvrspic vs1, vs3

Encoding

Binary Layout
18
0
T
6
B
11
BX
16
TX
21
 
Format XX2-form
Opcode 0xF00002AC
Extension VSX
Registers Altered FPSCR, VXSNAN, XX

Operands

  • XT
    Target Vector-Specific Register
  • XB
    Source Vector-Specific Register