search for: __sync_add_and_fetch

Displaying 15 results from an estimated 15 matches for "__sync_add_and_fetch".

2015 Apr 08
2
[LLVMdev] __sync_add_and_fetch in objc block for global variable on ARM
Hello community, I faced with bug in multithread environment in objective C code which using dispatch_async and block, __sync_add_and_fetch increments global variable. But in case of many..many threads> 5, after every __sync_add_and_fetch got damaged ... int32_t count = 0; ... int main(int argc, char *argv[]) {    for (i = 1; i < 32; ++i) {      ...         char* name;         asprintf(&name, "test.overcommit.%d&quo...
2015 Apr 09
2
[LLVMdev] __sync_add_and_fetch in objc block for global variable on ARM
Hi Tim ---------------------------------------- > Date: Wed, 8 Apr 2015 06:53:44 -0700 > Subject: Re: [LLVMdev] __sync_add_and_fetch in objc block for global variable on ARM > From: t.p.northover at gmail.com > To: alexey.perevalov at hotmail.com > CC: llvmdev at cs.uiuc.edu > >> in disas I see dmb ish instruction, but I don't know is it enough. > > There should be 2 dmb instructions: one before the l...
2009 Jul 01
2
[LLVMdev] build failure on ARM linux
...if we want to be able to compile llvm on linux/ARM with GCC versions below < 4.4 xerxes at labbserver:~/llvm$ grep _sync lib/*/* lib/System/Atomic.cpp: __sync_synchronize(); lib/System/Atomic.cpp: return __sync_val_compare_and_swap(ptr, old_value, new_value); lib/System/Atomic.cpp: return __sync_add_and_fetch(ptr, 1); lib/System/Atomic.cpp: return __sync_sub_and_fetch(ptr, 1); lib/System/Atomic.cpp: return __sync_add_and_fetch(ptr, val); Cheers Xerxes Andrew Haley skrev: > Nick Lewycky wrote: > >> 2009/6/30 Andrew Haley <aph at redhat.com <mailto:aph at redhat.com>> >&g...
2012 Feb 28
0
[LLVMdev] [patch] atomic functions on darwin
...tr)); #elif defined(__GNUC__) return __sync_val_compare_and_swap(ptr, old_value, new_value); #elif defined(_MSC_VER) @@ -56,6 +68,8 @@ #if LLVM_HAS_ATOMICS == 0 ++(*ptr); return *ptr; +#elif defined(__APPLE__) + return OSAtomicIncrement32(vcast(ptr)); #elif defined(__GNUC__) return __sync_add_and_fetch(ptr, 1); #elif defined(_MSC_VER) @@ -69,6 +83,8 @@ #if LLVM_HAS_ATOMICS == 0 --(*ptr); return *ptr; +#elif defined(__APPLE__) + return OSAtomicDecrement32(vcast(ptr)); #elif defined(__GNUC__) return __sync_sub_and_fetch(ptr, 1); #elif defined(_MSC_VER) @@ -82,6 +98,8 @@ #if LLVM_HAS_...
2015 Feb 25
1
[PATCH 1/2] nouveau: make nouveau importing global buffers completely thread-safe, with tests
...>atomic) >> # define atomic_set(x, val) ((x)->atomic = (val)) >> # define atomic_inc(x) ((void) __sync_fetch_and_add (&(x)->atomic, 1)) >> -# define atomic_dec_and_test(x) (__sync_fetch_and_add (&(x)->atomic, -1) == 1) >> +# define atomic_inc_return(x) (__sync_add_and_fetch (&(x)->atomic, 1)) >> +# define atomic_dec_and_test(x) (__sync_add_and_fetch (&(x)->atomic, -1) == 0) > The atomic_dec_and_test change seems like unrelated bugfix. Split it > out perhaps ? Not a bug fix, just swapping the order.. - atomic_fetch_and_add(-1) == 1 + atomic_ad...
2015 Feb 26
4
[PATCH v2 1/4] Add atomic_inc_return to atomics.
...696..17fb088 100644 --- a/xf86atomic.h +++ b/xf86atomic.h @@ -49,6 +49,7 @@ typedef struct { # define atomic_read(x) ((x)->atomic) # define atomic_set(x, val) ((x)->atomic = (val)) # define atomic_inc(x) ((void) __sync_fetch_and_add (&(x)->atomic, 1)) +# define atomic_inc_return(x) (__sync_add_and_fetch (&(x)->atomic, 1)) # define atomic_dec_and_test(x) (__sync_fetch_and_add (&(x)->atomic, -1) == 1) # define atomic_add(x, v) ((void) __sync_add_and_fetch(&(x)->atomic, (v))) # define atomic_dec(x, v) ((void) __sync_sub_and_fetch(&(x)->atomic, (v))) @@ -68,6 +69,7 @@ ty...
2009 Jun 30
0
[LLVMdev] build failure on ARM linux
Nick Lewycky wrote: > 2009/6/30 Andrew Haley <aph at redhat.com <mailto:aph at redhat.com>> > > Nick Lewycky wrote: > > I'm seeing this new build failure, starting some time yesterday on > ARM: > > Yes. It's just a matter of defining __sync_val_compare_and_swap_4: > >
2015 Feb 24
4
[PATCH 1/2] nouveau: make nouveau importing global buffers completely thread-safe, with tests
...uct { # define atomic_read(x) ((x)->atomic) # define atomic_set(x, val) ((x)->atomic = (val)) # define atomic_inc(x) ((void) __sync_fetch_and_add (&(x)->atomic, 1)) -# define atomic_dec_and_test(x) (__sync_fetch_and_add (&(x)->atomic, -1) == 1) +# define atomic_inc_return(x) (__sync_add_and_fetch (&(x)->atomic, 1)) +# define atomic_dec_and_test(x) (__sync_add_and_fetch (&(x)->atomic, -1) == 0) # define atomic_add(x, v) ((void) __sync_add_and_fetch(&(x)->atomic, (v))) # define atomic_dec(x, v) ((void) __sync_sub_and_fetch(&(x)->atomic, (v))) # define atomic_cmp...
2009 Jul 01
0
[LLVMdev] build failure on ARM linux
...e llvm on linux/ARM > with GCC versions below < 4.4 > > xerxes at labbserver:~/llvm$ grep _sync lib/*/* > lib/System/Atomic.cpp: __sync_synchronize(); > lib/System/Atomic.cpp: return __sync_val_compare_and_swap(ptr, > old_value, new_value); > lib/System/Atomic.cpp: return __sync_add_and_fetch(ptr, 1); > lib/System/Atomic.cpp: return __sync_sub_and_fetch(ptr, 1); > lib/System/Atomic.cpp: return __sync_add_and_fetch(ptr, val); > > Cheers > Xerxes > > Andrew Haley skrev: >> Nick Lewycky wrote: >> >>> 2009/6/30 Andrew Haley <aph at redhat.com &...
2009 Mar 18
3
[LLVMdev] Status of LLVM's atomic intrinsics
...work as I had hoped (at least not on x86). A mutex-based programs works fine (but is substantially slower than gcc) but my wait-free alternative fails with: $ llvm-g++ -O3 -lpthread waitfree.c -o waitfree /tmp/cc6t7jaO.o: In function `inc_count(void*)': (.text+0x2ee): undefined reference to `__sync_add_and_fetch_4' collect2: ld returned 1 exit status The source is: #include <pthread.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #define NUM_THREADS 9 #define TCOUNT (1 << 23) #define COUNT_LIMIT (1 << 25) volatile int count = 0; pthread_mutex_t cou...
2009 Jun 30
3
[LLVMdev] build failure on ARM linux
2009/6/30 Andrew Haley <aph at redhat.com> > Nick Lewycky wrote: > > I'm seeing this new build failure, starting some time yesterday on ARM: > > > > make[3]: Entering directory `/home/nlewycky/llvm/tools/llvmc/driver' > > llvm[3]: Linking Debug executable llvmc > > g++ -DLLVMC_BUILTIN_PLUGIN_1=Base -DLLVMC_BUILTIN_PLUGIN_2=Clang >
2015 Feb 25
0
[PATCH 1/2] nouveau: make nouveau importing global buffers completely thread-safe, with tests
...ic_read(x) ((x)->atomic) > # define atomic_set(x, val) ((x)->atomic = (val)) > # define atomic_inc(x) ((void) __sync_fetch_and_add (&(x)->atomic, 1)) > -# define atomic_dec_and_test(x) (__sync_fetch_and_add (&(x)->atomic, -1) == 1) > +# define atomic_inc_return(x) (__sync_add_and_fetch (&(x)->atomic, 1)) > +# define atomic_dec_and_test(x) (__sync_add_and_fetch (&(x)->atomic, -1) == 0) The atomic_dec_and_test change seems like unrelated bugfix. Split it out perhaps ? Introduction of atomic_inc_return could/should be a separate commit as well. > # define atomi...
2012 Jul 15
1
[LLVMdev] Errors reported in config.log on linux
...r each function it appears in.) conftest.cpp:161: error: `finite' was not declared in this scope conftest.cpp:164: error: `__sync_synchronize' was not declared in this scope conftest.cpp:165: error: `__sync_val_compare_and_swap' was not declared in this scope conftest.cpp:166: error: `__sync_add_and_fetch' was not declared in this scope conftest.cpp:167: error: `__sync_sub_and_fetch' was not declared in this scope Warnings: conftest.c:87: warning: conflicting types for built-in function 'strchr' conftest.c:88: warning: conflicting types for built-in function 'strrchr' conft...
2009 Mar 18
0
[LLVMdev] Status of LLVM's atomic intrinsics
...least not on x86). A mutex-based programs works fine (but is > substantially slower than gcc) but my wait-free alternative fails with: > > $ llvm-g++ -O3 -lpthread waitfree.c -o waitfree > /tmp/cc6t7jaO.o: In function `inc_count(void*)': > (.text+0x2ee): undefined reference to `__sync_add_and_fetch_4' > collect2: ld returned 1 exit status This probably means that you're target triple starts with i386, where __sync instructions aren't supported, possibly reconfiguring llvm-g++ explicitly with i686 (if that's what you have) will fix your problem. This should prevent the b...
2015 Mar 19
0
[ANNOUNCE] libdrm 2.4.60
...unctions Jeff McGee (1): intel: Export total subslice and EU counts Jerome Glisse (1): nouveau: fix unlock nouveau_bo_name_ref() Kristian Høgsberg (1): intel: Fix documentation for drm_intel_gem_bo_wait() Maarten Lankhorst (4): Add atomic_inc_return to atomics. Use __sync_add_and_fetch instead of __sync_fetch_and_add for atomic_dec_and_test nouveau: make nouveau importing global buffers completely thread-safe, with tests nouveau: Do not add most bo's to the global bo list. Philipp Zabel (1): tests: add support for imx-drm Thomas Klausner (4): Fix lib...