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

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

https://gcc.gnu.org/g:f48c10c6c7bda00d913dd06803e1519d1301801b

commit r17-1412-gf48c10c6c7bda00d913dd06803e1519d1301801b
Author: Naveen <[email protected]>
Date:   Sun Jun 7 21:20:42 2026 -0700

    [PATCH] tree-optimization/118680 match.pd: Fold (type)(minmax((wide)a,
(wide)b)) -> minmax(a, b)

    This patch folds a min/max expression where both operands are first
    widened to a larger integer type and the result is then converted back
    to the original type.

    For example:
      (uint32_t) MAX_EXPR <(uint64_t) a, (uint64_t) b>
    can be folded to:
      MAX_EXPR <a, b>
    when the widening conversion preserves the signedness of the original
    type. In that case the wider min/max result is always one of the
    original operands so converting it back is unnecessary.

    The PR118680 match.pd simplification folds widened integer MIN/MAX
    expressions before vectorization. pr113281-5.c does not contain
over-widened
    MIN_EXPR/MAX_EXPR operations for the vectorizer to narrow. Hence, the
    corresponding vectorizer dump messages are no longer emitted.

    Bootstrapped and tested on aarch64-linux-gnu.

    PR tree-optimization/118680

    gcc/ChangeLog:
            * match.pd: ((type) minmax (wide) a, wide (b)): New pattern.

    gcc/testsuite/ChangeLog:
            * gcc.dg/tree-ssa/pr118680.c: New test.
            * gcc.dg/vect/pr113281-5.c: Drop MIN_EXPR and MAX_EXPR narrowing
            dump checks that are optimized away before vectorization.

    Signed-off-by: Naveen <[email protected]>
  • [Bug tree-optimization/118680] ... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to