summaryrefslogtreecommitdiff
path: root/src/cpu/inorder/resources/bpred_unit.cc
diff options
context:
space:
mode:
authorMrinmoy Ghosh <mrinmoy.ghosh@arm.com>2012-02-13 12:26:24 -0600
committerMrinmoy Ghosh <mrinmoy.ghosh@arm.com>2012-02-13 12:26:24 -0600
commitfd90c3676d94520b98a9af29af09c1f8a2858465 (patch)
treeebda3f4fbd25b9135545bf2bfee4e316873e2130 /src/cpu/inorder/resources/bpred_unit.cc
parentabc212461b865a47437a8dbf532b497ea4562137 (diff)
downloadgem5-fd90c3676d94520b98a9af29af09c1f8a2858465.tar.xz
BP: Fix several Branch Predictor issues.
1. Updates the Branch Predictor correctly to the state just after a mispredicted branch, if a squash occurs. 2. If a BTB does not find an entry, the branch is predicted not taken. The global history is modified to correctly reflect this prediction. 3. Local history is now updated at the fetch stage instead of execute stage. 4. In the Update stage of the branch predictor the local predictors are now correctly updated according to the state of local history during fetch stage. This patch also improves performance by as much as 17% on some benchmarks
Diffstat (limited to 'src/cpu/inorder/resources/bpred_unit.cc')
-rw-r--r--src/cpu/inorder/resources/bpred_unit.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cpu/inorder/resources/bpred_unit.cc b/src/cpu/inorder/resources/bpred_unit.cc
index 778366532..1a458e1d6 100644
--- a/src/cpu/inorder/resources/bpred_unit.cc
+++ b/src/cpu/inorder/resources/bpred_unit.cc
@@ -284,7 +284,8 @@ BPredUnit::update(const InstSeqNum &done_sn, ThreadID tid)
// Update the branch predictor with the correct results.
BPUpdate(predHist[tid].back().pc.instAddr(),
predHist[tid].back().predTaken,
- predHist[tid].back().bpHistory);
+ predHist[tid].back().bpHistory,
+ false);
predHist[tid].pop_back();
}
@@ -367,7 +368,7 @@ BPredUnit::squash(const InstSeqNum &squashed_sn,
}
BPUpdate((*hist_it).pc.instAddr(), actually_taken,
- pred_hist.front().bpHistory);
+ pred_hist.front().bpHistory, true);
// only update BTB on branch taken right???
if (actually_taken)
@@ -425,12 +426,12 @@ BPredUnit::BPLookup(Addr inst_PC, void * &bp_history)
void
-BPredUnit::BPUpdate(Addr inst_PC, bool taken, void *bp_history)
+BPredUnit::BPUpdate(Addr inst_PC, bool taken, void *bp_history, bool squashed)
{
if (predictor == Local) {
localBP->update(inst_PC, taken, bp_history);
} else if (predictor == Tournament) {
- tournamentBP->update(inst_PC, taken, bp_history);
+ tournamentBP->update(inst_PC, taken, bp_history, squashed);
} else {
panic("Predictor type is unexpected value!");
}