aboutsummaryrefslogtreecommitdiff
path: root/target-alpha/op_helper.c
diff options
context:
space:
mode:
authorj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-25 23:34:44 +0000
committerj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-10-25 23:34:44 +0000
commite14fe0a921631ab6cf1f404ad6243a716cb84366 (patch)
treecad065364e93f979512f4fc579bb2846149aa643 /target-alpha/op_helper.c
parent9d901a201bc37bbb40ca8fa325866cba047ec701 (diff)
Use host-utils for Alpha 64x64 bits multiplications.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3443 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-alpha/op_helper.c')
-rw-r--r--target-alpha/op_helper.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c
index e471a1f06f..3a34df49b6 100644
--- a/target-alpha/op_helper.c
+++ b/target-alpha/op_helper.c
@@ -199,30 +199,14 @@ void helper_mullv (void)
void helper_mulqv ()
{
- uint64_t res, tmp0, tmp1;
-
- res = (T0 >> 32) * (T1 >> 32);
- tmp0 = ((T0 & 0xFFFFFFFF) * (T1 >> 32)) +
- ((T0 >> 32) * (T1 & 0xFFFFFFFF));
- tmp1 = (T0 & 0xFFFFFFFF) * (T1 & 0xFFFFFFFF);
- tmp0 += tmp1 >> 32;
- res += tmp0 >> 32;
- T0 *= T1;
- if (unlikely(res != 0)) {
+ uint64_t tl, th;
+
+ muls64(&tl, &th, T0, T1);
+ /* If th != 0 && th != -1, then we had an overflow */
+ if (unlikely((th + 1) > 1)) {
helper_excp(EXCP_ARITH, EXCP_ARITH_OVERFLOW);
}
-}
-
-void helper_umulh (void)
-{
- uint64_t tmp0, tmp1;
-
- tmp0 = ((T0 & 0xFFFFFFFF) * (T1 >> 32)) +
- ((T0 >> 32) * (T1 & 0xFFFFFFFF));
- tmp1 = (T0 & 0xFFFFFFFF) * (T1 & 0xFFFFFFFF);
- tmp0 += tmp1 >> 32;
- T0 = (T0 >> 32) * (T0 >> 32);
- T0 += tmp0 >> 32;
+ T0 = tl;
}
void helper_ctpop (void)