11 SVE · table lookup
TBL
Each lane picks any element of an eight-entry table — out of range gives zero.
tbl z0.s, { z1.s, z2.s }, z3.s
Types: 32-bit float elements throughout; the indices in z3.s select whole elements. Drawn at SVL = 128 bits, so the two-register table holds 8 entries; at SVL = 512 it holds 32, and out-of-range still zeroes.
z1.s · 0–3
z2.s · 4–7
z3.s
z0.s
z0.s[i] ← table[z3.s[i]], or 0 past the end
Ready. Click index lanes to change them, or just play.
Arrow keys step, space plays or pauses.
This browser prefers reduced motion. Play still runs the instruction and jumps straight to the result.
Reading the picture
-
Any element, any lane
The table is two consecutive vectors — eight .s entries here, numbered 0 to 7. Each index lane picks one entry; the order can be arbitrary, reversed, or duplicated.
-
Out of range means zero
An index of 8 or more writes 0 into that lane. The zeroing is by design, so missing entries need no masking. The index lanes above run up to 9 — click one and watch its lane go to zero.
-
Not length-agnostic
Unlike the rest of SVE, the table size depends on the vector length: code that hard-codes eight entries works only at 128 bits. That rarity is why these index lanes run up to 9.
This pass looks up z3.s = {1, 8, 3, 9} in the table {5, 2, 9, 7} + {4, 8, 1, 6}.