xvrsqrtesp

VSX Vector Reciprocal Square Root Estimate Single-Precision

xvrsqrtesp XT,XB

Estimates the reciprocal square root of single-precision floating-point values in a vector.

Encoding

Binary Layout
18
0:5
T
6:10
B
11:15
BX
16:20
TX
21:31
 
Format XX2-form
Opcode 0xF0000228
Extension VSX

Operands

  • XT
    Target Vector Register
  • XB
    Source Vector Register

Example

xvrsqrtesp vs1, vs3

Registers Altered

FPSCR (FX, ZX, VXSNAN, VXSQRT)

Related

More in VSX

Reference

Description

The instruction estimates the reciprocal square root of each element in the source vector and stores the result in the target vector. The estimate has a relative error no greater than one part in 16384 of the reciprocal of the square root of the source value.

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])
    v   ←bfp_RECIPROCAL_SQUARE_ROOT_ESTIMATE(src)
    rnd ←bfp_ROUND_TO_BFP32(FPSCR.RN,v)
    vresult.word[i] ←bfp32_CONVERT_FROM_BFP(rnd)
    if vxsqrt_flag=1 then SetFX(FPSCR.VXSQRT)
    if zx_flag=1 then SetFX(FPSCR.ZX)
end

if ex_flag=0 then VSR[32×TX+T] ←vresult

Programming Note

The xvrsqrtesp instruction is commonly used for fast reciprocal square root estimation in single-precision floating-point operations. Ensure that the VSX (Vector Scalar Extensions) are enabled by checking and setting the MSR.VSX bit. Be aware of potential exceptions such as VXSNAN or VXSQRT, which can be handled by examining the FPSCR register flags. The instruction operates on 4-element vectors, so ensure proper alignment and ordering of data for accurate results.