https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64567
--- Comment #6 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:b4162b53545220b2ae19993e2edf4707bab4a3db commit r17-83-gb4162b53545220b2ae19993e2edf4707bab4a3db Author: Daniel Barboza <[email protected]> Date: Wed Feb 18 10:29:50 2026 -0300 match.pd: remove bit set/bit clear branch mispredict [PR64567] Add two patterns to eliminate mispredicts in the following bit ops scenarios: - checking if a single bit is not set, and in this case set it: always set the bit; - checking if a bitmask is set (even partially), and in this case clear it: always clear the bitmask. Bootstrapped and tested with x86_64-pc-linux-gnu. PR tree-optimization/64567 gcc/ChangeLog: * match.pd (`cond (bit_and A IMM) (bit_or A IMM) A`): New pattern. (`cond (bit_and A IMM) (bit_and A ~IMM) A`): New pattern. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr64567-2.c: New test. * gcc.dg/tree-ssa/pr64567.c: New test.
