addi

Add Immediate

addi RT, RA, SI

Adds a signed immediate value to the contents of a register and places the result in another register.

Encoding

Binary Layout
14
0:5
RT
6:10
RA
11:15
SI
16:31
 
Format D-form
Opcode 0x38000000
Extension Base

Operands

  • RT
    Target Register
  • RA
    Source Register (0 means 0)
  • SI
    Signed 16-bit Immediate
  • SIMM
    16-bit Signed Immediate Value

Example

addi r3, r4, 10

// r3 = r4 + 10

Related

Across architectures

Integer Addition : how x86, ARM, RISC-V, and PowerISA each do this.

More in Base

Reference

Description

Adds the signed 16-bit immediate value SI to the contents of register RA (or 0 if RA=0) and stores the result in RT. This instruction does not affect any condition registers or XER flags, and no overflow checking is performed.

Operation

RT ← (RA | 0) + sign_extend(SI)

Extended Mnemonics

Extended Mnemonic Equivalent Instruction
la
li
subi

Programming Note

addi, addis, add, and subf are the preferred instructions for addition and subtraction, because they set few status bits.