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_gcc_aarch32.hpp 10 * 11 * This header contains implementation of the \c fence_arch_operations struct. 12 */ 13 14 #ifndef BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_GCC_AARCH32_HPP_INCLUDED_ 15 #define BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_GCC_AARCH32_HPP_INCLUDED_ 16 17 #include <boost/cstdint.hpp> 18 #include <boost/memory_order.hpp> 19 #include <boost/atomic/detail/config.hpp> 20 #include <boost/atomic/detail/capabilities.hpp> 21 #include <boost/atomic/detail/header.hpp> 22 23 #ifdef BOOST_HAS_PRAGMA_ONCE 24 #pragma once 25 #endif 26 27 namespace boost { 28 namespace atomics { 29 namespace detail { 30 31 //! Fence operations for AArch32 32 struct fence_arch_operations_gcc_aarch32 33 { thread_fenceboost::atomics::detail::fence_arch_operations_gcc_aarch3234 static BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT 35 { 36 if (order != memory_order_relaxed) 37 { 38 if (order == memory_order_consume || order == memory_order_acquire) 39 __asm__ __volatile__ ("dmb ishld\n\t" ::: "memory"); 40 else 41 __asm__ __volatile__ ("dmb ish\n\t" ::: "memory"); 42 } 43 } 44 signal_fenceboost::atomics::detail::fence_arch_operations_gcc_aarch3245 static BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT 46 { 47 if (order != memory_order_relaxed) 48 __asm__ __volatile__ ("" ::: "memory"); 49 } 50 }; 51 52 typedef fence_arch_operations_gcc_aarch32 fence_arch_operations; 53 54 } // namespace detail 55 } // namespace atomics 56 } // namespace boost 57 58 #include <boost/atomic/detail/footer.hpp> 59 60 #endif // BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_GCC_AARCH32_HPP_INCLUDED_ 61