On 5/11/2026 6:59 AM, Naveen wrote:
> 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.
This is OK for the trunk.  Sorry it took so long.

jeff

Reply via email to