https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110217
--- Comment #4 from Georg-Johann Lay <gjl at gcc dot gnu.org> --- At least CLI / SBI won't glitch at O0, same for ATOMIC_BLOCK. For SBI et al. you are right, they rely on insn combine. The right approach would have been compiler built-ins or API using inline asm. But the time to introduce such interfaces was 20 or so years ago...