Displaying 5 results from an estimated 5 matches for "osatomiccompareandswap32".
2009 May 24
2
[LLVMdev] broken Atomic.cpp on Darwin
There is no __sync_synchronize or __sync_val_compare_and_swap on Mac
OS X. One might use OSMemoryBarrier or OSAtomicCompareAndSwap32
instead. The patch is attached.
- xi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: application/octet-stream
Size: 1248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090524/6f854791/attachment.obj>
2009 May 24
2
[LLVMdev] broken Atomic.cpp on Darwin
...d I use something else for LLVM?
- xi
On Sun, May 24, 2009 at 1:20 AM, Owen Anderson <resistor at mac.com> wrote:
>
> On May 23, 2009, at 9:41 PM, Xi Wang wrote:
>
> There is no __sync_synchronize or __sync_val_compare_and_swap on Mac
> OS X. One might use OSMemoryBarrier or OSAtomicCompareAndSwap32
> instead. The patch is attached.
>
> Actually, __sync_synchronize and __sync_val_compare_and_swap DO exist on
> Darwin, but only if you use Apple's GCC 4.2 (or later), just as it is on
> Linux. We always want to use these intrinsic versions if possible, because
> they'r...
2009 May 24
0
[LLVMdev] broken Atomic.cpp on Darwin
On May 23, 2009, at 9:41 PM, Xi Wang wrote:
> There is no __sync_synchronize or __sync_val_compare_and_swap on Mac
> OS X. One might use OSMemoryBarrier or OSAtomicCompareAndSwap32
> instead. The patch is attached.
Actually, __sync_synchronize and __sync_val_compare_and_swap DO exist
on Darwin, but only if you use Apple's GCC 4.2 (or later), just as it
is on Linux. We always want to use these intrinsic versions if
possible, because they're much lower overh...
2012 Feb 28
0
[LLVMdev] [patch] atomic functions on darwin
...int main() {
#ifdef _MSC_VER
volatile LONG val = 1;
@@ -13,6 +16,12 @@
InterlockedCompareExchange(&val, 0, 1);
InterlockedIncrement(&val);
InterlockedDecrement(&val);
+#elif defined(__APPLE__)
+ int32_t val = 1;
+ OSMemoryBarrier();
+ OSAtomicCompareAndSwap32(0, 1, &val);
+ OSAtomicIncrement32(&val);
+ OSAtomicDecrement32(&val);
#else
volatile unsigned long val = 1;
__sync_synchronize();
Index: include/llvm/Support/Atomic.h
===================================================================
--- include/llvm/S...
2009 May 24
0
[LLVMdev] broken Atomic.cpp on Darwin
...xi
>
> On Sun, May 24, 2009 at 1:20 AM, Owen Anderson <resistor at mac.com>
> wrote:
>>
>> On May 23, 2009, at 9:41 PM, Xi Wang wrote:
>>
>> There is no __sync_synchronize or __sync_val_compare_and_swap on Mac
>> OS X. One might use OSMemoryBarrier or OSAtomicCompareAndSwap32
>> instead. The patch is attached.
>>
>> Actually, __sync_synchronize and __sync_val_compare_and_swap DO
>> exist on
>> Darwin, but only if you use Apple's GCC 4.2 (or later), just as it
>> is on
>> Linux. We always want to use these intrinsic ver...