diff options
Diffstat (limited to 'include/qemu')
-rw-r--r-- | include/qemu/atomic128.h | 17 |
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 |