addic

Add Immediate Carrying

addic RT,RA,SI
subf RT,RA,RB
subf. RT,RA,RB
subfo RT,RA,RB
subfo. RT,RA,RB

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

Details

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

Pseudocode Operation

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

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.

Extended Mnemonics

Extended Mnemonic Equivalent Instruction
subic

Example

addic r3, r4, 10

Encoding

Binary Layout
12
0
RT
6
RA
11
SI
16
 
Format D-form
Opcode 0x30000000
Extension Base
Registers Altered XER, CR0

Operands

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