This is the mail archive of the
mailing list for the GCC project.
Re: -fno-guess-branch-probability switch...
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Dave Fladebo <dfladebo at starband dot net>
- Cc: gcc at gnu dot org
- Date: Sun, 5 May 2002 23:04:44 -0400
- Subject: Re: -fno-guess-branch-probability switch...
- References: <firstname.lastname@example.org>
On Sun, May 05, 2002 at 09:57:45PM -0500, Dave Fladebo wrote:
> Great work to all - I just ran some benchmark stuff with gcc v3.0.4 against
> VC++ v7.0 on the same (dual boot Linux / WinXP) box, and gcc generally comes
> out on top. Amazing!!!
> What exactly does the following imply?
> Sometimes gcc will opt to guess branch probabilities when none are
> available from either profile directed feedback (`-fprofile-arcs')
> or `__builtin_expect'. In a hard real-time system, people don't
> want different runs of the compiler to produce code that has different
> behavior; minimizing non-determinism is of paramount import. This
> switch allows users to reduce non-determinism, possibly at the expense
> of inferior optimization.
> It almost sounds to me like the branch-prediction is being done "randomly" in
> some cases, so that the exact same code may be compiled differently given the
> exact same compiler options, etc...
> That is NOT correct, right??? In other words, the following statement would be
> "Given the same source code and compiler switches, the gcc/g++ compiler will
> produce the exact same binary code."
> Please advise.
Given the same source code, compiler switches, surrounding environment,
and profile data (if any), yes. It can also depend on your host
machine's floating point precision (fixed in GCC 3.2).
I believe the option is just to make output a little more predictable.
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer