vtbl
Vector Table Lookup
VTBL<c>.8 <Dd>, <list>, <Dm>
Look up elements in a vector table.
Details
Performs a table lookup where each element of Dm is used as an index into the table formed by one or more consecutive NEON registers in <list>, and the corresponding table element is written to Dd. Out-of-range indices produce a zero result. No flags are affected. Execution is restricted to A32/T32 with NEON support; the table may span 1–4 consecutive registers, controlled by the <len> encoding field.
Pseudocode Operation
Example
VTBL.8 d0, {r0-r3}, d2
Encoding
Binary Layout
111100111
D
11
Vn
Vd
10
len
N
0
M
0
Vm
Operands
-
Dd
Destination 64-bit SIMD/FP register -
list
Table -
Dm
Indices
Reference (Arm AArch32 ISA)
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