This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Move some flag_unsafe_math_optimizations using simplify and match
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: "Hurugalawadi, Naveen" <Naveen dot Hurugalawadi at caviumnetworks dot com>
- Cc: Richard Biener <richard dot guenther at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Aug 2015 07:38:19 +0200 (CEST)
- Subject: Re: Move some flag_unsafe_math_optimizations using simplify and match
- Authentication-results: sourceware.org; auth=none
- References: <SN2PR0701MB1024EC4AD2C9B654AE3F0E9A8E790 at SN2PR0701MB1024 dot namprd07 dot prod dot outlook dot com> <CAFiYyc1xhkUsnmaGeLg-8iufxWpgXSjgP_izamcX0bvm9KRRNQ at mail dot gmail dot com> <SN2PR0701MB1024A460F6FA7BC0FB386A588E670 at SN2PR0701MB1024 dot namprd07 dot prod dot outlook dot com>,<CAFiYyc0CZ1ECw0wysk1xHkNrOBUnYcC8P22=HJ-Qk+cx0aR95Q at mail dot gmail dot com> <SN2PR0701MB10247452B48809F7CC92DFD08E660 at SN2PR0701MB1024 dot namprd07 dot prod dot outlook dot com>
- Reply-to: gcc-patches at gcc dot gnu dot org
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