ROL

Rotate Left

ROL rd, rs1, rs2

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

Details

ROL rotates rs1 left 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

ROL x10, x11, x12

Encoding

Binary Layout
0110000
31:25
rs2
24:20
rs1
19:15
001
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