# `rotr`

[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/rotr

**Rotate right**

Category: Shifts and rotates

Rotates the second register right by a fixed amount of 0 to 31 bits, with bits leaving the right end re-entering on the left, and stores the result in the first.

## Forms

- `rotr $t1, $t2, imm5`

## 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`.
- `imm5`: An unsigned 5-bit immediate, `0` to `31`, used for values such as a shift count.

## Description

Unlike 'srl', bits shifted off the right re-enter on the left rather than being discarded, so no information is lost. Encoded as 'srl' with bit 21 set.

## Example

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