Set num_threads to 50 on 32-bit hppa in two libgomp loop tests
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / imperfect1.c
blobcafdcaf25b0e27250c37bfd70c1b3b4130f6ca52
1 /* { dg-do run } */
3 static int f1count[3], f2count[3];
5 #ifndef __cplusplus
6 extern void abort (void);
7 #else
8 extern "C" void abort (void);
9 #endif
11 int f1 (int depth, int iter)
13 f1count[depth]++;
14 return iter;
17 int f2 (int depth, int iter)
19 f2count[depth]++;
20 return iter;
23 void s1 (int a1, int a2, int a3)
25 int i, j, k;
27 #pragma omp for collapse(3)
28 for (i = 0; i < a1; i++)
30 f1 (0, i);
31 for (j = 0; j < a2; j++)
33 f1 (1, j);
34 for (k = 0; k < a3; k++)
36 f1 (2, k);
37 f2 (2, k);
39 f2 (1, j);
41 f2 (0, i);
45 int
46 main (void)
48 f1count[0] = 0;
49 f1count[1] = 0;
50 f1count[2] = 0;
51 f2count[0] = 0;
52 f2count[1] = 0;
53 f2count[2] = 0;
55 s1 (3, 4, 5);
57 /* All intervening code at the same depth must be executed the same
58 number of times. */
59 if (f1count[0] != f2count[0]) abort ();
60 if (f1count[1] != f2count[1]) abort ();
61 if (f1count[2] != f2count[2]) abort ();
63 /* Intervening code must be executed at least as many times as the loop
64 that encloses it. */
65 if (f1count[0] < 3) abort ();
66 if (f1count[1] < 3 * 4) abort ();
68 /* Intervening code must not be executed more times than the number
69 of logical iterations. */
70 if (f1count[0] > 3 * 4 * 5) abort ();
71 if (f1count[1] > 3 * 4 * 5) abort ();
73 /* Check that the innermost loop body is executed exactly the number
74 of logical iterations expected. */
75 if (f1count[2] != 3 * 4 * 5) abort ();