64-Bit CPUs: What You Need to Know - Page 13

: Going Out On a Limb">

The longer the pipeline, the bigger the train wreck if the processor mispredicts a branch. And Itanium has a fairly long pipeline, so the potential for performance-robbing disaster looms ever large. Predicting branches takes on paramount importance and to that end, IA-64 has a number of tricks to help it avoid the dreaded mispredicted branch.

First, theres only one form of conditional branch, but its behavior can be based on any of the 64 predicate bits mentioned earlier. Branches can also be tagged with either static or dynamic branch prediction (thats prediction, not predication), which predicts whether the branch is likely, or not likely, to be taken this time around. Static prediction cannot be overridden; dynamic prediction leaves the decision to Itaniums own branch-prediction hardware. If you, as the programmer, know which way the branch is likely to go, stick with static prediction and the chip will assume youre always right. If youre unsure, let Itanium make up its own mind. If youre feeling especially clairvoyant, you can also suggest that Itanium fetch instructions from the predicted target of the branch, and even how far ahead of the branch target it should prefetch.