https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96688
--- Comment #1 from Gabriel Ravier <gabravier at gmail dot com> --- int f(int x) { return ~(x + 123); } A very similar optimization can be done with this, by converting this to `return ~123 - x;` (and the constant can be swapped out with pretty much any other constant here too).