[Bug tree-optimization/113072] `(a ^ CST0) & (~a ^ CST0)` is not optimized to 0 at the gimple level

2024-05-29 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113072 Andrew Pinski changed: What|Removed |Added Resolution|--- |DUPLICATE Status|ASSIGNED

[Bug tree-optimization/113072] `(a ^ CST0) & (~a ^ CST0)` is not optimized to 0 at the gimple level

2023-12-31 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113072 --- Comment #5 from Andrew Pinski --- (In reply to Andrew Pinski from comment #2) > Looks like bool sometimes produces != or ^ :) > ``` > bool foo(bool a, int b) > { > bool b1 = b == 1; > bool b2 = !b1; > bool c = (a ^

[Bug tree-optimization/113072] `(a ^ CST0) & (~a ^ CST0)` is not optimized to 0 at the gimple level

2023-12-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113072 --- Comment #4 from Andrew Pinski --- Note this applies to `|` instead of `&` too: ``` int foo1(int a, int b) { return (a ^ 4) | (~a ^ 4); } ``` This should be optimized to `-1`. Though this does NOT get optimized to `-1` on the RTL

[Bug tree-optimization/113072] `(a ^ CST0) & (~a ^ CST0)` is not optimized to 0 at the gimple level

2023-12-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113072 --- Comment #3 from Andrew Pinski --- here is the bool testcase which just allows the use of ^: ``` bool foo1(bool a, int b) { bool b1 = b == 1; bool b2 = !b1; return (a ^ b1) & (a ^ b2); } ```

[Bug tree-optimization/113072] `(a ^ CST0) & (~a ^ CST0)` is not optimized to 0 at the gimple level

2023-12-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113072 Andrew Pinski changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill

[Bug tree-optimization/113072] `(a ^ CST0) & (~a ^ CST0)` is not optimized to 0 at the gimple level

2023-12-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113072 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Ever confirmed|0

[Bug tree-optimization/113072] `(a ^ CST0) & (~a ^ CST0)` is not optimized to 0 at the gimple level

2023-12-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113072 --- Comment #1 from Andrew Pinski --- Wait this part is wrong `which does basically `(a ^ 4) & (a ^ (~4))` -> `(4 ^ (~4)) & (a ^ a)` which is 0 as `a ^ a` is 0.` Anyways a pattern like: ``` (simplify (bit_and (bit_xor @0 @1) (bit_xor @0 @2))