https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122616
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:73824bffde7a2226a864313546f8f0bd127a22b7 commit r16-5896-g73824bffde7a2226a864313546f8f0bd127a22b7 Author: Daniel Barboza <[email protected]> Date: Thu Nov 27 22:03:18 2025 -0300 match.pd: x&c ?(x op c):(x|c) -> x^c [PR122615, PR122616] Add a single pattern to reduce these patterns to "x ^ c": x & c ? (x - c) | (x | c) x & c ? (x & ~c) | (x | c) As long as "c" has a single bit set. PR tree-optimization/122615 PR tree-optimization/122616 gcc/ChangeLog: * match.pd (`x & c ? (x - c) | (x | c)`): New pattern. (`x & c ? (x & ~c) | (x | c)`): Likewise. gcc/testsuite/ChangeLog: * gcc.dg/torture/pr122615.c: New test. * gcc.dg/torture/pr122616.c: Likewise. Co-authored-by: Jeff Law <[email protected]> Signed-off-by: Daniel Barboza <[email protected]>
