This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PRE in gcse.c
On Tue, Nov 10, 1998 at 11:58:51AM -0700, Jeffrey A Law wrote:
>
> In message <199811101744.JAA10366@dm.cobaltmicro.com>you write:
> > Date: Tue, 10 Nov 1998 10:17:07 -0700
> > From: Jeffrey A Law <law@cygnus.com>
> >
> > I don't think __builtin_expect itself is all that useful -- what is
> > more useful is the mechanisms to take unlikely code and pull it
> > away from the main code for a function.
> >
> > I think it is, at one point I experimented with them on some hot code
> > paths in the TCP implementation of the Linux kernel just for the
> > effect of setting the branch prediction bits correctly on UltraSparc.
> > The performance gains were significant for benchmarks which exercised
> > these code paths.
> Actually, protocol stacks are the one place where I would consider this
> kind of stuff useful :-)
There is a whole lot of code in the linux kernel that uses gotos just to
get the main path in one piece. __builtin_expect would really improve the
readability of this code without being a performance loss.
There are other things, like loops that are known to execute just once 99.99%
of the time. Maybe this could be bettered, too (No alignment of this loop,
for example).
Philipp Rumpf (prumpf@jcsbs.lanobis.de)