gnu/gcc/4d341923e93d6d55b4cdc36db7a8e52f03973c19 match: X % Y < Y -> Y >= 0 and X % Y >= Y -> Y < 0 [PR125737]
We had a pattern for `X % Y < Y` when X and Y where non-negative but
this can be generalized for all values. And also we can handle `>=` too.
Bootstrapped and tested on x86_64-pc-linux-gnu
PR tree-optimization/125737
gcc:
* match.pd: Optimize X % Y < Y -> Y >= 0 and X % Y >= Y -> Y < 0
gcc/testsuite:
* gcc.dg/pr125737.c: Move test to pr125737-1.c.
* gcc.dg/pr125737-1.c: Add test for (a % b) >= b when a and b are nonnegative.
* gcc.dg/pr125737-2.c: New test for (a % b) {<,>=} b.
Signed-off-by: Kael Franco <kaelfandrew@gmail.com>
4 files changed