[Bug tree-optimization/93150] (A) == CST1 &( ((A)==CST2) | ((A)==CST3) ) is not simplified
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93150 --- Comment #4 from Navid Rahimi --- Although I wrote a small code to just test this optimization. But I am not able to verify this transformation [1]. https://alive2.llvm.org/ce/z/THP27D The code can be something like this but if I were able to verify the optimization, I don't see any reason why N, M, O should be constant too. /* ((x & N) == CST1) bitop1 (((x & M) == CST2) bitop2 ((x & O) == CST3)) -> ((x & (N | M)) == (CST1 | CST2)) bitopt2 ((x & (N | O)) == (CST1 | CST3)) */ (for bitop1 (bit_and bit_or) bitop2 (bit_or bit_and) (for cmp (eq ne) (simplify (bitop1:c (cmp (bit_and @0 INTEGER_CST@N) INTEGER_CST@CST1) (bitop2 (cmp (bit_and @0 INTEGER_CST@N) INTEGER_CST@CST2) (cmp (bit_and @0 INTEGER_CST@N) INTEGER_CST@CST3))) (bitop2:c (cmp (bit_and:c @0 (bit_or INTEGER_CST@N INTEGER_CST@M)) (bit_or INTEGER_CST@CST1 INTEGER_CST@CST2)) (cmp (bit_and:c @0 (bit_or INTEGER_CST@N INTEGER_CST@O)) (bit_or INTEGER_CST@CST1 INTEGER_CST@CST3))
[Bug tree-optimization/93150] (A) == CST1 &( ((A)==CST2) | ((A)==CST3) ) is not simplified
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93150 --- Comment #3 from Navid Rahimi --- Thanks Dávid, that does make sense. I forgot about constant elimination. I will send a patch for this.
[Bug tree-optimization/93150] (A) == CST1 &( ((A)==CST2) | ((A)==CST3) ) is not simplified
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93150 Dávid Bolvanský changed: What|Removed |Added CC||david.bolvansky at gmail dot com --- Comment #2 from Dávid Bolvanský --- Bin ops with constants are simplified by compiler itself..
[Bug tree-optimization/93150] (A) == CST1 &( ((A)==CST2) | ((A)==CST3) ) is not simplified
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93150 navidrahimi changed: What|Removed |Added CC||navidrahimi at microsoft dot com --- Comment #1 from navidrahimi --- I was just checking this bug and I don't see how this can be a win though: Expression: (x) == CST1 & ( ((x)==CST2) | ((x)==CST3)) Number of operations: &:4 |:1 ==:3 Expression: ((x&(N|M)) == (CST1|CST2)) | ((x&(N|O)==(CST1|CST3)) Number of operations: &:2 |:5 ==:2 P.S. I might be missing something here though.