https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96921
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The final conversion should happen at the RTL level (or during expansion). simplify-rtx.c has this: /* If STORE_FLAG_VALUE is 1, (minus 1 (comparison foo bar)) can be done by reversing the comparison code if valid. */ I will implement the rtl level in simplify-rtx.c first and then add the others.