public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Suggestion: Add -ffast-math to default BOOT_CFLAGS
@ 2004-01-20 21:04 Nathanael Nerode
  0 siblings, 0 replies; 3+ messages in thread
From: Nathanael Nerode @ 2004-01-20 21:04 UTC (permalink / raw)
  To: gcc

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Suggestion: Add -ffast-math to default BOOT_CFLAGS
  2004-01-20 20:25 Kelley Cook
@ 2004-01-21  0:28 ` Richard Henderson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2004-01-21  0:28 UTC (permalink / raw)
  To: Kelley Cook; +Cc: GCC Mailing List

On Tue, Jan 20, 2004 at 03:24:21PM -0500, Kelley Cook wrote:
> life analysis          4.94        4.02       -0.92
> name lookup            8.83        8.35       -0.48
> garbage collection     5.98        5.83       -0.15

Where, pray, is the floating point in these passes
that would be affected by -ffast-math at all?

AFAIK there isn't any, which makes your numbers
highly suspicious.


r~

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Suggestion: Add -ffast-math to default BOOT_CFLAGS
@ 2004-01-20 20:25 Kelley Cook
  2004-01-21  0:28 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Kelley Cook @ 2004-01-20 20:25 UTC (permalink / raw)
  To: GCC Mailing List

[-- Attachment #1: Type: text/plain, Size: 3132 bytes --]

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.

BOOT_CFLAGS          -O2 -g      -O2 -g       Delta
                             -ffast-math

life analysis          4.94        4.02       -0.92
name lookup            8.83        8.35       -0.48
CSE                    5.36        5.11       -0.25
garbage collection     5.98        5.83       -0.15
register scan          0.74        0.60       -0.14
CSE 2                  2.68        2.57       -0.11
expand                 3.20        3.11       -0.09
combiner               1.57        1.49       -0.08
branch prediction      0.69        0.61       -0.08
jump                   0.54        0.47       -0.07
life info update       1.55        1.51       -0.04
bypass jumps           0.13        0.09       -0.04
if-conversion 2        0.14        0.10       -0.04
peephole 2             0.27        0.23       -0.04
flow 2                 0.18        0.14       -0.04
cfg construction       0.69        0.65       -0.04
flow analysis          0.09        0.06       -0.03
cfg cleanup            1.30        1.28       -0.02
global CSE             0.50        0.49       -0.01
reorder blocks         0.23        0.22       -0.01
final                  1.01        1.00       -0.01
callgraph optimization 0.04        0.04        0.00
preprocessing          0.51        0.51        0.00
callgraph construction 0.29        0.30        0.01
trivially dead code    0.92        0.93        0.01
shorten branches       0.27        0.29        0.02
rename registers       0.30        0.32        0.02
regmove                1.00        1.03        0.03
scheduling 2           1.05        1.09        0.04
local alloc            0.95        1.01        0.06
alias analysis         1.11        1.18        0.07
varconst               0.11        0.18        0.07
global alloc           2.22        2.31        0.09
reload CSE regs        1.11        1.20        0.09
loop analysis          0.57        0.66        0.09
integration            4.95        5.05        0.10
parser                 9.82        9.93        0.11
rebuild jump labels    0.28        0.39        0.11
if-conversion          0.19        0.33        0.14
rest of compilation    1.07        1.26        0.19
                     -------    --------    --------
Total                 67.38       65.94       -1.44

[-- Attachment #2: ffast_math.patch --]
[-- Type: text/plain, Size: 409 bytes --]

--- Makefile.in	2004-01-20 14:54:29.967564800 -0500
+++ ../../gcc-snapshot/gcc/Makefile.in	2004-01-16 12:57:37.523872000 -0500
@@ -136,7 +137,7 @@
 TCFLAGS =
 CFLAGS = -g
 STAGE1_CFLAGS = -g @stage1_cflags@
-BOOT_CFLAGS = -g -O2 -ffast-math
+BOOT_CFLAGS = -g -O2
 
 # Flags to determine code coverage. When coverage is disabled, this will
 # contain the optimization flags, as you normally want code coverage

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-21  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-20 21:04 Suggestion: Add -ffast-math to default BOOT_CFLAGS Nathanael Nerode
  -- strict thread matches above, loose matches on Subject: below --
2004-01-20 20:25 Kelley Cook
2004-01-21  0:28 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).