From: Andrew Galante Date: Mon, 11 Jun 2018 22:03:36 +0000 (-0700) Subject: meson: Test for __atomic_add_fetch in atomic checks X-Git-Tag: upstream/19.0.0~4673 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d547a7617fbcbc29f75ed85ff774807ddca5ce0;p=platform%2Fupstream%2Fmesa.git meson: Test for __atomic_add_fetch in atomic checks Some platforms have 64-bit __atomic_load_n but not 64-bit __atomic_add_fetch, so test for both of them. Bug: https://bugs.gentoo.org/655616 Reviewed-by: Matt Turner Reviewed-by: Eric Engestrom Reviewed-by: Dylan Baker --- diff --git a/meson.build b/meson.build index 375751b..22e7a6d 100644 --- a/meson.build +++ b/meson.build @@ -835,7 +835,9 @@ if cc.compiles('''#include struct { uint64_t *v; } x; - return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE); + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & + (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); + }''', name : 'GCC atomic builtins') pre_args += '-DUSE_GCC_ATOMIC_BUILTINS' @@ -851,7 +853,8 @@ if cc.compiles('''#include struct { uint64_t *v; } x; - return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE); + return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & + (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); }''', name : 'GCC atomic builtins required -latomic') dep_atomic = cc.find_library('atomic')