Re: Atomic operations on Sparc in libstdc++

2006-01-09 Thread Benjamin Kosnik

Piotr,

Hello. First, a note: you should be sending libstdc++ mail to the
[EMAIL PROTECTED] list.

I haven't verified your claim, but if it is true, I would suggest the
following actions on your part to solve it:

1) enter a sparc backend bug in gcc bugzilla about not defining __sparcv9 in 32 
bit mode. Make sure the sparc maintainer is cc'd. (That would be Eric Botcazou).

2) enter a libstdc++ feature request in gcc bugzilla about 32bit atomic
operations on sparc. Please include the atomic operations you've developed and 
would like to be part of libstdc++.

I don't have access (or time) to deal with sun/sparc issues directly at
the moment, but hopefully this will be useful to you.

best,
benjamin



Atomic operations on Sparc in libstdc++

2006-01-07 Thread Piotr Wyderski
Hello,

why there is no cas-based version of __exchange_and_add for 32-bit
mode Sparcs in libstdc++, namely in config/cpu/sparc/atomicity.h ?
There is spinlock-based generic code for all Sparcs, but V9 does support
32-bit cas, which can be used instead of a spinlock. This spinlock

_Atomicity_lock<__inst>::_S_atomicity_lock

causes serious scalability problems with std::string. On a machine with
4 processors our 32-bit code is only about 2.3 times faster that on a
uniprocessor. When I hack atomicity.h, providing my own cas-based
__exchange_and_add, it works nearly 4 times faster compared to a UP.

Is it possible to replace __exchange_and_add with my code without
patching libstdc++? Unfortunately it is impossible to provide a generic
patch for atomicity.h, because GCC does not define __sparcv9 in
32-bit mode, as described in this thread:

http://gcc.gnu.org/ml/gcc/2005-11/msg00842.html

Best regards
Piotr Wyderski