xvtsqrtsp

VSX Vector Test for software Square Root, Single-Precision

xvtsqrtsp BF,XB

Tests each element of a vector for conditions related to square root operations.

Details

The xvtsqrtsp instruction tests each element of the vector VSR[XB] for various conditions and sets the condition register field CR.field[BF] based on these tests.

Pseudocode Operation

if MSR.VSX=0 then
    VSX_Unavailable()

fe_flag ←0b0
fg_flag ←0b0

do i = 0 to 3
    src    ←VSR[32×XB+B].word[i]
e_b    ←src2.bit[1:8] - 127
fe_flag ←fe_flag |
           IsNaN(src) | IsInf(src) |
           IsZero(src) | IsNeg(src) |
           (e_a <= -103)
fg_flag ←fg_flag | IsInf(src) |
           IsZero(src) | IsDen(src)
end

fl_flag = xvrsqrtesp_error() <= 2-14
CR.field[BF]  = 0b1 || fg_flag || fe_flag || 0b0

Programming Note

The xvtsqrtsp instruction is used to test each element of a vector for NaN, infinity, zero, negative values, and underflow conditions. It sets the condition register based on these tests. Ensure that VSX is enabled in the MSR before using this instruction; otherwise, it will raise an exception. The instruction does not require specific alignment but must be executed at a privilege level where VSX is available.

Example

xvtsqrtsp cr0, vs3

Encoding

Binary Layout
18
0
BF
6
XB
9
 
Format XX2-form
Opcode 0xF00002A8
Extension VSX
Registers Altered CR

Operands

  • BF
    Condition Register Field
  • XB
    Vector-Scalar Register