rbit

Reverse Bits (64-bit)

RBIT <Xd>, <Xn>

Reverses the bit order in a 64-bit register.

Details

Reverses the bit order in a 64-bit register, placing the least significant bit at the most significant position. No condition flags are affected. This is an AArch64 instruction with no privilege requirements.

Pseudocode Operation

Xd ← BitReverse(Xn)

Example

RBIT x0, x1

Encoding

Binary Layout
1
1
0
11010110
00000
000000
Rn
Rd
 
Format Data Processing
Opcode 0xDAC00000
Extension Base

Operands

  • Xd
    Destination 64-bit integer register
  • Xn
    First source / base 64-bit integer register

Reference (Arm A64 ISA)

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;