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

--- Comment #1 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:3602ebc86473a9ff9c68996470600e372a8b9379

commit r16-4499-g3602ebc86473a9ff9c68996470600e372a8b9379
Author: Richard Biener <[email protected]>
Date:   Thu Oct 9 14:03:29 2025 +0200

    Implement bool reduction vectorization

    Currently we mess up here in two places.  One is pattern recognition
    which computes a mask-precision for a bool reduction PHI that's
    inconsistent with that of the latch definition.  This is solved by
    iterating the mask-precision computation.  The second is that the
    reduction epilogue generation and the code querying support for it
    isn't ready for mask inputs.  The following fixes this by falling
    back to doing all the epilogue processing on a data type again, if
    the target does not support a direct mask reduction.  For that we
    utilize the newly added reduc_sbool_{and,ior,xor}_scal optabs
    so we can go the direct IFN path on masks if the target supports
    that.  In the future we can also implement an additional fallback
    for IOR and AND reductions using a scalar cond-expr like
    mask != 0 ? true : false, but the new optabs provide more information
    to the target.

            PR tree-optimization/101639
            PR tree-optimization/103495
            * tree-vectorizer.h (vect_reduc_info_s): Add reduc_type_for_mask.
            (VECT_REDUC_INFO_VECTYPE_FOR_MASK): New.
            * tree-vect-patterns.cc (vect_determine_mask_precision):
            Return whether the mask precision changed.
            (vect_determine_precisions): Iterate mask precision computation
            for loop vectorization.
            * tree-vect-loop.cc (get_initial_defs_for_reduction): Properly
            convert non-mask initial values to a mask initial def for
            the reduction.
            (sbool_reduction_fn_for_fn): New function.
            (vect_create_epilog_for_reduction): For a mask input convert
            it to the vector type analysis decided to use.  Use a regular
            conversion for the final convert to the scalar code type.
            (vectorizable_reduction): Support mask reductions.  Verify
            we can compute a data vector from the mask result or a direct
            maks reduction is provided by the target.

            * gcc.dg/vect/vect-reduc-bool-1.c: New testcase.
            * gcc.dg/vect/vect-reduc-bool-2.c: Likewise.
            * gcc.dg/vect/vect-reduc-bool-3.c: Likewise.
            * gcc.dg/vect/vect-reduc-bool-4.c: Likewise.
            * gcc.dg/vect/vect-reduc-bool-5.c: Likewise.
            * gcc.dg/vect/vect-reduc-bool-6.c: Likewise.
            * gcc.dg/vect/vect-reduc-bool-7.c: Likewise.
            * gcc.dg/vect/vect-reduc-bool-8.c: Likewise.
  • [Bug tree-optimization/103495] ... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to