From 3cc6df46a3cd0aa97cd960f7f284d21c36a05181 Mon Sep 17 00:00:00 2001 From: Santi Galan Date: Tue, 18 Apr 2017 11:08:46 -0500 Subject: [PATCH] x86: fixed branching() computation for branch uops When a branch micro-op belongs to a flow and the micro-op does not change the nPC and just updates the nuPC (like a 'rep movs' flow), branching() function always returns not-taken no matter actual micro-branch outcome. Provided fix adds to the equation nuPC attribute checking since these kind of branch micro-op only updates that pointer. This issue has been found while debugging the performance of a copy-loop implemented with memcopy function. Without the fix, 'rep movss' internal micro-branch was always predicted as not-taken causing an squash event after every branch micro-branch execution. Using the provided test, branch mispredition went from 1922 without the fix to 7. Change-Id: I1bcbefae26aef47e3135817ef99b53d0ea0a98fa --- src/arch/x86/types.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arch/x86/types.hh b/src/arch/x86/types.hh index 954f9f16e..8d47b7efb 100644 --- a/src/arch/x86/types.hh +++ b/src/arch/x86/types.hh @@ -318,7 +318,8 @@ namespace X86ISA bool branching() const { - return this->npc() != this->pc() + size(); + return (this->npc() != this->pc() + size()) || + (this->nupc() != this->upc() + 1); } void -- 2.30.2