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

--- Comment #17 from Martin Sebor <msebor at gcc dot gnu.org> ---
Following up on my comment #14, and as requested on gcc-patches, the test case
below is vectorized with GCC 4.8.2 for T being either 32 bits wide (e.g., int)
or 64-bits wide (e.g., long or long long) but not with the fix referenced in
comment #13.  The difference between the test in costmodel-bb-slp-9a.c and the
code here is that unlike the source, the destination of the copy isn't aligned
on an even element boundary.

const T a [] = { 1, 2, 3, 4, 5 };
extern T b[sizeof a / sizeof *a];

void g (void)
{
    const T *p = a;
    T *q = b + 1;

    *q++ = *p++;
    *q++ = *p++;
    *q++ = *p++;
    *q++ = *p++;
}

In addition to this failure (mentioned on the list) the latest trunk also fails
to vectorize the following code which is successfully vectorized by 4.8.2.  The
difference is that the arrays are only declared here while in
costmodel-bb-slp-9a.c they are defined.  I only noticed this now, and so it's
not being exercised in the proposed enhanced test submitted to gcc-patches last
Friday,

extern const T a [];
extern T b[];

void g (void)
{
    const T *p = a + 1;
    T *q = b;

    *q++ = *p++;
    *q++ = *p++;
    *q++ = *p++;
    *q++ = *p++;
}

Reply via email to