Match: Add pattern for `(a ? b : 0) | (a ? 0 : c)` into `a ? b : c` [PR103660]
This adds a pattern to convert `(a ? b : 0) | (a ? 0 : c)` into `a ? b : c`
which is simplier. It adds both for cond and vec_cond; even though vec_cond is
handled via a different pattern currently but requires extra steps for matching
so this should be slightly faster.
Also handle it for xor and plus too since those can be handled the same way.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR tree-optimization/103660
gcc/ChangeLog:
* match.pd (`(a ? b : 0) | (a ? 0 : c)`): New pattern.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/pr103660-4.C: New test.
* gcc.dg/tree-ssa/pr103660-4.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>