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

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

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

commit r17-3672-gf8aa5e7715dbc2c6c6e4fb672b5e0ce0b7922bdf
Author: Kyrylo Tkachov <[email protected]>
Date:   Tue Aug 25 12:54:01 2026 +0200

    match.pd: require constant FMAX and FMIN reductions to fold [PR127039]

    The PR 127039 fix requires a generated constant reduction to fold for
    the operations that have an inverse reduction-pair rule.  It leaves
    FMAX and FMIN unchanged because they cannot form that cycle.

    The cycle is not the only concern.  When the constant reduction does
    not fold, the rule changes one runtime reduction:

      r = .REDUC_FMAX (.FMAX (v, C));

    into two:

      r1 = .REDUC_FMAX (v);
      r2 = .REDUC_FMAX (C);
      r = .FMAX (r1, r2);

    Require the constant reduction to fold for FMAX and FMIN too.  All
    eight reductions can then share one rule.  The transform is rejected
    when it would introduce a second runtime reduction.

    Bootstrapped and tested on aarch64-unknown-linux-gnu.

    gcc/ChangeLog:

            PR tree-optimization/127039
            * match.pd (REDUC (@0 op VECTOR_CST)): Require FMAX and FMIN
            constant reductions to simplify.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/127039
            * gcc.target/aarch64/vec-reduc-fmax-const-1.c: New test.

    Signed-off-by: Kyrylo Tkachov <[email protected]>

Reply via email to