compilers that QEMU requires support int128
(though arithmetic might be more challenging).
As virtio wants to use int128 with bitwise opts only,
make it simple by failing configure if not there.

Signed-off-by: Michael S. Tsirkin <m...@redhat.com>
---

Hi guys,
any feedback on this one?
Lightly tested.


 include/qemu/int128.h                                | 6 +-----
 host/include/x86_64/host/atomic128-ldst.h.inc        | 5 -----
 host/include/x86_64/host/load-extract-al16-al8.h.inc | 6 ------
 meson.build                                          | 5 ++++-
 4 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/include/qemu/int128.h b/include/qemu/int128.h
index 174bd7dafb..299bc8f0bf 100644
--- a/include/qemu/int128.h
+++ b/include/qemu/int128.h
@@ -479,18 +479,14 @@ static inline void bswap128s(Int128 *s)
 #define INT128_MIN int128_make128(0, INT64_MIN)
 
 /*
- * When compiler supports a 128-bit type, define a combination of
+ * Define a combination of
  * a possible structure and the native types.  Ease parameter passing
  * via use of the transparent union extension.
  */
-#ifdef CONFIG_INT128_TYPE
 typedef union {
     __uint128_t u;
     __int128_t i;
     Int128 s;
 } Int128Alias __attribute__((transparent_union));
-#else
-typedef Int128 Int128Alias;
-#endif /* CONFIG_INT128_TYPE */
 
 #endif /* INT128_H */
diff --git a/host/include/x86_64/host/atomic128-ldst.h.inc 
b/host/include/x86_64/host/atomic128-ldst.h.inc
index 4c698e3246..2c313f4168 100644
--- a/host/include/x86_64/host/atomic128-ldst.h.inc
+++ b/host/include/x86_64/host/atomic128-ldst.h.inc
@@ -11,7 +11,6 @@
 #ifndef X86_64_ATOMIC128_LDST_H
 #define X86_64_ATOMIC128_LDST_H
 
-#ifdef CONFIG_INT128_TYPE
 #include "host/cpuinfo.h"
 #include "tcg/debug-assert.h"
 #include <immintrin.h>
@@ -67,9 +66,5 @@ static inline void atomic16_set(Int128 *ptr, Int128 val)
         } while (!__sync_bool_compare_and_swap_16(ptr_align, old, new.i));
     }
 }
-#else
-/* Provide QEMU_ERROR stubs. */
-#include "host/include/generic/host/atomic128-ldst.h.inc"
-#endif
 
 #endif /* X86_64_ATOMIC128_LDST_H */
diff --git a/host/include/x86_64/host/load-extract-al16-al8.h.inc 
b/host/include/x86_64/host/load-extract-al16-al8.h.inc
index b837c37868..d8c838a420 100644
--- a/host/include/x86_64/host/load-extract-al16-al8.h.inc
+++ b/host/include/x86_64/host/load-extract-al16-al8.h.inc
@@ -8,7 +8,6 @@
 #ifndef X86_64_LOAD_EXTRACT_AL16_AL8_H
 #define X86_64_LOAD_EXTRACT_AL16_AL8_H
 
-#ifdef CONFIG_INT128_TYPE
 #include "host/atomic128-ldst.h.inc"
 
 /**
@@ -41,10 +40,5 @@ load_atom_extract_al16_or_al8(void *pv, int s)
     }
     return int128_getlo(int128_urshift(r.s, shr));
 }
-#else
-/* Fallback definition that must be optimized away, or error.  */
-uint64_t QEMU_ERROR("unsupported atomic")
-    load_atom_extract_al16_or_al8(void *pv, int s);
-#endif
 
 #endif /* X86_64_LOAD_EXTRACT_AL16_AL8_H */
diff --git a/meson.build b/meson.build
index 41f68d3806..38186524da 100644
--- a/meson.build
+++ b/meson.build
@@ -2966,7 +2966,10 @@ has_int128_type = cc.compiles('''
   __int128_t a;
   __uint128_t b;
   int main(void) { b = a; }''')
-config_host_data.set('CONFIG_INT128_TYPE', has_int128_type)
+
+if not has_int128_type
+    error('You must use a compiler with int128 support to compile QEMU')
+endif
 
 has_int128 = has_int128_type and cc.links('''
   __int128_t a;
-- 
MST


Reply via email to