| ... | ... | @@ -225,7 +225,12 @@ typedef char bool; |
| 225 | 225 | #define zig_atomicrmw_max(obj, arg, order, type) zig_expand_concat(zig_msvc_atomicrmw_max_, type)(obj, arg) |
| 226 | 226 | #define zig_atomic_store(obj, arg, order, type) zig_expand_concat(zig_msvc_atomic_store_, type)(obj, arg) |
| 227 | 227 | #define zig_atomic_load(obj, order, type) zig_expand_concat(zig_msvc_atomic_load_, type)(obj) |
| 228 | #if _M_X64 |
| 228 | 229 | #define zig_fence(order) __faststorefence() |
| 230 | #else |
| 231 | #define zig_fence(order) zig_msvc_atomic_barrier() |
| 232 | #endif |
| 233 | |
| 229 | 234 | // TODO: _MSC_VER && (_M_ARM || _M_ARM64) |
| 230 | 235 | #else |
| 231 | 236 | #define memory_order_relaxed 0 |
| ... | ... | @@ -2271,6 +2276,13 @@ zig_msvc_flt_atomics(f64, u64, 64) |
| 2271 | 2276 | #endif |
| 2272 | 2277 | |
| 2273 | 2278 | #if _M_IX86 |
| 2279 | static inline void zig_msvc_atomic_barrier() { |
| 2280 | zig_i32 barrier; |
| 2281 | __asm { |
| 2282 | xchg barrier, eax |
| 2283 | } |
| 2284 | } |
| 2285 | |
| 2274 | 2286 | static inline void* zig_msvc_atomicrmw_xchg_p32(void** obj, zig_u32* arg) { |
| 2275 | 2287 | return _InterlockedExchangePointer(obj, arg); |
| 2276 | 2288 | } |
| ... | ... | @@ -2279,7 +2291,7 @@ static inline void zig_msvc_atomic_store_p32(void** obj, zig_u32* arg) { |
| 2279 | 2291 | _InterlockedExchangePointer(obj, arg); |
| 2280 | 2292 | } |
| 2281 | 2293 | |
| 2282 | | static inline void* zig_msvc_atomic_load_p32(void** obj, zig_u32* arg) { |
| 2294 | static inline void* zig_msvc_atomic_load_p32(void** obj) { |
| 2283 | 2295 | return (void*)_InterlockedOr((void*)obj, 0); |
| 2284 | 2296 | } |
| 2285 | 2297 | |