[Bug tree-optimization/94212] [8/9/10/11 Regression] Incorrect vectorization of loop with FP calculations

qianjh at cn dot fujitsu.com gcc-bugzilla@gcc.gnu.org
Fri Mar 26 09:40:58 GMT 2021


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.


More information about the Gcc-bugs mailing list