diff options
author | Tom Lane | 2012-01-07 20:38:52 +0000 |
---|---|---|
committer | Tom Lane | 2012-01-07 20:38:52 +0000 |
commit | 0a41e865845bfa5d7aafcc5fe000dafa26573fef (patch) | |
tree | d11383fae426e60b58c5fd5a231297a51245b3a6 /configure | |
parent | 1fc3d18faa8f4476944bc6854be0f7f6adf4aec8 (diff) |
Use __sync_lock_test_and_set() for spinlocks on ARM, if available.
Historically we've used the SWPB instruction for TAS() on ARM, but this
is deprecated and not available on ARMv6 and later. Instead, make use
of a GCC builtin if available. We'll still fall back to SWPB if not,
so as not to break existing ports using older GCC versions.
Eventually we might want to try using __sync_lock_test_and_set() on some
other architectures too, but for now that seems to present only risk and
not reward.
Back-patch to all supported versions, since people might want to use any
of them on more recent ARM chips.
Martin Pitt
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/configure b/configure index 5cb3d9b14f0..af4f9a3d2cd 100755 --- a/configure +++ b/configure @@ -22596,6 +22596,71 @@ fi done +{ $as_echo "$as_me:$LINENO: checking for builtin locking functions" >&5 +$as_echo_n "checking for builtin locking functions... " >&6; } +if test "${pgac_cv_gcc_int_atomics+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +int lock = 0; + __sync_lock_test_and_set(&lock, 1); + __sync_lock_release(&lock); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + pgac_cv_gcc_int_atomics="yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + pgac_cv_gcc_int_atomics="no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $pgac_cv_gcc_int_atomics" >&5 +$as_echo "$pgac_cv_gcc_int_atomics" >&6; } +if test x"$pgac_cv_gcc_int_atomics" = x"yes"; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_GCC_INT_ATOMICS 1 +_ACEOF + +fi + # # Pthreads |