HPMC User Guide v 1.00
© 2026 Bassem W. Jamaleddine
One of the most common operation in matrix computations is to compute d = a * b + c on floating point data. The operations involved in getting d are: multiply, normalize, round, normalize, add, normalize, round.
The floating point multiplication, under IEEE 754 standard, requires to normalize the data before rounding it. We normalize the result so that the binary point is in the correct position, and if an overflow shift or left shift happens, we adjust the exponent accordingly. Next, we round the normalized result to fit into the floating point targetted precision.
It is possible to avoid the intermediate rounding operation, and even get more precision, by having an instruction (multiply-add fused) that does: multiply, normalize, add, normalize, round.
In 1990, Robert K. Montoye of IBM introduced the fused multiply-add and referred to it as "multiply-add fused", for its IBM RS/6000 POWER1 workstation. Montoye filed the foundational U.S. Patent for this architecture: "Floating Point Unit for Calculating A=XY+Z Having Simultaneous Multiply and Add", under U.S. Patent No. 4,969,118 which was granted in November 1990. The concept was so effective that it was standardized across the industry in the IEEE 754-2008 floating-point specification.
In 1992, the PowerPC 601 processor powered the IBM RS/6000 workstations. The 601 contains 2.8 million transistors, has a 32 KB unified L1 cache, supports an external L2 cache, and can process up to 3 instructions per cycle. This RISC processor outperformed Intel’s Pentium. IBM released an updated version 601+ with higher speeds from 90 MHz to 120 MHz, running at 2x or 3x bus speed.
The 601 processor included the Multiply-Add Fused (MAF) instruction as one of the most powerful features of the IBM RS/6000. It allows the execution unit to multiply two operands, add a third operand, and round the result only once at the very end. This yields higher performance and greater floating-point precision than evaluating the operations separately.
The PowerPC 601 architecture supports two primary sets of assembly mnemonics for these operations depending on whether you are compiling for single or double precision:
The following table shows the fused operations and their mnemonics on PowerPC 601.
| Operation Type | Double Precision Mnemonic | Single Precision Mnemonic | Mathematical Formula |
|---|---|---|---|
| Multiply-Add | fmadd or fma | fmadds | fr4 = (fr1 * fr2) + fr3 |
| Multiply-Subtract | fmsub or fms | fmsubs | fr4 = (fr1 * fr2) - fr3 |
| Negative Multiply-Add | fnmadd or fnma | fnmadds | fr4 = -((fr1 * fr2) + fr3) |
# Code Example: Fused Multiply-Add (Double Precision)
# Goal: Compute Result = (X * Y) + Z
# Registers utilized:
# fr1 (X), fr2 (Y), fr3 (Z), fr4 (Result)
# fr1 (A), fr2 (B), fr3 (C), fr4 (Result)
.globl fused_calculation
.csect .fused_calculation[PR]
fused_calculation:
# Load your floating point values into registers from memory
lfd 1, 0(3) # Load double from address in r3 into fr1
lfd 2, 0(4) # Load double from address in r4 into fr2
lfd 3, 0(5) # Load double from address in r5 into fr3
# Perform the Fused Multiply-Add operation
fmadd 4, 1, 2, 3 # fr4 = (fr1 * fr2) + fr3
stfd 4, 0(6) # Store Result from fr4 into address in r6
bclr 20, 0 # Return by branching to link register LR
# Goal: Compute Result = (X * Y) + Z
# Registers utilized:
# fr1 (X), fr2 (Y), fr3 (Z), fr4 (Result)
# fr1 (A), fr2 (B), fr3 (C), fr4 (Result)
.globl fused_calculation
.csect .fused_calculation[PR]
fused_calculation:
# Load your floating point values into registers from memory
lfd 1, 0(3) # Load double from address in r3 into fr1
lfd 2, 0(4) # Load double from address in r4 into fr2
lfd 3, 0(5) # Load double from address in r5 into fr3
# Perform the Fused Multiply-Add operation
fmadd 4, 1, 2, 3 # fr4 = (fr1 * fr2) + fr3
stfd 4, 0(6) # Store Result from fr4 into address in r6
bclr 20, 0 # Return by branching to link register LR
A 601 CPU may show Motorola instead of IBM printed on the chip, as the chip was designed in 1992–1993 through the AIM Alliance (Apple, IBM, and Motorola) and manufactured by IBM. Apple officially adapted and released its first computers using the PowerPC 601 processor in 1994.
While the fused operation was released by IBM in 1992, it took 16 years for Nvidia to include it in their G200 silicon codename, 19 years for AMD to include it in their Bulldozer microarchitecture, and 20 years for Intel to include it in their Knights Corner MIC.
Nvidia Tesla released in 2006 used standard Multiply-Add (MAD) instruction, where the product of the multiplication is rounded to 32-bit precision before the addition takes place. However, the later revision, with the G200 codename (GT200 consumer name) released in 2008, introduced FMA exclusively for double-precision (FP64) math. The 2010 Nvidia Fermi implemented the IEEE 754-2008 floating-point standard. This allowed the GPUs to perform a fused multiply-add (A × B + C) with a single, final rounding step for both 32-bit single-precision and 64-bit double-precision calculations.
![]()
This section is not included in the SAMPLE PREVIEW.
Intel stayed away from FMA4 (that requires adding extra register read ports). It endorsed FMA3 that uses 3 operands, and have the result overwrites one of its own source registers. This way more instructions can be decoded per cycle, and avoid that extra byte to encode the 4th register identifier, which fills up the instruction cache faster.