DESCRIPTION:  BTCLEAR is a front end event that counts the number of times the Branch Target Buffer (BTB) predicted a taken branch.

 RELEVANCE: BTCLEARs can be an indicator of how well your branch prediction is working. Too many clears in the BTB may be an indicator that branch prediction is taxed. Conditional branches, which are never taken, do not consume BTB resources.

 SOLUTION: Eliminating branches improves performance because it reduces the possibility of mispredictions and reduces the number of required BTB entries. There are four principal ways of eliminating branches:        

-         Arrange code to make basic blocks contiguous

-         Unroll loops

-         Use the CMOV instruction

-         Use the SETCC instruction

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.