rori
Rotate right (Immediate)
- Extension
- Zbb, Zbkb, Zk, Zkn, Zks
- XLEN
- RV32 and RV64
- Assembly (riscv-unified-db)
rori xd, xs1, shamt- Length
- 32-bit
Encoding
RV64 form
| 3126 | 2520 | 1915 | 1412 | 117 | 62 | 10 | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 011000 | shamt | rs1 | 101 | rd | 00100 | 11 | |||||||||||||||||||||||||
Match 0x60005013, mask 0xfc00707f. Source: rori rd rs1 31..26=0x18 shamtd 14..12=5 6..2=0x04 1..0=3 in riscv-opcodes/extensions/rv64_zbb.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| shamt | 25:20 | shamtd |
| rs1 | 19:15 | rs1 |
| rd | 11:7 | rd |
RV32 form; listed in riscv-opcodes as a pseudo-op of rori
| 3125 | 2420 | 1915 | 1412 | 117 | 62 | 10 | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0110000 | shamt | rs1 | 101 | rd | 00100 | 11 | |||||||||||||||||||||||||
Match 0x60005013, mask 0xfe00707f. Source: $pseudo_op rv64_zbb::rori rori.rv32 rd rs1 31..25=0x30 shamtw 14..12=5 6..2=0x04 1..0=3 in riscv-opcodes/extensions/rv32_zbb.
| Field | Bits | riscv-opcodes name |
|---|---|---|
| shamt | 24:20 | shamtw |
| rs1 | 19:15 | rs1 |
| rd | 11:7 | rd |
Description
Performs a rotate right of xs1 by the amount in the least-significant log2(XLEN) bits of shamt. For RV32, the encodings corresponding to shamt[5]=1 are reserved.
Description from riscv-unified-db, reformatted.
Operation
XReg shamt = (xlen() == 32) ? shamt[4:0] : shamt[5:0]; X[xd] = (X[xs1] >> shamt) | (X[xs1] << (xlen() - shamt));
Pseudocode in riscv-unified-db’s IDL, quoted unchanged.
Specification and related pages
- The RISC-V Instruction Set Manual: src/unpriv/zbb.adoc (Zbb)
- The RISC-V Instruction Set Manual: src/unpriv/zbkb.adoc (Zbkb)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zk)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zkn)
- The RISC-V Instruction Set Manual: src/unpriv/zk.adoc (Zks)
- riscv-unified-db: spec/std/isa/inst/B/rori.yaml
- Zbb instruction listing
- Zbkb instruction listing
- Zk instruction listing
- Zkn instruction listing
- Zks instruction listing