saba

SABA <Zda>.<T>, <Zn>.<T>, <Zm>.<T>

Signed Absolute Difference Accumulate.

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
01000101
31:24
size
23:22
0
21
Zm
20:16
11111
15:11
0
10
Zn
9:5
Zda
4:0
 
Format SVE2
Opcode 0x4500F800
Extension SVE2

Related

More in SVE2

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x0E207C00 SABA <Vd>.<T>, <Vn>.<T>, <Vm>.<T> A64 0 | Q | 0 | 01110 | size | 1 | Rm | 0111 | 1 | 1 | Rn | Rd
0x4500F800 SABA <Zda>.<T>, <Zn>.<T>, <Zm>.<T> A64 01000101 | size | 0 | Zm | 11111 | 0 | Zn | Zda

Description

Compute the absolute difference between signed integer values in elements of the second source vector and corresponding elements of the first source vector, and add the difference to the corresponding elements of the destination vector. This instruction is unpredicated.

Operation

CheckSVEEnabled();
constant integer VL = CurrentVL;
constant integer PL = VL DIV 8;
constant integer elements = VL DIV esize;
bits(VL) operand1 = Z[n, VL];
bits(VL) operand2 = Z[m, VL];
bits(VL) result = Z[da, VL];

for e = 0 to elements-1
    integer element1 = Int(Elem[operand1, e, esize], unsigned);
    integer element2 = Int(Elem[operand2, e, esize], unsigned);
    bits(esize) absdiff = Abs(element1 - element2)<esize-1:0>;
    Elem[result, e, esize] = Elem[result, e, esize] + absdiff;

Z[da, VL] = result;