lis

Load Immediate Shifted

lis RT, SIM

Loads a 16-bit immediate into the upper half of a 32-bit word. (Alias for 'addis RT, 0, SIM').

Details

The 'lis' instruction loads an immediate value shifted left by 16 bits into a register. If the source register (RA) is zero, it uses the value 0; otherwise, it adds the contents of RA to the sign-extended immediate value.

Pseudocode Operation

if RA = 0 then
    RT ← EXTS(SI || 160)
else
    RT ← (RA) + EXTS(SI || 160)

Programming Note

The 'lis' instruction is commonly used to load large constants into a register by shifting the immediate value left by 16 bits. If the source register (RA) is not zero, its contents are added to the sign-extended immediate value. Be cautious with alignment as this can affect performance and correctness. This instruction operates at user privilege level.

Example

lis r3, 4

Encoding

Binary Layout
15
0
RT
6
0
11
SIM
16
 
Format D-form
Opcode 0x3C000000
Extension Base

Operands

  • RT
    Target
  • SIM
    Immediate