Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

-O3 contains what?

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
13 posts • Page 1 of 1
Author
Message
eyeL
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Nov 13, 2005 9:46 pm
Location: Missouri
Contact:
Contact eyeL
Website

-O3 contains what?

  • Quote

Post by eyeL » Mon Jan 16, 2006 9:27 pm

hrm, I was searching for a link to see what all -O3 contains, because I don't want to put something else in there that is already there.. but I couldn't find one. Anyone have any links?
[theNPA - down for updates] | [Adopt an unanswered post]
gentoo 2005.1 [lazy] - gcc 4.1.1
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Mon Jan 16, 2006 9:30 pm

this can be interesting(read all the posts:) )
Top
HydroSan
l33t
l33t
User avatar
Posts: 764
Joined: Thu Mar 04, 2004 5:43 pm
Location: The Kremlin (aka Canada)
Contact:
Contact HydroSan
Website

  • Quote

Post by HydroSan » Mon Jan 16, 2006 9:31 pm

http://gcc.gnu.org/onlinedocs/gcc-3.4.5 ... ze-Options

Code: Select all

-O
-O1
    Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function.

    With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time.

    -O turns on the following optimization flags:

              -fdefer-pop 
              -fmerge-constants 
              -fthread-jumps 
              -floop-optimize 
              -fif-conversion 
              -fif-conversion2 
              -fdelayed-branch 
              -fguess-branch-probability 
              -fcprop-registers
         

    -O also turns on -fomit-frame-pointer on machines where doing so does not interfere with debugging.
-O2
    Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. The compiler does not perform loop unrolling or function inlining when you specify -O2. As compared to -O, this option increases both compilation time and the performance of the generated code.

    -O2 turns on all optimization flags specified by -O. It also turns on the following optimization flags:

              -fforce-mem 
              -foptimize-sibling-calls 
              -fstrength-reduce 
              -fcse-follow-jumps  -fcse-skip-blocks 
              -frerun-cse-after-loop  -frerun-loop-opt 
              -fgcse  -fgcse-lm  -fgcse-sm  -fgcse-las 
              -fdelete-null-pointer-checks 
              -fexpensive-optimizations 
              -fregmove 
              -fschedule-insns  -fschedule-insns2 
              -fsched-interblock  -fsched-spec 
              -fcaller-saves 
              -fpeephole2 
              -freorder-blocks  -freorder-functions 
              -fstrict-aliasing 
              -funit-at-a-time 
              -falign-functions  -falign-jumps 
              -falign-loops  -falign-labels 
              -fcrossjumping
         

    Please note the warning under -fgcse about invoking -O2 on programs that use computed gotos.
-O3
    Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions, -fweb, -frename-registers and -funswitch-loops options.
I was a Gangster for Capitalism, by Major General Smedley Butler.

Server status: Currently down, being replaced with fresh install - 20% completed.
Top
eyeL
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Nov 13, 2005 9:46 pm
Location: Missouri
Contact:
Contact eyeL
Website

  • Quote

Post by eyeL » Mon Jan 16, 2006 9:32 pm

Thanks alot guys. This'll help me :)
[theNPA - down for updates] | [Adopt an unanswered post]
gentoo 2005.1 [lazy] - gcc 4.1.1
Top
eyeL
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Nov 13, 2005 9:46 pm
Location: Missouri
Contact:
Contact eyeL
Website

  • Quote

Post by eyeL » Mon Jan 16, 2006 9:37 pm

err, wait, I thought -fomit-frame-pointer was in there as well?

EDIT:

Ok, here's my cflags now.

CFLAGS="-O3 -march=athlon64 -mmmx -msse -msse2 -m3dnow -funroll-all-loops -fpeel -loops -ftracer -fforce-addr -pipe"


Thoughts, comments, suggestions, ideas?
[theNPA - down for updates] | [Adopt an unanswered post]
gentoo 2005.1 [lazy] - gcc 4.1.1
Top
Halcy0n
Developer
Developer
User avatar
Posts: 1682
Joined: Wed Sep 17, 2003 5:09 am
Location: Freehold, NJ
Contact:
Contact Halcy0n
Website

  • Quote

Post by Halcy0n » Mon Jan 16, 2006 10:12 pm

