Add support for __sync builtin compare and swap on 128-bit values
Этот коммит содержится в:
родитель
250f749602
Коммит
fe787512d8
@ -19,6 +19,23 @@ dnl $HEADER$
|
||||
dnl
|
||||
|
||||
|
||||
AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
|
||||
AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values])
|
||||
|
||||
OPAL_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result])
|
||||
|
||||
AC_TRY_COMPILE([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);],
|
||||
[AC_MSG_RESULT([yes])
|
||||
sync_bool_compare_and_swap_128_result=1],
|
||||
[AC_MSG_RESULT([no])
|
||||
sync_bool_compare_and_swap_128_result=0])
|
||||
|
||||
AC_DEFINE_UNQUOTED([OPAL_HAVE_SYNC_BUILTIN_CSWAP_INT128], [$sync_bool_compare_and_swap_128_result],
|
||||
[Whether the __sync builtin atomic compare and swap supports 128-bit values])
|
||||
|
||||
OPAL_VAR_SCOPE_POP
|
||||
])
|
||||
|
||||
AC_DEFUN([OPAL_CHECK_SYNC_BUILTINS], [
|
||||
AC_MSG_CHECKING([for __sync builtin atomics])
|
||||
|
||||
@ -577,7 +594,6 @@ AC_DEFUN([OPAL_CHECK_CMPXCHG16B],[
|
||||
OPAL_VAR_SCOPE_POP
|
||||
])dnl
|
||||
|
||||
|
||||
dnl #################################################################
|
||||
dnl
|
||||
dnl OPAL_CHECK_INLINE_GCC
|
||||
@ -789,6 +805,7 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
|
||||
[AC_MSG_ERROR([__sync builtin atomics requested but not found.])])
|
||||
AC_DEFINE([OPAL_C_GCC_INLINE_ASSEMBLY], [1],
|
||||
[Whether C compiler supports GCC style inline assembly])
|
||||
OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128
|
||||
elif test "$enable_osx_builtin_atomics" = "yes" ; then
|
||||
AC_CHECK_HEADER([libkern/OSAtomic.h],[opal_cv_asm_builtin="BUILTIN_OSX"],
|
||||
[AC_MSG_ERROR([OSX builtin atomics requested but not found.])])
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
@ -10,6 +11,8 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
||||
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -106,6 +109,17 @@ static inline int opal_atomic_cmpset_64( volatile int64_t *addr,
|
||||
return __sync_bool_compare_and_swap(addr, oldval, newval);
|
||||
}
|
||||
|
||||
#if OPAL_HAVE_SYNC_BUILTIN_CSWAP_INT128
|
||||
static inline int opal_atomic_cmpset_128 (volatile opal_int128_t *addr,
|
||||
opal_int128_t oldval, opal_int128_t newval)
|
||||
{
|
||||
return __sync_bool_compare_and_swap(addr, oldval, newval);
|
||||
}
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_CMPSET_128 1
|
||||
|
||||
#endif
|
||||
|
||||
#define OPAL_HAVE_ATOMIC_MATH_64 1
|
||||
#define OPAL_HAVE_ATOMIC_ADD_64 1
|
||||
static inline int64_t opal_atomic_add_64(volatile int64_t *addr, int64_t delta)
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user