File: declare-variant-8.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (218 lines) | stat: -rw-r--r-- 5,690 bytes parent folder | download
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
! { dg-do compile }
! { dg-additional-options "-fdump-tree-gimple" }

program main
  !$omp requires atomic_default_mem_order(seq_cst)
  !$omp declare target to (test3)
contains
  subroutine f01 ()
  end subroutine

  subroutine f02 ()
    !$omp declare variant (f01) match (user={condition(6 == 7)},implementation={vendor(gnu)})
  end subroutine

  subroutine f03 ()
  end subroutine

  subroutine f04 ()
    !$omp declare variant (f03) match (user={condition(6 == 6)},implementation={atomic_default_mem_order(seq_cst)})
  end subroutine

  subroutine f05 ()
  end subroutine

  subroutine f06 ()
    !$omp declare variant (f05) match (user={condition(.true.)},implementation={atomic_default_mem_order(relaxed)})
  end subroutine

  subroutine f07 ()
  end subroutine

  subroutine f08 ()
    !$omp declare variant (f07) match (construct={parallel,do},device={kind("any")})
  end subroutine

  subroutine f09 ()
  end subroutine

  subroutine f10 ()
    !$omp declare variant (f09) match (construct={parallel,do},implementation={vendor("gnu")})
  end subroutine

  subroutine f11 ()
  end subroutine

  subroutine f12 ()
    !$omp declare variant (f11) match (construct={parallel,do})
  end subroutine

  subroutine f13 ()
  end subroutine

  subroutine f14 ()
    !$omp declare variant (f13) match (construct={parallel,do})
  end subroutine

  subroutine f15 ()
    !$omp declare target to (f13, f14)
  end subroutine

  subroutine f16 ()
    !$omp declare variant (f15) match (implementation={vendor(llvm)})
  end subroutine

  subroutine f17 ()
  end subroutine

  subroutine f18 ()
    !$omp declare variant (f17) match (construct={target,parallel})
  end subroutine

  subroutine f19 ()
  end subroutine

  subroutine f20 ()
    !$omp declare variant (f19) match (construct={target,parallel})
  end subroutine

  subroutine f22 ()
    !$omp declare variant (f21) match (construct={teams,parallel})
  end subroutine

  subroutine f23 ()
  end subroutine

  subroutine f24 ()
    !$omp declare variant (f23) match (construct={teams,parallel,do})
  end subroutine

  subroutine f25 ()
  end subroutine

  subroutine f27 ()
  end subroutine

  subroutine f28 ()
    !$omp declare variant (f27) match (construct={teams,parallel,do})
  end subroutine

  subroutine f30 ()
    !$omp declare variant (f29) match (implementation={vendor(gnu)})
  end subroutine

  subroutine f31 ()
  end subroutine

  subroutine f32 ()
    !$omp declare variant (f31) match (construct={teams,parallel,do})
  end subroutine

  subroutine f33 ()
  end subroutine

  subroutine f34 ()
    !$omp declare variant (f33) match (device={kind("any\0any")})	! { dg-warning "unknown property '.any..0any.' of 'kind' selector" }
  end subroutine

  subroutine f35 ()
  end subroutine

  subroutine f36 ()
    !$omp declare variant (f35) match (implementation={vendor("gnu\0")})	! { dg-warning "unknown property '.gnu..0.' of 'vendor' selector" }
  end subroutine

  subroutine test1 ()
    integer :: i

    call f02 ()	! { dg-final { scan-tree-dump-times "f02 \\\(\\\);" 1 "gimple" } }
    call f04 ()	! { dg-final { scan-tree-dump-times "f03 \\\(\\\);" 1 "gimple" } }
    call f06 ()	! { dg-final { scan-tree-dump-times "f06 \\\(\\\);" 1 "gimple" } }

    !$omp parallel
      !$omp do
      do i = 1, 2
	call f08 ()		! { dg-final { scan-tree-dump-times "f07 \\\(\\\);" 1 "gimple" } }
      end do
      !$omp end do
    !$omp end parallel

    !$omp parallel do
      do i = 1, 2
	call f10 ()		! { dg-final { scan-tree-dump-times "f09 \\\(\\\);" 1 "gimple" } }
      end do
    !$omp end parallel do

    !$omp do
      do i = 1, 2
	!$omp parallel
	  call f12 ()	! { dg-final { scan-tree-dump-times "f12 \\\(\\\);" 1 "gimple" } }
	!$omp end parallel
      end do
    !$omp end do

    !$omp parallel
      !$omp target
	!$omp do
	do i = 1, 2
	  call f14 ()		! { dg-final { scan-tree-dump-times "f14 \\\(\\\);" 1 "gimple" } }
	end do
	!$omp end do
      !$omp end target
    !$omp end parallel

    call f16 ()	! { dg-final { scan-tree-dump-times "f16 \\\(\\\);" 1 "gimple" } }
    call f34 ()	! { dg-final { scan-tree-dump-times "f34 \\\(\\\);" 1 "gimple" } }
    call f36 ()	! { dg-final { scan-tree-dump-times "f36 \\\(\\\);" 1 "gimple" } }
  end subroutine

  subroutine test2 ()
    ! OpenMP 5.0 specifies that the 'target' trait should be added for
    ! functions within a declare target block, but Fortran does not have
    ! the notion of a declare target _block_, so the variant is not used here.
    ! This may change in later versions of OpenMP.

    !$omp declare target
    !$omp parallel
      call f18 ()	! { dg-final { scan-tree-dump-times "f18 \\\(\\\);" 1 "gimple" } }
    !$omp end parallel
  end subroutine

  subroutine test3 ()
    ! In the C version, this test was used to check that the
    ! 'declare target to' form of the directive did not result in the variant
    ! being used.
    !$omp parallel
      call f20 ()	! { dg-final { scan-tree-dump-times "f20 \\\(\\\);" 1 "gimple" } }
    !$omp end parallel
  end subroutine

  subroutine f21 ()
    integer :: i
    !$omp do
      do i = 1, 2
	call f24 ()	! { dg-final { scan-tree-dump-times "f23 \\\(\\\);" 1 "gimple" } }
      end do
    !$omp end do
  end subroutine

  subroutine f26 ()
    !$omp declare variant (f25) match (construct={teams,parallel})

    integer :: i
    !$omp do
      do i = 1, 2
	call f28 ()	! { dg-final { scan-tree-dump-times "f28 \\\(\\\);" 1 "gimple" } }
      end do
    !$omp end do
  end subroutine

  subroutine f29 ()
    integer :: i
    !$omp do
      do i = 1, 2
	call f32 ()	! { dg-final { scan-tree-dump-times "f32 \\\(\\\);" 1 "gimple" } }
      end do
    !$omp end do
  end subroutine
end program