2 ! { dg-require-effective-target tls_runtime }
7 !$omp threadprivate (/tlsblock/, z)
11 call test_threadprivate
18 !$omp parallel num_threads (4)
19 if (omp_get_thread_num () .eq
. 0) i
= omp_get_num_threads ()
20 if (omp_get_thread_num () .eq
. 0) j
= j
+ 1
23 if (omp_get_thread_num () .eq
. 1) j
= j
+ 2
26 if (omp_get_thread_num () .eq
. 2) j
= j
+ 3
30 if (omp_get_thread_num () .eq
. 3) j
= j
+ 4
32 end subroutine test_flush
34 subroutine test_ordered
36 integer, dimension (100) :: d
38 !$omp parallel do ordered schedule (dynamic) num_threads (4)
47 if (d(i
) .ne
. i
) call abort
50 if (d(i
) .ne
. -1) call abort
53 end subroutine test_ordered
55 subroutine test_threadprivate
56 common /tlsblock
/ x
, y
57 !$omp threadprivate (/tlsblock/)
60 call omp_set_num_threads (4)
61 call omp_set_dynamic (.false
.)
68 !$omp parallel copyin (/tlsblock/, z) reduction (.or.:m) &
69 !$omp& num_threads (4)
70 if (omp_get_thread_num () .eq
. 0) i
= omp_get_num_threads ()
71 if (x
.ne
. 6 .or
. y
.ne
. 7 .or
. z
.ne
. 8) call abort
72 x
= omp_get_thread_num ()
73 y
= omp_get_thread_num () + 1024
74 z
= omp_get_thread_num () + 4096
76 if (x
.ne
. 0 .or
. y
.ne
. 1024 .or
. z
.ne
. 4096) call abort
77 !$omp parallel num_threads (4), private (j) reduction (.or.:n)
78 if (omp_get_num_threads () .eq
. i
) then
79 j
= omp_get_thread_num ()
80 if (x
.ne
. j
.or
. y
.ne
. j
+ 1024 .or
. z
.ne
. j
+ 4096) &
86 !$omp parallel num_threads (4), copyin (z) reduction (.or. : n) &
88 if (z
.ne
. 4096) n
= .true
.
89 if (omp_get_num_threads () .eq
. i
) then
90 j
= omp_get_thread_num ()
91 if (x
.ne
. j
.or
. y
.ne
. j
+ 1024) call abort
94 if (m
.or
. n
) call abort
95 end subroutine test_threadprivate