https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125737

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <[email protected]>:

https://gcc.gnu.org/g:4d341923e93d6d55b4cdc36db7a8e52f03973c19

commit r17-1953-g4d341923e93d6d55b4cdc36db7a8e52f03973c19
Author: Kael Andrew Alonzo Franco <[email protected]>
Date:   Tue Jun 23 14:34:29 2026 -0400

    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 <[email protected]>

Reply via email to