Hello Nikos Nikoleris, Andreas Sandberg,
I'd like you to do a code review. Please visit
https://gem5-review.googlesource.com/5262
to review the following change.
Change subject: arch-arm: RBIT instruction using mirroring func
......................................................................
arch-arm: RBIT instruction using mirroring func
The high speed bit-reversing function is now used
for the Aarch64/32 RBIT instruction implementation.
Change-Id: Id5a8a93d928d00fd33ec4061fbb586b8420a1c1b
Signed-off-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikole...@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandb...@arm.com>
---
M src/arch/arm/isa/insts/data64.isa
M src/arch/arm/isa/insts/misc.isa
2 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/src/arch/arm/isa/insts/data64.isa
b/src/arch/arm/isa/insts/data64.isa
index 48fc87c..3284d5b 100644
--- a/src/arch/arm/isa/insts/data64.isa
+++ b/src/arch/arm/isa/insts/data64.isa
@@ -248,18 +248,7 @@
Dest64 = (Op164 == 0) ? intWidth : (intWidth - 1 -
findMsbSet(Op164));
''')
buildDataXRegInst("rbit", 1, '''
- uint64_t result = Op164;
- uint64_t lBit = 1ULL << (intWidth - 1);
- uint64_t rBit = 1ULL;
- while (lBit > rBit) {
- uint64_t maskBits = lBit | rBit;
- uint64_t testBits = result & maskBits;
- // If these bits are different, swap them by toggling them.
- if (testBits && testBits != maskBits)
- result ^= maskBits;
- lBit >>= 1; rBit <<= 1;
- }
- Dest64 = result;
+ Dest64 = reverseBits(Op164, intWidth/8);
''')
buildDataXRegInst("rev", 1, '''
if (intWidth == 32)
diff --git a/src/arch/arm/isa/insts/misc.isa
b/src/arch/arm/isa/insts/misc.isa
index 5eda615..edeb0f6 100644
--- a/src/arch/arm/isa/insts/misc.isa
+++ b/src/arch/arm/isa/insts/misc.isa
@@ -329,17 +329,7 @@
exec_output += PredOpExecute.subst(revshIop)
rbitCode = '''
- uint8_t *opBytes = (uint8_t *)&Op1;
- uint32_t resTemp;
- uint8_t *destBytes = (uint8_t *)&resTemp;
- // This reverses the bytes and bits of the input, or so says the
- // internet.
- for (int i = 0; i < 4; i++) {
- uint32_t temp = opBytes[i];
- temp = (temp * 0x0802 & 0x22110) | (temp * 0x8020 & 0x88440);
- destBytes[3 - i] = (temp * 0x10101) >> 16;
- }
- Dest = resTemp;
+ Dest = reverseBits(Op1);
'''
rbitIop = InstObjParams("rbit", "Rbit", "RegRegOp",
{ "code": rbitCode,
--
To view, visit https://gem5-review.googlesource.com/5262
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id5a8a93d928d00fd33ec4061fbb586b8420a1c1b
Gerrit-Change-Number: 5262
Gerrit-PatchSet: 1
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Nikos Nikoleris <nikos.nikole...@arm.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev