# `lui`

[RISC-V Documentation](https://asm-editor.specy.app/documentation/risc-v.md) › [Instructions](https://asm-editor.specy.app/documentation/risc-v/instruction.md)

Web page: https://asm-editor.specy.app/documentation/risc-v/instruction/lui

**Load upper immediate**

Category: Data movement

Sets a register to a 20-bit immediate followed by 12 zero bits.

[RISC-V manual: lui](https://docs.riscv.org/reference/isa/v20260120/unpriv/rv32.html#norm:lui_op)

## Forms

- `lui t1, imm20`

## Pseudo-instructions

The processor does not have these forms. The assembler replaces each of them with one or more real instructions. Open a row to see them.

- `lui t1, %hi(label)` · Set t1 to upper 20-bit label's address
  - `lui t1,%hi(label)` → `lui t1, hi(label)`

## Operands

- `t1`: Any integer register, `x0` to `x31`, or its named alias, such as `zero`, `t0` or `t6`.
- `imm20`: A 20-bit immediate, `0` to `1048575` (`0xFFFFF`), placed in bits 31–12.
- `label`: A named address in the program, such as the start of a loop or a variable in `.data`.

## Example

```riscv
# lui writes 73728 to t0.
.data
marker: .word 17
.text
lui t0, 18
```
