2018-01-10 Richard Biener <rguenther@suse.de>
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c / nested-function-1.c
blobfb2a3acdfa9fdaee5d123c46dc5261a7ad845683
1 /* Exercise nested function decomposition, gcc/tree-nested.c. */
3 int
4 main (void)
6 void test1 ()
8 int i, j, k;
9 int a[4][7][8];
11 __builtin_memset (a, 0, sizeof (a));
13 #pragma acc parallel
14 #pragma acc loop collapse(4 - 1)
15 for (i = 1; i <= 3; i++)
16 for (j = 4; j <= 6; j++)
17 for (k = 5; k <= 7; k++)
18 a[i][j][k] = i + j + k;
20 for (i = 1; i <= 3; i++)
21 for (j = 4; j <= 6; j++)
22 for (k = 5; k <= 7; k++)
23 if (a[i][j][k] != i + j + k)
24 __builtin_abort();
27 void test2 ()
29 int i, j, k;
30 int a[4][4][4];
32 __builtin_memset (a, 0, sizeof (a));
34 #pragma acc parallel
35 #pragma acc loop collapse(3)
36 for (i = 1; i <= 3; i++)
37 for (j = 1; j <= 3; j++)
38 for (k = 1; k <= 3; k++)
39 a[i][j][k] = 1;
41 for (i = 1; i <= 3; i++)
42 for (j = 1; j <= 3; j++)
43 for (k = 1; k <= 3; k++)
44 if (a[i][j][k] != 1)
45 __builtin_abort ();
48 test1 ();
49 test2 ();
51 return 0;