xvsqrtsp
VSX Vector Square Root Single-Precision
Computes the square root of each single-precision floating-point element in a vector.
Details
For xvsqrtsp, the unbounded-precision square root of each single-precision floating-point operand in word elements i of VSR[XB] is computed. The result is rounded to single precision using the rounding mode specified by RN and placed into word element i 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_BFP64(VSR[32×BX+B].word[i])
v ←bfp_SQUARE_ROOT(src)
rnd ←bfp_ROUND_TO_BFP32(FPSCR.RN,v)
vresult.word[i] ←bfp32_CONVERT_FROM_BFP(rnd)
if vxsnan_flag=1 then SetFX(FPSCR.VXSNAN)
if vxsqrt_flag=1 then SetFX(FPSCR.VXSQRT)
if xx_flag=1 then SetFX(FPSCR.XX)
ex_flag ←ex_flag | (FPSCR.VE & vxsnan_flag) | (FPSCR.VE & vxsqrt_flag) | (FPSCR.XE & xx_flag)
end
if ex_flag=0 then VSR[32×TX+T] ←vresult
Programming Note
The xvsqrtsp instruction computes the square root of each single-precision floating-point element in a vector. Ensure that VSX is enabled (MSR.VSX=1) to avoid exceptions. Handle potential exceptions by checking FPSCR flags such as VXSNAN, VXSQRT, and XX. The instruction operates on 4 elements per vector register.
Example
Encoding
Operands
-
XT
Target -
XB
Source