Open In App

GATE | GATE CS 2008 | Question 76

Like Article
Like
Save
Share
Report

Delayed branching can help in the handling of control hazards.

For all delayed conditional branch instructions, irrespective of whether the condition evaluates to true or false,
(A) the instruction following the conditional branch instruction in memory is executed
(B) the first instruction in the fall through path is executed
(C) the first instruction in the taken path is executed
(D) the branch takes longer to execute than any other instruction


Answer: (D)

Explanation: In order to avoid the pipeline delay due to conditional branch instruction, a suitable instruction is placed below the conditional branch instruction such that the instruction will be executed irrespective of whether branch is taken or not and won’t affect the program behavior.

Another explanation :
An instruction following a branch instruction in a pipeline is always executed because usually branch target address is available at the ID which in turn introduces stall in the pipeline. This stall slot is called branch delay slot. As we don’t know beforehand whether the branch will take place or not, we need to fill the delay slot with an appropriate instruction, for example, an instruction having no dependency or a NOP instruction.

Quiz of this Question


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads