Skip to content

Commit bf1efb6

Browse files
committed
cpu-o3: fix path history info target
- Align target generation in `getPHistInfo` with `getTarget` Change-Id: I3cf46388e19780eccbaa80656db2f74652b97677
1 parent d6691fc commit bf1efb6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/cpu/pred/btb/common.hh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,20 @@ struct FullBTBPrediction
650650
} else {
651651
// uncond
652652
taken = true;
653-
pc = entry.pc; // get the pc of the cond branch
653+
pc = entry.pc; // get the pc of the uncond branch
654654
target = entry.target;
655+
// indirect target should come from ipred or ras,
656+
// or btb itself when ipred miss
657+
if (entry.isIndirect) {
658+
if (!entry.isReturn) { // normal indirect, see ittage
659+
auto it = IndirectTakens_find(indirectTargets, pc);
660+
if (it != indirectTargets.end()) { // found in ittage, use it
661+
target = it->second;
662+
}
663+
} else { // indirect return, use RAS target
664+
target = returnTarget;
665+
}
666+
} // else: normal taken, use btb target
655667
break;
656668
}
657669
}

0 commit comments

Comments
 (0)