fabs
Floating-Point Absolute Value (Half-Precision)
FABS <Vd>.8H, <Vn>.8H
Absolute value of half-precision vector.
Details
Computes the absolute value (clear sign bit) of each half-precision floating-point element in Vn, writing results to Vd. Operates on 8 half-precision (16-bit) values in a 128-bit vector; this is a bitwise operation that does not raise floating-point exceptions. No condition flags are affected. Requires FEAT_FP16 extension; AArch64-only.
Pseudocode Operation
for i = 0 to 7
Vd[i*16 +: 16] ← Vn[i*16 +: 16] AND 0x7FFF
Example
FABS v0.4s.8H, v1.4s.8H
Encoding
Binary Layout
0
Q
0
01110
1
111100
01111
10
Rn
Rd
Operands
-
Vd
Destination SIMD/FP vector register -
Vn
First source SIMD/FP vector register
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x0EF8F800 | FABS <Vd>.<T>, <Vn>.<T> | A64 | 0 | Q | 0 | 01110 | 1 | 111100 | 01111 | 10 | Rn | Rd | ||
| 0x0EA0F800 | FABS <Vd>.<T>, <Vn>.<T> | A64 | 0 | Q | 0 | 011101 | sz | 10000 | 01111 | 10 | Rn | Rd | ||
| 0x1EE0C000 | FABS <Hd>, <Hn> | A64 | 0 | 0 | 0 | 11110 | 11 | 10000 | 01 | 10000 | Rn | Rd | ||
| 0x1E20C000 | FABS <Sd>, <Sn> | A64 | 0 | 0 | 0 | 11110 | 00 | 10000 | 01 | 10000 | Rn | Rd | ||
| 0x1E60C000 | FABS <Dd>, <Dn> | A64 | 0 | 0 | 0 | 11110 | 01 | 10000 | 01 | 10000 | Rn | Rd | ||
| 0x041CA000 | FABS <Zd>.<T>, <Pg>/M, <Zn>.<T> | A64 | 00000100 | size | 011 | 10 | 0 | 101 | Pg | Zn | Zd |
Description
Floating-point Absolute value (vector). This instruction calculates the absolute value of each vector element in the source SIMD&FP register, writes the result to a vector, and writes the vector to the destination SIMD&FP register.
Depending on the settings in the CPACR_EL1, CPTR_EL2, and CPTR_EL3 registers, and the current Security state and Exception level, an attempt to execute the instruction might be trapped.
Operation
CheckFPAdvSIMDEnabled64();
bits(datasize) operand = V[n, datasize];
bits(datasize) result;
bits(esize) element;
for e = 0 to elements-1
element = Elem[operand, e, esize];
if neg then
element = FPNeg(element, FPCR);
else
element = FPAbs(element, FPCR);
Elem[result, e, esize] = element;
V[d, datasize] = result;