Commit 9d901a201bc37bbb40ca8fa325866cba047ec701

Authored by j_mayer
1 parent cd346349

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
target-ppc/op.c
... ... @@ -980,7 +980,7 @@ void OPPROTO op_mulhd (void)
980 980 {
981 981 uint64_t tl, th;
982 982  
983   - do_imul64(&tl, &th);
  983 + muls64(&tl, &th, T0, T1);
984 984 T0 = th;
985 985 RETURN();
986 986 }
... ... @@ -998,7 +998,7 @@ void OPPROTO op_mulhdu (void)
998 998 {
999 999 uint64_t tl, th;
1000 1000  
1001   - do_mul64(&tl, &th);
  1001 + mulu64(&tl, &th, T0, T1);
1002 1002 T0 = th;
1003 1003 RETURN();
1004 1004 }
... ...
target-ppc/op_helper.c
... ... @@ -199,79 +199,6 @@ void ppc_store_dump_spr (int sprn, target_ulong val)
199 199  
200 200 /*****************************************************************************/
201 201 /* Fixed point operations helpers */
202   -#if defined(TARGET_PPC64)
203   -static void add128 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
204   -{
205   - *plow += a;
206   - /* carry test */
207   - if (*plow < a)
208   - (*phigh)++;
209   - *phigh += b;
210   -}
211   -
212   -static void neg128 (uint64_t *plow, uint64_t *phigh)
213   -{
214   - *plow = ~*plow;
215   - *phigh = ~*phigh;
216   - add128(plow, phigh, 1, 0);
217   -}
218   -
219   -static void mul64 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
220   -{
221   - uint32_t a0, a1, b0, b1;
222   - uint64_t v;
223   -
224   - a0 = a;
225   - a1 = a >> 32;
226   -
227   - b0 = b;
228   - b1 = b >> 32;
229   -
230   - v = (uint64_t)a0 * (uint64_t)b0;
231   - *plow = v;
232   - *phigh = 0;
233   -
234   - v = (uint64_t)a0 * (uint64_t)b1;
235   - add128(plow, phigh, v << 32, v >> 32);
236   -
237   - v = (uint64_t)a1 * (uint64_t)b0;
238   - add128(plow, phigh, v << 32, v >> 32);
239   -
240   - v = (uint64_t)a1 * (uint64_t)b1;
241   - *phigh += v;
242   -#if defined(DEBUG_MULDIV)
243   - printf("mul: 0x%016llx * 0x%016llx = 0x%016llx%016llx\n",
244   - a, b, *phigh, *plow);
245   -#endif
246   -}
247   -
248   -void do_mul64 (uint64_t *plow, uint64_t *phigh)
249   -{
250   - mul64(plow, phigh, T0, T1);
251   -}
252   -
253   -static void imul64 (uint64_t *plow, uint64_t *phigh, int64_t a, int64_t b)
254   -{
255   - int sa, sb;
256   -
257   - sa = (a < 0);
258   - if (sa)
259   - a = -a;
260   - sb = (b < 0);
261   - if (sb)
262   - b = -b;
263   - mul64(plow, phigh, a, b);
264   - if (sa ^ sb) {
265   - neg128(plow, phigh);
266   - }
267   -}
268   -
269   -void do_imul64 (uint64_t *plow, uint64_t *phigh)
270   -{
271   - imul64(plow, phigh, T0, T1);
272   -}
273   -#endif
274   -
275 202 void do_adde (void)
276 203 {
277 204 T2 = T0;
... ... @@ -403,7 +330,7 @@ void do_mulldo (void)
403 330 int64_t th;
404 331 uint64_t tl;
405 332  
406   - do_imul64(&tl, &th);
  333 + muls64(&tl, &th, T0, T1);
407 334 if (likely(th == 0)) {
408 335 xer_ov = 0;
409 336 } else {
... ...
target-ppc/op_helper.h
... ... @@ -79,8 +79,6 @@ void do_sraw (void);
79 79 #if defined(TARGET_PPC64)
80 80 void do_adde_64 (void);
81 81 void do_addmeo_64 (void);
82   -void do_imul64 (uint64_t *tl, uint64_t *th);
83   -void do_mul64 (uint64_t *tl, uint64_t *th);
84 82 void do_divdo (void);
85 83 void do_divduo (void);
86 84 void do_mulldo (void);
... ...