[Openmcl-devel] Quick HW question...

R. Matthew Emerson rme at clozure.com
Wed Nov 17 19:59:51 UTC 2010


On Nov 17, 2010, at 2:29 PM, Daniel Weinreb wrote:

> Gary Byers wrote:
>> 
>> 
>> Exactly what needs to be done to help the processor predict whether a branch
>> is taken tends to be architecture- and implementation-dependent.  (It's often
>> the case that simple rules - like "backward conditional branches are predicted
>> to be taken and forward conditional branches are predicted to not be taken" -
>> go a long way.)
> Do current architecures do dynamic branch predication, in which
> they keep a bit at runtime to keep track of which way the
> branch went last time?

Fancy processors keep more than a single bit these days.  There are all sorts of clever schemes in use.  http://www.agner.org/optimize/microarchitecture.pdf has a chapter about how branch prediction works on x86 processors.

In fact, on some x86 implementations (Intel Core, e.g., there's no static prediction for conditional branches at all.  Branch hint prefixes are ignored, so the hardware is just does what it thinks is best regardless of any programmer hints.  Agner Fog's papers are interesting reading if you like these gory details.




More information about the Openmcl-devel mailing list