]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/atomic/detail/hwcaps_gcc_arm.hpp
buildsys: switch source download to quincy
[ceph.git] / ceph / src / boost / boost / atomic / detail / hwcaps_gcc_arm.hpp
1 /*
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)
5 *
6 * Copyright (c) 2017 Andrey Semashev
7 */
8 /*!
9 * \file atomic/detail/hwcaps_gcc_arm.hpp
10 *
11 * This header defines hardware capabilities macros for ARM
12 */
13
14 #ifndef BOOST_ATOMIC_DETAIL_HWCAPS_GCC_ARM_HPP_INCLUDED_
15 #define BOOST_ATOMIC_DETAIL_HWCAPS_GCC_ARM_HPP_INCLUDED_
16
17 #include <boost/atomic/detail/config.hpp>
18 #include <boost/atomic/detail/platform.hpp>
19
20 #ifdef BOOST_HAS_PRAGMA_ONCE
21 #pragma once
22 #endif
23
24 #if defined(__GNUC__) && defined(__arm__) && (BOOST_ATOMIC_DETAIL_ARM_ARCH+0) >= 6
25
26 #if BOOST_ATOMIC_DETAIL_ARM_ARCH > 6
27 // ARMv7 and later have dmb instruction
28 #define BOOST_ATOMIC_DETAIL_ARM_HAS_DMB 1
29 #endif
30
31 #if defined(__ARM_FEATURE_LDREX)
32
33 #if (__ARM_FEATURE_LDREX & 1)
34 #define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXB_STREXB 1
35 #endif
36 #if (__ARM_FEATURE_LDREX & 2)
37 #define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXH_STREXH 1
38 #endif
39 #if (__ARM_FEATURE_LDREX & 8)
40 #define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXD_STREXD 1
41 #endif
42
43 #else // defined(__ARM_FEATURE_LDREX)
44
45 #if !(defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6Z__))
46
47 // ARMv6k and ARMv7 have 8 and 16-bit ldrex/strex variants, but at least GCC 4.7 fails to compile them. GCC 4.9 is known to work.
48 #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 409
49 #define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXB_STREXB 1
50 #define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXH_STREXH 1
51 #endif
52
53 #if !(((defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__)) && defined(__thumb__)) || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7M__))
54 // ARMv6k and ARMv7 except ARMv7-M have 64-bit ldrex/strex variants.
55 // Unfortunately, GCC (at least 4.7.3 on Ubuntu) does not allocate register pairs properly when targeting ARMv6k Thumb,
56 // which is required for ldrexd/strexd instructions, so we disable 64-bit support. When targeting ARMv6k ARM
57 // or ARMv7 (both ARM and Thumb 2) it works as expected.
58 #define BOOST_ATOMIC_DETAIL_ARM_HAS_LDREXD_STREXD 1
59 #endif
60
61 #endif // !(defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6Z__))
62
63 #endif // defined(__ARM_FEATURE_LDREX)
64
65 #endif // defined(__GNUC__) && defined(__arm__) && (BOOST_ATOMIC_DETAIL_ARM_ARCH+0) >= 6
66
67 #endif // BOOST_ATOMIC_DETAIL_HWCAPS_GCC_ARM_HPP_INCLUDED_