Skip various cmp-mem-const tests on lp64 hppa*-*-*
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / task-reduction-16.c
blob44d32c7bc25a7866c6a111707672f8a001bcfd0c
1 extern
2 #ifdef __cplusplus
3 "C"
4 #endif
5 void abort (void);
6 int a, b[3] = { 1, 1, 1 };
7 unsigned long int c[2] = { ~0UL, ~0UL };
9 void
10 bar (int i)
12 #pragma omp task in_reduction (*: b[:3]) in_reduction (&: c[1:]) \
13 in_reduction (+: a)
15 a += 4;
16 b[1] *= 4;
17 c[1] &= ~(1UL << (i + 16));
21 void
22 foo (int x)
24 #pragma omp scope reduction (task, +: a)
26 #pragma omp scope reduction (task, *: b)
28 #pragma omp scope reduction (task, &: c[1:1])
30 #pragma omp barrier
31 #pragma omp sections
34 a++; b[0] *= 2; bar (2); b[2] *= 3; c[1] &= ~(1UL << 2);
36 #pragma omp section
37 { b[0] *= 2; bar (4); b[2] *= 3; c[1] &= ~(1UL << 4); a++; }
38 #pragma omp section
39 { bar (6); b[2] *= 3; c[1] &= ~(1UL << 6); a++; b[0] *= 2; }
40 #pragma omp section
41 { b[2] *= 3; c[1] &= ~(1UL << 8); a++; b[0] *= 2; bar (8); }
42 #pragma omp section
43 { c[1] &= ~(1UL << 10); a++; b[0] *= 2; bar (10); b[2] *= 3; }
44 #pragma omp section
45 { a++; b[0] *= 2; b[2] *= 3; c[1] &= ~(1UL << 12); bar (12); }
46 #pragma omp section
47 if (x)
49 a++; b[0] *= 2; b[2] *= 3; bar (14); c[1] &= ~(1UL << 14);
57 int
58 main ()
60 volatile int one = 1;
61 foo (!one);
62 if (a != 30 || b[0] != 64 || b[1] != (1 << 12) || b[2] != 3 * 3 * 3 * 3 * 3 * 3
63 || c[0] != ~0UL || c[1] != ~0x15541554UL)
64 abort ();
65 a = 0;
66 b[0] = 1;
67 b[1] = 1;
68 b[2] = 1;
69 c[1] = ~0UL;
70 #pragma omp parallel
71 foo (one);
72 if (a != 35 || b[0] != 128 || b[1] != (1 << 14) || b[2] != 3 * 3 * 3 * 3 * 3 * 3 * 3
73 || c[0] != ~0UL || c[1] != ~0x55545554UL)
74 abort ();
75 return 0;