cpuid_h=yes
fi
+########################################
+# check if __[u]int128_t is usable.
+
+int128=no
+cat > $TMPC << EOF
+__int128_t a;
+__uint128_t b;
+int main (void) {
+ a = a + b;
+ b = a * b;
+ return 0;
+}
+EOF
+if compile_prog "" "" ; then
+ int128=yes
+fi
##########################################
# End of CC checks
echo "CONFIG_CPUID_H=y" >> $config_host_mak
fi
+if test "$int128" = "yes" ; then
+ echo "CONFIG_INT128=y" >> $config_host_mak
+fi
+
if test "$glusterfs" = "yes" ; then
echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
fi
#include "qemu/compiler.h" /* QEMU_GNUC_PREREQ */
#include <limits.h>
-#if defined(__x86_64__)
-#define __HAVE_FAST_MULU64__
+#ifdef CONFIG_INT128
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));
+ __uint128_t r = (__uint128_t)a * b;
+ *plow = r;
+ *phigh = r >> 64;
}
-#define __HAVE_FAST_MULS64__
+
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)
- : "a" (a), "0" (b));
+ __int128_t r = (__int128_t)a * b;
+ *plow = r;
+ *phigh = r >> 64;
}
#else
void muls64(uint64_t *phigh, uint64_t *plow, int64_t a, int64_t b);
//#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;
a, b, *phigh, *plow);
#endif
}
-#endif /* !defined(__x86_64__) */
+#endif /* !CONFIG_INT128 */