lui

Load upper immediate

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

RISC-V manual: lui

Forms

  • lui ,

Pseudo-instructions

The assembler turns these into one or more real instructions.

  • Set t1 to upper 20-bit label's address

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.
# lui writes 73728 to t0.
.data
marker: .word 17
.text
lui t0, 18