gnu/gcc/cee985872c4976c6253c9caeae476760fcf18bec tree-optimization: Add bitop reduction simplifications against zero
This patch introduces a simplification rule in match.pd to reduce bitwise
expressions against zero. Specifically, it simplifies patterns where a
variable checked against zero is combined via bitwise AND/OR with a compounded
bitwise OR check against zero.
PR tree-optimization/125442
gcc/ChangeLog:
* match.pd: Add simplification rules for
(a == 0) | ((a | b) == 0) -> (a == 0) and
(a != 0) & ((a | b) != 0) -> (a != 0).
gcc/testsuite/ChangeLog:
* gcc.dg/int-bwise-opt-3.c: New test.
* gcc.dg/int-bwise-opt-4.c: New test.
Suggested-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
Signed-off-by: Souradipto Das <souradiptodas6@gmail.com>
3 files changed