OSDN Git Service

PR middle-end/29274
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / bfin / l2.c
1 /* { dg-do run { target bfin-*-linux-uclibc } } */
2 /* { dg-bfin-processors bf544 bf547 bf548 bf549 bf561} */
3
4 #if defined(__ADSPBF544__)
5 #define L2_START 0xFEB00000
6 #define L2_LENGTH 0x10000
7 #else
8 #define L2_START 0xFEB00000
9 #define L2_LENGTH 0x20000
10 #endif
11
12 int n __attribute__ ((l2));
13
14 int foo (int i) __attribute__ ((l2));
15
16 int foo (int a)
17 {
18   return a + 1;
19 }
20
21 int main ()
22 {
23   int r;
24   unsigned long *p;
25
26   p = (unsigned long *) foo;
27   if (*p < L2_START || *p >= L2_START + L2_LENGTH)
28     return 1;
29
30   p = (unsigned long *) &n;
31   if ((unsigned long) p < L2_START || (unsigned long) p >= L2_START + L2_LENGTH)
32     return 2;
33
34   if (foo (0) != 1)
35     return 3;
36
37   return 0;
38 }