* crtstuff.c (USE_EH_FRAME_REGISTRY): Let USE_EH_FRAME_REGISTRY_ALWAYS
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / target4.f90
blobaa2f0a5ac193869663b9a6d57243058b146cdb55
1 ! { dg-do run }
3 module target4
4 contains
5 subroutine foo (a,m,n)
6 integer :: m,n,i,j
7 double precision :: a(m, n), t
8 !$omp target data map(a) map(to: m, n)
9 do i=1,n
10 t = 0.0d0
11 !$omp target
12 !$omp parallel do reduction(+:t)
13 do j=1,m
14 t = t + a(j,i) * a(j,i)
15 end do
16 !$omp end target
17 t = 2.0d0 * t
18 !$omp target
19 !$omp parallel do
20 do j=1,m
21 a(j,i) = a(j,i) * t
22 end do
23 !$omp end target
24 end do
25 !$omp end target data
26 end subroutine foo
27 end module target4
28 use target4, only : foo
29 integer :: i, j
30 double precision :: a(8, 9), res(8, 9)
31 do i = 1, 8
32 do j = 1, 9
33 a(i, j) = i + j
34 end do
35 end do
36 call foo (a, 8, 9)
37 res = reshape ((/ 1136.0d0, 1704.0d0, 2272.0d0, 2840.0d0, 3408.0d0, 3976.0d0, &
38 & 4544.0d0, 5112.0d0, 2280.0d0, 3040.0d0, 3800.0d0, 4560.0d0, 5320.0d0, 6080.0d0, &
39 & 6840.0d0, 7600.0d0, 3936.0d0, 4920.0d0, 5904.0d0, 6888.0d0, 7872.0d0, 8856.0d0, &
40 & 9840.0d0, 10824.0d0, 6200.0d0, 7440.0d0, 8680.0d0, 9920.0d0, 11160.0d0, 12400.0d0, &
41 & 13640.0d0, 14880.0d0, 9168.0d0, 10696.0d0, 12224.0d0, 13752.0d0, 15280.0d0, 16808.0d0, &
42 & 18336.0d0, 19864.0d0, 12936.0d0, 14784.0d0, 16632.0d0, 18480.0d0, 20328.0d0, 22176.0d0, &
43 & 24024.0d0, 25872.0d0, 17600.0d0, 19800.0d0, 22000.0d0, 24200.0d0, 26400.0d0, 28600.0d0, &
44 & 30800.0d0, 33000.0d0, 23256.0d0, 25840.0d0, 28424.0d0, 31008.0d0, 33592.0d0, 36176.0d0, &
45 & 38760.0d0, 41344.0d0, 30000.0d0, 33000.0d0, 36000.0d0, 39000.0d0, 42000.0d0, 45000.0d0, &
46 & 48000.0d0, 51000.0d0 /), (/ 8, 9 /))
47 if (any (a /= res)) call abort
48 end