
Helge Bahmann wrote:
Sure, if you turn optimization off, code looks ridiculous. Both gcc (tested with various versions ranging from 3.3 to 4.4) and msvc (visual studio express) optimize the switch/case with constant operand into nothingness.
Sorry, the problem observed on MS VC++ 2008 x86 with full optimization and SSE instruction set. See my previous answer to Phil with explanations. GCC is not studied by me.
I would however be very interested in sparc and ia64 atomic operations, would you be interested in implementing (or lending me a hand) them for boost.atomic?
You may try CDS implementation of sparc and ia64 atomics: cds\compiler\gcc\ia64\atomic.h - for itanium ia64 cds\compiler\gcc\sparc\atomic.h - for sparc 64bit mode These files contain template and common versions of 32bit and 64bit atomic primitives. If you need I can extract it from CDS for you, no problem. It works well with CDS tests but I'm not sure whether it is correct...