PR testsuite/85483: Move aarch64/sve/vcond_1.c test to g++.dg/other/
[official-gcc.git] / libgomp / testsuite / libgomp.c / reduction-3.c
blob4f8f2fc123660df26413aa80641604b131237d22
1 #include <omp.h>
2 #include <stdlib.h>
4 int
5 main (void)
7 int i = 0, j = 0, k = ~0, l;
8 double d = 1.0;
9 #pragma omp parallel num_threads(4)
11 #pragma omp single
13 i = 16;
14 k ^= (1 << 16);
15 d += 32.0;
18 #pragma omp for reduction(+:i) reduction(*:d) reduction(&:k) nowait
19 for (l = 0; l < 4; l++)
21 if (omp_get_num_threads () == 4 && (i != 0 || d != 1.0 || k != ~0))
22 #pragma omp atomic
23 j |= 1;
25 if (l == omp_get_thread_num ())
27 i = omp_get_thread_num ();
28 d = i + 1;
29 k = ~(1 << (2 * i));
33 if (omp_get_num_threads () == 4)
35 #pragma omp barrier
36 if (i != (16 + 0 + 1 + 2 + 3))
37 #pragma omp atomic
38 j |= 2;
39 if (d != (33.0 * 1.0 * 2.0 * 3.0 * 4.0))
40 #pragma omp atomic
41 j |= 4;
42 if (k != (~0 ^ 0x55 ^ (1 << 16)))
43 #pragma omp atomic
44 j |= 8;
48 if (j)
49 abort ();
50 return 0;