On Thu, 20 Aug 2015, Hurugalawadi, Naveen wrote:

The following testcase does not generate "x" as needed.
====================
double t (double x)
{
x = sqrt (x) * sqrt (x);
return x;
}
====================

With -fno-math-errno, we CSE the calls to sqrt, so I would expect this to match:

  (mult (SQRT@1 @0) @1)

Without the flag, I expect that one will apply

 (simplify
  (mult (SQRT:s @0) (SQRT:s @1))
  (SQRT (mult @0 @1)))

and then maybe we have something converting sqrt(x*x) to abs(x) or maybe not.

I wonder if all the unsafe math optimizations are really ok without -fno-math-errno...

--
Marc Glisse

Reply via email to