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

--- Comment #4 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:8351875a5e2c52492198e3959a42b0934b89694f

commit r17-1931-g8351875a5e2c52492198e3959a42b0934b89694f
Author: Eikansh Gupta <[email protected]>
Date:   Fri Jun 26 11:10:43 2026 +0530

    tree-optimization: Use ranges for int-float comparisons [PR125385]

    When integer operands are converted to a floating-point type before a
    comparison, the existing fold only checks whether the whole integer type
    is exactly representable.  Use SSA range information as a fallback so
    range-limited values, such as those masked to [0, 255], can be compared
    directly as integers.  Apply the same range-aware exactness check to
    integer-to-float comparisons against real constants.

            PR tree-optimization/125385

    gcc/ChangeLog:

            * match.pd ((FTYPE) N CMP (FTYPE) M): Use range information
            to decide whether integer operands are exactly representable.
            ((FTYPE) N CMP CST): Likewise.
            * real.cc: Include backend.h and vr-values.h.
            (format_helper::can_represent_range_value_p): New function.
            * real.h (format_helper::can_represent_range_value_p): Declare.
            * tree-core.h (class irange): Forward declare.

    gcc/testsuite/ChangeLog:

            * gcc.dg/tree-ssa/pr125385.c: New test.

    Signed-off-by: Eikansh Gupta <[email protected]>

Reply via email to