tbb
Table Branch Byte
TBB [<Rn>, <Rm>]
PC-relative branch using a table of bytes (Switch statements).
Details
Table Branch Byte performs a PC-relative branch using a single-byte lookup table indexed by Rm. The branch offset is calculated as 2 × [Rn + Rm], enabling efficient switch statement implementations. No condition flags are affected. T32-only; updates PC implicitly to the target address.
Example
TBB [r1, r2]
Encoding
Binary Layout
111010001101
Rn
1
1
1
1
0
0
0
0
000
0
Rm
Operands
-
Rn
Table Base -
Rm
Index
Reference (Arm AArch32 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0xE8D0F000 | TBB{<c>}{<q>} [<Rn>, <Rm>] | T32 | 111010001101 | Rn | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 000 | 0 | Rm |
Description
Table Branch Byte or Halfword causes a PC-relative forward branch using a table of single byte or halfword offsets. A base register provides a pointer to the table, and a second register supplies an index into the table. The branch length is twice the value returned from the table.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
integer halfwords;
if is_tbh then
halfwords = UInt(MemU[R[n]+LSL(R[m],1), 2]);
else
halfwords = UInt(MemU[R[n]+R[m], 1]);
BranchWritePC(PC + 2*halfwords, BranchType_INDIR);