This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -ffast-math and floating point reordering
- From: law at redhat dot com
- To: Joe Buck <Joe dot Buck at synopsys dot COM>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 26 Mar 2004 09:21:26 -0700
- Subject: Re: -ffast-math and floating point reordering
- Reply-to: law at redhat dot com
In message <20040324170719.A12420@synopsys.com>, Joe Buck writes:
>If -ffast-math is not specified, we should follow the language standards.
>First question: can tree-ssa distinguish, for Fortran, whether parentheses
>were present and so whether reordering is allowed?
No. The front-ends don't pass enough information around in the tree nodes
to know when such changes are safe/unsafe. Even if the information existed
none of the optimizers would know how to use it (at least initially).
>If -ffast-math is specified, what should we do? One option is to use the
>K&R rule and free-associate at will. I feel uncomfortable with that
>because of the major loss in accuracy that can result. If, however, we
>implement support for the Fortran rules, one option would be to relax
>order of evaluation when there are no parentheses (like Fortran), another
>would be to just leave the order the same.
First I'd like to come out in favor of having a flag to turn on FP
reassociation.
The question then becomes whether or not -ffast-math ought to turn that
flag on. I'm neither a significant user or expert in FP arithmetic. So
I've got no strong opinions here.
jeff