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

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

https://gcc.gnu.org/g:298071eb7e88b01adc6a88f9eba797edaedec170

commit r17-2970-g298071eb7e88b01adc6a88f9eba797edaedec170
Author: liuhongt <[email protected]>
Date:   Fri Jun 12 01:43:32 2026 -0700

    expand: Split divisions with near-power-of-two divisors [PR
middle-end/125708]

    When range info proves that a TRUNC_DIV_EXPR divisor is either N or N
    + 1, and one value is a positive power of two, expand the operation as
    two constant divisions selected by a conditional move.

    Only do this for speed, when conditional moves are available.  Cost
    the split sequence against a plain DIV/UDIV and keep the original
    expansion unless the split is cheaper.

            PR middle-end/125708

    gcc/ChangeLog:

            * expr.cc: Include gimple-range.h.
            (near_pow2_divisor_range_p): New function.
            (expand_expr_divmod): Split eligible TRUNC_DIV_EXPRs into two
            constant divisions selected by a conditional move.

    gcc/testsuite/ChangeLog:

            * gcc.dg/torture/pr125708-1.c: New test.
            * gcc.target/i386/pr125708-2.c: New test.
  • [Bug middle-end/125708] Missed ... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to