eyeL wrote:err, wait, I thought -fomit-frame-pointer was in there as well?

EDIT:

Ok, here's my cflags now.

CFLAGS="-O3 -march=athlon64 -mmmx -msse -msse2 -m3dnow -funroll-all-loops -fpeel -loops -ftracer -fforce-addr -pipe"


Thoughts, comments, suggestions, ideas?
-mmmx, -msse, -msse2, -m3dnow are all redundant, get rid of them.

-funroll-all-loops and -fpeel-loops - ricer flags, will probably break things, get rid of them
-fforce-addr - may or may not produce better code, get rid of it
-O3 - broken in some cases, use -O2

So, what we are left with is sane:

CFLAGS="-O2 -march=athlon64 -ftracer -pipe"

More flags does not == better in this case.
Mark Loeser
http://www.halcy0n.com
Top
eyeL
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Nov 13, 2005 9:46 pm
Location: Missouri
Contact:
Contact eyeL
Website

  • Quote

Post by eyeL » Mon Jan 16, 2006 10:13 pm

Thanks alot. and should I remove

CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"

that extra part as well?
[theNPA - down for updates] | [Adopt an unanswered post]
gentoo 2005.1 [lazy] - gcc 4.1.1
Top
truc
Advocate
Advocate
User avatar
Posts: 3199
Joined: Mon Jul 25, 2005 9:24 am

  • Quote

Post by truc » Mon Jan 16, 2006 10:32 pm

Not sure but I don't think so (read the link I gave above:
slycordinator wrote:One small thing with that...

There might be a good reason to leave redundant CFLAGS in.

Lets say one ebuild automatically strips CFLAGS and changes O3 to O2 (since O2 is "safer"). Lets then say that one of the options that O3 provides is perfectly safe. If you add it in redundantly, then you'll still get the effect of it after the ebuild does the change.

Food for thought.
Top
Vann
Guru
Guru
User avatar
Posts: 357
Joined: Sun Aug 04, 2002 7:20 am

  • Quote

Post by Vann » Mon Jan 16, 2006 10:32 pm

I generally find that my system runs slightly better with -Os than with -O2 or -O3. I imagine it is because it allows for better use of the CPU cache. My CFLAGS are very simple: CFLAGS="-march=athlon-xp -pipe -Os"
Top
Vann
Guru
Guru
User avatar
Posts: 357
Joined: Sun Aug 04, 2002 7:20 am

  • Quote

Post by Vann » Mon Jan 16, 2006 10:33 pm

If an ebuild is dropping -O3 to -O2, then manually specifying flags set by -O3 is probably a bad idea. ebuilds only do this when the more aggressive flags are known to break things.
Top
eyeL
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Nov 13, 2005 9:46 pm
Location: Missouri
Contact:
Contact eyeL
Website

  • Quote

Post by eyeL » Mon Jan 16, 2006 10:34 pm

Vann wrote:I generally find that my system runs slightly better with -Os than with -O2 or -O3. I imagine it is because it allows for better use of the CPU cache. My CFLAGS are very simple: CFLAGS="-march=athlon-xp -pipe -Os"
Where do you notice the performance in? Run times, compiling code, or just emerging?
[theNPA - down for updates] | [Adopt an unanswered post]
gentoo 2005.1 [lazy] - gcc 4.1.1
Top
AaronPPC
Guru
Guru
Posts: 522
Joined: Sun May 29, 2005 8:22 am
Location: Tucson, AZ

  • Quote

Post by AaronPPC » Tue Jan 17, 2006 12:40 am

I have been using -O3 when I re-installed my sytem a couple of months ago. I am very disappointed by my system performance since switching. I swear it ran faster with -O2. The next time I upgrade gcc, I think I'll switch to -O2 or -Os since I'll have to do an emerge -e world.
--Aaron
Top
eyeL
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 82
Joined: Sun Nov 13, 2005 9:46 pm
Location: Missouri
Contact:
Contact eyeL
Website

  • Quote

Post by eyeL » Tue Jan 17, 2006 2:16 am

I'm trying to decide the advantages of -O2 over -Os, or the opposite way, that way I know which one to pick.
[theNPA - down for updates] | [Adopt an unanswered post]
gentoo 2005.1 [lazy] - gcc 4.1.1
Top
Post Reply

13 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic