This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -funsafe-math-optimizations and -fno-rounding-math
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Revital1 Eres" <ERES at il dot ibm dot com>
- Cc: gcc at gcc dot gnu dot org, roger <roger%eyesopen dot _com at il dot ibm dot com>, "Geert Bosch" <bosch at adacore dot com>
- Date: Sun, 12 Nov 2006 00:06:58 +0100
- Subject: Re: -funsafe-math-optimizations and -fno-rounding-math
- References: <OF3A371DE9.BBD923D6-ONC2257223.00768959-C2257223.007C7CF0@il.ibm.com>
On 11/11/06, Revital1 Eres <ERES@il.ibm.com> wrote:
Hello,
-fno-rounding-math enables the transformation of (-(X - Y)) -> (Y - X)
in simplify-rtx.c which seems to be the same transformation
that enabled by -funsafe-math-optimizations in fold-const.c.
If I understand currently -frounding-math means that the rounding mode is
important.
In that case should there be correlation between
-funsafe-math-optimizations
and -fno-rounding-math (which currently does not exist)?
I think the simplify-rtx.c code is partly wrong, as it changes behavior
with signed zeros. I don't know off-hand if -(X - Y) and Y - X behave
the same in rounding if the rounding mode is round to nearest, but
certainly for round to +Inf it will differ. So HONOR_SIGNED_ZEROS (mode)
&& !flag_rounding_math might be the correct predicate here (and in
the fold-const.c case).
But floating point rounding scares me ;)
Richard.