Adds the contents of two general-purpose registers.
PowerPC | |
---|---|
add | RT,RA,RB |
add. | RT,RA,RB |
addo | RT,RA,RB |
addo. | RT,RA,RB |
POWER | |
---|---|
cax | RT,RA,RB |
cax. | RT,RA,RB |
caxo | RT,RA,RB |
caxo. | RT,RA,RB |
The add and cax instructions place the sum of the contents of general-purpose register (GPR) RA and GPR RB into the target GPR RT.
The add and cax instructions have four syntax forms. Each syntax form has a different effect on Condition Register Field 0 and the Fixed-Point Exception Register.
Syntax Form | Overflow Exception (OE) | Fixed-Point Exception Register | Record Bit (Rc) | Condition Register Field 0 |
add | 0 | None | 0 | None |
add. | 0 | None | 1 | LT,GT,EQ,SO |
addo | 1 | SO,OV | 0 | None |
addo. | 1 | SO,OV | 1 | LT,GT,EQ,SO |
cax | 0 | None | 0 | None |
cax. | 0 | None | 1 | LT,GT,EQ,SO |
caxo | 1 | SO,OV | 0 | None |
caxo. | 1 | SO,OV | 1 | LT,GT,EQ,SO |
The four syntax forms of the add instruction and the four syntax forms of the cax instruction never affect the Carry bit (CA) in the Fixed-Point Exception Register. If the syntax form sets the Overflow Exception (OE) bit to 1, the instruction affects the Summary Overflow (SO) and Overflow (OV) bits in the Fixed-Point Exception Register. If the syntax form sets the Record (Rc) bit to 1, the instruction affects the Less Than (LT) zero, Greater Than (GT) zero, Equal To (EQ) zero, and Summary Overflow (SO) bits in Condition Register Field 0.
# Assume GPR 6 contains 0x0004 0000. # Assume GPR 3 contains 0x0000 4000. add 4,6,3 # GPR 4 now contains 0x0004 4000.
# Assume GPR 6 contains 0x8000 7000. # Assume GPR 3 contains 0x7000 8000. add. 4,6,3 # GPR 4 now contains 0xF000 F000.
# Assume GPR 6 contains 0xEFFF FFFF. # Assume GPR 3 contains 0x8000 0000. addo 4,6,3 # GPR 4 now contains 0x6FFF FFFF.
# Assume GPR 6 contains 0xEFFF FFFF. # Assume GPR 3 contains 0xEFFF FFFF. addo. 4,6,3 # GPR 4 now contains 0xDFFF FFFE.
Fixed-Point Address Computation Instructions.