diff options
author | Gabe Black <gblack@eecs.umich.edu> | 2010-06-02 12:58:02 -0500 |
---|---|---|
committer | Gabe Black <gblack@eecs.umich.edu> | 2010-06-02 12:58:02 -0500 |
commit | beb759912bc1efd90ee4843e2a06308a6fde007e (patch) | |
tree | d6eece163960a9aee6e3c98f385039391bb23bb9 /src/arch | |
parent | 8136cb360575aad8a6418c76f5b69194bec23f5c (diff) | |
download | gem5-beb759912bc1efd90ee4843e2a06308a6fde007e.tar.xz |
ARM: Move the modified_imm function from all ARM instructions to just data processing ones.
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/arm/insts/pred_inst.hh | 24 | ||||
-rw-r--r-- | src/arch/arm/insts/static_inst.cc | 23 | ||||
-rw-r--r-- | src/arch/arm/insts/static_inst.hh | 2 |
3 files changed, 24 insertions, 25 deletions
diff --git a/src/arch/arm/insts/pred_inst.hh b/src/arch/arm/insts/pred_inst.hh index 220cf6a0f..3231894b0 100644 --- a/src/arch/arm/insts/pred_inst.hh +++ b/src/arch/arm/insts/pred_inst.hh @@ -54,6 +54,30 @@ rotate_imm(uint32_t immValue, int rotateValue) (immValue << (32 - (rotateValue & 31)))); } +static inline uint32_t +modified_imm(uint8_t ctrlImm, uint8_t dataImm) +{ + uint32_t bigData = dataImm; + uint32_t bigCtrl = ctrlImm; + if (bigCtrl < 4) { + switch (bigCtrl) { + case 0: + return bigData; + case 1: + return bigData | (bigData << 16); + case 2: + return (bigData << 8) | (bigData << 24); + case 3: + return (bigData << 0) | (bigData << 8) | + (bigData << 16) | (bigData << 24); + } + } + bigCtrl = (bigCtrl << 1) | ((bigData >> 7) & 0x1); + bigData |= (1 << 7); + return bigData << (32 - bigCtrl); +} + + /** * Base class for predicated integer operations. */ diff --git a/src/arch/arm/insts/static_inst.cc b/src/arch/arm/insts/static_inst.cc index 027980b3c..7f5f56f19 100644 --- a/src/arch/arm/insts/static_inst.cc +++ b/src/arch/arm/insts/static_inst.cc @@ -231,29 +231,6 @@ ArmStaticInstBase::arm_sub_overflow(int32_t result, int32_t lhs, int32_t rhs) co return findOverflow(32, result, lhs, ~rhs); } -uint32_t -ArmStaticInstBase::modified_imm(uint8_t ctrlImm, uint8_t dataImm) const -{ - uint32_t bigData = dataImm; - uint32_t bigCtrl = ctrlImm; - if (bigCtrl < 4) { - switch (bigCtrl) { - case 0: - return bigData; - case 1: - return bigData | (bigData << 16); - case 2: - return (bigData << 8) | (bigData << 24); - case 3: - return (bigData << 0) | (bigData << 8) | - (bigData << 16) | (bigData << 24); - } - } - bigCtrl = (bigCtrl << 1) | ((bigData >> 7) & 0x1); - bigData |= (1 << 7); - return bigData << (32 - bigCtrl); -} - void ArmStaticInstBase::printReg(std::ostream &os, int reg) const { diff --git a/src/arch/arm/insts/static_inst.hh b/src/arch/arm/insts/static_inst.hh index ec33c73a2..99fa819b5 100644 --- a/src/arch/arm/insts/static_inst.hh +++ b/src/arch/arm/insts/static_inst.hh @@ -66,8 +66,6 @@ class ArmStaticInstBase : public StaticInst bool arm_add_overflow(int32_t result, int32_t lhs, int32_t rhs) const; bool arm_sub_overflow(int32_t result, int32_t lhs, int32_t rhs) const; - uint32_t modified_imm(uint8_t ctrlImm, uint8_t dataImm) const; - // Constructor ArmStaticInstBase(const char *mnem, ExtMachInst _machInst, OpClass __opClass) |