1 // RUN: %libomp-compile-and-run
2 #include "omp_testsuite.h"
6 int x1
, x2
, x3
, x4
, x5
;
7 #pragma omp threadprivate(x1, x2, x3, x4, x5)
9 int test_omp_parallel_copyin() {
13 #pragma omp parallel copyin(x1)
15 for (int i
= 0; i
< N
; i
++)
20 for (int i
= 0; i
< N
; i
++)
23 return (sum
== ((99 + 2 * x1
) * 100) / 2);
26 int test_omp_parallel_for_copyin() {
30 #pragma omp parallel for copyin(x2)
31 for (int i
= 0; i
< N
; i
++)
36 for (int i
= 0; i
< N
; i
++)
39 return (sum
== ((99 + 2 * x2
) * 100) / 2);
42 int test_omp_parallel_for_simd_copyin() {
46 #pragma omp parallel for simd copyin(x3)
47 for (int i
= 0; i
< N
; i
++)
52 for (int i
= 0; i
< N
; i
++)
55 return (sum
== ((99 + 2 * x3
) * 100) / 2);
58 int test_omp_parallel_sections_copyin() {
63 #pragma omp parallel sections copyin(x4)
72 return (a
+ b
== x4
* 2);
75 int test_omp_parallel_master_copyin() {
79 #pragma omp parallel master copyin(x5)
80 for (int i
= 0; i
< N
; i
++)
85 for (int i
= 0; i
< N
; i
++)
88 return (sum
== ((99 + 2 * x5
) * 100) / 2);
94 if (!test_omp_parallel_copyin())
97 if (!test_omp_parallel_for_copyin())
100 if (!test_omp_parallel_for_simd_copyin())
103 if (!test_omp_parallel_sections_copyin())
106 if (!test_omp_parallel_master_copyin())