Reducing branch costs via branch alignment

Brad Calder, Dirk Grunwald
1994 SIGPLAN notices  
Several researchers have proposed algorithms for basic block reordering. We call these branch alignment algorithms. The primary emphasis of these algorithms has been on improving instruction cache locality, and the few studies concerned with branch prediction reported small or minimal improvements. As wide-issue architectures become increasingly popular the importance of reducing branch costs will increase, and branch alignment is one mechanism which can effectively reduce these costs. In this
more » ... aper, we propose an improved branch alignment algorithm that takes into consideration the architectural cost model and the branch prediction architecture when performing the basic block reordering. We show that branch alignment algorithms can improve a broad range of static and dynamic branch prediction architectures. We also show that a programs performance can be improved by approximately 5% even when using recently proposed, highly accurate branch prediction architectures. The programs are compiled by any existing compiler and then transformed via binary transformations. When implementing these algorithms on a Alpha AXP 21604 up to a 16% reduction in total execution time is achieved. We show that static and dynamic branch prediction mechanisms we examine benefit from such transformations, with the static branch architectures benefiting more than the dynamic. We implemented the branch alignment binary transformation algorithms on a DEC Alpha AXP 21064, and measured total execution time improvements of up to 16%.
doi:10.1145/195470.195553 fatcat:2xhrntspxnfnbgoxbjfs4cd3bi