C++: simplify output from suggest_alternatives_for
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / target1.f90
blob99c5087ca973f58e22b221a5f20e8bd3b5ac67ec
1 ! { dg-do run }
3 module target1
4 contains
5 subroutine foo (p, v, w, n)
6 double precision, pointer :: p(:), v(:), w(:)
7 double precision :: q(n)
8 integer :: i, n
9 !$omp target if (n > 256) map (to: v(1:n), w(:n)) map (from: p(1:n), q)
10 !$omp parallel do simd
11 do i = 1, n
12 p(i) = v(i) * w(i)
13 q(i) = p(i)
14 end do
15 !$omp end target
16 if (any (p /= q)) STOP 1
17 do i = 1, n
18 if (p(i) /= i * iand (i, 63)) STOP 2
19 end do
20 !$omp target data if (n > 256) map (to: v(1:n), w) map (from: p, q)
21 !$omp target if (n > 256)
22 do i = 1, n
23 p(i) = 1.0
24 q(i) = 2.0
25 end do
26 !$omp end target
27 !$omp target if (n > 256)
28 do i = 1, n
29 p(i) = p(i) + v(i) * w(i)
30 q(i) = q(i) + v(i) * w(i)
31 end do
32 !$omp end target
33 !$omp target if (n > 256)
34 !$omp teams distribute parallel do simd linear(i:1)
35 do i = 1, n
36 p(i) = p(i) + 2.0
37 q(i) = q(i) + 3.0
38 end do
39 !$omp end target
40 !$omp end target data
41 if (any (p + 2.0 /= q)) STOP 3
42 end subroutine
43 end module target1
44 use target1, only : foo
45 integer :: n, i
46 double precision, pointer :: p(:), v(:), w(:)
47 n = 10000
48 allocate (p(n), v(n), w(n))
49 do i = 1, n
50 v(i) = i
51 w(i) = iand (i, 63)
52 end do
53 call foo (p, v, w, n)
54 do i = 1, n
55 if (p(i) /= i * iand (i, 63) + 3) STOP 4
56 end do
57 deallocate (p, v, w)
58 end