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

nightstrike <nightstrike at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code

--- Comment #1 from nightstrike <nightstrike at gmail dot com> ---
This should trigger the prefetchw instruction with -march=k8 -O3:

void f() {
    extern int size;
    int i;

    float * fvec;
    float * fptr = (float *) get();
    for(i = 0; i < size; ++i)
        fvec[i] = fptr[i];

    int * ivec;
    int * iptr = (int *) get();
    for(i = 0; i < size; ++i)
        ivec[i] = iptr[i];
}


If I give an "extern void * get()" prototype for get, if there's only one
vector loop, or if size is local, the prefetchw instruction goes away.

$ gcc -fverbose-asm -S a.c -march=k8 -O3; grep prefetchw a.s
        prefetchw       464(%rcx)       #
        prefetchw       (%rdx)  # ivtmp.37

Reply via email to