https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79173
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 55271 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55271&action=edit gcc14-pr79173-wip.patch Untested WIP (with backend implementation for x86 only so far). Still, need to add/tweak some peephole2s to make pr79173-{1,2,3,4}.c tests clean on both x86-64 and i?86, and then as can be seen in pr79173-5.c need to do some tweaks so that it pattern recognizes also the pattern recognized __builtin_{add,sub}_overflow instead of those being used directly. C23 is standardizing __builtin_{add,sub,mul}_overflow under the ckd_{add,sub,mul} names, so pattern recognizing it that way is definitely desirable. Oh, and maybe incrementally check what happens if one of the addends or subtrahends are immediate.