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) 2020 Andrey Semashev
9 * \file atomic/detail/fence_arch_ops_msvc_arm.hpp
11 * This header contains implementation of the \c fence_arch_operations struct.
14 #ifndef BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_MSVC_ARM_HPP_INCLUDED_
15 #define BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_MSVC_ARM_HPP_INCLUDED_
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>
22 #ifdef BOOST_HAS_PRAGMA_ONCE
26 extern "C" void __dmb(unsigned int);
27 #if defined(BOOST_MSVC)
28 #pragma intrinsic(__dmb)
35 //! Fence operations for ARM
36 struct fence_arch_operations_msvc_arm
38 static BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
40 BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
41 if (order != memory_order_relaxed)
42 hardware_full_fence();
43 BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
46 static BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
48 if (order != memory_order_relaxed)
49 BOOST_ATOMIC_DETAIL_COMPILER_BARRIER();
52 static BOOST_FORCEINLINE void hardware_full_fence() BOOST_NOEXCEPT
54 __dmb(0xB); // _ARM_BARRIER_ISH, see armintr.h from MSVC 11 and later
58 typedef fence_arch_operations_msvc_arm fence_arch_operations;
61 } // namespace atomics
64 #include <boost/atomic/detail/footer.hpp>
66 #endif // BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_MSVC_ARM_HPP_INCLUDED_