diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2009-07-01 22:16:36 -0700 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2009-07-01 22:16:36 -0700 |
commit | 7172e26cc446556e6b8241549d5d188b5cb0cd37 (patch) | |
tree | 38ac996fee85f4ed7a03c0e8e4f725a46821675e /src/arch | |
parent | f5141c23fd63c0fd89828ebf91317b1bd7f77881 (diff) | |
download | gem5-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.isa | 14 |
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 { |