Possible Duplicate:
Is it possible to tell the branch predictor how likely it is to follow the branch?
So, if branch predicting plays such a great role ("Branch predictors play a critical role in achieving high effective performance in many modern pipelined microprocessor architectures such as x86." wiki), it makes sense that there must be a way to optimize and help it, right?
I'll ask my question in a straightforward manner:
Can you tell the branch predictor what route you're most likely to take?
I'll offer an example:
My program checks every time it loads if this is the first time the user runs it. Most likely the branch that should be cached is the one that's labeled "it's not the first time".
In this example it's not a big deal, and maybe the algorithms can figure out what route to take, but in complicated applications with lots of branches, I'm not so sure the algorithms would score 10 out of 10.
Can we optimize this somehow? maybe mark a branch for caching?
By the way I'm asking for educational purposes, and maybe one day for time-critical programs.