1 // SPDX-FileCopyrightText: 2020 Michael Jeanson <mjeanson@efficios.com>
3 // SPDX-License-Identifier: LGPL-2.1-or-later
5 #ifndef _URCU_UATOMIC_H
6 #define _URCU_UATOMIC_H
9 #include <urcu/compiler.h>
10 #include <urcu/config.h>
19 CMM_SEQ_CST_FENCE
= 6,
22 #ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS
25 * Make sure that CMM_SEQ_CST_FENCE is not equivalent to other memory orders.
27 urcu_static_assert(CMM_RELAXED
== __ATOMIC_RELAXED
, "", cmm_relaxed
);
28 urcu_static_assert(CMM_CONSUME
== __ATOMIC_CONSUME
, "", cmm_consume
);
29 urcu_static_assert(CMM_ACQUIRE
== __ATOMIC_ACQUIRE
, "", cmm_acquire
);
30 urcu_static_assert(CMM_RELEASE
== __ATOMIC_RELEASE
, "", cmm_release
);
31 urcu_static_assert(CMM_ACQ_REL
== __ATOMIC_ACQ_REL
, "", cmm_acq_rel
);
32 urcu_static_assert(CMM_SEQ_CST
== __ATOMIC_SEQ_CST
, "", cmm_seq_cst
);
35 * This is not part of the public API. It it used internally to implement the
36 * CMM_SEQ_CST_FENCE memory order.
38 * NOTE: Using switch here instead of if statement to avoid -Wduplicated-cond
39 * warning when memory order is conditionally determined.
41 static inline void cmm_seq_cst_fence_after_atomic(enum cmm_memorder mo
)
44 case CMM_SEQ_CST_FENCE
:
55 * This is not part of the public API. It is used internally to convert from the
56 * CMM memory model to the C11 memory model.
58 static inline int cmm_to_c11(int mo
)
60 if (mo
== CMM_SEQ_CST_FENCE
) {
66 #if defined(CONFIG_RCU_USE_ATOMIC_BUILTINS)
67 #include <urcu/uatomic/builtins.h>
68 #elif defined(URCU_ARCH_X86)
69 #include <urcu/uatomic/x86.h>
70 #elif defined(URCU_ARCH_PPC)
71 #include <urcu/uatomic/ppc.h>
72 #elif defined(URCU_ARCH_S390)
73 #include <urcu/uatomic/s390.h>
74 #elif defined(URCU_ARCH_SPARC64)
75 #include <urcu/uatomic/sparc64.h>
76 #elif defined(URCU_ARCH_ALPHA)
77 #include <urcu/uatomic/alpha.h>
78 #elif defined(URCU_ARCH_IA64)
79 #include <urcu/uatomic/ia64.h>
80 #elif defined(URCU_ARCH_ARM)
81 #include <urcu/uatomic/arm.h>
82 #elif defined(URCU_ARCH_AARCH64)
83 #include <urcu/uatomic/aarch64.h>
84 #elif defined(URCU_ARCH_MIPS)
85 #include <urcu/uatomic/mips.h>
86 #elif defined(URCU_ARCH_NIOS2)
87 #include <urcu/uatomic/nios2.h>
88 #elif defined(URCU_ARCH_TILE)
89 #include <urcu/uatomic/tile.h>
90 #elif defined(URCU_ARCH_HPPA)
91 #include <urcu/uatomic/hppa.h>
92 #elif defined(URCU_ARCH_M68K)
93 #include <urcu/uatomic/m68k.h>
94 #elif defined(URCU_ARCH_RISCV)
95 #include <urcu/uatomic/riscv.h>
97 #error "Cannot build: unrecognized architecture, see <urcu/arch.h>."
100 #endif /* _URCU_UATOMIC_H */
This page took 0.031014 seconds and 4 git commands to generate.