summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/acinclude.m4
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-10 18:20:43 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-10 18:20:43 +0000
commitf06b90735bae23bedcc6e6c183bceeba88b2982a (patch)
tree0dbe6745de2f1b55e6c7f809f4157e564668753a /libstdc++-v3/acinclude.m4
parentdcee68b4a3d7d21bede3a5d6bf2a900d352a6af7 (diff)
downloadppe42-gcc-f06b90735bae23bedcc6e6c183bceeba88b2982a.tar.gz
ppe42-gcc-f06b90735bae23bedcc6e6c183bceeba88b2982a.zip
2012-02-10 Benjamin Kosnik <bkoz@redhat.com>
Jonathan Wakely <jwakely.gcc@gmail.com> PR libstdc++/51798 continued. * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Use __atomic_* builtins instead of __sync_* builtins for atomic functionality. * include/bits/shared_ptr_base.h: Same. * include/parallel/compatibility.h: Same. * include/profile/impl/profiler_state.h: Same. * include/tr1/shared_ptr.h: Same. * libsupc++/eh_ptr.cc: Same. * libsupc++/eh_throw.cc: Same. * libsupc++/eh_tm.cc: Same. * libsupc++/guard.cc: Same. * configure: Regenerated. * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184110 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/acinclude.m4')
-rw-r--r--libstdc++-v3/acinclude.m4113
1 files changed, 62 insertions, 51 deletions
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 529532e5260..e089b20dd4f 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -2685,7 +2685,7 @@ AC_DEFUN([GLIBCXX_ENABLE_PCH], [
dnl
dnl Check for atomic builtins.
dnl See:
-dnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins
+dnl http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
dnl
dnl This checks to see if the host supports the compiler-generated
dnl builtins for atomic operations for various integral sizes. Note, this
@@ -2726,12 +2726,13 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
[typedef bool atomic_type;
atomic_type c1;
atomic_type c2;
- const atomic_type c3(0);
- __sync_fetch_and_add(&c1, c2);
- __sync_val_compare_and_swap(&c1, c3, c2);
- __sync_lock_test_and_set(&c1, c3);
- __sync_lock_release(&c1);
- __sync_synchronize();],
+ atomic_type c3(0);
+ __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+ __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
+ __atomic_load_n(&c1, __ATOMIC_RELAXED);
+ ],
[glibcxx_cv_atomic_bool=yes],
[glibcxx_cv_atomic_bool=no])
])
@@ -2744,12 +2745,13 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
[typedef short atomic_type;
atomic_type c1;
atomic_type c2;
- const atomic_type c3(0);
- __sync_fetch_and_add(&c1, c2);
- __sync_val_compare_and_swap(&c1, c3, c2);
- __sync_lock_test_and_set(&c1, c3);
- __sync_lock_release(&c1);
- __sync_synchronize();],
+ atomic_type c3(0);
+ __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+ __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
+ __atomic_load_n(&c1, __ATOMIC_RELAXED);
+ ],
[glibcxx_cv_atomic_short=yes],
[glibcxx_cv_atomic_short=no])
])
@@ -2762,12 +2764,13 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
[typedef int atomic_type;
atomic_type c1;
atomic_type c2;
- const atomic_type c3(0);
- __sync_fetch_and_add(&c1, c2);
- __sync_val_compare_and_swap(&c1, c3, c2);
- __sync_lock_test_and_set(&c1, c3);
- __sync_lock_release(&c1);
- __sync_synchronize();],
+ atomic_type c3(0);
+ __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+ __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
+ __atomic_load_n(&c1, __ATOMIC_RELAXED);
+ ],
[glibcxx_cv_atomic_int=yes],
[glibcxx_cv_atomic_int=no])
])
@@ -2780,12 +2783,13 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
[typedef long long atomic_type;
atomic_type c1;
atomic_type c2;
- const atomic_type c3(0);
- __sync_fetch_and_add(&c1, c2);
- __sync_val_compare_and_swap(&c1, c3, c2);
- __sync_lock_test_and_set(&c1, c3);
- __sync_lock_release(&c1);
- __sync_synchronize();],
+ atomic_type c3(0);
+ __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+ __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
+ __atomic_load_n(&c1, __ATOMIC_RELAXED);
+ ],
[glibcxx_cv_atomic_long_long=yes],
[glibcxx_cv_atomic_long_long=no])
])
@@ -2807,12 +2811,13 @@ int main()
typedef bool atomic_type;
atomic_type c1;
atomic_type c2;
- const atomic_type c3(0);
- __sync_fetch_and_add(&c1, c2);
- __sync_val_compare_and_swap(&c1, c3, c2);
- __sync_lock_test_and_set(&c1, c3);
- __sync_lock_release(&c1);
- __sync_synchronize();
+ atomic_type c3(0);
+ __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+ __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
+ __atomic_load_n(&c1, __ATOMIC_RELAXED);
+
return 0;
}
EOF
@@ -2835,12 +2840,13 @@ int main()
typedef short atomic_type;
atomic_type c1;
atomic_type c2;
- const atomic_type c3(0);
- __sync_fetch_and_add(&c1, c2);
- __sync_val_compare_and_swap(&c1, c3, c2);
- __sync_lock_test_and_set(&c1, c3);
- __sync_lock_release(&c1);
- __sync_synchronize();
+ atomic_type c3(0);
+ __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+ __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
+ __atomic_load_n(&c1, __ATOMIC_RELAXED);
+
return 0;
}
EOF
@@ -2864,12 +2870,13 @@ int main()
typedef int atomic_type;
atomic_type c1;
atomic_type c2;
- const atomic_type c3(0);
- __sync_fetch_and_add(&c1, c2);
- __sync_val_compare_and_swap(&c1, c3, c2);
- __sync_lock_test_and_set(&c1, c3);
- __sync_lock_release(&c1);
- __sync_synchronize();
+ atomic_type c3(0);
+ __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+ __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
+ __atomic_load_n(&c1, __ATOMIC_RELAXED);
+
return 0;
}
EOF
@@ -2892,12 +2899,13 @@ int main()
typedef long long atomic_type;
atomic_type c1;
atomic_type c2;
- const atomic_type c3(0);
- __sync_fetch_and_add(&c1, c2);
- __sync_val_compare_and_swap(&c1, c3, c2);
- __sync_lock_test_and_set(&c1, c3);
- __sync_lock_release(&c1);
- __sync_synchronize();
+ atomic_type c3(0);
+ __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED);
+ __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+ __atomic_test_and_set(&c1, __ATOMIC_RELAXED);
+ __atomic_load_n(&c1, __ATOMIC_RELAXED);
+
return 0;
}
EOF
@@ -2918,8 +2926,11 @@ EOF
CXXFLAGS="$old_CXXFLAGS"
AC_LANG_RESTORE
- # Set atomicity_dir to builtins if either of above tests pass.
- if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
+ # Set atomicity_dir to builtins if all of above tests pass.
+ if test $glibcxx_cv_atomic_bool = yes \
+ && test $glibcxx_cv_atomic_short = yes \
+ && test $glibcxx_cv_atomic_int = yes \
+ && test $glibcxx_cv_atomic_long_long = yes ; then
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1,
[Define if the compiler supports C++11 atomics.])
atomicity_dir=cpu/generic/atomicity_builtins
OpenPOWER on IntegriCloud