This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Suggestion: Add -ffast-math to default BOOT_CFLAGS
- From: Nathanael Nerode <neroden at twcny dot rr dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 20 Jan 2004 16:04:31 -0500
- Subject: Re: Suggestion: Add -ffast-math to default BOOT_CFLAGS
Kelley Cook wrote:
I just timed using the same compilier sources built with and without BOOT_CFLAGS="-O2 -g -ffast-math" to time building Gerald's Testcase.
Repeated runs showed that the slowest version with -ffast-math was still faster than the quickest version without. Below is posted a sorted -ftime-report comparing the quickest results obtained from g++ built with and without -ffast-math. A 2 percent speedup is nothing to sneeze at.
Note that I have not yet done a full all-languages and libraries regression test. But if those results do not change, it would seem prudent to build the compiler with -ffast-math. A one-liner patch to do that is attached.
Also this patch does not propose to make '-ffast-math' the default compiler option -- that would be another discussion. It is only about whether or not to build gcc itself using -ffast-math.
I'm pretty sure we want to make sure of two things before trying this:
* no libraries should be compiled with -ffast-math (including libgcc),
to avoid affecting user code
* no code which performs user code compilation at compile time should be
affected by -ffastmath, to avoid affecting user code. (I'm not sure
whether that would actually mean not compiling them with -ffast-math --
a lot of this stuff is done by weird routines related to HOST_WIDE_INT,
if I remember correctly, and I'm not sure how it would be affected.)
If we can separate those code segments out, compiling the 'ordinary'
part of the compiler with -ffast-math seems reasonable -- but on the
other hand, it would give different benefits, so needs to be benchmarked
on its own.