aboutsummaryrefslogtreecommitdiff
path: root/host-utils.c
diff options
context:
space:
mode:
authorj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-04 02:24:58 +0000
committerj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-04 02:24:58 +0000
commit7a51ad822f533472cab908d2622578d51eb97dc6 (patch)
tree92e7d1dda1536cd9260d203ac93714e3adedd24b /host-utils.c
parent077fc2061e254422c44b2de16c526476398113ae (diff)
For consistency, move muls64 / mulu64 prototypes to host-utils.h
Make x86_64 optimized versions inline. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3523 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'host-utils.c')
-rw-r--r--host-utils.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/host-utils.c b/host-utils.c
index a3c838f4dc..7cd0843f94 100644
--- a/host-utils.c
+++ b/host-utils.c
@@ -28,6 +28,7 @@
//#define DEBUG_MULDIV
/* Long integer helpers */
+#if !defined(__x86_64__)
static void add128 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
{
*plow += a;
@@ -69,17 +70,10 @@ static void mul64 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
*phigh += v;
}
-
/* Unsigned 64x64 -> 128 multiplication */
void mulu64 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
{
-#if defined(__x86_64__)
- __asm__ ("mul %0\n\t"
- : "=d" (*phigh), "=a" (*plow)
- : "a" (a), "0" (b));
-#else
mul64(plow, phigh, a, b);
-#endif
#if defined(DEBUG_MULDIV)
printf("mulu64: 0x%016llx * 0x%016llx = 0x%016llx%016llx\n",
a, b, *phigh, *plow);
@@ -89,11 +83,6 @@ void mulu64 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b)
/* Signed 64x64 -> 128 multiplication */
void muls64 (uint64_t *plow, uint64_t *phigh, int64_t a, int64_t b)
{
-#if defined(__x86_64__)
- __asm__ ("imul %0\n\t"
- : "=d" (*phigh), "=a" (*plow)
- : "a" (a), "0" (b));
-#else
int sa, sb;
sa = (a < 0);
@@ -106,9 +95,9 @@ void muls64 (uint64_t *plow, uint64_t *phigh, int64_t a, int64_t b)
if (sa ^ sb) {
neg128(plow, phigh);
}
-#endif
#if defined(DEBUG_MULDIV)
printf("muls64: 0x%016llx * 0x%016llx = 0x%016llx%016llx\n",
a, b, *phigh, *plow);
#endif
}
+#endif /* !defined(__x86_64__) */