BUILD: atomic: fix build on mac/arm64

The inline assembly is invalid for this platform thus falling back
to the builtin instead.

(cherry picked from commit c050dc6c689e761af6c2d5a673086a1408164c6a)
Signed-off-by: Willy Tarreau <w@1wt.eu>
diff --git a/include/haproxy/atomic.h b/include/haproxy/atomic.h
index 792c42c..ee5c18e 100644
--- a/include/haproxy/atomic.h
+++ b/include/haproxy/atomic.h
@@ -698,7 +698,7 @@
  */
 #define __ha_cpu_relax() ({ asm volatile("isb" ::: "memory"); 1; })
 
-#if defined(__ARM_FEATURE_ATOMICS) // ARMv8.1-A atomics
+#if defined(__ARM_FEATURE_ATOMICS) && !defined(__clang__) // ARMv8.1-A atomics
 
 /* returns 0 on failure, non-zero on success */
 static forceinline int __ha_cas_dw(void *target, void *compare, const void *set)
@@ -738,7 +738,7 @@
 	return ret;
 }
 
-#elif defined(__SIZEOF_INT128__) && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) // no ARMv8.1-A atomics but 128-bit atomics
+#elif defined(__SIZEOF_INT128__) && defined(_ARM_FEATURE_ATOMICS) // 128-bit and ARMv8.1-A will work
 
 /* According to https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
  * we can use atomics on __int128. The availability of CAS is defined there: