https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52933
--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> --- Some of the original test cases are still not working. In particular cases where bit positions != 31 are compared/xor'ed: bool cmp_signs_24 (int a, int b) { return (a & 0x8000) ^ (b & 0x8000); } bool cmp_signs_25 (int a, int b) { return (a & 0x8000) != (b & 0x8000); } bool cmp_signs_26 (short a, short b) { return (a < 0) == (b < 0); } bool cmp_signs_27 (short a, short b) { return (a < 0) != (b < 0); } int cmp_signs_28 (short a, short b) { return (a < 0) != (b < 0) ? 40 : -10; } Such cases can be improved by shifting the tested bit into MSB position and using div0s.