From: Andrew Galante <spock...@gmail.com>

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 <matts...@gmail.com>
---
 meson.build | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 62200476216..517636e5e09 100644
--- a/meson.build
+++ b/meson.build
@@ -841,7 +841,9 @@ if cc.compiles('''#include <stdint.h>
                     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'
@@ -857,7 +859,8 @@ if cc.compiles('''#include <stdint.h>
                        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')
-- 
2.16.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to