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

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

https://gcc.gnu.org/g:195bc16864c5f75a03e631049f22a3fd0d1d7367

commit r17-5195-g195bc16864c5f75a03e631049f22a3fd0d1d7367
Author: Richard Biener <[email protected]>
Date:   Wed Oct 14 07:46:17 2026 +0200

    tree-optimization/127876 - wrong code with conditional float reduction

    When vectorizing a reduction r = <cond> ? r : CST we reduce a
    vector mixed with the initial constant value and the constant
    and perform a final MAX or MIN reduction dependent on the
    relation of the intiial value and the constant reduction value.
    That only works if they do not compare equal.  Use explicit
    LT/GT checks to cover -0.0 vs 0.0 but also NaNs.

            PR tree-optimization/127876
            * tree-vect-loop.cc (vectorizable_reduction): For
            conditional reduction assign then CONST_COND_REDUCTION mode
            with explicit LT/GT checks.

            * gcc.dg/vect/vect-pr127876-1.c: New testcase.
            * gcc.dg/vect/vect-pr127876-2.c: Likewise.

Reply via email to