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

Roland Scheidegger sroland at vmware.com
Mon Oct 20 06:53:05 PDT 2014


Am 19.10.2014 um 18:32 schrieb David Heidelberger:
> 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.

The question of course would be why you'd need to use intrinsics
directly - if that's just in the state tracker surely it should be
possible to fix, though I'd guess they come from elsewhere... In any
case, obviously this workaround would leave some platforms broken.

The other question is if this couldn't be fixed for real, so compiler
intrinsics work. Some quick search seems to indicate this may happen if
no -march is specified so building for windows selects i386. If
specifying something newer indeed fixes that we should just do that I
seriously doubt you really need to support 80386 :-).

Roland


> 
> [1]
> https://urldefense.proofpoint.com/v1/url?u=https://bugs.freedesktop.org/show_bug.cgi?id%3D30514&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0A&m=LqwoYg4HEgtzdMKCI1yuyoU3baZxAXty6%2BpI15VaPSg%3D%0A&s=f118d94502a261552331f4c2e831ad478caad37e47c9a498c95de8ce271e7ff2
> 
> 
> 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))



More information about the mesa-dev mailing list