Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Safe optimisation levels for compilation
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
barry
Guest





PostPosted: Wed May 01, 2002 10:12 pm    Post subject: Safe optimisation levels for compilation Reply with quote

Using an Athlon XP processor. What's the safest highest level optimisation in /etc/make.conf?

I've tried various options. Recommended for high performance was:
-O3 -fomit-frame-pointer -march=i686 -malign-functions=4 -funroll-loops -fexpensive-optimizations -malign-double -fschedule-insns2 -mwide-multiply

'-malign-double' breaks glibc for instance, and these options also break C++ programs altogether.

-O3 -fomit-frame-pointer -march=i686 -malign-functions=4

Are these definitely safe? Anything else that can be added?

Barry
Back to top
mb
Guru
Guru


Joined: 25 Apr 2002
Posts: 355
Location: Hessen | .de

PostPosted: Thu May 02, 2002 7:34 am    Post subject: Reply with quote

looks good..

but.. correct me if i'm wrong.. -malign-functions= will be automatically set to 4 by the compiler if your cpu >= 486

btw: why don't you try gcc304 with athlon optimisation ??
i compiled my system / kernel / kde with no problems... :D

#mb
Back to top
View user's profile Send private message
barry
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 170
Location: UK

PostPosted: Thu May 02, 2002 10:10 am    Post subject: Reply with quote

Setting -malign-functions=4 causes the glibc compilation to bomb out every time. As for gcc 3.0.4, the consensus seems to be that it's too unstable.
Back to top
View user's profile Send private message
RickN
n00b
n00b


Joined: 29 Apr 2002
Posts: 26

PostPosted: Thu May 02, 2002 10:46 am    Post subject: Reply with quote

This is what is in the faq:

Quote:
-O3 -mcpu=i686 -march=i686 -fforce-addr -fomit-frame-pointer -funroll-loops -frerun-cse-after-loop -frerun-loop-opt -malign-functions=4


I added -pipe to this, not knowing what it does, but it was in all the examples in make.conf. These settings allowed me to compile my base system with no problems.
Back to top
View user's profile Send private message
Malakin
Veteran
Veteran


Joined: 14 Apr 2002
Posts: 1692
Location: Victoria BC Canada

PostPosted: Thu May 02, 2002 11:34 am    Post subject: Reply with quote

Here's a link to the manual if you'd like to look things up.
http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_2.html

The faq indirectly suggests not using it but I used -ffast-math on everything after I hit stage 3 and never had any problems.

Note that according to the manual turning on -funroll-loops also enables both -fstrength-reduce and -frerun-cse-after-loop so you need not specify -frerun-cse-after-loop separately.

Quote:
-malign-functions=num
Align the start of functions to a 2 raised to num byte boundary. If `-malign-functions' is not specified, the default is 2 if compiling for 32 bit sparc, and 5 if compiling for 64 bit sparc.

Quote:
-pipe
Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble.
Back to top
View user's profile Send private message
mb
Guru
Guru


Joined: 25 Apr 2002
Posts: 355
Location: Hessen | .de

PostPosted: Thu May 02, 2002 11:36 am    Post subject: Reply with quote

gcc manual:

Quote:

-pipe
Use pipes rather than temporary files for communication between the various stages of compilation. This fails to work on some systems where the assembler is unable to read from a pipe; but the GNU assembler has no trouble.


@malakin

strange.. in the 304 docu
Quote:

-malign-functions=num
Align the start of functions to a 2 raised to num byte boundary. If `-malign-functions' is not specified, the default is 2 if optimizing for a 386, and 4 if optimizing for a 486.
Back to top
View user's profile Send private message
RickN
n00b
n00b


Joined: 29 Apr 2002
Posts: 26

PostPosted: Thu May 02, 2002 11:45 am    Post subject: Reply with quote

Malakin wrote:
[..]Note that according to the manual turning on -funroll-loops also enables both -fstrength-reduce and -frerun-cse-after-loop so you need not specify -frerun-cse-after-loop separately.


Mmmm, yes well, I don't like implicitly enabled options :wink:
Back to top
View user's profile Send private message
Guest






PostPosted: Thu May 02, 2002 12:22 pm    Post subject: Reply with quote

Quote:
Mmmm, yes well, I don't like implicitly enabled options :wink:


But in this case it makes sense, doesn't it? Unrolling loops alone without a case optimization pass afterwards is ... well ... not very good optimized.
Back to top
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum