tbx

Table Lookup Extension (SVE)

TBX <Zd>.<T>, <Zn>.<T>, <Zm>.<T>

Vector table extension (SVE version of TBX).

Pseudocode Operation

No pseudocode available.

Encoding

Binary Layout
00000101
31:24
size
23:22
1
21
Zm
20:16
00101
15:11
1
10
Zn
9:5
Zd
4:0
 
Format SVE Permute
Opcode 0x05202C00
Extension SVE

Related

More in SVE

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x0E001000 TBX <Vd>.<Ta>, { <Vn>.16B }, <Vm>.<Ta> A64 0 | Q | 001110 | 00 | 0 | Rm | 0 | 00 | 1 | 00 | Rn | Rd
0x0E003000 TBX <Vd>.<Ta>, { <Vn>.16B, <Vn+1>.16B }, <Vm>.<Ta> A64 0 | Q | 001110 | 00 | 0 | Rm | 0 | 01 | 1 | 00 | Rn | Rd
0x0E005000 TBX <Vd>.<Ta>, { <Vn>.16B, <Vn+1>.16B, <Vn+2>.16B }, <Vm>.<Ta> A64 0 | Q | 001110 | 00 | 0 | Rm | 0 | 10 | 1 | 00 | Rn | Rd
0x0E007000 TBX <Vd>.<Ta>, { <Vn>.16B, <Vn+1>.16B, <Vn+2>.16B, <Vn+3>.16B }, <Vm>.<Ta> A64 0 | Q | 001110 | 00 | 0 | Rm | 0 | 11 | 1 | 00 | Rn | Rd
0x05202C00 TBX <Zd>.<T>, <Zn>.<T>, <Zm>.<T> A64 00000101 | size | 1 | Zm | 00101 | 1 | Zn | Zd

Description

Reads each element of the second source (index) vector and uses its value to select an indexed element from a table of elements in the first source vector, and places the indexed element in the destination vector element corresponding to the index vector element. If an index value is greater than or equal to the number of vector elements then the corresponding destination vector element is left unchanged. Since the index values can select any element in a vector this operation is not naturally vector length agnostic.

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[d, VL];

for e = 0 to elements-1
    integer element2 = UInt(Elem[operand2, e, esize]);
    if element2 < elements then
        Elem[result, e, esize] = Elem[operand1, element2, esize];

Z[d, VL] = result;