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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <l...@gcc.gnu.org>:

https://gcc.gnu.org/g:224fd59b2dc8a5fa78a309a09863afe9b3cf2111

commit r14-2367-g224fd59b2dc8a5fa78a309a09863afe9b3cf2111
Author: Hao Liu OS <h...@os.amperecomputing.com>
Date:   Thu Jul 6 10:04:46 2023 -0600

    Vect: use a small step to calculate induction for the unrolled loop (PR
tree-optimization/110449)

    If a loop is unrolled by n times during vectoriation, two steps are used to
    calculate the induction variable:
      - The small step for the unrolled ith-copy: vec_1 = vec_iv + (VF/n *
Step)
      - The large step for the whole loop: vec_loop = vec_iv + (VF * Step)

    This patch calculates an extra vec_n to replace vec_loop:
      vec_n = vec_prev + (VF/n * S) = vec_iv + (VF/n * S) * n = vec_loop.

    So that we can save the large step register and related operations.

    gcc/ChangeLog:

            PR tree-optimization/110449
            * tree-vect-loop.cc (vectorizable_induction): use vec_n to replace
            vec_loop for the unrolled loop.

    gcc/testsuite/ChangeLog:

            * gcc.target/aarch64/pr110449.c: New testcase.

Reply via email to