rbit
Reverse Bits (Thumb)
RBIT <Rd>, <Rm>
Reverses bits in a 32-bit register.
Pseudocode Operation
for i = 0 to 31
Rd[i] ← Rm[31-i]
Example
RBIT r0, r2
Encoding
Binary Layout
111110101
31:23
001
22:20
Rn
19:16
1111
15:12
Rd
11:8
10
7:6
10
5:4
Rm
3:0
Operands
-
Rd
Destination general-purpose register -
Rm
Second source / offset general-purpose register
Related
Other forms of rbit
Across architectures
Count Trailing Zeros : how x86, ARM, RISC-V, and PowerISA each do this.
More in A32 (Base)
Reference
View in Arm A64 ISA Reference ↗
Arm AArch32 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x06FF0F30 | RBIT{<c>}{<q>} <Rd>, <Rm> | A32 | cond | 01101 | 1 | 11 | 1 | 1 | 1 | 1 | Rd | 1 | 1 | 1 | 1 | 0 | 011 | Rm | ||
| 0xFA90F0A0 | RBIT{<c>}{<q>} <Rd>, <Rm> | T32 | 111110101 | 001 | Rn | 1111 | Rd | 10 | 10 | Rm |
Description
Reverse Bits reverses the bit order in a 32-bit register.
Operation
if ConditionPassed() then
EncodingSpecificOperations();
bits(32) result;
for i = 0 to 31
result<31-i> = R[m]<i>;
R[d] = result;