https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98737
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #50058|0 |1 is obsolete| | --- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 51997 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51997&action=edit gcc12-pr98737.patch Updated patch which uses internal fn and optabs for this. Only the *_fetch and not fetch_* atomics are handled though. For the latter, I wonder if we instead just shouldn't generally try to replace __atomic_fetch_add (&x, y, whatever) + y with __atomic_add_fetch (&x, y, whatever) and __atomic_add_fetch (&x, y, whatever) - y with __atomic_fetch_add (&x, y, whatever) etc.