This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
[PATCH] Fix PPC atomicity.h
- To: gcc-patches at gcc dot gnu dot org,libstdc++ at sources dot redhat dot com
- Subject: [PATCH] Fix PPC atomicity.h
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Sat, 25 Nov 2000 23:25:51 +0100
Hi,
the appended patch is a big step forward on PPC, the libstdc++ tests now look
like:
Detailed test results in ./testsuite/20001125-mkcheck.txt
+: pass, -b: build failure, -r: run failure, x: disabled
------------------------------------------------------------------------
static shared test
------------------------------------------------------------------------
+ + 17_intro/header_ciso646.cc
+ + 17_intro/header_fstream.cc
+ + 17_intro/header_iomanip.cc
+ + 17_intro/header_ios.cc
+ + 17_intro/header_iosfwd.cc
+ + 17_intro/header_iostream.cc
+ + 17_intro/header_istream.cc
+ + 17_intro/header_ostream.cc
+ + 17_intro/headers.cc
+ + 17_intro/header_sstream.cc
+ + 17_intro/header_streambuf.cc
+ + 18_support/numeric_limits.cc
-b -b 20_util/auto_ptr.cc
-r + 21_strings/append.cc
+ + 21_strings/capacity.cc
+ + 21_strings/char_traits.cc
+ + 21_strings/compare.cc
-r + 21_strings/ctor_copy_dtor.cc
-r + 21_strings/element_access.cc
+ + 21_strings/find.cc
-r + 21_strings/insert.cc
+ + 21_strings/inserters_extractors.cc
+ + 21_strings/invariants.cc
+ + 21_strings/nonmember.cc
+ + 21_strings/operations.cc
+ + 21_strings/replace.cc
+ + 21_strings/rfind.cc
-r + 21_strings/substr.cc
+ + 22_locale/codecvt_char_char.cc
+ + 22_locale/codecvt_unicode_char.cc
+ + 22_locale/codecvt_unicode_wchar_t.cc
+ + 22_locale/codecvt_wchar_t_char.cc
+ + 22_locale/ctor_copy_dtor.cc
+ + 22_locale/ctype.cc
+ + 22_locale/ctype_char_members.cc
+ + 22_locale/ctype_wchar_t_members.cc
+ + 22_locale/facet.cc
+ + 22_locale/global_templates.cc
+ + 22_locale/operators.cc
+ + 22_locale/static_members.cc
-r + 23_containers/bitset_ctor.cc
+ + 23_containers/bitset_shift.cc
-b -b 23_containers/map_operators.cc
+ + 23_containers/multiset.cc
-b -b 23_containers/set_operators.cc
+ + 23_containers/vector_capacity.cc
+ + 23_containers/vector_ctor.cc
-r + 23_containers/vector_element_access.cc
+ + 23_containers/vector_modifiers.cc
+ + 24_iterators/istreambuf_iterator.cc
+ + 24_iterators/iterator.cc
+ + 25_algorithms/lower_bound.cc
+ + 25_algorithms/min_max.cc
+ + 26_numerics/binary_closure.cc
+ + 26_numerics/buggy_complex.cc
+ + 26_numerics/c_math.cc
+ + 26_numerics/complex_inserters_extractors.cc
+ + 26_numerics/complex_value.cc
+ + 26_numerics/valarray.cc
+ + 27_io/filebuf.cc
-r -r 27_io/filebuf_members.cc
+ + 27_io/fpos.cc
+ + 27_io/ifstream_members.cc
+ + 27_io/ios_base_callbacks.cc
+ + 27_io/ios_base_members_static.cc
+ + 27_io/ios_ctor.cc
+ + 27_io/ios_manip_basefield.cc
+ + 27_io/ios_manip_fmtflags.cc
-r + 27_io/ios_members.cc
+ + 27_io/istream.cc
+ + 27_io/istream_extractor_arith.cc
+ + 27_io/istream_extractor_char.cc
+ + 27_io/istream_extractor_other.cc
+ + 27_io/istream_manip.cc
+ + 27_io/istream_seeks.cc
+ + 27_io/istream_sentry.cc
+ + 27_io/istream_unformatted.cc
+ + 27_io/istringstream_members.cc
+ + 27_io/narrow_stream_objects.cc
+ + 27_io/ofstream_members.cc
+ + 27_io/ostream.cc
+ + 27_io/ostream_inserter_arith.cc
+ + 27_io/ostream_inserter_char.cc
+ + 27_io/ostream_inserter_other.cc
+ + 27_io/ostream_manip.cc
+ + 27_io/ostream_seeks.cc
+ + 27_io/ostream_unformatted.cc
+ + 27_io/streambuf.cc
+ + 27_io/stringbuf.cc
+ + 27_io/stringstream.cc
+ + 27_io/wide_stream_objects.cc
+ + ext/headers.cc
which is a _lot_ better than before. Also the c++ testsuite fails shrinked to
71 FAILs from ~850!.
BTW, is atomicity.h going to stay in the libstdc++-v3 dir? Or will it be a
generic GCC header (which seems useful) at some point in time? If it will
stay under libstdc++-v3, I would prefer to remove everything but
__exchange_and_add and __atomic_add from it in a subsequent patch.
OK to commit?
Franz.
* config/cpu/powerpc/bits/atomicity.h: Replace '__ATOMICITY_INLINE'
with 'inline'.
(__ex__atomic_add): Add __volatile__ to asm.
(__atomic_add): Likewise.
(__compare_and_swap): Likewise.
(__always_swap): Likewise.
(__test_and_set): Likewise.
Index: libstdc++-v3/config/cpu/powerpc/bits/atomicity.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/config/cpu/powerpc/bits/atomicity.h,v
retrieving revision 1.4
diff -u -p -r1.4 atomicity.h
--- libstdc++-v3/config/cpu/powerpc/bits/atomicity.h 2000/08/22 18:24:16 1.4
+++ libstdc++-v3/config/cpu/powerpc/bits/atomicity.h 2000/11/25 22:17:57
@@ -22,18 +22,12 @@
typedef int _Atomic_word;
-#if BROKEN_PPC_ASM_CR0
-# define __ATOMICITY_INLINE /* nothing */
-#else
-# define __ATOMICITY_INLINE inline
-#endif
-
-static __ATOMICITY_INLINE _Atomic_word
+static inline _Atomic_word
__attribute__ ((__unused__))
__exchange_and_add (volatile _Atomic_word* __mem, int __val)
{
_Atomic_word __tmp, __res;
- __asm__ ("\
+ __asm__ __volatile__ ("\
0: lwarx %0,0,%2
add%I3 %1,%0,%3
stwcx. %1,0,%2
@@ -42,12 +36,12 @@ __exchange_and_add (volatile _Atomic_wor
return __res;
}
-static __ATOMICITY_INLINE void
+static inline void
__attribute__ ((__unused__))
__atomic_add (volatile _Atomic_word *__mem, int __val)
{
_Atomic_word __tmp;
- __asm__ ("\
+ __asm__ __volatile__ ("\
0: lwarx %0,0,%1
add%I2 %0,%0,%2
stwcx. %0,0,%1
@@ -55,12 +49,12 @@ __atomic_add (volatile _Atomic_word *__m
" : "=&b"(__tmp) : "r" (__mem), "Ir"(__val) : "cr0", "memory");
}
-static __ATOMICITY_INLINE int
+static inline int
__attribute__ ((__unused__))
__compare_and_swap (volatile long *__p, long int __oldval, long int __newval)
{
int __res;
- __asm__ ("\
+ __asm__ __volatile__ ("\
0: lwarx %0,0,%1
sub%I2c. %0,%0,%2
cntlzw %0,%0
@@ -72,12 +66,12 @@ __compare_and_swap (volatile long *__p,
return __res >> 5;
}
-static __ATOMICITY_INLINE long
+static inline long
__attribute__ ((__unused__))
__always_swap (volatile long *__p, long int __newval)
{
long __res;
- __asm__ ("\
+ __asm__ __volatile__ ("\
0: lwarx %0,0,%1
stwcx. %2,0,%1
bne- 0b
@@ -85,12 +79,12 @@ __always_swap (volatile long *__p, long
return __res;
}
-static __ATOMICITY_INLINE int
+static inline int
__attribute__ ((__unused__))
__test_and_set (volatile long *__p, long int __newval)
{
int __res;
- __asm__ ("\
+ __asm__ __volatile__ ("\
0: lwarx %0,0,%1
cmpwi %0,0
bne- 1f