[Mesa-dev] [PATCH] Prefer intrinsics to handrolled atomic ops for Linux (v2)

David Heidelberger david.heidelberger at ixit.cz
Sun Oct 19 09:32:14 PDT 2014


v2: prefer intrinsics only on Linux to avoid compilation problems on 
other
platforms [1].

Is posible that other OS could also benefit from intrinsic.

We need this patch, because Gallium Nine use directly intrinsics.
Otherwise build fails.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=30514

Cc: Tom Fogal <tfogal at alumni.unh.edu>
Cc: Vinson Lee <vlee at freedesktop.org>
Signed-off-by: David Heidelberger <david.heidelberger at ixit.cz>
---
  src/gallium/auxiliary/util/u_atomic.h | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_atomic.h 
b/src/gallium/auxiliary/util/u_atomic.h
index 68369a1..6271736 100644
--- a/src/gallium/auxiliary/util/u_atomic.h
+++ b/src/gallium/auxiliary/util/u_atomic.h
@@ -24,6 +24,9 @@
  #define PIPE_ATOMIC_MSVC_INTRINSIC
  #elif (defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86))
  #define PIPE_ATOMIC_ASM_MSVC_X86
+#elif defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 401) && \
+      defined(PIPE_OS_LINUX)
+#define PIPE_ATOMIC_GCC_INTRINSIC
  #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86))
  #define PIPE_ATOMIC_ASM_GCC_X86
  #elif (defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64))
-- 
2.1.2


More information about the mesa-dev mailing list