rbit
Reverse Bits (A32)
RBIT<c> <Rd>, <Rm>
Reverses bits in a 32-bit register.
Details
Reverses the bit order in a 32-bit register, writing the reversed value to the destination. Bit 0 becomes bit 31, bit 1 becomes bit 30, and so on. No condition flags are affected. This instruction requires the ARMv6T2 or later extension.
Pseudocode Operation
Rd ← ReverseBits(Rm)
Example
RBIT r0, r2
Encoding
Binary Layout
cond
01101
1
11
1
1
1
1
Rd
1
1
1
1
0
011
Rm
Operands
-
Rd
Destination general-purpose register -
Rm
Second source / offset general-purpose register
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;