66
67 #define inlasm_sync() __asm__ __volatile__ ("sync" : : : "memory");
68 #define inlasm_lwsync() __asm__ __volatile__ ("lwsync" : : : "memory");
69 #define inlasm_eieio() __asm__ __volatile__ ("eieio" : : : "memory");
70 #define inlasm_isync() __asm__ __volatile__ ("isync" : : : "memory");
71 // Use twi-isync for load_acquire (faster than lwsync).
72 #define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory");
73
74 inline void OrderAccess::loadload() { inlasm_lwsync(); }
75 inline void OrderAccess::storestore() { inlasm_lwsync(); }
76 inline void OrderAccess::loadstore() { inlasm_lwsync(); }
77 inline void OrderAccess::storeload() { inlasm_sync(); }
78
79 inline void OrderAccess::acquire() { inlasm_lwsync(); }
80 inline void OrderAccess::release() { inlasm_lwsync(); }
81 inline void OrderAccess::fence() { inlasm_sync(); }
82
83
84 template<size_t byte_size>
85 struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
86 VALUE_OBJ_CLASS_SPEC
87 {
88 template <typename T>
89 T operator()(const volatile T* p) const { register T t = Atomic::load(p); inlasm_acquire_reg(t); return t; }
90 };
91
92 #undef inlasm_sync
93 #undef inlasm_lwsync
94 #undef inlasm_eieio
95 #undef inlasm_isync
96 #undef inlasm_acquire_reg
97
98 #endif // OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP
|
66
67 #define inlasm_sync() __asm__ __volatile__ ("sync" : : : "memory");
68 #define inlasm_lwsync() __asm__ __volatile__ ("lwsync" : : : "memory");
69 #define inlasm_eieio() __asm__ __volatile__ ("eieio" : : : "memory");
70 #define inlasm_isync() __asm__ __volatile__ ("isync" : : : "memory");
71 // Use twi-isync for load_acquire (faster than lwsync).
72 #define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory");
73
74 inline void OrderAccess::loadload() { inlasm_lwsync(); }
75 inline void OrderAccess::storestore() { inlasm_lwsync(); }
76 inline void OrderAccess::loadstore() { inlasm_lwsync(); }
77 inline void OrderAccess::storeload() { inlasm_sync(); }
78
79 inline void OrderAccess::acquire() { inlasm_lwsync(); }
80 inline void OrderAccess::release() { inlasm_lwsync(); }
81 inline void OrderAccess::fence() { inlasm_sync(); }
82
83
84 template<size_t byte_size>
85 struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
86 {
87 template <typename T>
88 T operator()(const volatile T* p) const { register T t = Atomic::load(p); inlasm_acquire_reg(t); return t; }
89 };
90
91 #undef inlasm_sync
92 #undef inlasm_lwsync
93 #undef inlasm_eieio
94 #undef inlasm_isync
95 #undef inlasm_acquire_reg
96
97 #endif // OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP
|