OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [builtin-prefetch-5.c] - Blame information for rev 301

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

Line No. Rev Author Line
1 297 jeremybenn
/* Test that __builtin_prefetch does no harm.
2
 
3
   Use addresses that are unlikely to be word-aligned.  Some targets
4
   have alignment requirements for prefetch addresses, so make sure the
5
   compiler takes care of that.  This fails if it aborts, anything else
6
   is OK.  */
7
 
8
struct S {
9
  short a;
10
  short b;
11
  char c[8];
12
} s;
13
 
14
char arr[100];
15
char *ptr = arr;
16
int idx = 3;
17
 
18
void
19
arg_ptr (char *p)
20
{
21
  __builtin_prefetch (p, 0, 0);
22
}
23
 
24
void
25
arg_idx (char *p, int i)
26
{
27
  __builtin_prefetch (&p[i], 0, 0);
28
}
29
 
30
void
31
glob_ptr (void)
32
{
33
  __builtin_prefetch (ptr, 0, 0);
34
}
35
 
36
void
37
glob_idx (void)
38
{
39
  __builtin_prefetch (&ptr[idx], 0, 0);
40
}
41
 
42
int
43
main ()
44
{
45
  __builtin_prefetch (&s.b, 0, 0);
46
  __builtin_prefetch (&s.c[1], 0, 0);
47
 
48
  arg_ptr (&s.c[1]);
49
  arg_ptr (ptr+3);
50
  arg_idx (ptr, 3);
51
  arg_idx (ptr+1, 2);
52
  idx = 3;
53
  glob_ptr ();
54
  glob_idx ();
55
  ptr++;
56
  idx = 2;
57
  glob_ptr ();
58
  glob_idx ();
59
  exit (0);
60
}

powered by: WebSVN 2.1.0

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