Atomic operations/builtins and Windows

Hi,

What is the status/usability of Clang’s builtin atomic functions, especially on Windows? Are the builtins related to the availability of pthreads or not?

It seems libc++ uses these builtins, but for --mingw*, they’re undeclared :frowning:

Can Clang “tap into” the GCC implementations?

Thanks,

Ruben

Please clarify what exactly you are talking about... which builtins, exactly?

-Eli

2011/9/25 Eli Friedman <eli.friedman@gmail.com>

Hi,

What is the status/usability of Clang’s builtin atomic functions, especially
on Windows? Are the builtins related to the availability of pthreads or not?

It seems libc++ uses these builtins, but for --mingw*, they’re undeclared
:frowning:

Can Clang “tap into” the GCC implementations?

Please clarify what exactly you are talking about… which builtins, exactly?

Things documented/proposed? here:
http://libcxx.llvm.org/atomic_design_a.html
or http://libcxx.llvm.org/atomic_design_b.html
or http://libcxx.llvm.org/atomic_design_c.html
GCC has _sync* documented here: http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html

I don’t know if libc++ is meant to be usable yet (I would think it is), but the __has_feature(cxx_atomic) is false for my Clang build. I do know someone did some work in this regard for Clang. The only discussion on this topic I can find right now is dated almost a year ago:
http://clang-developers.42468.n3.nabble.com/atomic-intrinsics-td1618127i20.html

Ruben

PS: if is not meant to be used right now, I’ll ignore it completely.

<atomic> is not meant to be used right now. I'm working with Howard
and a couple other people to get it working, but it isn't quite there
yet.

-Eli

I posted this same question to the list last week. The short answer:

Eli is working on it and posted a patch to the -commits list last week, which makes about 25 of the tests pass, but the rest still fail.

David