Kyle Roarty has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/41053 )
Change subject: arch-gcn3: Fix sign extension for branches with multiplied
offset
......................................................................
arch-gcn3: Fix sign extension for branches with multiplied offset
Certain branch instructions specify that the result of (simm16 * 4)
gets sign-extended before being added to the PC.
Previously, that result was being sign extended as if it was still a
16-bit number. This patch fixes that by having the result be sign
extended as an 18-bit number.
Change-Id: Id4d430f8daa71ca7910b570e7e39790626f1decf
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41053
Reviewed-by: Matt Sinclair <[email protected]>
Reviewed-by: Matthew Poremba <[email protected]>
Maintainer: Matt Sinclair <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/arch/gcn3/insts/instructions.cc
1 file changed, 7 insertions(+), 7 deletions(-)
Approvals:
Matthew Poremba: Looks good to me, approved
Matt Sinclair: Looks good to me, but someone else must approve; Looks
good to me, approved
kokoro: Regressions pass
diff --git a/src/arch/gcn3/insts/instructions.cc
b/src/arch/gcn3/insts/instructions.cc
index 03b11ab..29de1a8 100644
--- a/src/arch/gcn3/insts/instructions.cc
+++ b/src/arch/gcn3/insts/instructions.cc
@@ -3900,7 +3900,7 @@
Addr pc = wf->pc();
ScalarRegI16 simm16 = instData.SIMM16;
- pc = pc + ((ScalarRegI64)sext<16>(simm16 * 4LL)) + 4LL;
+ pc = pc + ((ScalarRegI64)sext<18>(simm16 * 4LL)) + 4LL;
wf->pc(pc);
}
@@ -3946,7 +3946,7 @@
scc.read();
if (!scc.rawData()) {
- pc = pc + ((ScalarRegI64)sext<16>(simm16 * 4LL)) + 4LL;
+ pc = pc + ((ScalarRegI64)sext<18>(simm16 * 4LL)) + 4LL;
}
wf->pc(pc);
@@ -3975,7 +3975,7 @@
scc.read();
if (scc.rawData()) {
- pc = pc + ((ScalarRegI64)sext<16>(simm16 * 4LL)) + 4LL;
+ pc = pc + ((ScalarRegI64)sext<18>(simm16 * 4LL)) + 4LL;
}
wf->pc(pc);
@@ -4005,7 +4005,7 @@
vcc.read();
if (!vcc.rawData()) {
- pc = pc + ((ScalarRegI64)sext<16>(simm16 * 4LL)) + 4LL;
+ pc = pc + ((ScalarRegI64)sext<18>(simm16 * 4LL)) + 4LL;
}
wf->pc(pc);
@@ -4035,7 +4035,7 @@
if (vcc.rawData()) {
Addr pc = wf->pc();
ScalarRegI16 simm16 = instData.SIMM16;
- pc = pc + ((ScalarRegI64)sext<16>(simm16 * 4LL)) + 4LL;
+ pc = pc + ((ScalarRegI64)sext<18>(simm16 * 4LL)) + 4LL;
wf->pc(pc);
}
}
@@ -4060,7 +4060,7 @@
if (wf->execMask().none()) {
Addr pc = wf->pc();
ScalarRegI16 simm16 = instData.SIMM16;
- pc = pc + ((ScalarRegI64)sext<16>(simm16 * 4LL)) + 4LL;
+ pc = pc + ((ScalarRegI64)sext<18>(simm16 * 4LL)) + 4LL;
wf->pc(pc);
}
}
@@ -4085,7 +4085,7 @@
if (wf->execMask().any()) {
Addr pc = wf->pc();
ScalarRegI16 simm16 = instData.SIMM16;
- pc = pc + ((ScalarRegI64)sext<16>(simm16 * 4LL)) + 4LL;
+ pc = pc + ((ScalarRegI64)sext<18>(simm16 * 4LL)) + 4LL;
wf->pc(pc);
}
}
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41053
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id4d430f8daa71ca7910b570e7e39790626f1decf
Gerrit-Change-Number: 41053
Gerrit-PatchSet: 2
Gerrit-Owner: Kyle Roarty <[email protected]>
Gerrit-Reviewer: Alexandru Duțu <[email protected]>
Gerrit-Reviewer: Kyle Roarty <[email protected]>
Gerrit-Reviewer: Matt Sinclair <[email protected]>
Gerrit-Reviewer: Matthew Poremba <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s