[llvm-commits] [llvm] r90683 - /llvm/trunk/cmake/modules/CheckAtomic.cmake
Oscar Fuentes
ofv at wanadoo.es
Sat Dec 5 15:19:33 PST 2009
Author: ofv
Date: Sat Dec 5 17:19:33 2009
New Revision: 90683
URL: http://llvm.org/viewvc/llvm-project?rev=90683&view=rev
Log:
Fix for atomic intrinsics detection when using MSVC.
Patch by Michael Beck!
Modified:
llvm/trunk/cmake/modules/CheckAtomic.cmake
Modified: llvm/trunk/cmake/modules/CheckAtomic.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CheckAtomic.cmake?rev=90683&r1=90682&r2=90683&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/CheckAtomic.cmake (original)
+++ llvm/trunk/cmake/modules/CheckAtomic.cmake Sat Dec 5 17:19:33 2009
@@ -1,14 +1,26 @@
# atomic builtins are required for threading support.
INCLUDE(CheckCXXSourceCompiles)
+
+#ifdef _MSC_VER
+#include <windows.h>
+#endif
CHECK_CXX_SOURCE_COMPILES("
int main() {
+#ifdef _MSC_VER
+ volatile LONG val = 1;
+ MemoryBarrier();
+ InterlockedCompareExchange(&val, 0, 1);
+ InterlockedIncrement(&val);
+ InterlockedDecrement(&val);
+#else
volatile unsigned long val = 1;
__sync_synchronize();
__sync_val_compare_and_swap(&val, 1, 0);
__sync_add_and_fetch(&val, 1);
__sync_sub_and_fetch(&val, 1);
+#endif
return 0;
}
" LLVM_MULTITHREADED)
More information about the llvm-commits
mailing list