Lets say we have instructions like:
bne r1 $0 loop
sw r2 0(r1)
Let's say we go ahead with the taken path, i.e., execute the sw instruction after bne assuming the branch is Not Taken. On a branch misprediction (bne turns out to be Not Taken), how do we update the data memory/ cache with the correct value because sw was not supposed to be executed and change the values in memory and corrupt it? I am asking this question concerning both an R10K/P6 OOO core and a simple 5-stage pipeline core.