Gentoo Archives: gentoo-dev

From: "Robin H.Johnson" <robbat2@g.o>
To: gentoo-dev@g.o
Cc: Dhruba Bandopadhyay <dhruba@××××××××××××.uk>
Subject: Re: [gentoo-dev] [ANN] Genflags 0.91
Date: Thu, 26 Jun 2003 18:43:59
Message-Id: 20030626184356.GA23929@cherenkov.orbis-terrarum.net
In Reply to: Re: [gentoo-dev] [ANN] Genflags 0.91 by Dhruba Bandopadhyay
1 On Thu, Jun 26, 2003 at 12:58:47PM +0100, Dhruba Bandopadhyay wrote:
2 > Genflags is looking to be a very promising tool. Has any thought been
3 > given to a secondary tier of cflags that would take a little more
4 > liberty and be more optimised/aggressive?
5 >
6 > Can initiative be taken to provide a slightly more aggressive yet safe
7 > set of cflags assigned to a command parameter or would that be difficult
8 > and time consuming to incorporate into the tool? Just a thought.
9 The tool already has everything for adding in special CFLAGS on all levels.
10 That is:
11 globally - for all arches
12 per-arch - eg: only for ppc
13 per-subarch - eg: only for athlon-xp
14
15 If somebody else is willing to undertake _conclusively_ proving
16 optimization flags are 100% stable and _always_ provide correct
17 (-ffast-math doesn't) and most importantly, do _NOT_ interfere with
18 tracking down bugs, then those flags will be added.
19
20 > For example, the following flags were omitted in the case of my
21 > machine.
22 >
23 > -fomit-frame-pointer -fprefetch-loop-arrays -falign-functions=4
24 > -funroll-loops -ffast-math -fforce-addr
25 Lets look at this set of CFLAGS for now.
26 -fomit-frame-pointer , makes debugging impossible, not going to use
27 this.
28
29 -falign-functions=4 , This is automatically implied by your -march/-mcpu
30 settings.
31
32 -funroll-loops , This only slows things down the majority of the time.
33
34 -ffast-math , see this from the GCC manpage:
35 "This option should never be turned on by any -O option since it can
36 result in incorrect output for programs which depend on an exact
37 implementation of IEEE or ISO rules/specifications for math functions."
38
39 -fprefetch-loop-arrays , The only flag here of much value. Automatically
40 implied by -O3 on most systems I believe.
41
42 -fforce-addr, from the GCC manpage:
43 "Force memory address constants to be copied into registers before doing
44 arithmetic on them. This may produce better code just as -fforce-mem
45 may."
46 Pointer arirthmatic isn't common, so the performance boost here is
47 minimal.
48
49
50 > P.S. Here is a demonstration of it working on my machine.
51 > ====
52 > dhruba@wolf bin $ ./info2flags
53 > CHOST="i686-unknown-gnu-linux"
54 > CFLAGS="-march=pentium4 -O3 -pipe"
55 > CXXFLAGS="-march=pentium4 -O3 -pipe"
56 [snip]
57 Did you look at the README? It states that the help functions are
58 not done yet, and to use the source instead.
59
60 --
61 Robin Hugh Johnson
62 E-Mail : robbat2@××××××××××××××.net
63 Home Page : http://www.orbis-terrarum.net/?l=people.robbat2
64 ICQ# : 30269588 or 41961639
65 GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85