li

Load immediate Pseudo-instruction

Loads an immediate constant into t1, 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 assembler chooses a supported encoding for the value and other operands; a pseudoinstruction may expand into several instructions.

This example runs on RV64.

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