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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>:

https://gcc.gnu.org/g:19d1a529fa9f78e7ec7be38d423c90e00cec8f8c

commit r12-2832-g19d1a529fa9f78e7ec7be38d423c90e00cec8f8c
Author: Richard Biener <rguent...@suse.de>
Date:   Mon Aug 9 11:42:47 2021 +0200

    tree-optimization/101801 - rework generic vector vectorization more

    This builds ontop of the vect_worthwhile_without_simd_p refactoring
    done earlier.  It was wrong in dropping the appearant double checks
    for operation support since the optab check can happen with an
    integer vector emulation mode and thus succeed but vector lowering
    might not actually support the operation on word_mode.

    The following patch adds a vect_emulated_vector_p helper and
    re-instantiates the check where it was previously.  It also adds
    appropriate costing of the scalar stmts emitted by vector lowering
    to vectorizable_operation which should be the only place such
    operations are synthesized.  I've also cared for the case where
    the vector mode is supported but the operation is not (though
    I think this will be unlikely given we're talking about plus, minus
    and negate).

    This fixes the observed FAIL of gcc.dg/tree-ssa/gen-vect-11b.c
    with -m32 where we end up vectorizing a multiplication that ends up
    being teared down to scalars again by vector lowering.

    I'm not super happy about all the other places where we're now
    and previously feeding scalar modes to optab checks where we
    want to know whether we can vectorize sth but well.

    2021-09-08  Richard Biener  <rguent...@suse.de>

            PR tree-optimization/101801
            PR tree-optimization/101819
            * tree-vectorizer.h (vect_emulated_vector_p): Declare.
            * tree-vect-loop.c (vect_emulated_vector_p): New function.
            (vectorizable_reduction): Re-instantiate a check for emulated
            operations.
            * tree-vect-stmts.c (vectorizable_shift): Likewise.
            (vectorizable_operation): Likewise.  Cost emulated vector
            operations according to the scalar sequence synthesized by
            vector lowering.

Reply via email to