2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
6 * Copyright (c) 2012 Hartmut Kaiser
7 * Copyright (c) 2014 Andrey Semashev
10 * \file atomic/detail/config.hpp
12 * This header defines configuraion macros for Boost.Atomic
15 #ifndef BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
16 #define BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_
18 #include <boost/config.hpp>
20 #ifdef BOOST_HAS_PRAGMA_ONCE
24 #if defined(__has_builtin)
25 #if __has_builtin(__builtin_memcpy)
26 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
28 #if __has_builtin(__builtin_memcmp)
29 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
31 #elif defined(BOOST_GCC)
32 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
33 #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
36 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY)
37 #define BOOST_ATOMIC_DETAIL_MEMCPY __builtin_memcpy
39 #define BOOST_ATOMIC_DETAIL_MEMCPY std::memcpy
42 #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP)
43 #define BOOST_ATOMIC_DETAIL_MEMCMP __builtin_memcmp
45 #define BOOST_ATOMIC_DETAIL_MEMCMP std::memcmp
48 #if defined(__CUDACC__)
49 // nvcc does not support alternatives in asm statement constraints
50 #define BOOST_ATOMIC_DETAIL_NO_ASM_CONSTRAINT_ALTERNATIVES
51 // nvcc does not support condition code register ("cc") clobber in asm statements
52 #define BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC
55 #if !defined(BOOST_ATOMIC_DETAIL_NO_ASM_CLOBBER_CC)
56 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC "cc"
57 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "cc",
59 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC
60 #define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA
63 #if ((defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 403)) ||\
65 // This macro indicates we're using older binutils that don't support implied zero displacements for memory opereands,
66 // making code like this invalid:
67 // movl 4+(%%edx), %%eax
68 #define BOOST_ATOMIC_DETAIL_NO_ASM_IMPLIED_ZERO_DISPLACEMENTS
71 #if defined(__clang__) || (defined(BOOST_GCC) && (BOOST_GCC+0) < 40500) || defined(__SUNPRO_CC)
72 // This macro indicates that the compiler does not support allocating rax:rdx register pairs ("A") in asm blocks
73 #define BOOST_ATOMIC_DETAIL_NO_ASM_RAX_RDX_PAIRS
76 #endif // BOOST_ATOMIC_DETAIL_CONFIG_HPP_INCLUDED_