rbit

Reverse Bits

RBIT <Wd>, <Wn>

Reverses the bit order in a register.

Pseudocode Operation

result ← BitReverse(Wn)
Wd ← result

Example

RBIT w0, w1

Encoding

Binary Layout
0
31
1
30
0
29
11010110
28:21
00000
20:16
000000
15:10
Rn
9:5
Rd
4:0
 
Format Data Processing
Opcode 0x5AC00000
Extension Base

Operands

  • Wd
    Destination 32-bit integer register
  • Wn
    First source / base 32-bit integer register

Related

Other forms of rbit

  • rbit SVE Reverse Bits
  • rbit Reverse Bits (Thumb)
  • rbit Reverse Bits (64-bit)
  • rbit Reverse Bits (A32)

Across architectures

Count Trailing Zeros : how x86, ARM, RISC-V, and PowerISA each do this.

More in Base

Reference

Instruction Forms

Encoding Instruction ISA Bit pattern
0x2E605800 RBIT <Vd>.<T>, <Vn>.<T> A64 0 | Q | 1 | 01110 | 01 | 10000 | 00101 | 10 | Rn | Rd
0x5AC00000 RBIT <Wd>, <Wn> A64 0 | 1 | 0 | 11010110 | 00000 | 000000 | Rn | Rd
0xDAC00000 RBIT <Xd>, <Xn> A64 1 | 1 | 0 | 11010110 | 00000 | 000000 | Rn | Rd
0x05278000 RBIT <Zd>.<T>, <Pg>/M, <Zn>.<T> A64 00000101 | size | 1001 | 1 | 1 | 100 | Pg | Zn | Zd

Description

Reverse Bits reverses the bit order in a register.

Operation

bits(datasize) operand = X[n, datasize];
bits(datasize) result;

for i = 0 to datasize-1
    result<(datasize-1)-i> = operand<i>;

X[d, datasize] = result;