提交 9d901a20 编写于 作者: J j_mayer

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
上级 cd346349
...@@ -980,7 +980,7 @@ void OPPROTO op_mulhd (void) ...@@ -980,7 +980,7 @@ void OPPROTO op_mulhd (void)
{ {
uint64_t tl, th; uint64_t tl, th;
do_imul64(&tl, &th); muls64(&tl, &th, T0, T1);
T0 = th; T0 = th;
RETURN(); RETURN();
} }
...@@ -998,7 +998,7 @@ void OPPROTO op_mulhdu (void) ...@@ -998,7 +998,7 @@ void OPPROTO op_mulhdu (void)
{ {
uint64_t tl, th; uint64_t tl, th;
do_mul64(&tl, &th); mulu64(&tl, &th, T0, T1);
T0 = th; T0 = th;
RETURN(); RETURN();
} }
......
...@@ -199,79 +199,6 @@ void ppc_store_dump_spr (int sprn, target_ulong val) ...@@ -199,79 +199,6 @@ void ppc_store_dump_spr (int sprn, target_ulong val)
/*****************************************************************************/ /*****************************************************************************/
/* Fixed point operations helpers */ /* 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) void do_adde (void)
{ {
T2 = T0; T2 = T0;
...@@ -403,7 +330,7 @@ void do_mulldo (void) ...@@ -403,7 +330,7 @@ void do_mulldo (void)
int64_t th; int64_t th;
uint64_t tl; uint64_t tl;
do_imul64(&tl, &th); muls64(&tl, &th, T0, T1);
if (likely(th == 0)) { if (likely(th == 0)) {
xer_ov = 0; xer_ov = 0;
} else { } else {
......
...@@ -79,8 +79,6 @@ void do_sraw (void); ...@@ -79,8 +79,6 @@ void do_sraw (void);
#if defined(TARGET_PPC64) #if defined(TARGET_PPC64)
void do_adde_64 (void); void do_adde_64 (void);
void do_addmeo_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_divdo (void);
void do_divduo (void); void do_divduo (void);
void do_mulldo (void); void do_mulldo (void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册