# `sll`

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

**Shift left logical**

Category: Shifts and rotates

Shifts the second register left by a fixed amount of 0 to 31 bits, filling vacated bits with zeros, and stores the result in the first.

Used in: [Arithmetic, logic and bits](https://asm-editor.specy.app/learn/courses/mips/think-in-assembly/arithmetic-logic-and-bits.md) (MIPS assembly), [jal, jr, and the course calling convention](https://asm-editor.specy.app/learn/courses/mips/think-in-assembly/jal-jr-and-the-calling-convention.md) (MIPS assembly), [The bitmap display and keyboard registers](https://asm-editor.specy.app/learn/courses/mips/talking-to-the-outside-world/the-bitmap-display-and-the-keyboard.md) (MIPS assembly), [The largest element](https://asm-editor.specy.app/learn/courses/mips/examples/max-of-an-array.md) (MIPS assembly), [Masks, shifts, popcount, and leading zeroes](https://asm-editor.specy.app/learn/courses/mips/examples/bit-tricks.md) (MIPS assembly), [A jump table](https://asm-editor.specy.app/learn/courses/mips/examples/jump-table.md) (MIPS assembly), [Binary search](https://asm-editor.specy.app/learn/courses/mips/examples/binary-search.md) (MIPS assembly), [A 2D array](https://asm-editor.specy.app/learn/courses/mips/examples/two-dimensional-array.md) (MIPS assembly), [Drawing shapes on the screen](https://asm-editor.specy.app/learn/courses/mips/examples/drawing-on-the-screen.md) (MIPS assembly), [A bouncing ball](https://asm-editor.specy.app/learn/courses/mips/examples/bouncing-ball.md) (MIPS assembly)

## Forms

- `sll $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

Vacated bits on the right are filled with 0. Shifting left by n is equivalent to multiplying by 2^n (without overflow checking). Example: sll $t1,$t1,2 multiplies $t1 by 4.

## Example

```mips
# Shift or rotate an initialized word; inspect $t2: 72.
li $t0, 0x12
sll $t2, $t0, 2
```
