From 2194aea0530d8af00c6ea005eeaadcc1e9071e50 Mon Sep 17 00:00:00 2001 From: Cui Jin Date: Tue, 21 Dec 2021 23:15:03 +0800 Subject: [PATCH] arch-riscv: rvc instruction is mistaken as branch Fetch in O3CPU mistakes the normal non-branching compressed instructions, and regards it as a branch. This issue interrupts the consecutive instruction stream, thus affecting performance of cpu front-end. This fix sets the compressed for PCState during decoding. Jira Issue: https://gem5.atlassian.net/browse/GEM5-1137 Change-Id: I7607d563bba8a08869e104877fc3c11c94cbe904 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54644 Reviewed-by: Jin Cui Reviewed-by: Ayaz Akram Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/arch/riscv/decoder.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/arch/riscv/decoder.cc b/src/arch/riscv/decoder.cc index 4fbcc64f65..a02415fae0 100644 --- a/src/arch/riscv/decoder.cc +++ b/src/arch/riscv/decoder.cc @@ -105,8 +105,10 @@ Decoder::decode(PCStateBase &_next_pc) if (compressed(emi)) { next_pc.npc(next_pc.instAddr() + sizeof(machInst) / 2); + next_pc.compressed(true); } else { next_pc.npc(next_pc.instAddr() + sizeof(machInst)); + next_pc.compressed(false); } return decode(emi, next_pc.instAddr());