There is no way, AFAIK. GCC implements C++11 atomics via lock-free builtin functions (__atomic_fetch_add
, __atomic_test_and_set
, etc). Depending on what is available in the machine definition, GCC may emit some efficient insn sequence or, as a last resort, use a compare-and-swap loop. If nothing useful is available, GCC just emits calls to external functions with the same names and arguments.
http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/_005f_005fatomic-Builtins.html#_005f_005fatomic-Builtins
PS. Actually, you may compile with -m32 -march=i386
and provide yourself the required external functions.