]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/atomic/detail/fence_arch_ops_msvc_arm.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / atomic / detail / fence_arch_ops_msvc_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) 2020 Andrey Semashev
7 */
8 /*!
9 * \file atomic/detail/fence_arch_ops_msvc_arm.hpp
10 *
11 * This header contains implementation of the \c fence_arch_operations struct.
12 */
13
14 #ifndef BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_MSVC_ARM_HPP_INCLUDED_
15 #define BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_MSVC_ARM_HPP_INCLUDED_
16
17 #include <boost/memory_order.hpp>
18 #include <boost/atomic/detail/config.hpp>
19 #include <boost/atomic/detail/ops_msvc_common.hpp>
20 #include <boost/atomic/detail/header.hpp>
21
22 #ifdef BOOST_HAS_PRAGMA_ONCE
23 #pragma once
24 #endif
25
26 extern "C" void __dmb(unsigned int);
27 #if defined(BOOST_MSVC)
28 #pragma intrinsic(__dmb)
29 #endif
30
31 namespace boost {
32 namespace atomics {
33 namespace detail {
34
35 //! Fence operations for ARM
36 struct fence_arch_operations_msvc_arm
37 {
38 static BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
39 {
40 BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
41 if (order != memory_order_relaxed)
42 hardware_full_fence();
43 BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
44 }
45
46 static BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
47 {
48 if (order != memory_order_relaxed)
49 BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
50 }
51
52 static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
53 {
54 __dmb(0xB); // _ARM_BARRIER_ISH, see armintr.h from MSVC 11 and later
55 }
56 };
57
58 typedef fence_arch_operations_msvc_arm fence_arch_operations;
59
60 } // namespace detail
61 } // namespace atomics
62 } // namespace boost
63
64 #include <boost/atomic/detail/footer.hpp>
65
66 #endif // BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_MSVC_ARM_HPP_INCLUDED_