diff options
author | Owen Anderson <resistor@mac.com> | 2009-06-23 20:17:22 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-06-23 20:17:22 +0000 |
commit | ac637c60998dded7d0051f17b27db78d99510f5b (patch) | |
tree | 4daa65427ce630a0a020fb9ca1d426187ab98aa3 /lib/System/Atomic.cpp | |
parent | 16b38426a8d255a8fc0a01bb2027a70d37d5e533 (diff) | |
download | external_llvm-ac637c60998dded7d0051f17b27db78d99510f5b.zip external_llvm-ac637c60998dded7d0051f17b27db78d99510f5b.tar.gz external_llvm-ac637c60998dded7d0051f17b27db78d99510f5b.tar.bz2 |
Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
we care about are capable of supporting it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73993 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Atomic.cpp')
-rw-r--r-- | lib/System/Atomic.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/lib/System/Atomic.cpp b/lib/System/Atomic.cpp index fda2708..6e751a3 100644 --- a/lib/System/Atomic.cpp +++ b/lib/System/Atomic.cpp @@ -35,11 +35,11 @@ void sys::MemoryFence() { #endif } -uint32_t sys::CompareAndSwap32(volatile uint32_t* ptr, - uint32_t new_value, - uint32_t old_value) { +sys::cas_flag sys::CompareAndSwap(volatile sys::cas_flag* ptr, + sys::cas_flag new_value, + sys::cas_flag old_value) { #if LLVM_MULTITHREADED==0 - uint32_t result = *ptr; + sys::cas_flag result = *ptr; if (result == old_value) *ptr = new_value; return result; @@ -52,7 +52,7 @@ uint32_t sys::CompareAndSwap32(volatile uint32_t* ptr, #endif } -int32_t sys::AtomicIncrement32(volatile int32_t* ptr) { +sys::cas_flag sys::AtomicIncrement(volatile sys::cas_flag* ptr) { #if LLVM_MULTITHREADED==0 ++(*ptr); return *ptr; @@ -65,7 +65,7 @@ int32_t sys::AtomicIncrement32(volatile int32_t* ptr) { #endif } -int32_t sys::AtomicDecrement32(volatile int32_t* ptr) { +sys::cas_flag sys::AtomicDecrement(volatile sys::cas_flag* ptr) { #if LLVM_MULTITHREADED==0 --(*ptr); return *ptr; @@ -78,7 +78,7 @@ int32_t sys::AtomicDecrement32(volatile int32_t* ptr) { #endif } -int32_t sys::AtomicAdd32(volatile int32_t* ptr, int32_t val) { +sys::cas_flag sys::AtomicAdd(volatile sys::cas_flag* ptr, sys::cas_flag val) { #if LLVM_MULTITHREADED==0 *ptr += val; return *ptr; @@ -91,16 +91,4 @@ int32_t sys::AtomicAdd32(volatile int32_t* ptr, int32_t val) { #endif } -int64_t sys::AtomicAdd64(volatile int64_t* ptr, int64_t val) { -#if LLVM_MULTITHREADED==0 - *ptr += val; - return *ptr; -#elif defined(__GNUC__) - return __sync_add_and_fetch(ptr, val); -#elif defined(_MSC_VER) - return InterlockedAdd64(ptr, val); -#else -# error No atomic add implementation for your platform! -#endif -} |