OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [prefetch-6.c] - Blame information for rev 437

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
2
/* { dg-require-effective-target ilp32 } */
3
/* { dg-require-effective-target sse2 } */
4
/* { dg-options "-O2 -fprefetch-loop-arrays -march=athlon -msse2 -mfpmath=sse --param simultaneous-prefetches=100 -fdump-tree-aprefetch-details" } */
5
 
6
#define N 1000
7
#define K 900
8
 
9
double a[N][N];
10
 
11
double test(void)
12
{
13
  unsigned i, j;
14
  double sum = 0;
15
 
16
  /* Here, we should use non-temporal prefetch instruction.  */
17
  for (i = 0; i < K; i++)
18
    for (j = 0; j < K; j++)
19
      sum += a[i][j];
20
 
21
  /* Here, we should not use non-temporal prefetch instruction, since the
22
     value of a[i+10][j] is reused in L2 cache.  */
23
  for (i = 0; i < K; i++)
24
    for (j = 0; j < K; j++)
25
      sum += a[i][j] * a[i + 10][j];
26
 
27
  /* Here, we should use non-temporal prefetch instruction, since the
28
     value of a[i+100][j] is too far to be reused in L2 cache.  */
29
  for (i = 0; i < K; i++)
30
    for (j = 0; j < K; j++)
31
      sum += a[i][j] * a[i + 100][j];
32
 
33
  /* Here, temporal prefetches should be used, since the volume of the
34
     memory accesses is smaller than L2 cache.  */
35
  for (i = 0; i < 100; i++)
36
    for (j = 0; j < 100; j++)
37
      sum += a[i][j] * a[i + 100][j];
38
 
39
  /* Temporal prefetches should be used here (even though the accesses to
40
     a[j][i] are independent, the same cache line is almost always hit
41
     every N iterations).  */
42
  for (i = 0; i < N; i++)
43
    for (j = 0; j < N; j++)
44
      sum += a[j][i];
45
 
46
  return sum;
47
}
48
 
49
/* { dg-final { scan-tree-dump-times "Issued prefetch" 5 "aprefetch" } } */
50
/* { dg-final { scan-tree-dump-times "Issued nontemporal prefetch" 3 "aprefetch" } } */
51
 
52
/* { dg-final { scan-assembler-times "prefetcht" 5 } } */
53
/* { dg-final { scan-assembler-times "prefetchnta" 3 } } */
54
 
55
/* { dg-final { cleanup-tree-dump "aprefetch" } } */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.