rbit
Reverse Bits (A32)
RBIT<c> <Rd>, <Rm>
Reverses bits in a 32-bit register.
Pseudocode Operation
Rd ← ReverseBits(Rm)
Example
RBIT r0, r2
Encoding
Binary Layout
cond
31:28
01101
27:23
1
22
11
21:20
1
19
1
18
1
17
1
16
Rd
15:12
1
11
1
10
1
9
1
8
0
7
011
6: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;