li
RISC-V li Pseudo-Instruction Details
Assembler pseudo-instructionRISC-V li is written as li rd, immediate in the RISC-V Assembly Programmer's Manual and means Load immediate. Its expansion is listed as Myriad sequences, with different sequences possible for a numeric value.
What You Write
li rd, immediate
Typical Real Expansion
Myriad sequences
What This Pseudo Instruction Is Saving You From Writing
li loads an immediate, but the instruction sequence depends on the value; there is no universal fixed expansion.
How To Read The Expansion
Step 1
li rd, immediate can generate multiple instruction sequences.
Step 2
Its note says a specific numeric value can produce different instruction sequences.
Official References And Reading Order
This page treats pseudo-instructions as assembler-level aliases or macros: first read what real instructions they expand to, then use the official ISA manual for the behavior of those real instructions. ABI, relocation, and linker-relaxation details follow the psABI document.
Pitfalls / Common Confusions
Do not describe one particular sequence as the expansion for every immediate value.
FAQ
Does li have a universal fixed expansion?
No. li can use different instruction sequences for different immediate values.