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
10 #include <urcu/arch.h>
11 #include <urcu/config.h>
20 CMM_SEQ_CST_FENCE
= 6,
23 #ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS
26 * Make sure that CMM_SEQ_CST_FENCE is not equivalent to other memory orders.
29 static_assert(CMM_RELAXED
== __ATOMIC_RELAXED
, "");
30 static_assert(CMM_CONSUME
== __ATOMIC_CONSUME
, "");
31 static_assert(CMM_ACQUIRE
== __ATOMIC_ACQUIRE
, "");
32 static_assert(CMM_RELEASE
== __ATOMIC_RELEASE
, "");
33 static_assert(CMM_ACQ_REL
== __ATOMIC_ACQ_REL
, "");
34 static_assert(CMM_SEQ_CST
== __ATOMIC_SEQ_CST
, "");
38 * This is not part of the public API. It it used internally to implement the
39 * CMM_SEQ_CST_FENCE memory order.
41 * NOTE: Using switch here instead of if statement to avoid -Wduplicated-cond
42 * warning when memory order is conditionally determined.
44 static inline void cmm_seq_cst_fence_after_atomic(enum cmm_memorder mo
)
47 case CMM_SEQ_CST_FENCE
:
58 * This is not part of the public API. It is used internally to convert from the
59 * CMM memory model to the C11 memory model.
61 static inline int cmm_to_c11(int mo
)
63 if (mo
== CMM_SEQ_CST_FENCE
) {
69 #if defined(CONFIG_RCU_USE_ATOMIC_BUILTINS)
70 #include <urcu/uatomic/builtins.h>
71 #elif defined(URCU_ARCH_X86)
72 #include <urcu/uatomic/x86.h>
73 #elif defined(URCU_ARCH_PPC)
74 #include <urcu/uatomic/ppc.h>
75 #elif defined(URCU_ARCH_S390)
76 #include <urcu/uatomic/s390.h>
77 #elif defined(URCU_ARCH_SPARC64)
78 #include <urcu/uatomic/sparc64.h>
79 #elif defined(URCU_ARCH_ALPHA)
80 #include <urcu/uatomic/alpha.h>
81 #elif defined(URCU_ARCH_IA64)
82 #include <urcu/uatomic/ia64.h>
83 #elif defined(URCU_ARCH_ARM)
84 #include <urcu/uatomic/arm.h>
85 #elif defined(URCU_ARCH_AARCH64)
86 #include <urcu/uatomic/aarch64.h>
87 #elif defined(URCU_ARCH_MIPS)
88 #include <urcu/uatomic/mips.h>
89 #elif defined(URCU_ARCH_NIOS2)
90 #include <urcu/uatomic/nios2.h>
91 #elif defined(URCU_ARCH_TILE)
92 #include <urcu/uatomic/tile.h>
93 #elif defined(URCU_ARCH_HPPA)
94 #include <urcu/uatomic/hppa.h>
95 #elif defined(URCU_ARCH_M68K)
96 #include <urcu/uatomic/m68k.h>
97 #elif defined(URCU_ARCH_RISCV)
98 #include <urcu/uatomic/riscv.h>
100 #error "Cannot build: unrecognized architecture, see <urcu/arch.h>."
103 #endif /* _URCU_UATOMIC_H */
This page took 0.032092 seconds and 4 git commands to generate.