This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Call for compiler help/advice: atomic builtins for v3


Richard Guenther wrote:

>Can you point me to some libstdc++ class/file where you use the
>builtins or other solution?
>
Simply config/cpu/*/atomicity.h will do, for ia64, powerpc, ia64, alpha,
s390, currently to implement __exchange_and_add and __atomic_add. Note
that in this way the latter are *not* inlined, because atomicity.h is
compiled in the *.so :-(

Anyway, as you can see, currently we are using only one builtin,
__sync_fetch_and_add, and only for one type, _Atomic_word, but if we can
rely on the builtins to be available we can call them directly from the
*headers* for a big performance benefit. Also in many other places, of
course, e.g., lock-free tr1::shared_ptr.

I'm still unsure, however, which is the most flexible and clean
strategy: a fall back library call mechanism in principle (could) allow
to easily obtain a behavior very similar to the current one when you
don't pass any special -march at compile time, at the cost of worse
performance indeed, but meaning a single executable both for i386 and
i686. I think it is possible to have libgcc code tailored to the
effective target (i386 vs i686), right?

If possible, I think the latter is a wanted feature. Maybe there is
something I don't understand about the libgcc-based mechanisms... I'm
eager to learn more...

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]