Section 16.9 of the current gcc doc is as follows. It implies that the
fma pattern should/could be used on a machine that double rounds the
multiply add.
`fmam4'
Multiply operand 2 and operand 1, then add operand 3, storing the
result in operand 0. All operands must have mode m. This pattern is
used to implement the |fma|, |fmaf|, and |fmal| builtin functions
from the ISO C99 standard. The |fma| operation may produce different
results than doing the multiply followed by the add if the machine
does not perform a rounding step between the operations.
However, this gccint doc says that this pattern is to be used to
implement the fma* builtin functions of ISO C99.
The iso c99 standard states:
7.12.13 Floating multiply-add
7.12.13.1 Thefmafunctions
Synopsis
1 #include<math.h> double fma(double x, double y, double z); float
fmaf(float x, float y, float z); long double fmal(long double x, long double y,
long double z);
Description
2 The fma functions compute (x × y) + z, rounded as one ternary
operation: they compute the value (as if) to infinite precision and round once
to the result format, according to the rounding mode characterized by the value
of FLT_ROUNDS.
Returns
3 The fma functions return (x × y) + z, rounded as one ternary operation.
Point 2 of the standard above states that those functions only do single
rounding. My guess is that the gccint doc is wrong. (I should point
out that the gccint doc for the new rtl operator in section 10.9 does
require only single rounding. But that is not the question here.)
Should i change the section 16.9 doc to indicate that this pattern is
only to be used if the machine can do this with a single rounding?
kenny