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_aarch64.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_AARCH64_HPP_INCLUDED_ 15 #define BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_GCC_AARCH64_HPP_INCLUDED_ 16 17 #include <boost/memory_order.hpp> 18 #include <boost/atomic/detail/config.hpp> 19 #include <boost/atomic/detail/header.hpp> 20 21 #ifdef BOOST_HAS_PRAGMA_ONCE 22 #pragma once 23 #endif 24 25 namespace boost { 26 namespace atomics { 27 namespace detail { 28 29 //! Fence operations for AArch64 30 struct fence_arch_operations_gcc_aarch64 31 { thread_fenceboost::atomics::detail::fence_arch_operations_gcc_aarch6432 static BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT 33 { 34 if (order != memory_order_relaxed) 35 { 36 if (order == memory_order_consume || order == memory_order_acquire) 37 __asm__ __volatile__ ("dmb ishld\n\t" ::: "memory"); 38 else 39 __asm__ __volatile__ ("dmb ish\n\t" ::: "memory"); 40 } 41 } 42 signal_fenceboost::atomics::detail::fence_arch_operations_gcc_aarch6443 static BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT 44 { 45 if (order != memory_order_relaxed) 46 __asm__ __volatile__ ("" ::: "memory"); 47 } 48 }; 49 50 typedef fence_arch_operations_gcc_aarch64 fence_arch_operations; 51 52 } // namespace detail 53 } // namespace atomics 54 } // namespace boost 55 56 #include <boost/atomic/detail/footer.hpp> 57 58 #endif // BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_GCC_AARCH64_HPP_INCLUDED_ 59