adde
Add Extended
adde RT, RA, RB
Adds two registers plus the current Carry bit.
Details
Adds the values in registers RA and RB plus the Carry bit from XER and places the result in RT. If OE=1, sets XER[SO] and XER[OV] on signed overflow. If Rc=1, updates CR0 based on the result. This instruction is used for multi-precision arithmetic.
Pseudocode Operation
RT ← RA + RB + XER[CA]
if OE = 1 then
if overflow then XER[OV] ← 1; XER[SO] ← 1
if result > 2^64-1 or result < -2^64 then XER[CA] ← 1 else XER[CA] ← 0
if Rc = 1 then
CR0 ← (RT < 0) || (RT > 0) || (RT = 0) || XER[SO]
Programming Note
When Rc=1 (dot form), CR0 is updated with the signed comparison of the result against zero (LT, GT, EQ) and the current SO bit from XER.
Example
adde r3, r4, r5
// r3 = r4 + r5 + CA
Encoding
Binary Layout
31
0
RT
6
RA
11
RB
16
OE
21
138
22
Rc
31
Operands
-
RT
Target Register -
RA
Source Register 1 -
RB
Source Register 2