uatomic/x86: Remove redundant memory barriers
[urcu.git] / include / urcu / system.h
index 8816c50c924e07293aabf72af9a615046c85ef77..139c37f6d474a646141bb0650b6f8c936061a9a2 100644 (file)
@@ -9,9 +9,29 @@
  * System definitions.
  */
 
+#include <urcu/config.h>
 #include <urcu/compiler.h>
 #include <urcu/arch.h>
 
+#ifdef CONFIG_RCU_USE_ATOMIC_BUILTINS
+
+#define CMM_LOAD_SHARED(x)                                             \
+       __atomic_load_n(cmm_cast_volatile(&(x)), __ATOMIC_RELAXED)
+
+#define _CMM_LOAD_SHARED(x) CMM_LOAD_SHARED(x)
+
+#define CMM_STORE_SHARED(x, v)                                 \
+       __extension__                                           \
+       ({                                                      \
+               __typeof__(v) _v = (v);                         \
+               __atomic_store_n(cmm_cast_volatile(&(x)), _v,   \
+                                __ATOMIC_RELAXED);             \
+               _v;                                             \
+       })
+
+#define _CMM_STORE_SHARED(x, v) CMM_STORE_SHARED(x, v)
+
+#else
 /*
  * Identify a shared load. A cmm_smp_rmc() or cmm_smp_mc() should come
  * before the load.
@@ -46,4 +66,6 @@
                _v = _v;        /* Work around clang "unused result" */ \
        })
 
+#endif /* CONFIG_RCU_USE_ATOMIC_BUILTINS */
+
 #endif /* _URCU_SYSTEM_H */
This page took 0.023406 seconds and 4 git commands to generate.