2 ! { dg-skip-if "" { *-*-* } { "-DACC_MEM_SHARED=1" } }
4 ! { dg-additional-options "-fopt-info-all-omp" }
5 ! { dg-additional-options "--param=openacc-privatization=noisy" }
6 ! { dg-additional-options "-foffload=-fopt-info-all-omp" }
7 ! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
8 ! for testing/documenting aspects of that functionality.
10 ! Tests to exercise the declare directive along with
24 !$acc declare create (z)
27 subroutine subr5 (a
, b
, c
, d
)
29 integer, parameter :: N
= 8
32 !$acc declare present_or_copyin (a)
34 !$acc declare present_or_create (b)
36 !$acc declare present_or_copyout (c)
38 !$acc declare present_or_copy (d)
43 ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
53 subroutine subr4 (a
, b
)
55 integer, parameter :: N
= 8
58 !$acc declare present (a)
60 !$acc declare copyout (b)
65 ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
73 subroutine subr3 (a
, c
)
75 integer, parameter :: N
= 8
78 !$acc declare present (a)
80 !$acc declare copyin (c)
85 ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
94 subroutine subr2 (a
, b
, c
)
96 integer, parameter :: N
= 8
99 !$acc declare present (a)
101 !$acc declare create (b)
103 !$acc declare copy (c)
108 ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
111 c(i
) = b(i
) + c(i
) + 1
119 integer, parameter :: N
= 8
122 !$acc declare present (a)
127 ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
135 subroutine test (a
, e
)
139 integer, parameter :: N
= 8
142 if (acc_is_present (a
) .neqv
. e
) STOP 1
146 subroutine subr0 (a
, b
, c
, d
)
147 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
148 ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
149 ! { dg-note {variable 'a\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
151 integer, parameter :: N
= 8
153 !$acc declare copy (a)
159 call test (a
, .true
.)
160 call test (b
, .false
.)
161 call test (c
, .false
.)
165 call test (a
, .true
.)
166 call test (b
, .false
.)
167 call test (c
, .false
.)
171 call test (a
, .true
.)
172 call test (b
, .false
.)
173 call test (c
, .false
.)
176 if (c(i
) .ne
. 8) STOP 2
181 call test (a
, .true
.)
182 call test (b
, .false
.)
183 call test (c
, .false
.)
186 if (a(i
) .ne
. 2) STOP 3
187 if (c(i
) .ne
. 8) STOP 4
192 call test (a
, .true
.)
193 call test (b
, .false
.)
194 call test (c
, .false
.)
197 if (b(i
) .ne
. 8) STOP 5
200 call subr5 (a
, b
, c
, d
)
202 call test (a
, .true
.)
203 call test (b
, .false
.)
204 call test (c
, .false
.)
205 call test (d
, .false
.)
208 if (c(i
) .ne
. 8) STOP 6
209 if (d(i
) .ne
. 13) STOP 7
215 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
216 ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
217 ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
218 ! { dg-note {variable 'desc\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: artificial} "" { target *-*-* } .-4 }
222 integer, parameter :: N
= 8
234 if (acc_is_present (z
) .neqv
. .true
.) STOP 8
236 call subr0 (a
, b
, c
, d
)
238 call test (a
, .false
.)
239 call test (b
, .false
.)
240 call test (c
, .false
.)
241 call test (d
, .false
.)
244 if (a(i
) .ne
. 8) STOP 9
245 if (b(i
) .ne
. 8) STOP 10
246 if (c(i
) .ne
. 8) STOP 11
247 if (d(i
) .ne
. 13) STOP 12