[PATCH] Speed up single-threaded case of atomic ops and reduce text size
Richard Guenther
rguenther@suse.de
Wed Aug 16 12:26:00 GMT 2006
This patch speeds up the Boost wave preprocessor by 1% and also improves
runtimes of the DLV testsuite by the same margin while reducing text-size
over a wider variety of libstdc++ users.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
Ok for mainline?
For v7 we might want to remove the volatile qualifier from the
atomic ops interface.
Thanks,
Richard.
2006-08-16 Richard Guenther <rguenther@suse.de>
* include/bits/atomicity.h (__exchange_and_add_single): Use
a not volatile-qualified pointer to access memory.
(__atomic_add_single): Likewise.
Index: libstdc++-v3/include/bits/atomicity.h
===================================================================
*** libstdc++-v3/include/bits/atomicity.h (revision 116006)
--- libstdc++-v3/include/bits/atomicity.h (working copy)
*************** _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
*** 62,75 ****
static inline _Atomic_word
__exchange_and_add_single(volatile _Atomic_word* __mem, int __val)
{
! _Atomic_word __result = *__mem;
! *__mem += __val;
return __result;
}
static inline void
__atomic_add_single(volatile _Atomic_word* __mem, int __val)
! { *__mem += __val; }
static inline _Atomic_word
__attribute__ ((__unused__))
--- 62,76 ----
static inline _Atomic_word
__exchange_and_add_single(volatile _Atomic_word* __mem, int __val)
{
! _Atomic_word *__m = (_Atomic_word*)__mem;
! _Atomic_word __result = *__m;
! *__m += __val;
return __result;
}
static inline void
__atomic_add_single(volatile _Atomic_word* __mem, int __val)
! { _Atomic_word *__m = (_Atomic_word*)__mem; *__m += __val; }
static inline _Atomic_word
__attribute__ ((__unused__))
More information about the Libstdc++
mailing list