cpu: Fix RAS behaviour when both isReturn and isCall are set.

As discussed in [1], current BP cannot handle the instruction
with both isReturn and isCall on RAS. This hurts the performance
of coroutine-based programs.

This patch adjusts the behaviour of RAS. When the isReturn flag
is set, it will pop a RAS. Then, if the isCall flag is set, it
will push a RAS. Previous implementation only pop a RAS when both
isReturn and isCall are set.

This behaviour follows the RISC-V Spec [2]. Since other ISAs do
not have instructions that set both isCall and isReturn, this
patch has no impact on other ISAs.

[1] https://gem5-review.googlesource.com/c/public/gem5/+/58209
[2] https://github.com/riscv/riscv-isa-manual/releases/download/Ratified-IMAFDQC/riscv-spec-20191213.pdf

Change-Id: I52c01bbea41347711edff9ce9a03076e46aadc92
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/63311
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
1 file changed