https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103857
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I don't think that's equivalent. For a[i] equal to b it will be and similarly it will be for a[i] equal to c, but not for all the other values. E.g. 13 == 42 ? 24 : 42 is 42, but 13 ^ (24 ^ 42) is 63. So, we could do this only if something assures us that a[i] only has 2 possible values, either equal to b or to c. So that would rule out non-constant b or c, perhaps it could be done if value range is two adjacent constants equal to b and c, or perhaps if the non-zero bits has a single bit and one of b or c is 0 and the other one is that non-zero bitmask of the other comparison operand.