C.LI
RISC-V C.LI Instruction Details
Instruction ManualC-typeLoad sign-extended 6-bit immediate into rd. CI format.
Instruction Syntax
c.li rd, imm
Operand Breakdown
Compressed instructions are 16 bits; registers are often limited to x8–x15.
Immediate fields are narrower. Refer to the full encoding for this compressed instruction.
CCompressed Instruction
Instruction Behavior
C.LI (CI format) loads sign-extended 6-bit immediate into rd (all 32 registers). Expands to addi rd,x0,imm. HINT when rd=x0.
Common Usage Scenarios
Immediates & Constants
Understand this scenario with real code like «c.li x10, 5 # x10 = 5».
Pre-Use Checklist
Syntax Check
- Confirm the current instruction format is C-type.
- Confirm the operand order matches the example.
Semantic Check
- Ensure the destination register usage is compatible with the calling convention.
- Confirm this is not the lower-level form of a pseudo-instruction expansion.
Pitfalls / Common Confusions
HINT when rd=x0