atomic.h: Prefer GCC builtins over ASM

The compiler can optimize the builtins better. For example, if the
result is not used, the compiler can use an instruction that does not
fetch the result and thus might generate more efficient code.