fsqrt
SVE Floating-Point Square Root
FSQRT <Zdn>.<T>, <Pg>/M, <Zdn>.<T>
Calculates square root of floats.
Details
SVE floating-point square root: computes the square root of each active element in Zdn and stores the result back in Zdn. Elements where the predicate is false are left unchanged. Floating-point exception flags (IOC, DZC, OFC, UFC, IXC) are updated according to the IEEE 754 standard; no integer condition flags are affected. This is an SVE-only instruction.
Pseudocode Operation
for i = 0 to VL-1
if Pg[i] == '1' then
Zdn[i] ← FPSquareRoot(Zdn[i])
// else Zdn[i] unchanged
// FP exception flags updated per IEEE 754
Example
FSQRT z0.s.T, p0/m/M, z0.s.T
Encoding
Binary Layout
01100101
size
0011
0
1
101
Pg
Zn
Zd
Operands
-
Zdn
Combined destination/source scalable vector register (SVE) -
Pg
Mask
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x2EF9F800 | FSQRT <Vd>.<T>, <Vn>.<T> | A64 | 0 | Q | 1 | 01110 | 1 | 111100 | 11111 | 10 | Rn | Rd | ||
| 0x2EA1F800 | FSQRT <Vd>.<T>, <Vn>.<T> | A64 | 0 | Q | 1 | 011101 | sz | 10000 | 11111 | 10 | Rn | Rd | ||
| 0x1EE1C000 | FSQRT <Hd>, <Hn> | A64 | 0 | 0 | 0 | 11110 | 11 | 10000 | 11 | 10000 | Rn | Rd | ||
| 0x1E21C000 | FSQRT <Sd>, <Sn> | A64 | 0 | 0 | 0 | 11110 | 00 | 10000 | 11 | 10000 | Rn | Rd | ||
| 0x1E61C000 | FSQRT <Dd>, <Dn> | A64 | 0 | 0 | 0 | 11110 | 01 | 10000 | 11 | 10000 | Rn | Rd | ||
| 0x650DA000 | FSQRT <Zd>.<T>, <Pg>/M, <Zn>.<T> | A64 | 01100101 | size | 0011 | 0 | 1 | 101 | Pg | Zn | Zd |
Description
Calculate the square root of each active floating-point element of the source vector, and place the results in the corresponding elements of the destination vector. Inactive elements in the destination vector register remain unmodified.
Operation
CheckSVEEnabled();
constant integer VL = CurrentVL;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV esize;
bits(PL) mask = P[g, PL];
bits(VL) operand = if AnyActiveElement(mask, esize) then Z[n, VL] else Zeros(VL);
bits(VL) result = Z[d, VL];
for e = 0 to elements-1
if ActivePredicateElement(mask, e, esize) then
bits(esize) element = Elem[operand, e, esize];
Elem[result, e, esize] = FPSqrt(element, FPCR);
Z[d, VL] = result;