diff --git a/target-ppc/op.c b/target-ppc/op.c index 0030c146611b0b7ef90beff8535fd37ae859b56b..0495879ce31eb5cca7f1227007c927500012b876 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 c654b139cc36010ac175bc8c31b74e642ffc83d3..13c1fbb00f498d4ff43cca45204d51d2293722b8 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 e260b4ff971744ea84fe33b11067def121b2a30d..d8b2f252c89e620030719d67bf25b5cd7535cdd2 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);