summaryrefslogtreecommitdiff
path: root/src/arch/arm/insts/pred_inst.hh
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:02 -0500
committerGabe Black <gblack@eecs.umich.edu>2010-06-02 12:58:02 -0500
commitbeb759912bc1efd90ee4843e2a06308a6fde007e (patch)
treed6eece163960a9aee6e3c98f385039391bb23bb9 /src/arch/arm/insts/pred_inst.hh
parent8136cb360575aad8a6418c76f5b69194bec23f5c (diff)
downloadgem5-beb759912bc1efd90ee4843e2a06308a6fde007e.tar.xz
ARM: Move the modified_imm function from all ARM instructions to just data processing ones.
Diffstat (limited to 'src/arch/arm/insts/pred_inst.hh')
-rw-r--r--src/arch/arm/insts/pred_inst.hh24
1 files changed, 24 insertions, 0 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.
*/