https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94212
--- Comment #11 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 26 Mar 2021, qianjh at cn dot fujitsu.com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94212 > > Qian Jianhua <qianjh at cn dot fujitsu.com> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |qianjh at cn dot fujitsu.com > > --- Comment #10 from Qian Jianhua <qianjh at cn dot fujitsu.com> --- > I simplified the testcase as below. > ---------------------------------- > #include <stdio.h> > > #define POLY(arg) (1.0d - 2.0d * arg + 3.0d * arg * arg - 4.0 * arg * arg * > arg) > double v[2]={1000006.0d,1000008.0d}; > > int main(int argc, char** argv) { > double res = 0.0d; > res = v[1]*POLY(v[0]); > printf("RESULT:%lf\n", res); > return 0;; > } > ---------------------------------- > > The result is also different with/without -ffp-contract=off. > Assembly has no problem. > > So I think there are differences in FP accuracy between mul+add and fmadd. > They are not equivalent for some specific numbers. Of course they are not. fmadd elides the intermediate rounding step of the multiplication. The result can differ in 1ulp