https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119402
--- Comment #9 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:80c77d9a1cfbfde3a437361fa95be326fcdf3e58 commit r16-6752-g80c77d9a1cfbfde3a437361fa95be326fcdf3e58 Author: Andrew Pinski <[email protected]> Date: Mon Jan 12 18:58:47 2026 -0800 match: Add simplification of `(a*zero_one_valued_p) & b` if `a & b` simplifies [PR119402] This is a small reassociation for `a*bool & b` into `(a & b) * bool` checking if `a & b` simplifies. Since it could be the case `b` is `~a` or `a` or something else that might simplify when anding with `a`. Note this fixes a regression for aarch64 where the cost of a multiply vs `&-` changed in GCC 14 and can no longer optimize some cases at the RTL level. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/119402 gcc/ChangeLog: * match.pd (`(a*zero_one_valued_p) & b`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/bitops-14.c: New test. * gcc.dg/tree-ssa/bitops-15.c: New test. Signed-off-by: Andrew Pinski <[email protected]>
