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/ops_gcc_aarch32_common.hpp
10  *
11  * This header contains basic utilities for gcc AArch32 backend.
12  */
13 
14 #ifndef BOOST_ATOMIC_DETAIL_OPS_GCC_AARCH32_COMMON_HPP_INCLUDED_
15 #define BOOST_ATOMIC_DETAIL_OPS_GCC_AARCH32_COMMON_HPP_INCLUDED_
16 
17 #include <boost/atomic/detail/config.hpp>
18 #include <boost/atomic/detail/capabilities.hpp>
19 
20 #ifdef BOOST_HAS_PRAGMA_ONCE
21 #pragma once
22 #endif
23 
24 #define BOOST_ATOMIC_DETAIL_AARCH32_MO_SWITCH(mo)\
25     switch (mo)\
26     {\
27     case memory_order_relaxed:\
28         BOOST_ATOMIC_DETAIL_AARCH32_MO_INSN("r", "r")\
29         break;\
30     \
31     case memory_order_consume:\
32     case memory_order_acquire:\
33         BOOST_ATOMIC_DETAIL_AARCH32_MO_INSN("a", "r")\
34         break;\
35     \
36     case memory_order_release:\
37         BOOST_ATOMIC_DETAIL_AARCH32_MO_INSN("r", "l")\
38         break;\
39     \
40     default:\
41         BOOST_ATOMIC_DETAIL_AARCH32_MO_INSN("a", "l")\
42         break;\
43     }
44 
45 #if defined(BOOST_ATOMIC_DETAIL_AARCH32_LITTLE_ENDIAN)
46 #define BOOST_ATOMIC_DETAIL_AARCH32_ASM_ARG_LO(arg) "%" BOOST_STRINGIZE(arg)
47 #define BOOST_ATOMIC_DETAIL_AARCH32_ASM_ARG_HI(arg) "%H" BOOST_STRINGIZE(arg)
48 #else
49 #define BOOST_ATOMIC_DETAIL_AARCH32_ASM_ARG_LO(arg) "%H" BOOST_STRINGIZE(arg)
50 #define BOOST_ATOMIC_DETAIL_AARCH32_ASM_ARG_HI(arg) "%" BOOST_STRINGIZE(arg)
51 #endif
52 
53 #endif // BOOST_ATOMIC_DETAIL_OPS_GCC_AARCH32_COMMON_HPP_INCLUDED_
54