https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56223
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note I did submit a patch (https://gcc.gnu.org/pipermail/gcc-patches/2021-July/574892.html) for: int abs0(int a, int b) { int c = a - b; if (c <= 0) c = b - a; return c; } But this is unrelated to your original testcase.