li
Load Immediate
li RT, SIM
Loads a 16-bit signed immediate into a register. (Alias for 'addi RT, 0, SIM').
Encoding
Binary Layout
14
0:5
RT
6:10
0
11:15
SIM
16:31
Operands
-
RT
Target -
SIM
Immediate
Example
li r3, 4
Related
More in Base
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
Loads a 16-bit signed immediate value into the target register. This is an assembly-language alias for 'addi RT, 0, SIM' that simplifies loading small constants. No condition register flags are affected.
Operation
RT ← sign_extend(SIM, 16)
Programming Note
The `li` instruction is commonly used for initializing or resetting registers to specific values. Ensure the immediate value fits within the 32-bit signed integer range to avoid unexpected behavior. This instruction operates at user privilege level and does not generate exceptions unless there are issues with the instruction encoding.