diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-25 09:25:25 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-25 09:25:25 +0000 |
commit | f2562d280654264ff5bc150f7099dee941c2aea6 (patch) | |
tree | f1cabe68634621feb1b63697e0c065713bffe477 /libstdc++-v3 | |
parent | 76d4bacb4f5fd50773dce38c67fd4b889bb3f71c (diff) | |
download | gcc-f2562d280654264ff5bc150f7099dee941c2aea6.tar.gz |
2005-05-25 Paolo Carlini <pcarlini@suse.de>
* config/cpu/alpha/atomicity.h: Use the builtins for
atomic memory operations.
* config/cpu/powerpc/atomicity.h: Likewise.
* config/cpu/ia64/atomicity.h: Do not include ia64intrin.h.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100139 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/config/cpu/alpha/atomicity.h | 38 | ||||
-rw-r--r-- | libstdc++-v3/config/cpu/ia64/atomicity.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/config/cpu/powerpc/atomicity.h | 40 |
4 files changed, 17 insertions, 72 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d84060a01d4..37880848f71 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2005-05-25 Paolo Carlini <pcarlini@suse.de> + + * config/cpu/alpha/atomicity.h: Use the builtins for + atomic memory operations. + * config/cpu/powerpc/atomicity.h: Likewise. + * config/cpu/ia64/atomicity.h: Do not include ia64intrin.h. + 2005-05-24 Paolo Carlini <pcarlini@suse.de> * testsuite/25_algorithms/equal.cc: Move to... diff --git a/libstdc++-v3/config/cpu/alpha/atomicity.h b/libstdc++-v3/config/cpu/alpha/atomicity.h index 4eb311b509a..24a4feb1b64 100644 --- a/libstdc++-v3/config/cpu/alpha/atomicity.h +++ b/libstdc++-v3/config/cpu/alpha/atomicity.h @@ -1,6 +1,7 @@ // Low-level functions for atomic operations: Alpha version -*- C++ -*- -// Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -29,47 +30,16 @@ #include <bits/atomicity.h> -/* @@@ With gas we can play nice .subsection games to get the - non-predicted branch pointing forward. But Digital assemblers - don't understand those directives. This isn't a terribly - important issue, so just ignore it. */ - namespace __gnu_cxx { _Atomic_word __attribute__ ((__unused__)) __exchange_and_add(volatile _Atomic_word* __mem, int __val) - { - register int __result, __tmp; - - __asm__ __volatile__ ( - "\n$Lxadd_%=:\n\t" - "ldl_l %0,%3\n\t" - "addl %0,%4,%1\n\t" - "stl_c %1,%2\n\t" - "beq %1,$Lxadd_%=\n\t" - "mb" - : "=&r"(__result), "=&r"(__tmp), "=m"(*__mem) - : "m" (*__mem), "r"(__val)); - - return __result; - } + { return __sync_fetch_and_add(__mem, __val); } void __attribute__ ((__unused__)) __atomic_add(volatile _Atomic_word* __mem, int __val) - { - register _Atomic_word __result; - - __asm__ __volatile__ ( - "\n$Ladd_%=:\n\t" - "ldl_l %0,%2\n\t" - "addl %0,%3,%0\n\t" - "stl_c %0,%1\n\t" - "beq %0,$Ladd_%=\n\t" - "mb" - : "=&r"(__result), "=m"(*__mem) - : "m" (*__mem), "r"(__val)); - } + { __sync_fetch_and_add(__mem, __val); } } // namespace __gnu_cxx diff --git a/libstdc++-v3/config/cpu/ia64/atomicity.h b/libstdc++-v3/config/cpu/ia64/atomicity.h index 0c3ab3343e9..c651b846e99 100644 --- a/libstdc++-v3/config/cpu/ia64/atomicity.h +++ b/libstdc++-v3/config/cpu/ia64/atomicity.h @@ -1,6 +1,7 @@ // Low-level functions for atomic operations: IA64 version -*- C++ -*- -// Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 2000, 2001, 2003, 2004, 2005 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -28,7 +29,6 @@ // the GNU General Public License. #include <bits/atomicity.h> -#include <ia64intrin.h> namespace __gnu_cxx { diff --git a/libstdc++-v3/config/cpu/powerpc/atomicity.h b/libstdc++-v3/config/cpu/powerpc/atomicity.h index 73149441dd8..d3e1e7464e4 100644 --- a/libstdc++-v3/config/cpu/powerpc/atomicity.h +++ b/libstdc++-v3/config/cpu/powerpc/atomicity.h @@ -1,6 +1,7 @@ // Low-level functions for atomic operations: PowerPC version -*- C++ -*- -// Copyright (C) 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +// Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -29,48 +30,15 @@ #include <bits/atomicity.h> -#ifdef __PPC405__ -#define _STWCX "sync \n\tstwcx. " -#else -#define _STWCX "stwcx. " -#endif - namespace __gnu_cxx { _Atomic_word __attribute__ ((__unused__)) __exchange_and_add(volatile _Atomic_word* __mem, int __val) - { - _Atomic_word __tmp, __res; - __asm__ __volatile__ ( - "/* Inline exchange & add */\n" - "0:\t" - "lwarx %0,0,%3 \n\t" - "add%I4 %1,%0,%4 \n\t" - _STWCX " %1,0,%3 \n\t" - "bne- 0b \n\t" - "/* End exchange & add */" - : "=&b"(__res), "=&r"(__tmp), "=m" (*__mem) - : "r" (__mem), "Ir"(__val), "m" (*__mem) - : "cr0"); - return __res; - } + { return __sync_fetch_and_add(__mem, __val); } void __attribute__ ((__unused__)) __atomic_add(volatile _Atomic_word* __mem, int __val) - { - _Atomic_word __tmp; - __asm__ __volatile__ ( - "/* Inline atomic add */\n" - "0:\t" - "lwarx %0,0,%2 \n\t" - "add%I3 %0,%0,%3 \n\t" - _STWCX " %0,0,%2 \n\t" - "bne- 0b \n\t" - "/* End atomic add */" - : "=&b"(__tmp), "=m" (*__mem) - : "r" (__mem), "Ir"(__val), "m" (*__mem) - : "cr0"); - } + { __sync_fetch_and_add(__mem, __val); } } // namespace __gnu_cxx |