https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110293
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Some more generally for the ==/!= cases for CSTs: x == (x == CST) -> CST == 0 ? 0 : (CST == 1 ? (x==0||x==1) : x != 0) x == (x != CST) -> CST == 1 ? 0 : (CST == 0 ? (x==0||x==1) : x != 1) x != (x == CST) -> CST == 0 ? 1 : (CST == 1 ? (x!=0&&x!=1) : x != 0) x != (x != CST) -> CST == 1 ? 1 : (CST == 0 ? (x!=0&&x!=1) : x != 1)