'Create a branch history in loop
Consider
int t = 0;
for( int i = 0; i < 8; i++ )
{
for( int j = 0; j < 8; j++ )
{
t = t + i*j;
}
}
Ex: Create a branch history table in t = t + i*j if we assume branch taken in dynamic branch predictor with one bit predictor.
Now to me the anwser is quite simple because the target addres is always the same, since we always jump from the end of the loop to the updation, same with the branch address and the prediciton, because we always predict branch. So all the the branch history table entries remain constant which makes me sceptical wether my thinking is right.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|