diff options
Diffstat (limited to 'contrib/llvm/lib/Support/Atomic.cpp')
-rw-r--r-- | contrib/llvm/lib/Support/Atomic.cpp | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/contrib/llvm/lib/Support/Atomic.cpp b/contrib/llvm/lib/Support/Atomic.cpp index ac4ff3e..80550e2 100644 --- a/contrib/llvm/lib/Support/Atomic.cpp +++ b/contrib/llvm/lib/Support/Atomic.cpp @@ -56,62 +56,3 @@ sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr, # error No compare-and-swap implementation for your platform! #endif } - -sys::cas_flag sys::AtomicIncrement(volatile sys::cas_flag* ptr) { -#if LLVM_HAS_ATOMICS == 0 - ++(*ptr); - return *ptr; -#elif defined(GNU_ATOMICS) - return __sync_add_and_fetch(ptr, 1); -#elif defined(_MSC_VER) - return InterlockedIncrement(ptr); -#else -# error No atomic increment implementation for your platform! -#endif -} - -sys::cas_flag sys::AtomicDecrement(volatile sys::cas_flag* ptr) { -#if LLVM_HAS_ATOMICS == 0 - --(*ptr); - return *ptr; -#elif defined(GNU_ATOMICS) - return __sync_sub_and_fetch(ptr, 1); -#elif defined(_MSC_VER) - return InterlockedDecrement(ptr); -#else -# error No atomic decrement implementation for your platform! -#endif -} - -sys::cas_flag sys::AtomicAdd(volatile sys::cas_flag* ptr, sys::cas_flag val) { -#if LLVM_HAS_ATOMICS == 0 - *ptr += val; - return *ptr; -#elif defined(GNU_ATOMICS) - return __sync_add_and_fetch(ptr, val); -#elif defined(_MSC_VER) - return InterlockedExchangeAdd(ptr, val) + val; -#else -# error No atomic add implementation for your platform! -#endif -} - -sys::cas_flag sys::AtomicMul(volatile sys::cas_flag* ptr, sys::cas_flag val) { - sys::cas_flag original, result; - do { - original = *ptr; - result = original * val; - } while (sys::CompareAndSwap(ptr, result, original) != original); - - return result; -} - -sys::cas_flag sys::AtomicDiv(volatile sys::cas_flag* ptr, sys::cas_flag val) { - sys::cas_flag original, result; - do { - original = *ptr; - result = original / val; - } while (sys::CompareAndSwap(ptr, result, original) != original); - - return result; -} |