1 /* FIXME. This is only a placeholder for the AIX compiler. */
2 /* It doesn't work. Please send a patch. */
3 /* Memory model documented at http://www-106.ibm.com/developerworks/ */
4 /* eserver/articles/archguide.html and (clearer) */
5 /* http://www-106.ibm.com/developerworks/eserver/articles/powerpc.html. */
6 /* There appears to be no implicit ordering between any kind of */
7 /* independent memory references. */
8 /* Architecture enforces some ordering based on control dependence. */
9 /* I don't know if that could help. */
10 /* Data-dependent loads are always ordered. */
11 /* Based on the above references, eieio is intended for use on */
12 /* uncached memory, which we don't support. It does not order loads */
13 /* from cached memory. */
14 /* Thanks to Maged Michael, Doug Lea, and Roger Hoover for helping to */
15 /* track some of this down and correcting my misunderstandings. -HB */
17 #include "../all_aligned_atomic_load_store.h"
20 #pragma mc_func AO_sync { "7c0004ac" }
23 #pragma mc_func AO_lwsync { "7c2004ac" }
25 #define AO_nop_write() AO_lwsync()
26 #define AO_HAVE_nop_write
28 #define AO_nop_read() AO_lwsync()
29 #define AO_HAVE_nop_read
31 /* We explicitly specify load_acquire and store_release, since these */
32 /* rely on the fact that lwsync is also a LoadStore barrier. */
34 AO_load_acquire(const volatile AO_t *addr)
41 #define AO_HAVE_load_acquire
44 AO_store_release(volatile AO_t *addr, AO_t value)
50 #define AO_HAVE_load_acquire
52 /* This is similar to the code in the garbage collector. Deleting */
53 /* this and having it synthesized from compare_and_swap would probably */
54 /* only cost us a load immediate instruction. */
56 AO_test_and_set(volatile AO_TS_t *addr) {
60 #define AO_have_test_and_set
63 AO_test_and_set_acquire(volatile AO_TS_t *addr) {
64 AO_TS_VAL_t result = AO_test_and_set(addr);
69 #define AO_HAVE_test_and_set_acquire
72 AO_test_and_set_release(volatile AO_TS_t *addr) {
74 return AO_test_and_set(addr);
77 #define AO_HAVE_test_and_set_release
80 AO_test_and_set_full(volatile AO_TS_t *addr) {
83 result = AO_test_and_set(addr);
88 #define AO_HAVE_test_and_set_full
91 AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val) {
95 #define AO_HAVE_compare_and_swap
98 AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val) {
99 AO_t result = AO_compare_and_swap(addr, old, new_val);
104 #define AO_HAVE_compare_and_swap_acquire
107 AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val) {
109 return AO_compare_and_swap(addr, old, new_val);
112 #define AO_HAVE_compare_and_swap_release
115 AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) {
118 result = AO_compare_and_swap(addr, old, new_val);
123 #define AO_HAVE_compare_and_swap_full
125 /* FIXME: We should also implement fetch_and_add and or primitives */