* [PATCH RFC] meson: require int128 type
@ 2025-05-08 12:20 Michael S. Tsirkin
2025-05-08 12:30 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2025-05-08 12:20 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Marc-André Lureau, Daniel P. Berrangé,
Philippe Mathieu-Daudé
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 -----
| 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 */
--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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RFC] meson: require int128 type
2025-05-08 12:20 [PATCH RFC] meson: require int128 type Michael S. Tsirkin
@ 2025-05-08 12:30 ` Peter Maydell
2025-05-08 14:43 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2025-05-08 12:30 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Paolo Bonzini, Marc-André Lureau,
Daniel P. Berrangé, Philippe Mathieu-Daudé
On Thu, 8 May 2025 at 13:21, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> 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.
IIRC the problem is not the compiler version but whether
or not it's targeting a 32-bit host: compilers will
implement an int128 based on 2 64-bit registers, but
not one based on 4 32-bit registers. Did you check this
on all our supported host platforms ?
(We've deprecated 32-bit host support, but not dropped
it yet, I think.)
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFC] meson: require int128 type
2025-05-08 12:30 ` Peter Maydell
@ 2025-05-08 14:43 ` Michael S. Tsirkin
0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2025-05-08 14:43 UTC (permalink / raw)
To: Peter Maydell
Cc: qemu-devel, Paolo Bonzini, Marc-André Lureau,
Daniel P. Berrangé, Philippe Mathieu-Daudé
On Thu, May 08, 2025 at 01:30:25PM +0100, Peter Maydell wrote:
> On Thu, 8 May 2025 at 13:21, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > 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.
>
> IIRC the problem is not the compiler version but whether
> or not it's targeting a 32-bit host: compilers will
> implement an int128 based on 2 64-bit registers, but
> not one based on 4 32-bit registers. Did you check this
> on all our supported host platforms ?
>
> (We've deprecated 32-bit host support, but not dropped
> it yet, I think.)
>
> thanks
> -- PMM
Thanks for the feedback, indeed I did not. Will check some
config.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-08 14:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-08 12:20 [PATCH RFC] meson: require int128 type Michael S. Tsirkin
2025-05-08 12:30 ` Peter Maydell
2025-05-08 14:43 ` Michael S. Tsirkin
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).