From f540166b7dfdf4ec2057ac322d8cbfd0691e1d65 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sat, 16 Feb 2013 12:46:59 -0800 Subject: host-utils: Use __int128_t for mul[us]64 Replace some x86_64 specific inline assembly with something that all 64-bit hosts ought to optimize well. At worst this becomes a call to the gcc __multi3 routine, which is no worse than our implementation in util/host-utils.c. With gcc 4.7, we get identical code generation for x86_64. We now get native multiplication on ia64 and s390x hosts. With minor improvements to gcc we can get it for ppc64 as well. Signed-off-by: Richard Henderson Signed-off-by: Blue Swirl --- util/host-utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/host-utils.c b/util/host-utils.c index 5e3915a..2d06a2c 100644 --- a/util/host-utils.c +++ b/util/host-utils.c @@ -30,7 +30,7 @@ //#define DEBUG_MULDIV /* Long integer helpers */ -#if !defined(__x86_64__) +#ifndef CONFIG_INT128 static void add128 (uint64_t *plow, uint64_t *phigh, uint64_t a, uint64_t b) { *plow += a; @@ -102,4 +102,4 @@ void muls64 (uint64_t *plow, uint64_t *phigh, int64_t a, int64_t b) a, b, *phigh, *plow); #endif } -#endif /* !defined(__x86_64__) */ +#endif /* !CONFIG_INT128 */ -- cgit v1.1