2 ! { dg-skip-if "" { *-*-* } { "-DACC_MEM_SHARED=1" } }
4 ! Tests to exercise the declare directive along with
18 !$acc declare create (z)
21 subroutine subr5 (a
, b
, c
, d
)
23 integer, parameter :: N
= 8
26 !$acc declare present_or_copyin (a)
28 !$acc declare present_or_create (b)
30 !$acc declare present_or_copyout (c)
32 !$acc declare present_or_copy (d)
46 subroutine subr4 (a
, b
)
48 integer, parameter :: N
= 8
51 !$acc declare present (a)
53 !$acc declare copyout (b)
65 subroutine subr3 (a
, c
)
67 integer, parameter :: N
= 8
70 !$acc declare present (a)
72 !$acc declare copyin (c)
85 subroutine subr2 (a
, b
, c
)
87 integer, parameter :: N
= 8
90 !$acc declare present (a)
92 !$acc declare create (b)
94 !$acc declare copy (c)
101 c(i
) = b(i
) + c(i
) + 1
109 integer, parameter :: N
= 8
112 !$acc declare present (a)
124 subroutine test (a
, e
)
128 integer, parameter :: N
= 8
131 if (acc_is_present (a
) .neqv
. e
) STOP 1
135 subroutine subr0 (a
, b
, c
, d
)
137 integer, parameter :: N
= 8
139 !$acc declare copy (a)
145 call test (a
, .true
.)
146 call test (b
, .false
.)
147 call test (c
, .false
.)
151 call test (a
, .true
.)
152 call test (b
, .false
.)
153 call test (c
, .false
.)
157 call test (a
, .true
.)
158 call test (b
, .false
.)
159 call test (c
, .false
.)
162 if (c(i
) .ne
. 8) STOP 2
167 call test (a
, .true
.)
168 call test (b
, .false
.)
169 call test (c
, .false
.)
172 if (a(i
) .ne
. 2) STOP 3
173 if (c(i
) .ne
. 8) STOP 4
178 call test (a
, .true
.)
179 call test (b
, .false
.)
180 call test (c
, .false
.)
183 if (b(i
) .ne
. 8) STOP 5
186 call subr5 (a
, b
, c
, d
)
188 call test (a
, .true
.)
189 call test (b
, .false
.)
190 call test (c
, .false
.)
191 call test (d
, .false
.)
194 if (c(i
) .ne
. 8) STOP 6
195 if (d(i
) .ne
. 13) STOP 7
204 integer, parameter :: N
= 8
216 if (acc_is_present (z
) .neqv
. .true
.) STOP 8
218 call subr0 (a
, b
, c
, d
)
220 call test (a
, .false
.)
221 call test (b
, .false
.)
222 call test (c
, .false
.)
223 call test (d
, .false
.)
226 if (a(i
) .ne
. 8) STOP 9
227 if (b(i
) .ne
. 8) STOP 10
228 if (c(i
) .ne
. 8) STOP 11
229 if (d(i
) .ne
. 13) STOP 12