diff options
author | j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-25 23:28:36 +0000 |
---|---|---|
committer | j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-25 23:28:36 +0000 |
commit | 9d901a201bc37bbb40ca8fa325866cba047ec701 (patch) | |
tree | 40c0d6c08c8a28cb79dc1a73609d597a422c322d | |
parent | cd346349b45ef056f138a184f660b8c34c3213cc (diff) | |
download | qemu-9d901a201bc37bbb40ca8fa325866cba047ec701.zip qemu-9d901a201bc37bbb40ca8fa325866cba047ec701.tar.gz qemu-9d901a201bc37bbb40ca8fa325866cba047ec701.tar.bz2 |
Use host-utils for PowerPC 64 64x64 bits multiplications.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3442 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | target-ppc/op.c | 4 | ||||
-rw-r--r-- | target-ppc/op_helper.c | 75 | ||||
-rw-r--r-- | target-ppc/op_helper.h | 2 |
3 files changed, 3 insertions, 78 deletions
diff --git a/target-ppc/op.c b/target-ppc/op.c index 0030c14..0495879 100644 --- a/target-ppc/op.c +++ b/target-ppc/op.c @@ -980,7 +980,7 @@ void OPPROTO op_mulhd (void) { uint64_t tl, th; - do_imul64(&tl, &th); + muls64(&tl, &th, T0, T1); T0 = th; RETURN(); } @@ -998,7 +998,7 @@ void OPPROTO op_mulhdu (void) { uint64_t tl, th; - do_mul64(&tl, &th); + mulu64(&tl, &th, T0, T1); T0 = th; RETURN(); } diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c index c654b13..13c1fbb 100644 --- a/target-ppc/op_helper.c +++ b/target-ppc/op_helper.c @@ -199,79 +199,6 @@ void ppc_store_dump_spr (int sprn, target_ulong val) /*****************************************************************************/ /* Fixed point operations helpers */ -#if defined(TARGET_PPC64) -static void add128 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b) -{ - *plow += a; - /* carry test */ - if (*plow < a) - (*phigh)++; - *phigh += b; -} - -static void neg128 (uint64_t *plow, uint64_t *phigh) -{ - *plow = ~*plow; - *phigh = ~*phigh; - add128(plow, phigh, 1, 0); -} - -static void mul64 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b) -{ - uint32_t a0, a1, b0, b1; - uint64_t v; - - a0 = a; - a1 = a >> 32; - - b0 = b; - b1 = b >> 32; - - v = (uint64_t)a0 * (uint64_t)b0; - *plow = v; - *phigh = 0; - - v = (uint64_t)a0 * (uint64_t)b1; - add128(plow, phigh, v << 32, v >> 32); - - v = (uint64_t)a1 * (uint64_t)b0; - add128(plow, phigh, v << 32, v >> 32); - - v = (uint64_t)a1 * (uint64_t)b1; - *phigh += v; -#if defined(DEBUG_MULDIV) - printf("mul: 0x%016llx * 0x%016llx = 0x%016llx%016llx\n", - a, b, *phigh, *plow); -#endif -} - -void do_mul64 (uint64_t *plow, uint64_t *phigh) -{ - mul64(plow, phigh, T0, T1); -} - -static void imul64 (uint64_t *plow, uint64_t *phigh, int64_t a, int64_t b) -{ - int sa, sb; - - sa = (a < 0); - if (sa) - a = -a; - sb = (b < 0); - if (sb) - b = -b; - mul64(plow, phigh, a, b); - if (sa ^ sb) { - neg128(plow, phigh); - } -} - -void do_imul64 (uint64_t *plow, uint64_t *phigh) -{ - imul64(plow, phigh, T0, T1); -} -#endif - void do_adde (void) { T2 = T0; @@ -403,7 +330,7 @@ void do_mulldo (void) int64_t th; uint64_t tl; - do_imul64(&tl, &th); + muls64(&tl, &th, T0, T1); if (likely(th == 0)) { xer_ov = 0; } else { diff --git a/target-ppc/op_helper.h b/target-ppc/op_helper.h index e260b4f..d8b2f25 100644 --- a/target-ppc/op_helper.h +++ b/target-ppc/op_helper.h @@ -79,8 +79,6 @@ void do_sraw (void); #if defined(TARGET_PPC64) void do_adde_64 (void); void do_addmeo_64 (void); -void do_imul64 (uint64_t *tl, uint64_t *th); -void do_mul64 (uint64_t *tl, uint64_t *th); void do_divdo (void); void do_divduo (void); void do_mulldo (void); |