mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
user: compile host-utils.c only once
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
e27b27b3c6
commit
facd285778
2
Makefile
2
Makefile
@ -162,7 +162,7 @@ libqemu_common.a: $(obj-y)
|
||||
|
||||
#######################################################################
|
||||
# user-obj-y is code used by qemu userspace emulation
|
||||
user-obj-y = cutils.o cache-utils.o path.o envlist.o
|
||||
user-obj-y = cutils.o cache-utils.o path.o envlist.o host-utils.o
|
||||
|
||||
libqemu_user.a: $(user-obj-y)
|
||||
|
||||
|
@ -35,7 +35,7 @@ all: $(PROGS)
|
||||
|
||||
#########################################################
|
||||
# cpu emulator library
|
||||
libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
|
||||
libobj-y = exec.o translate-all.o cpu-exec.o translate.o
|
||||
libobj-$(CONFIG_KQEMU) += kqemu.o
|
||||
libobj-y += tcg/tcg.o tcg/tcg-runtime.o
|
||||
libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
|
||||
|
@ -23,7 +23,8 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "exec.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "host-utils.h"
|
||||
|
||||
//#define DEBUG_MULDIV
|
||||
|
32
host-utils.h
32
host-utils.h
@ -27,16 +27,16 @@
|
||||
|
||||
#if defined(__x86_64__)
|
||||
#define __HAVE_FAST_MULU64__
|
||||
static always_inline void mulu64 (uint64_t *plow, uint64_t *phigh,
|
||||
uint64_t a, uint64_t b)
|
||||
static inline void mulu64(uint64_t *plow, uint64_t *phigh,
|
||||
uint64_t a, uint64_t b)
|
||||
{
|
||||
__asm__ ("mul %0\n\t"
|
||||
: "=d" (*phigh), "=a" (*plow)
|
||||
: "a" (a), "0" (b));
|
||||
}
|
||||
#define __HAVE_FAST_MULS64__
|
||||
static always_inline void muls64 (uint64_t *plow, uint64_t *phigh,
|
||||
int64_t a, int64_t b)
|
||||
static inline void muls64(uint64_t *plow, uint64_t *phigh,
|
||||
int64_t a, int64_t b)
|
||||
{
|
||||
__asm__ ("imul %0\n\t"
|
||||
: "=d" (*phigh), "=a" (*plow)
|
||||
@ -49,7 +49,7 @@ void mulu64(uint64_t *phigh, uint64_t *plow, uint64_t a, uint64_t b);
|
||||
|
||||
/* Binary search for leading zeros. */
|
||||
|
||||
static always_inline int clz32(uint32_t val)
|
||||
static inline int clz32(uint32_t val)
|
||||
{
|
||||
#if QEMU_GNUC_PREREQ(3, 4)
|
||||
if (val)
|
||||
@ -86,12 +86,12 @@ static always_inline int clz32(uint32_t val)
|
||||
#endif
|
||||
}
|
||||
|
||||
static always_inline int clo32(uint32_t val)
|
||||
static inline int clo32(uint32_t val)
|
||||
{
|
||||
return clz32(~val);
|
||||
}
|
||||
|
||||
static always_inline int clz64(uint64_t val)
|
||||
static inline int clz64(uint64_t val)
|
||||
{
|
||||
#if QEMU_GNUC_PREREQ(3, 4)
|
||||
if (val)
|
||||
@ -111,12 +111,12 @@ static always_inline int clz64(uint64_t val)
|
||||
#endif
|
||||
}
|
||||
|
||||
static always_inline int clo64(uint64_t val)
|
||||
static inline int clo64(uint64_t val)
|
||||
{
|
||||
return clz64(~val);
|
||||
}
|
||||
|
||||
static always_inline int ctz32(uint32_t val)
|
||||
static inline int ctz32(uint32_t val)
|
||||
{
|
||||
#if QEMU_GNUC_PREREQ(3, 4)
|
||||
if (val)
|
||||
@ -155,12 +155,12 @@ static always_inline int ctz32(uint32_t val)
|
||||
#endif
|
||||
}
|
||||
|
||||
static always_inline int cto32(uint32_t val)
|
||||
static inline int cto32(uint32_t val)
|
||||
{
|
||||
return ctz32(~val);
|
||||
}
|
||||
|
||||
static always_inline int ctz64(uint64_t val)
|
||||
static inline int ctz64(uint64_t val)
|
||||
{
|
||||
#if QEMU_GNUC_PREREQ(3, 4)
|
||||
if (val)
|
||||
@ -180,12 +180,12 @@ static always_inline int ctz64(uint64_t val)
|
||||
#endif
|
||||
}
|
||||
|
||||
static always_inline int cto64(uint64_t val)
|
||||
static inline int cto64(uint64_t val)
|
||||
{
|
||||
return ctz64(~val);
|
||||
}
|
||||
|
||||
static always_inline int ctpop8(uint8_t val)
|
||||
static inline int ctpop8(uint8_t val)
|
||||
{
|
||||
val = (val & 0x55) + ((val >> 1) & 0x55);
|
||||
val = (val & 0x33) + ((val >> 2) & 0x33);
|
||||
@ -194,7 +194,7 @@ static always_inline int ctpop8(uint8_t val)
|
||||
return val;
|
||||
}
|
||||
|
||||
static always_inline int ctpop16(uint16_t val)
|
||||
static inline int ctpop16(uint16_t val)
|
||||
{
|
||||
val = (val & 0x5555) + ((val >> 1) & 0x5555);
|
||||
val = (val & 0x3333) + ((val >> 2) & 0x3333);
|
||||
@ -204,7 +204,7 @@ static always_inline int ctpop16(uint16_t val)
|
||||
return val;
|
||||
}
|
||||
|
||||
static always_inline int ctpop32(uint32_t val)
|
||||
static inline int ctpop32(uint32_t val)
|
||||
{
|
||||
#if QEMU_GNUC_PREREQ(3, 4)
|
||||
return __builtin_popcount(val);
|
||||
@ -219,7 +219,7 @@ static always_inline int ctpop32(uint32_t val)
|
||||
#endif
|
||||
}
|
||||
|
||||
static always_inline int ctpop64(uint64_t val)
|
||||
static inline int ctpop64(uint64_t val)
|
||||
{
|
||||
#if QEMU_GNUC_PREREQ(3, 4)
|
||||
return __builtin_popcountll(val);
|
||||
|
Loading…
Reference in New Issue
Block a user