vtbx
Vector Table Extension
VTBX<c>.8 <Dd>, <list>, <Dm>
Inserts elements into a vector using a table lookup.
Details
Performs a table lookup and extension: for each byte index in Dm, looks up the corresponding byte in the table (1–4 registers starting at Vn) and inserts it into the corresponding position in Dd, leaving unmapped indices unchanged in Dd. Condition flags (N, Z, C, V) are unaffected. Execution is restricted to A32/T32 with NEON extension; out-of-range indices preserve the original element in Dd.
Pseudocode Operation
Example
VTBX.8 d0, {r0-r3}, d2
Encoding
Binary Layout
111100111
D
11
Vn
Vd
10
len
N
1
M
0
Vm
Operands
-
Dd
Dest/Base -
list
Table -
Dm
Indices
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0xF3B00840 | VTBX{<c>}{<q>}.8 <Dd>, <list>, <Dm> | A32 | 111100111 | D | 11 | Vn | Vd | 10 | len | N | 1 | M | 0 | Vm | ||
| 0xFFB00840 | VTBX{<c>}{<q>}.8 <Dd>, <list>, <Dm> | T32 | 111111111 | D | 11 | Vn | Vd | 10 | len | N | 1 | 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