summaryrefslogtreecommitdiff
path: root/boost/atomic/detail/config.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/atomic/detail/config.hpp')
-rw-r--r--boost/atomic/detail/config.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/boost/atomic/detail/config.hpp b/boost/atomic/detail/config.hpp
index 6b0e418693..489281c2b4 100644
--- a/boost/atomic/detail/config.hpp
+++ b/boost/atomic/detail/config.hpp
@@ -21,6 +21,30 @@
#pragma once
#endif
+#if defined(__has_builtin)
+#if __has_builtin(__builtin_memcpy)
+#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
+#endif
+#if __has_builtin(__builtin_memcmp)
+#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
+#endif
+#elif defined(BOOST_GCC)
+#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
+#define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
+#endif
+
+#if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY)
+#define BOOST_ATOMIC_DETAIL_MEMCPY __builtin_memcpy
+#else
+#define BOOST_ATOMIC_DETAIL_MEMCPY std::memcpy
+#endif
+
+#if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP)
+#define BOOST_ATOMIC_DETAIL_MEMCMP __builtin_memcmp
+#else
+#define BOOST_ATOMIC_DETAIL_MEMCMP std::memcmp
+#endif
+
#if defined(__CUDACC__)
// nvcc does not support alternatives in asm statement constraints
#define BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES
@@ -36,4 +60,16 @@
#define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA
#endif
+#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 403)
+// This macro indicates we're using older binutils that don't support implied zero displacements for memory opereands,
+// making code like this invalid:
+// movl 4+(%%edx), %%eax
+#define BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS
+#endif
+
+#if defined(__clang__) || (defined(BOOST_GCC) && (BOOST_GCC+0) < 40500)
+// This macro indicates that the compiler does not support allocating rax:rdx register pairs ("A") in asm blocks
+#define BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS
+#endif
+
#endif // BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_