mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 06:24:57 +00:00
Fixes the Atomic implementation if compiled by MSVC compiler.
sys::cas_flag should be long on this platform, InterlockedAdd() is defined only for the Itanium architecture (according to MSDN). Patch by Michael Beck! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90748 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -20,7 +20,11 @@ namespace llvm {
|
|||||||
namespace sys {
|
namespace sys {
|
||||||
void MemoryFence();
|
void MemoryFence();
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
typedef long cas_flag;
|
||||||
|
#else
|
||||||
typedef uint32_t cas_flag;
|
typedef uint32_t cas_flag;
|
||||||
|
#endif
|
||||||
cas_flag CompareAndSwap(volatile cas_flag* ptr,
|
cas_flag CompareAndSwap(volatile cas_flag* ptr,
|
||||||
cas_flag new_value,
|
cas_flag new_value,
|
||||||
cas_flag old_value);
|
cas_flag old_value);
|
||||||
|
@ -85,7 +85,7 @@ sys::cas_flag sys::AtomicAdd(volatile sys::cas_flag* ptr, sys::cas_flag val) {
|
|||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
return __sync_add_and_fetch(ptr, val);
|
return __sync_add_and_fetch(ptr, val);
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
return InterlockedAdd(ptr, val);
|
return InterlockedExchangeAdd(ptr, val) + val;
|
||||||
#else
|
#else
|
||||||
# error No atomic add implementation for your platform!
|
# error No atomic add implementation for your platform!
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user