https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116860
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Even on targets like riscv, if one tries int cmp1(int d1, int d2, int d3) { if (((d1 ^ d2) & 0xabcd) == 0 || d3 != 42 || d1 != d2) return 0; return 1; } (i.e. inserts in between completely unrelated comparison (or many of them)), I strongly doubt you can optimize that.