This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [rfc] Remove redundant prefetch instructions in the unroller
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: Steven Bosscher <stevenb at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 4 Aug 2005 18:18:22 -0400
- Subject: Re: [rfc] Remove redundant prefetch instructions in the unroller
- References: <200508050004.52885.stevenb@suse.de>
On Aug 4, 2005, at 6:04 PM, Steven Bosscher wrote:
Hi,
The loop unroller will duplicate prefetches without complaints while
unrolling a loop, but these duplicates do more harm than good. With
the attached patch the unroller purges all prefetch instructions in
duplicated basic blocks. Would such a patch still be appropriate at
this stage for mainline? Bootstrapped it on x86_64-unknown-linux-gnu
but I haven't tested it yet.
This seems like it will not work if the prefetch is way after/before
the memory location:
for (int i =0; i<1024;i++)
{
__builtin_prefetch(array[(i+4)*1024]);
__builtin_prefetch(array[(i+4)*1024+256]);
__builtin_prefetch(array[(i+4)*1024+512]);
__builtin_prefetch(array[(i+4)*1024+512+256]);
__builtin_prefetch(array[(i+4)*1024+1023]);
array[i*1024] = 0;
array[i*1024+512] = i;
array[i*1024+1023] = 1024 - i;
array[i*1024+256] = i/2;
array[i*1024+256+512] = i/2;
}