In compatibility.h, there are a lot of compiler- and architecture dependent switches. Relying on the GCC atomic operations would make this much cleaner.
Created attachment 17438 [details] remove support for other compilers this patch re-implements the parallel mode's atomic operations in terms of the GCC builtins
Created attachment 18049 [details] use BITS_PER_UNIT instead of hardcoded 8 additional patch to use BITS_PER_UNIT for lcas_t_bits
Ok, we are very far from having the parallel mode facilities correctly uglified, but we could as well use __CHAR_BIT__...
Note: I don't think we should remove support for ICC, since lately it doesn't come anymore with Dinkum, libstdc++-v3 is the default C++ runtime. Likewise, we should probably keep support for mingw32 and cygwin. In short I think we should be careful with the sort of clean up envisaged by Jon in Comment #1.
and I thought everyone had forgotten about that patch ;) granted, ICC uses libstdc++, but doesn't it already have to support the same atomic builtins as used elsewhere in the library? And my patch changes parallel mode to use those same builtins (which are designed after the Intel intrinsics anyway, so likely to work in ICC!)
similarly, if cygwin and mingw32 implement __sync_fetch_and_add etc. then why keep custom versions for those platforms? (but maybe the builtins aren't implemented on those platforms - I have no idea)
I don't know the details frankly, but at minimum we should be *very* careful and make sure we do the right thing also in the special cases, eg, on i386 when the atomic builtins are not available.
The compatibility.h header is still a complete mess with code we don't need, can I take this bug and clean it up? (In reply to comment #4) > Note: I don't think we should remove support for ICC, since lately it doesn't > come anymore with Dinkum, libstdc++-v3 is the default C++ runtime. But the code guarded by __ICC uses Win32 API functions, so can only work on Windows, not when ICC is used with libstdc++ With the new __atomic built-ins the file should be even simpler.
Definitely Jon!
mine then
Author: redi Date: Sat Sep 29 17:58:34 2012 New Revision: 191856 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191856 Log: PR libstdc++/34106 * include/parallel/compatibility.h: Remove non-GCC code. Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/parallel/compatibility.h
Non-GCC code removed, so closing as fixed. See Bug 54754 for further changes needed to support non-x86_64 platforms.