This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: Shouldn't unsafe-math-optimizations (re-)enable fp-contract=fast?
- From: "Ian Bolton" <ian dot bolton at arm dot com>
- To: "Ian Bolton" <Ian dot Bolton at arm dot com>, "'Joseph S. Myers'" <joseph at codesourcery dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Fri, 7 Mar 2014 16:29:39 -0000
- Subject: RE: Shouldn't unsafe-math-optimizations (re-)enable fp-contract=fast?
- Authentication-results: sourceware.org; auth=none
- References: <000001cf395b$7eab81d0$7c028570$ at bolton@arm.com> <Pine dot LNX dot 4 dot 64 dot 1403061800380 dot 19817 at digraph dot polyomino dot org dot uk> <000101cf3a16$8b260550$a1720ff0$ at bolton@arm.com>
> Thanks for the feedback, Joseph.
>
> I've been working on the patch, but I see in gcc/opts.c that there is
> a definite distinction between set_fast_math_flags and
> set_unsafe_math_optimizations_flags. I'm thinking this is more of a
> fast-math thing than an unsafe_math_optimizations thing, so I should
> actually be adding it in set_fast_math_flags.
>
> Is this correct?
Scratch that. I went ahead and tried to set it in opts.c, but the c-opts.c
override (to OFF) will currently happen in every case UNLESS you explicitly
asked for -ffp-contract=fast.
I therefore think the better solution is now to not override it in c-opts
if unsafe-math-optimizations (which itself is enabled by -ffast-math and/or
-Ofast) is enabled. We already have fp-contract=fast on by default, so we
should just stop it being turned off unnecessarily instead.
I've successfully coded this one and it works as expected when compiled
with "-Ofast -std=c99". I'll prepare the patch now.
Cheers,
Ian