[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Assembler Language Reference

fadd or fa (Floating Add) Instruction

Purpose

Adds two floating-point operands and places the result in a floating-point register.

Syntax

Bits Value
0-5 63
6-10 FRT
11-15 FRA
16-20 FRB
21-25 ///
26-30 21
31 Rc
PowerPC 
fadd FRT, FRA, FRB
fadd. FRT, FRA, FRB
POWER family 
fa FRT, FRA, FRB
fa. FRT, FRA, FRB
Bits Value
0-5 59
6-10 FRT
11-15 FRA
16-20 FRB
21-25 ///
26-30 21
31 Rc
PowerPC 
fadds FRT, FRA, FRB
fadds. FRT, FRA, FRB

Description

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.

Parameters

FRT Specifies target floating-point register for operation.
FRA Specifies source floating-point register for operation.
FRB Specifies source floating-point register for operation.

Examples

  1. The following code adds the contents of FPR 4 and FPR 5, places the result in FPR 6, and sets the Floating-Point Status and Control Register to reflect the result of the 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.
  2. The following code adds the contents of FPR 4 and FPR 25, places the result in FPR 6, and sets Condition Register Field 1 and the Floating-Point Status and Control Register to reflect the result of the operation:

    # 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.

Related Information

Floating-Point Processor .

Floating-Point Arithmetic Instructions .

Interpreting the Contents of a Floating-Point Register .

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]