Mailing List Archive

-O2 and -O3
What is -Ox all about? I've used -O2 on my Celeron systems and -O3 on
my P3 system because I read that was the proper way because of L2
cache. Is that correct?

- Grant

--
gentoo-user@gentoo.org mailing list
Re: -O2 and -O3 [ In reply to ]
'man gcc' has greatly cleared this up for me. Would specifying
-fomit-frame-pointer and -O2 or -O3 be redundant since it is included
in either of those? -pipe isn't listed in that man page. Where can I
read more about the dangers and benefits of using that CFLAG?

There is a warning about using -O2 "on programs that use computed
gotos". Has anyone actually run into this problem and fixed it by
specifying -O instead?

Is there a good rule of thumb to figure out which optimization setting
to use on a particular system? Is it just a matter of deciding how
dangerously you want to live?

- Grant

--
gentoo-user@gentoo.org mailing list
Re: -O2 and -O3 [ In reply to ]
Grant wrote:
> 'man gcc' has greatly cleared this up for me. Would specifying
> -fomit-frame-pointer and -O2 or -O3 be redundant since it is included
> in either of those?

I recently discovered, that on x86 systems (like celeron or the
P3) -fomit-frame-pointer is *NOT* included when setting -Ox. If
required, you need to do that manually.

> -pipe isn't listed in that man page.

Dunno. I always use the online docs on http://gcc.gnu.org/.

> There is a warning about using -O2 "on programs that use computed
> gotos". Has anyone actually run into this problem and fixed it by
> specifying -O instead?

No. I'm running a O3 system with no problems-

> Is there a good rule of thumb to figure out which optimization setting
> to use on a particular system?

