qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH RFC] meson: require int128 type
Date: Thu, 8 May 2025 08:20:44 -0400	[thread overview]
Message-ID: <8c8f9a7e77e25a87b54335f7c376cb079fe67655.1746706766.git.mst@redhat.com> (raw)

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 <mst@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	other threads:[~2025-05-08 12:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-08 12:20 Michael S. Tsirkin [this message]
2025-05-08 12:30 ` [PATCH RFC] meson: require int128 type Peter Maydell
2025-05-08 14:43   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c8f9a7e77e25a87b54335f7c376cb079fe67655.1746706766.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=berrange@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).