https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68908
--- Comment #4 from Richard Henderson <rth at gcc dot gnu.org> --- I think we should rather handle this in the front end than with quite complex pattern matching. If we want to do any complex logic with atomics in the middle-end, we should change their representation so that we don't have to struggle with a sequence of builtins. Which is clearly a subject for gcc7 at minimum.