public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Evan Powers <powers.161@osu.edu>
To: gentoo-dev@gentoo.org
Subject: Re: [gentoo-dev] -fbranch-probabilities optimisation
Date: Sat, 17 May 2003 19:28:41 -0400	[thread overview]
Message-ID: <200305171928.41732.powers.161@osu.edu> (raw)
In-Reply-To: <87y91675tu.fsf@speakeasy.net>

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@gentoo.org mailing list


  reply	other threads:[~2003-05-17 23:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-17  2:49 [gentoo-dev] -fbranch-probabilities optimisation Chris Davies
2003-05-17  0:52 ` Anupam Kapoor
2003-05-17 23:28   ` Evan Powers [this message]
2003-05-17  7:24 ` David Nielsen
2003-05-17 11:43 ` Sven Vermeulen
2003-05-17  6:33   ` Werner Van Belle
2003-05-17 13:57     ` Sven Vermeulen
2003-05-17 14:13       ` Werner Van Belle
2003-05-17 16:00         ` Paul de Vrieze
2003-05-17 16:47           ` Chris Davies
2003-05-17 18:16             ` Paul de Vrieze
2003-05-18  9:23             ` Sven Vermeulen
2003-05-18 14:45               ` Chris Davies
2003-05-17 12:30   ` Matt Tucker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200305171928.41732.powers.161@osu.edu \
    --to=powers.161@osu.edu \
    --cc=gentoo-dev@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox