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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by hongtao Liu <liuho...@gcc.gnu.org>:

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

commit r13-2503-gc13223b790bbc5e4a3f5605e057eac59b61b2c85
Author: liuhongt <hongtao....@intel.com>
Date:   Thu Aug 4 09:04:22 2022 +0800

    Extend vectorizer to handle nonlinear induction for neg, mul/lshift/rshift
with a constant.

    For neg, the patch create a vec_init as [ a, -a, a, -a, ...  ] and no
    vec_step is needed to update vectorized iv since vf is always multiple
    of 2(negative * negative is positive).

    For shift, the patch create a vec_init as [ a, a >> c, a >> 2*c, ..]
    as vec_step as [ c * nunits, c * nunits, c * nunits, ... ], vectorized iv
is
    updated as vec_def = vec_init >>/<< vec_step.

    For mul, the patch create a vec_init as [ a, a * c, a * pow(c, 2), ..]
    as vec_step as [ pow(c,nunits), pow(c,nunits),...] iv is updated as vec_def
=
    vec_init * vec_step.

    The patch handles nonlinear iv for
    1. Integer type only, floating point is not handled.
    2. No slp_node.
    3. iv_loop should be same as vector loop, not nested loop.
    4. No UD is created, for mul, use unsigned mult to avoid UD, for
       shift, shift count should be less than type precision.

    gcc/ChangeLog:

            PR tree-optimization/103144
            * tree-vect-loop.cc (vect_is_nonlinear_iv_evolution): New function.
            (vect_analyze_scalar_cycles_1): Detect nonlinear iv by upper
function.
            (vect_create_nonlinear_iv_init): New function.
            (vect_peel_nonlinear_iv_init): Ditto.
            (vect_create_nonlinear_iv_step): Ditto
            (vect_create_nonlinear_iv_vec_step): Ditto
            (vect_update_nonlinear_iv): Ditto
            (vectorizable_nonlinear_induction): Ditto.
            (vectorizable_induction): Call
            vectorizable_nonlinear_induction when induction_type is not
            vect_step_op_add.
            * tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer):
            Update nonlinear iv for epilogue loop.
            * tree-vectorizer.h (enum vect_induction_op_type): New enum.
            (STMT_VINFO_LOOP_PHI_EVOLUTION_TYPE): New Macro.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/pr103144-mul-1.c: New test.
            * gcc.target/i386/pr103144-mul-2.c: New test.
            * gcc.target/i386/pr103144-neg-1.c: New test.
            * gcc.target/i386/pr103144-neg-2.c: New test.
            * gcc.target/i386/pr103144-shift-1.c: New test.
            * gcc.target/i386/pr103144-shift-2.c: New test.

Reply via email to