diff -r 129282d020fe -r b08f96e894b7 src/cpu/o3/fetch_impl.hh --- a/src/cpu/o3/fetch_impl.hh Mon Jul 11 04:53:23 2011 -0700 +++ b/src/cpu/o3/fetch_impl.hh Mon Jul 11 04:55:13 2011 -0700 @@ -1301,6 +1301,10 @@ break; } } + // Whether we're moving to a new macroop because we're at the + // end of the current one, or the branch predictor incorrectly + // thinks we are... + bool newMacro = false; if (curMacroop || inRom) { if (inRom) { staticInst = cpu->microcodeRom.fetchMicroop( @@ -1308,10 +1312,7 @@ } else { staticInst = curMacroop->fetchMicroop(thisPC.microPC()); } - if (staticInst->isLastMicroop()) { - curMacroop = NULL; - pcOffset = 0; - } + newMacro |= staticInst->isLastMicroop(); } DynInstPtr instruction = @@ -1331,9 +1332,16 @@ DPRINTF(Fetch, "Branch detected with PC = %s\n", thisPC); } + newMacro |= thisPC.instAddr() != nextPC.instAddr(); + // Move to the next instruction, unless we have a branch. thisPC = nextPC; + if (newMacro) { + pcOffset = 0; + curMacroop = NULL; + } + if (instruction->isQuiesce()) { DPRINTF(Fetch, "Quiesce instruction encountered, halting fetch!");