Mesa (master): util: Remove u_atomic.h's GCC inline assembly.

Matt Turner mattst88 at kemper.freedesktop.org
Mon Dec 1 19:42:41 UTC 2014


Module: Mesa
Branch: master
Commit: 2879a77a37b4d044203913258800828482a55f95
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2879a77a37b4d044203913258800828482a55f95

Author: Matt Turner <mattst88 at gmail.com>
Date:   Fri Nov 21 16:28:21 2014 -0800

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 at vmware.com>

---

 src/util/u_atomic.h |  122 ---------------------------------------------------
 1 file changed, 122 deletions(-)

diff --git a/src/util/u_atomic.h b/src/util/u_atomic.h
index f326bd1..13b264f 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)




More information about the mesa-commit mailing list