http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52941
--- Comment #7 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-04-17 00:03:19 UTC --- Created attachment 27173 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27173 Proposed patch (In reply to comment #6) > The patch looks just fine. I don't mind whether those atomics are > fully optimized or not ATM. Programs having atomics in the minor > loop are pathological in the first place, I think. I was also concerned about the code size in sync.md... Anyway, how about the attached patch instead? It now should do all atomics for -mhard-atomic. I've scrapped the LUT and whatnot and the code size (both generated and in the compiler) now looks more reasonable. Only one thing ... is it safe to do the "@-r15", "@+r15" stuff in the atomic sequence? I remember there were some border cases where things would blow up, but can't recall. I've also briefly checked with atomic vars being on the stack and it looks OK.