Daily bump.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / subarrays-1.f90
blobb67a8f482f41a49657e60b2dfdbef9d7e5bef495
1 ! { dg-do run }
3 program subarrays
4 integer, parameter :: n = 20, c = 10
5 integer :: i, a(n), b(n)
7 a(:) = 0
8 b(:) = 0
10 ! COPY
12 !$acc parallel copy (a(1:n))
13 !$acc loop
14 do i = 1, n
15 a(i) = i
16 end do
17 !$acc end parallel
19 do i = 1, n
20 b(i) = i
21 end do
23 call check (a, b, n)
25 ! COPYOUT
27 a(:) = 0
29 !$acc parallel copyout (a(1:n))
30 !$acc loop
31 do i = 1, n
32 a(i) = i
33 end do
34 !$acc end parallel
36 do i = 1, n
37 if (a(i) .ne. b(i)) STOP 1
38 end do
39 call check (a, b, n)
41 ! COPYIN
43 a(:) = 0
45 !$acc parallel copyout (a(1:n)) copyin (b(1:n))
46 !$acc loop
47 do i = 1, n
48 a(i) = i
49 end do
50 !$acc end parallel
52 call check (a, b, n)
54 ! PRESENT_OR_COPY
56 !$acc parallel pcopy (a(1:n))
57 !$acc loop
58 do i = 1, n
59 a(i) = i
60 end do
61 !$acc end parallel
63 call check (a, b, n)
65 ! PRESENT_OR_COPYOUT
67 a(:) = 0
69 !$acc parallel pcopyout (a(1:n))
70 !$acc loop
71 do i = 1, n
72 a(i) = i
73 end do
74 !$acc end parallel
76 call check (a, b, n)
78 ! PRESENT_OR_COPYIN
80 a(:) = 0
82 !$acc parallel pcopyout (a(1:n)) pcopyin (b(1:n))
83 !$acc loop
84 do i = 1, n
85 a(i) = i
86 end do
87 !$acc end parallel
89 call check (a, b, n)
90 end program subarrays
92 subroutine check (a, b, n)
93 integer :: n, a(n), b(n)
94 integer :: i
96 do i = 1, n
97 if (a(i) .ne. b(i)) STOP 2
98 end do
99 end subroutine check