addi (Add Immediate) or cal (Compute Address Lower) instruction
Purpose
Calculates an address from an offset and a base address and places the result in a general-purpose register.
Syntax
| Bits | Value |
|---|---|
| 0 - 5 | 14 |
| 6 - 10 | RT |
| 11 - 15 | RA |
| 16 - 31 | SI/D |
See Extended Mnemonics of Fixed-Point Arithmetic Instructions and Extended Mnemonics of Fixed-Point Load Instructions for more information.
Description
The addi and cal instructions place the sum of the contents of general-purpose register (GPR) RA and the 16-bit two's complement integer SI or D, sign-extended to 32 bits, into the target GPR RT. If GPR RA is GPR 0, then SI or D is stored into the target GPR RT.
The addi and cal instructions have one syntax form and do not affect Condition Register Field 0 or the Fixed-Point Exception Register.
Parameters
| Item | Description |
|---|---|
| RT | Specifies target general-purpose register where result of operation is stored. |
| RA | Specifies source general-purpose register for operation. |
| D | Specifies 16-bit two's complement integer sign extended to 32 bits. |
| SI | Specifies 16-bit signed integer for operation. |
Examples
The following code calculates an address or contents with an offset of 0xFFFF 8FF0 from the contents of GPR 5 and stores the result in GPR 4:
# Assume GPR 5 contains 0x0000 0900.
cal 4,0xFFFF8FF0(5)
# GPR 4 now contains 0xFFFF 98F0.