summaryrefslogtreecommitdiff
path: root/src/arch/arm/isa/insts/misc.isa
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:07 -0500
committerGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:07 -0500
commit5cc1bb684226d9a67cd6868720a6ca2c267592d6 (patch)
treef764bc69243155f96cea4fd1b2dee924c7934826 /src/arch/arm/isa/insts/misc.isa
parent566b2ff20c311375a1d25cde735ddfb70706b581 (diff)
downloadgem5-5cc1bb684226d9a67cd6868720a6ca2c267592d6.tar.xz
ARM: Implement the rbit instruction.
Diffstat (limited to 'src/arch/arm/isa/insts/misc.isa')
-rw-r--r--src/arch/arm/isa/insts/misc.isa20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/arch/arm/isa/insts/misc.isa b/src/arch/arm/isa/insts/misc.isa
index 652a15b3b..09d27360e 100644
--- a/src/arch/arm/isa/insts/misc.isa
+++ b/src/arch/arm/isa/insts/misc.isa
@@ -154,6 +154,26 @@ let {{
decoder_output += RevOpConstructor.subst(revshIop)
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;
+ '''
+ rbitIop = InstObjParams("rbit", "Rbit", "RevOp",
+ { "code": rbitCode,
+ "predicate_test": predicateTest }, [])
+ header_output += RevOpDeclare.subst(rbitIop)
+ decoder_output += RevOpConstructor.subst(rbitIop)
+ exec_output += PredOpExecute.subst(rbitIop)
+
ssatCode = '''
int32_t operand = shift_rm_imm(Op1, shiftAmt, shiftType, 0);
int32_t res;