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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [builtin-prefetch-1.c] - Blame information for rev 455

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

Line No. Rev Author Line
1 149 jeremybenn
/* Test that __builtin_prefetch does no harm.
2
 
3
   Prefetch using some invalid rw and locality values.  These must be
4
   compile-time constants.  */
5
 
6
/* { dg-do run } */
7
 
8
extern void exit (int);
9
 
10
enum locality { none, low, moderate, high, bogus };
11
enum rw { read, write };
12
 
13
int arr[10];
14
 
15
void
16
good (int *p)
17
{
18
  __builtin_prefetch (p, 0, 0);
19
  __builtin_prefetch (p, 0, 1);
20
  __builtin_prefetch (p, 0, 2);
21
  __builtin_prefetch (p, 0, 3);
22
  __builtin_prefetch (p, 1, 0);
23
  __builtin_prefetch (p, 1, 1);
24
  __builtin_prefetch (p, 1, 2);
25
  __builtin_prefetch (p, 1, 3);
26
}
27
 
28
void
29
bad (int *p)
30
{
31
  __builtin_prefetch (p, -1, 0);  /* { dg-warning "invalid second argument to '__builtin_prefetch'; using zero" } */
32
  __builtin_prefetch (p, 2, 0);   /* { dg-warning "invalid second argument to '__builtin_prefetch'; using zero" } */
33
  __builtin_prefetch (p, bogus, 0);   /* { dg-warning "invalid second argument to '__builtin_prefetch'; using zero" } */
34
  __builtin_prefetch (p, 0, -1);  /* { dg-warning "invalid third argument to '__builtin_prefetch'; using zero" } */
35
  __builtin_prefetch (p, 0, 4);   /* { dg-warning "invalid third argument to '__builtin_prefetch'; using zero" } */
36
  __builtin_prefetch (p, 0, bogus);   /* { dg-warning "invalid third argument to '__builtin_prefetch'; using zero" } */
37
}
38
 
39
int
40
main ()
41
{
42
  good (arr);
43
  bad (arr);
44
  exit (0);
45
}

powered by: WebSVN 2.1.0

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