addic
Add Immediate Carrying - 30 00 00 00
addic
Instruction Syntax
Mnemonic | Format | Description |
addic | rD,rA,SIMM | Add immediate carrying |
Derived Forms
Mnemonic | Format | Description |
subic | rD,rA,value | Subtract immediate carrying (SIMM = -value) |
Instruction Encoding
0
0
1
1
0
0
D
D
D
D
D
A
A
A
A
A
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
Field | Bits | Description |
Primary Opcode | 0-5 | 001100 (0x0C) |
rD | 6-10 | Destination register |
rA | 11-15 | Source register A |
SIMM | 16-31 | 16-bit signed immediate value |
Operation
rD ← (rA) + EXTS(SIMM)
The sum of the contents of rA and the sign-extended immediate value is placed into rD.
Note: The addic instruction updates the carry bit (XER[CA]) but does not have an overflow exception option.
Affected Registers
XER (Exception Register)
(always)
- CA (Carry)
For more information on condition codes see Section 2.1.5, "XER Register," in the PowerPC Microprocessor Family: The Programming Environments manual.
Examples
Basic Immediate Addition with Carry
addic r3, r1, 100 # r3 = r1 + 100, set carry if overflow addic r5, r5, -50 # r5 = r5 - 50, set carry if underflow
Multi-Precision Arithmetic Setup
# Start multi-precision addition sequence addic r3, r1, 0x1000 # Add immediate, set carry adde r4, r2, r5 # Continue with extended add using carry
Subtract Immediate with Carry (subic)
subic r3, r1, 50 # r3 = r1 - 50 (equivalent to addic r3, r1, -50)
Checking for Overflow in Addition
# Add with carry detection addic r3, r1, 0x7FFFFFFF # Add large positive value # Check XER[CA] to determine if carry occurred