[PATCH] [clang-cl] Added _InterlockedCompareExchangePointer to Intrin.h

David Ziman kumquats.a.pair at gmail.com
Wed Jan 22 22:56:36 PST 2014


This patch adds _InterlockedCompareExchangePointer to Intrin.h. It has only been made available when __x86_64__ similar to MSVC Intrin.h. Please review.

http://llvm-reviews.chandlerc.com/D2600

Files:
  lib/Headers/Intrin.h

Index: lib/Headers/Intrin.h
===================================================================
--- lib/Headers/Intrin.h
+++ lib/Headers/Intrin.h
@@ -201,6 +201,9 @@
 static __inline__
 char _InterlockedCompareExchange8(char volatile *_Destination, char _Exchange,
                                   char _Comparand);
+static __inline__
+void *_InterlockedCompareExchangePointer(void *volatile *, void *,
+                                         void *);
 void *_InterlockedCompareExchangePointer_HLEAcquire(void *volatile *, void *,
                                                     void *);
 void *_InterlockedCompareExchangePointer_HLERelease(void *volatile *, void *,
@@ -741,6 +744,14 @@
   return _Comparand;
 }
 #ifdef __x86_64__
+static __inline__ void* __attribute__((__always_inline__, __nodebug__))
+_InterlockedCompareExchangePointer(void *volatile *_Destination,
+                              void *_Exchange, void *_Comparand) {
+  __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0, 0, 0);
+  return _Comparand;
+}
+#endif
+#ifdef __x86_64__
 static __inline__ __int64 __attribute__((__always_inline__, __nodebug__))
 _InterlockedCompareExchange64(__int64 volatile *_Destination,
                               __int64 _Exchange, __int64 _Comparand) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2600.1.patch
Type: text/x-patch
Size: 1288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140122/9d387fe6/attachment.bin>


More information about the cfe-commits mailing list