aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-05-18 19:02:16 +0000
committerRichard Henderson <richard.henderson@linaro.org>2023-05-23 16:51:18 -0700
commit333c813b06edffd26d1285f5352ae179c7033b0b (patch)
treeb8e0af85d96319faa68547a0686fee1f88491ad7 /include
parent87a8d12180c629221e14722271701372db708acc (diff)
downloadqemu-333c813b06edffd26d1285f5352ae179c7033b0b.zip
qemu-333c813b06edffd26d1285f5352ae179c7033b0b.tar.gz
qemu-333c813b06edffd26d1285f5352ae179c7033b0b.tar.bz2
include/qemu: Move CONFIG_ATOMIC128_OPT handling to atomic128.h
Not only the routines in ldst_atomicity.c.inc need markup, but also the ones in the headers. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/qemu/atomic128.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/qemu/atomic128.h b/include/qemu/atomic128.h
index 3a8adb4..34554bf 100644
--- a/include/qemu/atomic128.h
+++ b/include/qemu/atomic128.h
@@ -16,6 +16,23 @@
#include "qemu/int128.h"
/*
+ * If __alignof(unsigned __int128) < 16, GCC may refuse to inline atomics
+ * that are supported by the host, e.g. s390x. We can force the pointer to
+ * have our known alignment with __builtin_assume_aligned, however prior to
+ * GCC 13 that was only reliable with optimization enabled. See
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107389
+ */
+#if defined(CONFIG_ATOMIC128_OPT)
+# if !defined(__OPTIMIZE__)
+# define ATTRIBUTE_ATOMIC128_OPT __attribute__((optimize("O1")))
+# endif
+# define CONFIG_ATOMIC128
+#endif
+#ifndef ATTRIBUTE_ATOMIC128_OPT
+# define ATTRIBUTE_ATOMIC128_OPT
+#endif
+
+/*
* GCC is a house divided about supporting large atomic operations.
*
* For hosts that only have large compare-and-swap, a legalistic reading