[Bug tree-optimization/40921] missed optimization: x + (-y * z * z) => x - y * z * z

benoit dot hudson at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jul 30 23:58:00 GMT 2009



------- Comment #2 from benoit dot hudson at gmail dot com  2009-07-30 23:58 -------
> Note that -frounding-math should disable the proposed optimization.

Ah, true; and that means that with the options I said to use, the optimization
is simply wrong.  However, I see the same behaviour even with -ffast-math and
-funsafe-math-optimization and various other such options.

Also, squaring z is not necessary.  The following program has the same
behaviour:

double A (double x, double y, double z) {
  return x - y * z;
}
double B (double x, double y, double z) {
  return x + (-y * z);
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40921



More information about the Gcc-bugs mailing list