A method, apparatus, and computer instructions for autonomically counting
selected branch instructions executed in a processor to improve branch
predictions. Counters are provided to count branch instructions that are
executed in a processor to collect branch statistics. A set of branch
statistics fields is allocated to associate with a branch instruction.
When a program is executed, the stored statistics allows the program to
look at the branch statistics in the counter to perform branch
prediction. Hence, a user may use branch statistics values from the
hardware counter to perform analysis on application code.