]>
git.ipfire.org Git - thirdparty/gcc.git/commit
match.pd: Fold (y << x) <rel op> x -> 0 or 1
- (y << x) == x -> 0 when y != 0
- (y << x) {<,<=} x -> 0 when y > 0.
- (y << x) != x -> 1 when y != 0.
- (y << x) {>,>=} x -> 1 when y > 0.
Bootstrapped and regtested on aarch64-linux-gnu.
Signed-off-by: Dhruv Chawla <dhruvc@nvidia.com>
gcc/ChangeLog:
* match.pd: New patterns.
gcc/testsuite/ChangeLog:
* gcc.dg/match-shift-cmp-1.c: New test.
* gcc.dg/match-shift-cmp-2.c: Likewise.
* gcc.dg/match-shift-cmp-3.c: Likewise.
* gcc.dg/match-shift-cmp-4.c: Likewise.