public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45021]  New: Redundant prefetches for the vectorized loop
@ 2010-07-21 17:46 changpeng dot fang at amd dot com
  2010-07-21 18:27 ` [Bug tree-optimization/45021] " changpeng dot fang at amd dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-07-21 17:46 UTC (permalink / raw)
  To: gcc-bugs

For the following test case, prefetches will be inserted for both the load and
store of a[i] if the loop is vectorized:

float a[1024], b[1024];
void foo(int beta)
{
  int i;
  for(i=0; i<1024; i++)
     a[i] = a[i] + beta * b[i];
}

with gcc -O3 -fprefetch-loop-arrays -march=amdfam10 -S, a piece of the assembly
is:
        movaps  (%rcx), %xmm0
        addl    $4, %edi
        prefetcht0      (%rdx)
        prefetcht0      240(%rcx)
        prefetchw       (%rdx)
        leaq    64(%rax), %rsi
        mulps   %xmm1, %xmm0


If we don't vectorize the loop, we only generate prefetch for the load a[i]:
        addl    $16, %eax
        salq    $2, %rcx
        mulss   %xmm1, %xmm0
        prefetcht0      a+92(%rcx)
        prefetcht0      b+92(%rcx)
        movl    %esi, %ecx


-- 
           Summary: Redundant prefetches for the vectorized loop
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: changpeng dot fang at amd dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45021


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-07-28 18:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-21 17:46 [Bug tree-optimization/45021] New: Redundant prefetches for the vectorized loop changpeng dot fang at amd dot com
2010-07-21 18:27 ` [Bug tree-optimization/45021] " changpeng dot fang at amd dot com
2010-07-24 20:32 ` [Bug tree-optimization/45021] Redundant prefetches for some loops (vectorizer produced ones too) pinskia at gcc dot gnu dot org
2010-07-24 20:42 ` rakdver at kam dot mff dot cuni dot cz
2010-07-28 18:23 ` changpeng dot fang at amd dot com
2010-07-28 18:28 ` changpeng dot fang at amd dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).