sqabs

SQABS <Zd>.<T>, <Pg>/M, <Zn>.<T>

Signed Saturating Absolute.

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
01000100
31:24
size
23:22
00
21:20
1
19
0
18
0
17
0
16
101
15:13
Pg
12:10
Zn
9:5
Zd
4:0
 
Format SVE2
Opcode 0x4408A000
Extension SVE2

Related

More in SVE2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x5E207800 SQABS <V><d>, <V><n> A64 01 | 0 | 11110 | size | 10000 | 00111 | 10 | Rn | Rd
0x0E207800 SQABS <Vd>.<T>, <Vn>.<T> A64 0 | Q | 0 | 01110 | size | 10000 | 00111 | 10 | Rn | Rd
0x4408A000 SQABS <Zd>.<T>, <Pg>/M, <Zn>.<T> A64 01000100 | size | 00 | 1 | 0 | 0 | 0 | 101 | Pg | Zn | Zd

Description

Compute the absolute value of the signed integer in each active element of the source vector, and place the results in the corresponding elements of the destination vector. Each result element is saturated to the N-bit element's signed integer range -2(N-1) to (2(N-1) )-1. 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
        integer element = SInt(Elem[operand, e, esize]);
        element = Abs(element);
        Elem[result, e, esize] = SignedSat(element, esize);

Z[d, VL] = result;