Adds two floating-point operands and places the result in a floating-point register.
PowerPC | |
---|---|
fadd | FRT,FRA,FRB |
fadd. | FRT,FRA,FRB |
POWER | |
---|---|
fa | FRT,FRA,FRB |
fa. | FRT,FRA,FRB |
PowerPC | |
---|---|
fadds | FRT,FRA,FRB |
fadds. | FRT,FRA,FRB |
The fadd and fa instructions add the 64-bit, double-precision floating-point operand in floating-point register (FPR) FRA to the 64-bit, double-precision floating-point operand in FPR FRB.
The fadds instruction adds the 32-bit single-precision floating-point operand in FPR FRA to the 32-bit single-precision floating-point operand in FPR FRB.
The result is rounded under control of the Floating-Point Rounding Control Field RN of the Floating-Point Status and Control Register and is placed in FPR FRT.
Addition of two floating-point numbers is based on exponent comparison and addition of the two significands. The exponents of the two operands are compared, and the significand accompanying the smaller exponent is shifted right, with its exponent increased by one for each bit shifted, until the two exponents are equal. The two significands are then added algebraically to form the intermediate sum. All 53 bits in the significand as well as all three guard bits (G, R and X) enter into the computation.
The Floating-Point Result Field of the Floating-Point Status and Control Register is set to the class and sign of the result except for Invalid Operation exceptions when the Floating-Point Invalid Operation Exception Enable (VE) bit of the Floating-Point Status and Control Register is set to 1.
The fadd, fadds, and fa instructions each have two syntax forms. Each syntax form has a different effect on Condition Register Field 1.
Syntax Form | Floating-Point Status and Control Register | Record Bit (Rc) | Condition Register Field 1 |
fadd | C,FL,FG,FE,FU,FR,FI,OX,UX, XX,VXSNAN,VXISI | 0 | None |
fadd. | C,FL,FG,FE,FU,FR,FI,OX,UX, XX,VXSNAN,VXISI | 1 | FX,FEX,VX,OX |
fadds | C,FL,FG,FE,FU,FR,FI,OX,UX, XX,VXSNAN,VXISI | 0 | None |
fadds. | C,FL,FG,FE,FU,FR,FI,OX,UX, XX,VXSNAN,VXISI | 1 | FX,FEX,VX,OX |
fa | C,FL,FG,FE,FU,FR,FI,OX,UX, XX,VXSNAN,VXISI | 0 | None |
fa. | C,FL,FG,FE,FU,FR,FI,OX,UX, XX,VXSNAN,VXISI | 1 | FX,FEX,VX,OX |
All syntax forms of the fadd, fadds, and fa instructions always affect the Floating-Point Status and Control Register. If the syntax form sets the Record (Rc) bit to 1, the instruction affects the Floating-Point Exception Summary (FX), Floating-Point Enabled Exception Summary (FEX), Floating-Point Invalid Operation Exception Summary (VX), and Floating-Point Overflow Exception (OX) bits in Condition Register Field 1.
FRT | Specifies target floating-point register for operation. |
FRA | Specifies source floating-point register for operation. |
FRB | Specifies source floating-point register for operation. |
# Assume FPR 4 contains 0xC053 4000 0000 0000. # Assume FPR 5 contains 0x400C 0000 0000 0000. fadd 6,4,5 # FPR 6 now contains 0xC052 6000 0000 0000.
# Assume FPR 4 contains 0xC053 4000 0000 0000. # Assume FPR 25 contains 0xFFFF FFFF FFFF FFFF. fadd. 6,4,25 # GPR 6 now contains 0xFFFF FFFF FFFF FFFF.
Floating-Point Arithmetic Instructions.
Interpreting the Contents of a Floating-Point Register.