Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Evan Powers <powers.161@...>
Subject: Re: -fbranch-probabilities optimisation
Date: Sat, 17 May 2003 19:28:41 -0400
On Friday 16 May 2003 08:52 pm, Anupam Kapoor wrote:
> i was under the assumption that most processors already perform branch
> prediction. no ? do you think that -fbranch-probabilities provides a
> more 'comprehensive' view of the executing program ?

Yes, modern processors do perform branch prediction. But you're right, the 
compiler can do a much more 'comprehensive' job.

The reason is that CPU branch prediction algorithms tend to forget any 
information they learn that occurred farther away in time or space than 
certain thresholds. The Xeon, I think, retains information only about the 
last 16 branching instructions and the direction of only the last four 
branches on each of those instructions.

GCC, on the other hand, can retain information about all the branches, and 
complete directional statistics over the entire run, but it can only make 
static predictions. (For example, GCC can't take advantage of knowing that 
the branch will go one way for 200 consecutive times, then the other for 
300--it has to predict the branch will go the second way all the time and 
order accordingly.)

So you get the best performance when you combine the two approaches.

Evan

--
gentoo-dev@g.o mailing list

References:
-fbranch-probabilities optimisation
-- Chris Davies
Re: -fbranch-probabilities optimisation
-- Anupam Kapoor
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Re: -fbranch-probabilities optimisation
Next by thread:
Re: -fbranch-probabilities optimisation
Previous by date:
why 2 portage.py?
Next by date:
Re: why 2 portage.py?


Updated Jun 17, 2009

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.