[llvm-commits] [compiler-rt] r171968 - /compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h
Timur Iskhodzhanov
timurrrr at google.com
Wed Jan 9 04:03:27 PST 2013
Author: timurrrr
Date: Wed Jan 9 06:03:27 2013
New Revision: 171968
URL: http://llvm.org/viewvc/llvm-project?rev=171968&view=rev
Log:
[ASan/Win] Unbreak the 32-bit RTL build
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h?rev=171968&r1=171967&r2=171968&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_msvc.h Wed Jan 9 06:03:27 2013
@@ -24,10 +24,31 @@
extern "C" long _InterlockedExchangeAdd( // NOLINT
long volatile * Addend, long Value); // NOLINT
#pragma intrinsic(_InterlockedExchangeAdd)
+
+#ifdef _WIN64
extern "C" void *_InterlockedCompareExchangePointer(
void *volatile *Destination,
void *Exchange, void *Comparand);
#pragma intrinsic(_InterlockedCompareExchangePointer)
+#else
+// There's no _InterlockedCompareExchangePointer intrinsic on x86,
+// so call _InterlockedCompareExchange instead.
+extern "C"
+long __cdecl _InterlockedCompareExchange(
+ long volatile *Destination,
+ long Exchange, long Comparand);
+#pragma intrinsic(_InterlockedCompareExchange)
+
+inline static void *_InterlockedCompareExchangePointer(
+ void *volatile *Destination,
+ void *Exchange, void *Comparand) {
+ return reinterpret_cast<void*>(
+ _InterlockedCompareExchange(
+ reinterpret_cast<long volatile*>(Destination),
+ reinterpret_cast<long>(Exchange),
+ reinterpret_cast<long>(Comparand)));
+}
+#endif
namespace __sanitizer {
More information about the llvm-commits
mailing list