https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106701
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- I'd say all single-operation magic shouldn't happen in match.pd, this really looks like something for RTL expansion to decide. For example some targets might have instructions that can either do cst - a or cst ^ a with an immediate (when integer_pow2p (cst + 1)). match.pd should be about canonicalization here (none of the two is "simpler"), but canonicalization based on value-range looks a bit iffy.