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) {
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) {
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to