This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/77270] Flag -mprftchw is shared with 3dnow for -march=k8
- From: "nightstrike at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 16 Aug 2016 17:42:19 +0000
- Subject: [Bug middle-end/77270] Flag -mprftchw is shared with 3dnow for -march=k8
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
- References: <bug-77270-4@http.gcc.gnu.org/bugzilla/>
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