1 #include <stdlib.h>
2 
3 int t[] = { 1, 2, 3, 4, 5, 6, 7 };
4 int expect[] = { 1, 3, 6, 10, 15, 21, 28, 29, 31, 34, 38, 43, 49, 56 };
5 
foo(int n)6 int foo (int n)
7 {
8     int *p = t;
9     int sum = 0;
10     int i;
11     for (i = 0; i < n; i++) {
12 	sum += *p;
13 	p = __builtin_bfin_circptr (p, sizeof *p, t, sizeof t);
14     }
15     return sum;
16 }
17 
main()18 int main ()
19 {
20     int i;
21     int *p = expect;
22     for (i = 0; i < 14; i++) {
23 	int sum = foo (i + 1);
24 	if (sum != *p)
25 	    abort ();
26 	p = __builtin_bfin_circptr (p, sizeof *p, expect, sizeof expect);
27     }
28     return 0;
29 }
30