This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] Remove redundant prefetch instructions in the unroller



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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]