diff mbox series

[2/2] configure: atomic64/128 detection for clang

Message ID d9d6f2845c430ff95089717b304823c10d8114f0.1595463707.git.scw@google.com (mailing list archive)
State New, archived
Headers show
Series Instruction set detection for clang. | expand

Commit Message

Shu-Chun Weng July 23, 2020, 12:27 a.m. UTC
The public interface for __atomic_* and __sync_* do not contain the
explicit *_{number} versions:
  https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
  https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html

They appear to be GCC's internal symbols which happen to work. However,
clang does not recognize them. Replace the existing usages with the `_n`
versions (or no suffix) which are the documented API.

Signed-off-by: Shu-Chun Weng <scw@google.com>
---
 configure | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/configure b/configure
index d9ce3aa5db..0613a049e9 100755
--- a/configure
+++ b/configure
@@ -5894,9 +5894,9 @@  if test "$int128" = "yes"; then
 int main(void)
 {
   unsigned __int128 x = 0, y = 0;
-  y = __atomic_load_16(&x, 0);
-  __atomic_store_16(&x, y, 0);
-  __atomic_compare_exchange_16(&x, &y, x, 0, 0, 0);
+  y = __atomic_load_n(&x, 0);
+  __atomic_store_n(&x, y, 0);
+  __atomic_compare_exchange_n(&x, &y, x, 0, 0, 0);
   return 0;
 }
 EOF
@@ -5911,7 +5911,7 @@  if test "$int128" = yes && test "$atomic128" = no; then
 int main(void)
 {
   unsigned __int128 x = 0, y = 0;
-  __sync_val_compare_and_swap_16(&x, y, x);
+  __sync_val_compare_and_swap(&x, y, x);
   return 0;
 }
 EOF
@@ -5931,11 +5931,11 @@  int main(void)
 {
   uint64_t x = 0, y = 0;
 #ifdef __ATOMIC_RELAXED
-  y = __atomic_load_8(&x, 0);
-  __atomic_store_8(&x, y, 0);
-  __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
-  __atomic_exchange_8(&x, y, 0);
-  __atomic_fetch_add_8(&x, y, 0);
+  y = __atomic_load_n(&x, 0);
+  __atomic_store_n(&x, y, 0);
+  __atomic_compare_exchange_n(&x, &y, x, 0, 0, 0);
+  __atomic_exchange_n(&x, y, 0);
+  __atomic_fetch_add(&x, y, 0);
 #else
   typedef char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
   __sync_lock_test_and_set(&x, y);