From fd90c3676d94520b98a9af29af09c1f8a2858465 Mon Sep 17 00:00:00 2001 From: Mrinmoy Ghosh Date: Mon, 13 Feb 2012 12:26:24 -0600 Subject: 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 --- src/cpu/o3/decode_impl.hh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/cpu/o3/decode_impl.hh') diff --git a/src/cpu/o3/decode_impl.hh b/src/cpu/o3/decode_impl.hh index 60bca1041..22b89f4a8 100644 --- a/src/cpu/o3/decode_impl.hh +++ b/src/cpu/o3/decode_impl.hh @@ -278,11 +278,15 @@ DefaultDecode::squash(DynInstPtr &inst, ThreadID tid) // Send back mispredict information. toFetch->decodeInfo[tid].branchMispredict = true; toFetch->decodeInfo[tid].predIncorrect = true; + toFetch->decodeInfo[tid].mispredictInst = inst; toFetch->decodeInfo[tid].squash = true; toFetch->decodeInfo[tid].doneSeqNum = inst->seqNum; toFetch->decodeInfo[tid].nextPC = inst->branchTarget(); toFetch->decodeInfo[tid].branchTaken = inst->pcState().branching(); toFetch->decodeInfo[tid].squashInst = inst; + if (toFetch->decodeInfo[tid].mispredictInst->isUncondCtrl()) { + toFetch->decodeInfo[tid].branchTaken = true; + } InstSeqNum squash_seq_num = inst->seqNum; -- cgit v1.2.3