Fix ifunc detection in target-supports.exp file.
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / collapse3.f90
blobeac9eac651bc2faba7b7da6cf6e65dc257c78083
1 ! { dg-do run }
3 program collapse3
4 call test1
5 call test2 (2, 6, -2, 4, 13, 18)
6 call test3 (2, 6, -2, 4, 13, 18, 1, 1, 1)
7 call test4
8 call test5 (2, 6, -2, 4, 13, 18)
9 call test6 (2, 6, -2, 4, 13, 18, 1, 1, 1)
10 contains
11 subroutine test1
12 integer :: i, j, k, a(1:7, -3:5, 12:19), m
13 logical :: l
14 l = .false.
15 a(:, :, :) = 0
16 !$omp parallel do collapse (3) lastprivate (i, j, k, m) reduction (.or.:l)
17 do i = 2, 6
18 do j = -2, 4
19 do k = 13, 18
20 l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
21 l = l.or.k.lt.13.or.k.gt.18
22 if (.not.l) a(i, j, k) = a(i, j, k) + 1
23 m = i * 100 + j * 10 + k
24 end do
25 end do
26 end do
27 if (i.ne.7.or.j.ne.5.or.k.ne.19) call abort
28 if (m.ne.(600+40+18)) call abort
29 do i = 1, 7
30 do j = -3, 5
31 do k = 12, 19
32 if (i.eq.1.or.i.eq.7.or.j.eq.-3.or.j.eq.5.or.k.eq.12.or.k.eq.19) then
33 if (a(i, j, k).ne.0) print *, i, j, k
34 else
35 if (a(i, j, k).ne.1) print *, 'kk', i, j, k, a(i, j, k)
36 end if
37 end do
38 end do
39 end do
40 end subroutine test1
42 subroutine test2(v1, v2, v3, v4, v5, v6)
43 integer :: i, j, k, a(1:7, -3:5, 12:19), m
44 integer :: v1, v2, v3, v4, v5, v6
45 logical :: l
46 l = .false.
47 a(:, :, :) = 0
48 !$omp parallel do collapse (3) lastprivate (i, j, k, m) reduction (.or.:l)
49 do i = v1, v2
50 do j = v3, v4
51 do k = v5, v6
52 l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
53 l = l.or.k.lt.13.or.k.gt.18
54 if (.not.l) a(i, j, k) = a(i, j, k) + 1
55 m = i * 100 + j * 10 + k
56 end do
57 end do
58 end do
59 if (i.ne.7.or.j.ne.5.or.k.ne.19) call abort
60 if (m.ne.(600+40+18)) call abort
61 do i = 1, 7
62 do j = -3, 5
63 do k = 12, 19
64 if (i.eq.1.or.i.eq.7.or.j.eq.-3.or.j.eq.5.or.k.eq.12.or.k.eq.19) then
65 if (a(i, j, k).ne.0) print *, i, j, k
66 else
67 if (a(i, j, k).ne.1) print *, 'kk', i, j, k, a(i, j, k)
68 end if
69 end do
70 end do
71 end do
72 end subroutine test2
74 subroutine test3(v1, v2, v3, v4, v5, v6, v7, v8, v9)
75 integer :: i, j, k, a(1:7, -3:5, 12:19), m
76 integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9
77 logical :: l
78 l = .false.
79 a(:, :, :) = 0
80 !$omp parallel do collapse (3) lastprivate (i, j, k, m) reduction (.or.:l)
81 do i = v1, v2, v7
82 do j = v3, v4, v8
83 do k = v5, v6, v9
84 l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
85 l = l.or.k.lt.13.or.k.gt.18
86 if (.not.l) a(i, j, k) = a(i, j, k) + 1
87 m = i * 100 + j * 10 + k
88 end do
89 end do
90 end do
91 if (i.ne.7.or.j.ne.5.or.k.ne.19) call abort
92 if (m.ne.(600+40+18)) call abort
93 do i = 1, 7
94 do j = -3, 5
95 do k = 12, 19
96 if (i.eq.1.or.i.eq.7.or.j.eq.-3.or.j.eq.5.or.k.eq.12.or.k.eq.19) then
97 if (a(i, j, k).ne.0) print *, i, j, k
98 else
99 if (a(i, j, k).ne.1) print *, 'kk', i, j, k, a(i, j, k)
100 end if
101 end do
102 end do
103 end do
104 end subroutine test3
106 subroutine test4
107 integer :: i, j, k, a(1:7, -3:5, 12:19), m
108 logical :: l
109 l = .false.
110 a(:, :, :) = 0
111 !$omp parallel do collapse (3) lastprivate (i, j, k, m) reduction (.or.:l) &
112 !$omp& schedule (dynamic, 5)
113 do i = 2, 6
114 do j = -2, 4
115 do k = 13, 18
116 l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
117 l = l.or.k.lt.13.or.k.gt.18
118 if (.not.l) a(i, j, k) = a(i, j, k) + 1
119 m = i * 100 + j * 10 + k
120 end do
121 end do
122 end do
123 if (i.ne.7.or.j.ne.5.or.k.ne.19) call abort
124 if (m.ne.(600+40+18)) call abort
125 do i = 1, 7
126 do j = -3, 5
127 do k = 12, 19
128 if (i.eq.1.or.i.eq.7.or.j.eq.-3.or.j.eq.5.or.k.eq.12.or.k.eq.19) then
129 if (a(i, j, k).ne.0) print *, i, j, k
130 else
131 if (a(i, j, k).ne.1) print *, 'kk', i, j, k, a(i, j, k)
132 end if
133 end do
134 end do
135 end do
136 end subroutine test4
138 subroutine test5(v1, v2, v3, v4, v5, v6)
139 integer :: i, j, k, a(1:7, -3:5, 12:19), m
140 integer :: v1, v2, v3, v4, v5, v6
141 logical :: l
142 l = .false.
143 a(:, :, :) = 0
144 !$omp parallel do collapse (3) lastprivate (i, j, k, m) reduction (.or.:l) &
145 !$omp & schedule (guided)
146 do i = v1, v2
147 do j = v3, v4
148 do k = v5, v6
149 l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
150 l = l.or.k.lt.13.or.k.gt.18
151 if (.not.l) a(i, j, k) = a(i, j, k) + 1
152 m = i * 100 + j * 10 + k
153 end do
154 end do
155 end do
156 if (i.ne.7.or.j.ne.5.or.k.ne.19) call abort
157 if (m.ne.(600+40+18)) call abort
158 do i = 1, 7
159 do j = -3, 5
160 do k = 12, 19
161 if (i.eq.1.or.i.eq.7.or.j.eq.-3.or.j.eq.5.or.k.eq.12.or.k.eq.19) then
162 if (a(i, j, k).ne.0) print *, i, j, k
163 else
164 if (a(i, j, k).ne.1) print *, 'kk', i, j, k, a(i, j, k)
165 end if
166 end do
167 end do
168 end do
169 end subroutine test5
171 subroutine test6(v1, v2, v3, v4, v5, v6, v7, v8, v9)
172 integer :: i, j, k, a(1:7, -3:5, 12:19), m
173 integer :: v1, v2, v3, v4, v5, v6, v7, v8, v9
174 logical :: l
175 l = .false.
176 a(:, :, :) = 0
177 !$omp parallel do collapse (3) lastprivate (i, j, k, m) reduction (.or.:l) &
178 !$omp & schedule (dynamic)
179 do i = v1, v2, v7
180 do j = v3, v4, v8
181 do k = v5, v6, v9
182 l = l.or.i.lt.2.or.i.gt.6.or.j.lt.-2.or.j.gt.4
183 l = l.or.k.lt.13.or.k.gt.18
184 if (.not.l) a(i, j, k) = a(i, j, k) + 1
185 m = i * 100 + j * 10 + k
186 end do
187 end do
188 end do
189 if (i.ne.7.or.j.ne.5.or.k.ne.19) call abort
190 if (m.ne.(600+40+18)) call abort
191 do i = 1, 7
192 do j = -3, 5
193 do k = 12, 19
194 if (i.eq.1.or.i.eq.7.or.j.eq.-3.or.j.eq.5.or.k.eq.12.or.k.eq.19) then
195 if (a(i, j, k).ne.0) print *, i, j, k
196 else
197 if (a(i, j, k).ne.1) print *, 'kk', i, j, k, a(i, j, k)
198 end if
199 end do
200 end do
201 end do
202 end subroutine test6
204 end program collapse3