Fix __atomic to not implement atomic loads with CAS.
authorTorvald Riegel <torvald@gcc.gnu.org>
Wed, 1 Feb 2017 17:21:59 +0000 (17:21 +0000)
committerTorvald Riegel <torvald@gcc.gnu.org>
Wed, 1 Feb 2017 17:21:59 +0000 (17:21 +0000)
commit969a32ce9354585f5f2b89df2e025f52eb0e1644
treeba5dc4787f7d4f9d23224810508207f4fcc188dc
parent55e75c7c6bcfe386d0ecbf4611cff81040af00b3
Fix __atomic to not implement atomic loads with CAS.

gcc/
* builtins.c (fold_builtin_atomic_always_lock_free): Make "lock-free"
conditional on existance of a fast atomic load.
* optabs-query.c (can_atomic_load_p): New function.
* optabs-query.h (can_atomic_load_p): Declare it.
* optabs.c (expand_atomic_exchange): Always delegate to libatomic if
no fast atomic load is available for the particular size of access.
(expand_atomic_compare_and_swap): Likewise.
(expand_atomic_load): Likewise.
(expand_atomic_store): Likewise.
(expand_atomic_fetch_op): Likewise.
* testsuite/lib/target-supports.exp
(check_effective_target_sync_int_128): Remove x86 because it provides
no fast atomic load.
(check_effective_target_sync_int_128_runtime): Likewise.

libatomic/
* acinclude.m4: Add #define FAST_ATOMIC_LDST_*.
* auto-config.h.in: Regenerate.
* config/x86/host-config.h (FAST_ATOMIC_LDST_16): Define to 0.
(atomic_compare_exchange_n): New.
* glfree.c (EXACT, LARGER): Change condition and add comments.

From-SVN: r245098
gcc/ChangeLog
gcc/builtins.c
gcc/optabs-query.c
gcc/optabs-query.h
gcc/optabs.c
gcc/testsuite/lib/target-supports.exp
libatomic/ChangeLog
libatomic/acinclude.m4
libatomic/auto-config.h.in
libatomic/config/x86/host-config.h
libatomic/glfree.c