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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-09-19
     Ever confirmed|0                           |1
            Summary|Missed loop vectorization   |Missed loop vectorization
                   |case with gather/scatter    |case due to even IV
                   |                            |division by two
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
This isn't about gather/scatter but SCEV analysis failing to handle i/2
(i >> 1 in the IL) as IV.  That's only affine because i is even so it's
an exact division.  We might want to "fold" i / 2 to i /[ex] 2 somewhere
in VRP to help, but possibly somehow SCEV could "optimistically" analyze
the shift and resolve it after it finds the initial value and increment.

Bottom line - rewrite your code to

    for (int i = 0; i < n/2; i++)
    {
        out1[i] = in[2*i];
        out2[i] = in[2*i+1];
    }

Reply via email to