# `srav`

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

**Shift right arithmetic variable**

Category: Shifts and rotates

Shifts the second register right by the amount in the low 5 bits of the third, filling vacated bits with the sign bit, and stores the result in the first.

## Forms

- `srav $t1, $t2, $t3`

## 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`.

## Description

Like 'sra' but the shift amount is taken from the lowest 5 bits of register $t3. Vacated bits are sign-filled.

## Example

```mips
# Initialize both inputs, then execute srav with initialized inputs. Inspect $t2: 0.
li $t0, 7
li $t1, 3
srav $t2, $t0, $t1
```
