diff options
author | Matt Turner <mattst88@gmail.com> | 2014-11-21 16:28:21 -0800 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2014-12-01 11:28:45 -0800 |
commit | 2879a77a37b4d044203913258800828482a55f95 (patch) | |
tree | 4409acf6b97c7e6db4abd7e3ad164a6b8f9998ee /src | |
parent | 972f8458f1ebdf805059d9252ae0ebb727934613 (diff) |
util: Remove u_atomic.h's GCC inline assembly.
GCC >= 4.1 support the __sync_* intrinsics. That seems like a
sufficiently old baseline.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/util/u_atomic.h | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/src/util/u_atomic.h b/src/util/u_atomic.h index f326bd1c2c3..13b264f0d8f 100644 --- a/src/util/u_atomic.h +++ b/src/util/u_atomic.h @@ -21,133 +21,11 @@ #define PIPE_ATOMIC_MSVC_INTRINSIC #elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 401) #define PIPE_ATOMIC_GCC_INTRINSIC -#elif (defined(__GNUC__) && defined(__i386__)) -#define PIPE_ATOMIC_ASM_GCC_X86 -#elif (defined(__GNUC__) && defined(__x86_64__)) -#define PIPE_ATOMIC_ASM_GCC_X86_64 #else #error "Unsupported platform" #endif -#if defined(PIPE_ATOMIC_ASM_GCC_X86_64) -#define PIPE_ATOMIC "GCC x86_64 assembly" - -#ifdef __cplusplus -extern "C" { -#endif - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) - -static inline boolean -p_atomic_dec_zero(int32_t *v) -{ - unsigned char c; - - __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c) - ::"memory"); - - return c != 0; -} - -static inline void -p_atomic_inc(int32_t *v) -{ - __asm__ __volatile__("lock; incl %0":"+m"(*v)); -} - -static inline void -p_atomic_dec(int32_t *v) -{ - __asm__ __volatile__("lock; decl %0":"+m"(*v)); -} - -static inline int32_t -p_atomic_inc_return(int32_t *v) -{ - return __sync_add_and_fetch(v, 1); -} - -static inline int32_t -p_atomic_dec_return(int32_t *v) -{ - return __sync_sub_and_fetch(v, 1); -} - -static inline int32_t -p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) -{ - return __sync_val_compare_and_swap(v, old, _new); -} - -#ifdef __cplusplus -} -#endif - -#endif /* PIPE_ATOMIC_ASM_GCC_X86_64 */ - - -#if defined(PIPE_ATOMIC_ASM_GCC_X86) - -#define PIPE_ATOMIC "GCC x86 assembly" - -#ifdef __cplusplus -extern "C" { -#endif - -#define p_atomic_set(_v, _i) (*(_v) = (_i)) -#define p_atomic_read(_v) (*(_v)) - -static inline boolean -p_atomic_dec_zero(int32_t *v) -{ - unsigned char c; - - __asm__ __volatile__("lock; decl %0; sete %1":"+m"(*v), "=qm"(c) - ::"memory"); - - return c != 0; -} - -static inline void -p_atomic_inc(int32_t *v) -{ - __asm__ __volatile__("lock; incl %0":"+m"(*v)); -} - -static inline void -p_atomic_dec(int32_t *v) -{ - __asm__ __volatile__("lock; decl %0":"+m"(*v)); -} - -static inline int32_t -p_atomic_inc_return(int32_t *v) -{ - return __sync_add_and_fetch(v, 1); -} - -static inline int32_t -p_atomic_dec_return(int32_t *v) -{ - return __sync_sub_and_fetch(v, 1); -} - -static inline int32_t -p_atomic_cmpxchg(int32_t *v, int32_t old, int32_t _new) -{ - return __sync_val_compare_and_swap(v, old, _new); -} - -#ifdef __cplusplus -} -#endif - -#endif - - - /* Implementation using GCC-provided synchronization intrinsics */ #if defined(PIPE_ATOMIC_GCC_INTRINSIC) |