sched1: debug/model: dump predecessor list and BB num [NFC]
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / collapse-3.c
blob50f538d0a327db3d2c436bcf2864629e0145e5c6
1 /* { dg-do run } */
3 #include <string.h>
4 #include <stdlib.h>
5 #include <stdio.h>
7 int
8 main (void)
10 int i2, l = 0, r = 0, l2 = 0;
11 int a[3][3][3];
13 memset (a, '\0', sizeof (a));
14 #pragma acc parallel
15 #pragma acc loop collapse(4 - 1)
16 for (int i = 0; i < 2; i++)
17 for (int j = 0; j < 2; j++)
18 for (int k = 0; k < 2; k++)
19 a[i][j][k] = i + j * 4 + k * 16;
20 #pragma acc parallel
22 #pragma acc loop collapse(2) reduction(|:l)
23 for (i2 = 0; i2 < 2; i2++)
24 for (int j = 0; j < 2; j++)
25 for (int k = 0; k < 2; k++)
26 if (a[i2][j][k] != i2 + j * 4 + k * 16)
27 l += 1;
30 /* Test loop with >= condition. */
31 #pragma acc parallel
33 #pragma acc loop collapse(2) reduction(|:l2)
34 for (i2 = 0; i2 < 2; i2++)
35 for (int j = 1; j >= 0; j--)
36 for (int k = 0; k < 2; k++)
37 if (a[i2][j][k] != i2 + j * 4 + k * 16)
38 l2 += 1;
41 for (i2 = 0; i2 < 2; i2++)
42 for (int j = 0; j < 2; j++)
43 for (int k = 0; k < 2; k++)
44 if (a[i2][j][k] != i2 + j * 4 + k * 16)
45 r += 1;
47 if (l != r || l2 != r)
48 abort ();
49 return 0;