]> git.proxmox.com Git - mirror_qemu.git/commitdiff
Use host-utils for Alpha 64x64 bits multiplications.
authorj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 25 Oct 2007 23:34:44 +0000 (23:34 +0000)
committerj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 25 Oct 2007 23:34:44 +0000 (23:34 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3443 c046a42c-6fe2-441c-8c8c-71466251a162

target-alpha/op.c
target-alpha/op_helper.c
target-alpha/op_helper.h

index 409325221a0ce9792262bc525de655a18cec0306..2a52be4f4908c1eaa00151738d10e44d52ef64c2 100644 (file)
@@ -295,7 +295,7 @@ void OPPROTO op_mullv (void)
 
 void OPPROTO op_mulq (void)
 {
-    T0 *= T1;
+    T0 = (int64_t)T0 * (int64_t)T1;
     RETURN();
 }
 
@@ -307,7 +307,10 @@ void OPPROTO op_mulqv (void)
 
 void OPPROTO op_umulh (void)
 {
-    helper_umulh();
+    uint64_t tl, th;
+
+    mulu64(&tl, &th, T0, T1);
+    T0 = th;
     RETURN();
 }
 
index e471a1f06f13959d40d7a22c977ed068bfee73ee..3a34df49b67eedf9e347c7a51f685a450f9e8807 100644 (file)
@@ -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)
index 806a30d4a2d73ad7a0aa17e26c8da0008e188408..0c65fd4a3395c8fb9ae5f0998c361d45e8455393 100644 (file)
@@ -34,7 +34,6 @@ void helper_subqv (void);
 void helper_sublv (void);
 void helper_mullv (void);
 void helper_mulqv (void);
-void helper_umulh (void);
 void helper_ctpop (void);
 void helper_ctlz (void);
 void helper_cttz (void);