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) { @@ -766,6 +777,12 @@ _WriteBarrier(void) { __asm__ volatile ("" : : : "memory"); } +#ifdef __X86_64__ +static __inline__ void __attribute__((__always_inline__, __nodebug__)) +__faststorefence(void) { + __asm__ volatile ("lock orq $0,(%rsp)"); +} +#endif /*----------------------------------------------------------------------------*\ |* Misc \*----------------------------------------------------------------------------*/