addic. or ai. (Add Immediate Carrying and Record) instruction
Purpose
Performs an addition with carry of the contents of a general-purpose register and an immediate value.
Syntax
Bits | Value |
---|---|
0 - 5 | 13 |
6 - 10 | RT |
11 - 15 | RA |
16 - 31 | SI |
See Extended Mnemonics of Fixed-Point Arithmetic Instructions for more information.
Description
The addic. and ai. instructions place the sum of the contents of general-purpose register (GPR) RA and a 16-bit signed integer, SI, into the target GPR RT.
The 16-bit integer SI provided as immediate data is sign-extended to 32 bits prior to carrying out the addition operation.
The addic. and ai. instructions have one syntax form and can set the Carry Bit of the Fixed-Point Exception Register. These instructions also affect Condition Register Field 0.
Parameters
Item | Description |
---|---|
RT | Specifies target general-purpose register where result of operation is stored. |
RA | Specifies source general-purpose register for operation. |
SI | Specifies 16-bit signed integer for operation. |
Examples
The following code adds a 16-bit signed integer to the contents of GPR 4, stores the result in GPR 6, and sets the Fixed-Point Exception Register Carry bit and Condition Register Field 0 to reflect the result of the operation:
# Assume GPR 4 contains 0xEFFF FFFF.
addic. 6,4,0x1000
# GPR 6 now contains 0xF000 0FFF.