aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/gomp/non-rectangular-loop.f90
blob: a7f41cb69cab1cae06a4c7f00ebfcf97413a5fc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
! { dg-do compile }
! { dg-options "-fopenmp" }

! Test that errors are given for cases where there are constraints
! disallowing nonrectangular loops.

! Work-sharing loop disallows "schedule" and "ordered" clauses.

subroutine s1 (a1, a2)
  integer :: a1, a2
  integer :: i, j

  !$omp do collapse(2) schedule(static)  ! { dg-error "'schedule' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp do collapse(2) schedule(static)  ! { dg-error "'schedule' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp do collapse(2) ordered  ! { dg-error "'ordered' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp do collapse(2) ordered  ! { dg-error "'ordered' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  ! Derived constructs

  !$omp do simd collapse(2) schedule(static)  ! { dg-error "'schedule' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp parallel do collapse(2) schedule(static)  ! { dg-error "'schedule' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp parallel do simd collapse(2) schedule(static)  ! { dg-error "'schedule' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp target parallel do collapse(2) schedule(static)  ! { dg-error "'schedule' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp target parallel do collapse(2) schedule(static)  ! { dg-error "'schedule' clause may not appear on non-rectangular 'do'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

end subroutine


! Distribute construct disallows "dist_schedule" clause.

subroutine s2 (a1, a2)
  integer :: a1, a2
  integer :: i, j

  !$omp distribute collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp distribute collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  ! Derived constructs

  !$omp distribute simd collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp distribute parallel do collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp distribute parallel do simd collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp teams distribute collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp teams distribute simd collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp teams distribute parallel do collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp teams distribute parallel do simd collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp target teams distribute collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp target teams distribute simd collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp target teams distribute parallel do collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp target teams distribute parallel do simd collapse(2) dist_schedule(static)  ! { dg-error "'dist_schedule' clause may not appear on non-rectangular 'distribute'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

end subroutine

! Taskloop construct disallows "grainsize" and "num_tasks" clauses.

subroutine s3 (a1, a2)
  integer :: a1, a2
  integer :: i, j

  !$omp taskloop collapse(2) grainsize(4)  ! { dg-error "'grainsize' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp taskloop collapse(2) grainsize(4)  ! { dg-error "'grainsize' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  !$omp taskloop collapse(2) num_tasks(4)  ! { dg-error "'num_tasks' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp taskloop collapse(2) num_tasks(4)  ! { dg-error "'num_tasks' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = i, 16
    end do
  end do

  ! Derived constructs

  !$omp taskloop simd collapse(2) grainsize(4)  ! { dg-error "'grainsize' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp masked taskloop collapse(2) grainsize(4)  ! { dg-error "'grainsize' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp masked taskloop simd collapse(2) grainsize(4)  ! { dg-error "'grainsize' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp parallel masked taskloop collapse(2) grainsize(4)  ! { dg-error "'grainsize' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

  !$omp parallel masked taskloop simd collapse(2) grainsize(4)  ! { dg-error "'grainsize' clause may not appear on non-rectangular 'taskloop'" }
  do i = 1, 16
    do j = 1, i
    end do
  end do

end subroutine

! TODO: not yet implemented
! The tile construct disallows all non-rectangular loops.