A branch in a computer program is an instruction that communicates a device to start implementing several instructions instead of easily performing the instructions in order. In high-level languages, these are defined as flow control phases and are established into the language. The figure shows an overview of branch detection methods employed in microprocessors.
Early pipelined microprocessors detect branches during the common instruction decoding (master pipeline approach). The disadvantage of this straightforward technique is that it provides rise to Long Branch processing penalties. It can reduce taken penalties, up-to-date processors generally detect branches previous than during common instruction coding (early branch detection).
There are three approaches such as parallel branch detection, look-ahead branch detection, and integrated instruction fetch and detection. In the following, it can introduce these early branch detection schemes. Several processors detect and decode branches in parallel with the ‘common’ instruction decoding. This scheme is known as in parallel branch detection.
A kind of more advanced branch detection approach is to mark branches from the instruction buffer in parallel with the common instruction decoding as earlier, but additionally to look ahead into previous buffer entries. This scheme is known as lookahead branch detection.
For instance, the Power1 (RS/6000) detects branches from the last five entries, and the Power2 from the last eight entries, of the sequential instruction buffer. By contrast, instructions other than branches are decoded and issued only from the last four and six entries, respectively.
There are a different variant of branch detection is chosen in the PowerPC 603. In this processor branch detection is entirely shifted ahead, to the input of the instruction buffer. A dual decoder checks the instruction read from the instruction cache into the instruction buffer for branches.
The most advanced approach of branch detection prevents explicit decoding. Rather than, branch detection is integrated into the instruction fetch structure. This scheme is known as integrated instruction fetch and branch detection.
The instruction fetching structure is continued such that it can identify whether the next instruction to be fetched is a branch or not. Each detected branch is guessed to be taken and rather than, or in also to, the next sequential instruction, the target address of the branch or even the target instruction is also fetched in advance.
In this scheme, ‘common’ decoding follows for conditional branches, and if the guess process wrong, a structure is started to accurate this. Some novel processors employ the integrated instruction fetch and branch detection scheme, such as high-end models of the IBM ES 9000 family of processors, the PowerPC 604/620, MIPS R8000 and R10000, and PA 8000.