-ffast-math and floating point reordering
law@redhat.com
law@redhat.com
Fri Mar 26 18:18:00 GMT 2004
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
More information about the Gcc
mailing list