ROR

Rotate Right

ROR rd, rs1, rs2

Rotates the bits in rs1 right by the amount in rs2.

Details

ROR rotates rs1 right by the shift amount in the lower log2(XLEN) bits of rs2, writing the result to rd.

Pseudocode Operation

shamt = R[rs2] & (XLEN-1); R[rd] = (R[rs1] >> shamt) | (R[rs1] << (XLEN-shamt));

Example

ROR x10, x11, x12

Encoding

Binary Layout
0110000
31:25
rs2
24:20
rs1
19:15
101
14:12
rd
11:7
0110011
6:0
 
Format R-Type
Opcode 0x33
Extension Zbb

Operands

  • rd
    Destination register (integer)
  • rs1
    Source
  • rs2
    Rotate Amount