vtbl

Vector Table Lookup

VTBL<c>.8 <Dd>, <list>, <Dm>

Look up elements in a vector table.

Pseudocode Operation

for i ← 0 to (size_of_Dd / 8) - 1:
  index ← Dm[i*8 +: 8]
  if index < (len + 1) * 16:
    Dd[i*8 +: 8] ← table[index]
  else:
    Dd[i*8 +: 8] ← 0

Example

VTBL.8 d0, {r0-r3}, d2

Encoding

Binary Layout
111100111
31:23
D
22
11
21:20
Vn
19:16
Vd
15:12
10
11:10
len
9:8
N
7
0
6
M
5
0
4
Vm
3:0
 
Format NEON Table
Opcode 0xF3B00800
Extension NEON (SIMD)

Operands

  • Dd
    Destination 64-bit SIMD/FP register
  • list
    Table
  • Dm
    Indices

Related

More in NEON (SIMD)

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0xF3B00800 VTBL{<c>}{<q>}.8 <Dd>, <list>, <Dm> A32 111100111 | D | 11 | Vn | Vd | 10 | len | N | 0 | M | 0 | Vm
0xFFB00800 VTBL{<c>}{<q>}.8 <Dd>, <list>, <Dm> T32 111111111 | D | 11 | Vn | Vd | 10 | len | N | 0 | M | 0 | Vm

Description

Vector Table Lookup uses byte indexes in a control vector to look up byte values in a table and generate a new vector. Indexes out of range return 0. Vector Table Extension works in the same way, except that indexes out of range leave the destination element unchanged. Depending on settings in the CPACR, NSACR, and HCPTR registers, and the Security state and PE mode in which the instruction is executed, an attempt to execute the instruction might be undefined, or trapped to Hyp mode. For more information see Enabling Advanced SIMD and floating-point support.

Operation

if ConditionPassed() then
    EncodingSpecificOperations();  CheckAdvSIMDEnabled();

    // Create 256-bit = 32-byte table variable, with zeros in entries that will not be used.
    table3 = if length == 4 then D[n+3] else Zeros(64);
    table2 = if length >= 3 then D[n+2] else Zeros(64);
    table1 = if length >= 2 then D[n+1] else Zeros(64);
    table = table3 : table2 : table1 : D[n];

    for i = 0 to 7
        index = UInt(Elem[D[m],i,8]);
        if index < 8*length then
            Elem[D[d],i,8] = Elem[table,index,8];
        else
            if is_vtbl then
                Elem[D[d],i,8] = Zeros(8);
            // else Elem[D[d],i,8] unchanged