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

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

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

commit r16-7006-gd3b05ff815921ffe525787ed375665ef08a35135
Author: Robin Dapp <[email protected]>
Date:   Fri Jan 23 11:51:57 2026 +0100

    vect: Only scale vec_offset once [PR123767].

    Since allowing "unsupported" scales by just multiplying there was an
    issue with how the vec_offset was adjusted:

    For "real" gathers/scatters we have a separate vec_offset per stmt copy.
    For strided gather/scatter, however, there is just one vec_offset common
    to all copies.

    In case of an unsupported scale we need to multiply vec_offset with the
    required scale which is currently done like this:
     for (i = 0; i < num_vec; i++)
       vec_offset = vec_offset * scale_constant;
    where vec_offset is only different for real gathers/scatter.

    Thus, for more than one copy of a strided gather/scatter, we will
    erroneously multiply an already scaled vec_offset.

    This patch only performs the vec_offset scaling
     - for each copy in real gathers/scatters or
     - once for the first copy for strided gathers/scatters.

            PR tree-optimization/123767

    gcc/ChangeLog:

            * tree-vect-stmts.cc (vectorizable_store): Only scale offset
            once.
            (vectorizable_load): Ditto.

    gcc/testsuite/ChangeLog:

            * gcc.target/aarch64/sve/pr123767.c: New test.

Reply via email to