addic

Add Immediate Carrying

addic RT,RA,SI

Adds an immediate to a register and updates the Carry bit.

Encoding

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

Operands

  • RT
    Target Register
  • RA
    Source Register
  • SI
    Signed 16-bit Immediate

Example

addic r3, r4, 10

// r3 = r4 + 10 (Updates CA)

Registers Altered

XER, CR0

Related

More in Base

Reference

Description

The sum (RA) + SI is placed into register RT.

Operation

RT <- (RA) + EXTS(SI); CA <- Carry

Extended Mnemonics

Extended Mnemonic Equivalent Instruction
subic

Programming Note

The `addic` instruction adds an immediate value to a register and sets the carry bit in the XER. It's commonly used for arithmetic operations where overflow detection is needed. Ensure that the immediate value fits within 16 bits, as it is sign-extended before addition. This instruction operates at user privilege level.