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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>:

https://gcc.gnu.org/g:45466eecf5ef669164c0922e5be8fd288b144886

commit r14-1412-g45466eecf5ef669164c0922e5be8fd288b144886
Author: Andrew Pinski <apin...@marvell.com>
Date:   Tue May 16 14:26:41 2023 -0700

    Add a != MIN/MAX_VALUE_CST ? CST-+1 : a to minmax_from_comparison

    This patch adds the support for match that was implemented for PR 87913 in
phiopt.
    It implements it by adding support to minmax_from_comparison for the check.
    It uses the range information if available which allows to produce MIN/MAX
expression
    when comparing against the lower/upper bound of the range instead of
lower/upper
    of the type.

    minmax-20.c is the new testcase which tests the ranges part.

    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

    gcc/ChangeLog:

            * fold-const.cc (minmax_from_comparison): Add support for NE_EXPR.
            * match.pd ((cond (cmp (convert1? x) c1) (convert2? x) c2)
pattern):
            Add ne as a possible cmp.
            ((a CMP b) ? minmax<a, c> : minmax<b, c> pattern): Likewise.

    gcc/testsuite/ChangeLog:

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

Reply via email to