Don't go crazy on those CFLAGS. For sure, they have some influence, but
in the very most applications, you will not notice any difference at all
between -O3 and no -O. There are some exceptions where a difference is
*FEELABEL* (ssl, zlib I'd suppose), but those are rare. It's much more
important to have a "lean" system; ie. to have good USE flags.

Alexander Skwar
--
Quit worrying about your health. It'll go away.
-- Robert Orben
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


--
gentoo-user@gentoo.org mailing list
Re: -O2 and -O3 [ In reply to ]
On Mon, 20 Sep 2004 10:14:40 -0700 Grant <emailgrant@gmail.com> wrote:
| What is -Ox all about? I've used -O2 on my Celeron systems and -O3 on
| my P3 system because I read that was the proper way because of L2
| cache. Is that correct?

Stick with -O2 on x86. x86 CPUs have pathetically small caches and so
any local gain from function inlining is soon cancelled out by cache
hits. -frename-registers, which is the other thing turned on by -O3,
does pretty much nothing on x86, since x86 has a pathetically small
number of registers as well...

--
Ciaran McCreesh : Gentoo Developer (Sparc, MIPS, Vim, Fluxbox)
Mail : ciaranm at gentoo.org
Web : http://dev.gentoo.org/~ciaranm
Re: Re: -O2 and -O3 [ In reply to ]
On Monday 20 September 2004 19:52, Grant wrote:
> 'man gcc' has greatly cleared this up for me. Would specifying
> -fomit-frame-pointer and -O2 or -O3 be redundant since it is included
> in either of those? -pipe isn't listed in that man page. Where can I
> read more about the dangers and benefits of using that CFLAG?

it is not redundant on x86 systems.
-pipe is mentioned in the man page, you must skipped over it:

-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.

This is a SAFE flag. It does no optimiziations, it only speeds up compilation
and reduces harddisk accesses.



--
Conclusions
In a straight-up fight, the Empire squashes the Federation like a bug. Even
with its numerical advantage removed, the Empire would still squash the
Federation like a bug. Accept it. -Michael Wong

--
gentoo-user@gentoo.org mailing list
Re: Re: -O2 and -O3 [ In reply to ]
On Mon, 20 Sep 2004 21:50:08 +0200, Hemmann, Volker Armin
<volker.armin.hemmann@tu-clausthal.de> wrote:
> On Monday 20 September 2004 19:52, Grant wrote:
> > 'man gcc' has greatly cleared this up for me. Would specifying
> > -fomit-frame-pointer and -O2 or -O3 be redundant since it is included
> > in either of those? -pipe isn't listed in that man page. Where can I
> > read more about the dangers and benefits of using that CFLAG?
>
> it is not redundant on x86 systems.

But if I specify -O2, -fomit-frame-pointer is thereby included. What
would change by specifying it again explicity?

> -pipe is mentioned in the man page, you must skipped over it:
>

You're right, I'm not sure how I missed that.

- Grant

--
gentoo-user@gentoo.org mailing list
Re: Re: -O2 and -O3 [ In reply to ]
On Mon, 20 Sep 2004 12:56:47 -0700 Grant <emailgrant@gmail.com> wrote:
| On Mon, 20 Sep 2004 21:50:08 +0200, Hemmann, Volker Armin
| <volker.armin.hemmann@tu-clausthal.de> wrote:
| > On Monday 20 September 2004 19:52, Grant wrote:
| > > 'man gcc' has greatly cleared this up for me. Would specifying
| > > -fomit-frame-pointer and -O2 or -O3 be redundant since it is
| > > included in either of those? -pipe isn't listed in that man page.
| > > Where can I
| > > read more about the dangers and benefits of using that CFLAG?
| >
| > it is not redundant on x86 systems.
|
| But if I specify -O2, -fomit-frame-pointer is thereby included. What
| would change by specifying it again explicity?

Uh, not on x86 it isn't.

--
Ciaran McCreesh : Gentoo Developer (Sparc, MIPS, Vim, Fluxbox)
Mail : ciaranm at gentoo.org
Web : http://dev.gentoo.org/~ciaranm
Re: -O2 and -O3 [ In reply to ]
On Mon, 20 Sep 2004 19:19:37 +0100, Ciaran McCreesh <ciaranm@gentoo.org> wrote:
> Stick with -O2 on x86.

WIll do, thanks.

- Grant

--
gentoo-user@gentoo.org mailing list
Re: Re: -O2 and -O3 [ In reply to ]
On Mon, 20 Sep 2004 20:57:42 +0100, Ciaran McCreesh <ciaranm@gentoo.org> wrote:
> On Mon, 20 Sep 2004 12:56:47 -0700 Grant <emailgrant@gmail.com> wrote:
> | On Mon, 20 Sep 2004 21:50:08 +0200, Hemmann, Volker Armin
> | <volker.armin.hemmann@tu-clausthal.de> wrote:
> | > On Monday 20 September 2004 19:52, Grant wrote:
> | > > 'man gcc' has greatly cleared this up for me. Would specifying
> | > > -fomit-frame-pointer and -O2 or -O3 be redundant since it is
> | > > included in either of those? -pipe isn't listed in that man page.
> | > > Where can I
> | > > read more about the dangers and benefits of using that CFLAG?
> | >
> | > it is not redundant on x86 systems.
> |
> | But if I specify -O2, -fomit-frame-pointer is thereby included. What
> | would change by specifying it again explicity?
>
> Uh, not on x86 it isn't.

Ok, it must "interfere with debugging" on x86 then.

- Grant

--
gentoo-user@gentoo.org mailing list
Re: -O2 and -O3 [ In reply to ]
Grant wrote:
> On Mon, 20 Sep 2004 21:50:08 +0200, Hemmann, Volker Armin
> <volker.armin.hemmann@tu-clausthal.de> wrote:

Please try to use a 1 line header line.

>>it is not redundant on x86 systems.
>
> But if I specify -O2, -fomit-frame-pointer is thereby included.

Wrong. How did you get that idea?

> What
> would change by specifying it again explicity?

If it were implied: Nothing. But since it isn't, you gain the feature
-fomit-frame-pointer provides.

See <news:2r5hdoF15m5tvU6@uni-berlin.de>

Alexander Skwar
--
"Obviously, a major malfunction has occurred."
-- Steve Nesbitt, voice of Mission Control, January 28,
1986, as the shuttle Challenger exploded within view
of the grandstands.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


--
gentoo-user@gentoo.org mailing list
Re: Re: -O2 and -O3 [ In reply to ]
> Please try to use a 1 line header line.

I'll just take it out from now on.

>
> >>it is not redundant on x86 systems.
> >
> > But if I specify -O2, -fomit-frame-pointer is thereby included.
>
> Wrong. How did you get that idea?

man gcc says:

-O also turns on -fomit-frame-pointer on machines where doing so does
not interfere with debugging.

But I guess it does.

- Grant

--
gentoo-user@gentoo.org mailing list
Re: Re: -O2 and -O3 [ In reply to ]
Then... What is the most proper flag for pentium 4 and pentium 3?

What kind of flag are you using?


On Mon, 20 Sep 2004 14:15:19 -0700, Grant <emailgrant@gmail.com> wrote:
> > Please try to use a 1 line header line.
>
> I'll just take it out from now on.
>
> >
> > >>it is not redundant on x86 systems.
> > >
> > > But if I specify -O2, -fomit-frame-pointer is thereby included.
> >
> > Wrong. How did you get that idea?
>
> man gcc says:
>
> -O also turns on -fomit-frame-pointer on machines where doing so does
> not interfere with debugging.
>
> But I guess it does.
>
> - Grant
>
>
>
> --
> gentoo-user@gentoo.org mailing list
>
>

--
gentoo-user@gentoo.org mailing list
Re: Re: -O2 and -O3 [ In reply to ]
On Tue, 21 Sep 2004 10:27:43 +0545
Seung Hyun Cho <s970501@gmail.com> wrote:

> Then... What is the most proper flag for pentium 4 and pentium 3?
>
> What kind of flag are you using?
>
>
> On Mon, 20 Sep 2004 14:15:19 -0700, Grant <emailgrant@gmail.com> wrote:
> > > Please try to use a 1 line header line.
> >
> > I'll just take it out from now on.
> >
> > >
> > > >>it is not redundant on x86 systems.
> > > >
> > > > But if I specify -O2, -fomit-frame-pointer is thereby included.
> > >
> > > Wrong. How did you get that idea?
> >
> > man gcc says:
> >
> > -O also turns on -fomit-frame-pointer on machines where doing so does
> > not interfere with debugging.
> >
> > But I guess it does.
> >
> > - Grant
> >
> >
> >
> > --
> > gentoo-user@gentoo.org mailing list
> >
> >
>
> --
> gentoo-user@gentoo.org mailing list
>


--
Email: reg@rgh.ca, reg.hughson@sympatico.ca
MSN Messenger: reghughson@hotmail.com, to_cu@hotmail.com
Yahoo: reghughson@yahoo.ca
ICQ: 5404135, 160603454
Linux User: 344060
Linux Distro: Gentoo 2.6.8
Web: www.rgh.ca

--
gentoo-user@gentoo.org mailing list
Re: Re: -O2 and -O3 [ In reply to ]
> Then... What is the most proper flag for pentium 4 and pentium 3?
>
> What kind of flag are you using?
>

It sounds like -O2 is the one for any x86. I'm using that on all my
systems except -O3 on a P3 which I'll be changing.

- Grant

--
gentoo-user@gentoo.org mailing list