aboutsummaryrefslogtreecommitdiff
path: root/target-arm
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-31 03:45:13 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2008-03-31 03:45:13 +0000
commitf51bbbfefe73120a85a8d24a029d37c9c0f3a001 (patch)
treeded0d23ca903c3c124ceba5ccf342521d6f98c22 /target-arm
parentb26eefb68e7942eeb689c81fd20e67e57ad95cd2 (diff)
downloadqemu-f51bbbfefe73120a85a8d24a029d37c9c0f3a001.zip
qemu-f51bbbfefe73120a85a8d24a029d37c9c0f3a001.tar.gz
qemu-f51bbbfefe73120a85a8d24a029d37c9c0f3a001.tar.bz2
ARM TCG conversion 2/16.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4139 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-arm')
-rw-r--r--target-arm/helper.c8
-rw-r--r--target-arm/helpers.h1
-rw-r--r--target-arm/op.c9
-rw-r--r--target-arm/translate.c3
4 files changed, 12 insertions, 9 deletions
diff --git a/target-arm/helper.c b/target-arm/helper.c
index df09778..236aaed 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -340,6 +340,14 @@ uint32_t HELPER(uxtb16)(uint32_t x)
return res;
}
+uint32_t HELPER(clz)(uint32_t x)
+{
+ int count;
+ for (count = 32; x; count--)
+ x >>= 1;
+ return count;
+}
+
#if defined(CONFIG_USER_ONLY)
void do_interrupt (CPUState *env)
diff --git a/target-arm/helpers.h b/target-arm/helpers.h
index 577f5ee..8f2e129 100644
--- a/target-arm/helpers.h
+++ b/target-arm/helpers.h
@@ -2,5 +2,6 @@
#define DEF_HELPER(name, ret, args) ret helper_##name args;
#endif
+DEF_HELPER(clz, uint32_t, (uint32_t))
DEF_HELPER(sxtb16, uint32_t, (uint32_t))
DEF_HELPER(uxtb16, uint32_t, (uint32_t))
diff --git a/target-arm/op.c b/target-arm/op.c
index 9a01675..bf535c8 100644
--- a/target-arm/op.c
+++ b/target-arm/op.c
@@ -475,15 +475,6 @@ void OPPROTO op_rorl_T1_T0_cc(void)
}
/* misc */
-void OPPROTO op_clz_T0(void)
-{
- int count;
- for (count = 32; T0 > 0; count--)
- T0 = T0 >> 1;
- T0 = count;
- FORCE_RET();
-}
-
#define SIGNBIT (uint32_t)0x80000000
/* saturating arithmetic */
void OPPROTO op_addl_T0_T1_setq(void)
diff --git a/target-arm/translate.c b/target-arm/translate.c
index ef529eb..8669e94 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -205,6 +205,9 @@ static void store_reg(DisasContext *s, int reg, TCGv var)
#define gen_sxtb16(var) tcg_gen_helper_1_1(HELPER_ADDR(sxtb16), var, var)
#define gen_uxtb16(var) tcg_gen_helper_1_1(HELPER_ADDR(uxtb16), var, var)
+#define gen_op_clz_T0(var) \
+ tcg_gen_helper_1_1(HELPER_ADDR(clz), cpu_T[0], cpu_T[0])
+
/* Dual 16-bit add. Result placed in t0 and t1 is marked as dead.
tmp = (t0 ^ t1) & 0x8000;
t0 &= ~0x8000;