ops_gcc_arm_common.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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) 2009 Helge Bahmann
  7. * Copyright (c) 2013 Tim Blechmann
  8. * Copyright (c) 2014 Andrey Semashev
  9. */
  10. /*!
  11. * \file atomic/detail/ops_gcc_arm_common.hpp
  12. *
  13. * This header contains basic utilities for gcc ARM backend.
  14. */
  15. #ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_ARM_COMMON_HPP_INCLUDED_
  16. #define BOOST_ATOMIC_DETAIL_OPS_GCC_ARM_COMMON_HPP_INCLUDED_
  17. #include <boost/cstdint.hpp>
  18. #include <boost/memory_order.hpp>
  19. #include <boost/atomic/detail/config.hpp>
  20. #include <boost/atomic/detail/fence_arch_operations.hpp>
  21. #include <boost/atomic/detail/header.hpp>
  22. #ifdef BOOST_HAS_PRAGMA_ONCE
  23. #pragma once
  24. #endif
  25. namespace boost {
  26. namespace atomics {
  27. namespace detail {
  28. struct core_arch_operations_gcc_arm_base
  29. {
  30. static BOOST_CONSTEXPR_OR_CONST bool full_cas_based = false;
  31. static BOOST_CONSTEXPR_OR_CONST bool is_always_lock_free = true;
  32. static BOOST_FORCEINLINE void fence_before(memory_order order) BOOST_NOEXCEPT
  33. {
  34. if ((static_cast< unsigned int >(order) & static_cast< unsigned int >(memory_order_release)) != 0u)
  35. fence_arch_operations::hardware_full_fence();
  36. }
  37. static BOOST_FORCEINLINE void fence_after(memory_order order) BOOST_NOEXCEPT
  38. {
  39. if ((static_cast< unsigned int >(order) & (static_cast< unsigned int >(memory_order_consume) | static_cast< unsigned int >(memory_order_acquire))) != 0u)
  40. fence_arch_operations::hardware_full_fence();
  41. }
  42. static BOOST_FORCEINLINE void fence_after_store(memory_order order) BOOST_NOEXCEPT
  43. {
  44. if (order == memory_order_seq_cst)
  45. fence_arch_operations::hardware_full_fence();
  46. }
  47. };
  48. } // namespace detail
  49. } // namespace atomics
  50. } // namespace boost
  51. #include <boost/atomic/detail/footer.hpp>
  52. #endif // BOOST_ATOMIC_DETAIL_OPS_GCC_ARM_COMMON_HPP_INCLUDED_