li

Load immediate Pseudo-instruction

Loads an immediate constant into a register, using as many instructions as the value needs.

RISC-V manual: addi

Used in

Forms

Operands

t1
Any integer register, x0 to x31, or its named alias, such as zero, t0 or t6.
imm
An immediate value: a signed 12-bit value (-2048 to 2047), a 32-bit value (-2147483648 to 4294967295) or a 64-bit value in RV64 (signed decimal or a hexadecimal bit pattern up to 0xFFFFFFFFFFFFFFFF). The size your value needs decides which real instructions the assembler uses. Open the row to see them for each size.

This example runs on RV64.

# li writes 123 to t0.
.data
marker: .word 17
.text
li t0, 123