summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2009-07-01 22:16:36 -0700
committerGabe Black <gblack@eecs.umich.edu>2009-07-01 22:16:36 -0700
commit7172e26cc446556e6b8241549d5d188b5cb0cd37 (patch)
tree38ac996fee85f4ed7a03c0e8e4f725a46821675e /src/arch
parentf5141c23fd63c0fd89828ebf91317b1bd7f77881 (diff)
downloadgem5-7172e26cc446556e6b8241549d5d188b5cb0cd37.tar.xz
ARM: Add a findLsbSet function and use it to implement clz.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/arm/isa/decoder.isa14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/arch/arm/isa/decoder.isa b/src/arch/arm/isa/decoder.isa
index 9d2c90b4c..8c9f7aa50 100644
--- a/src/arch/arm/isa/decoder.isa
+++ b/src/arch/arm/isa/decoder.isa
@@ -270,18 +270,8 @@ format DataOp {
0x1: decode OPCODE {
0x9: BranchExchange::bx({{ }});
0xb: PredOp::clz({{
- if (Rm == 0)
- Rd = 32;
- else
- {
- int i;
- for (i = 0; i < 32; i++)
- {
- if (Rm & (1<<(31-i)))
- break;
- }
- Rd = i;
- }
+ unsigned lsb = findLsbSet(Rm);
+ Rd = (lsb > 31) ? 32 : lsb;
}});
}
0x2: decode OPCODE {