Skip various cmp-mem-const tests on lp64 hppa*-*-*
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / lastprivate-conditional-8.c
blob0443c9d1ab98aacaa197bf4ac0c587bf1b26d986
1 /* { dg-do run } */
2 /* { dg-additional-options "-O2 -fvect-cost-model=cheap -fdump-tree-vect-details" } */
3 /* { dg-additional-options "-mavx" { target avx_runtime } } */
4 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { target avx_runtime } } } */
6 int v, x;
8 __attribute__((noipa)) int
9 foo (int *a)
11 #pragma omp parallel for simd lastprivate (conditional: x) schedule(simd: static)
12 for (int i = 0; i < 128; i++)
13 if (a[i])
14 x = a[i];
15 return x;
18 __attribute__((noipa)) int
19 bar (int *a, int *b)
21 #pragma omp parallel
22 #pragma omp for simd lastprivate (conditional: x, v) schedule(static, 16)
23 for (int i = 16; i < 128; ++i)
25 if (a[i])
26 x = a[i];
27 if (b[i])
28 v = b[i] + 10;
30 return x;
33 __attribute__((noipa)) int
34 baz (int *a)
36 #pragma omp parallel for simd lastprivate (conditional: x) schedule(simd: dynamic, 16)
37 for (int i = 0; i < 128; i++)
38 if (a[i])
39 x = a[i] + 5;
40 return x;
43 int
44 main ()
46 int a[128], b[128], i;
47 for (i = 0; i < 128; i++)
49 a[i] = ((i % 11) == 2) ? i + 10 : 0;
50 asm volatile ("" : "+g" (i));
51 b[i] = ((i % 13) == 5) ? i * 2 : 0;
53 if (foo (a) != 133)
54 __builtin_abort ();
55 if (bar (b, a) != 244 || v != 143)
56 __builtin_abort ();
57 if (baz (b) != 249)
58 __builtin_abort ();
59 return 0;