# `ror`

[MIPS Documentation](https://asm-editor.specy.app/documentation/mips.md) › [Instructions](https://asm-editor.specy.app/documentation/mips/instruction.md)

Web page: https://asm-editor.specy.app/documentation/mips/instruction/ror

**Rotate right (register or immediate)** · Pseudo-instruction

Category: Shifts and rotates

Rotates the second register right by the amount in the third, or by a 5-bit immediate, and stores the result in the first.

## Forms

- `ror $t1, $t2, $t3`
  - `ror $t1,$t2,$t3` → `subu $at, $zero, $t3`; `sllv $at, $t2, $at`; `srlv $t1, $t2, $t3`; `or $t1, $t1, $at`

- `ror $t1, $t2, imm5` · Set $t1 to ($t2 rotated right by number of bit positions specified in 5-bit immediate)
  - `ror $t1,$t2,10` → `sll $at, $t2, 32-imm5`; `srl $t1, $t2, imm5`; `or $t1, $t1, $at`

## Operands

- `$t1`: Any general-purpose register, `$0` to `$31`, using its numeric or named spelling, such as `$8` or `$t0` (`$zero` is `$0`; `$ra` is `$31`).
- `$t2`: A general-purpose register. It may be the same register as `$t1`.
- `$t3`: A general-purpose register. It may be the same register as `$t1`.
- `imm5`: An unsigned 5-bit immediate, `0` to `31`, used for values such as a shift count.

## Example

```mips
# Shift or rotate an initialized word; inspect $t2: 0x20000001.
li $t0, 0x12
ror $t2, $t0, 4
```
