annotate libgomp/testsuite/libgomp.fortran/udr12.f90 @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ! { dg-do run }
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 interface
kono
parents:
diff changeset
4 elemental subroutine sub1 (x, y)
kono
parents:
diff changeset
5 integer, intent(in) :: y
kono
parents:
diff changeset
6 integer, intent(out) :: x
kono
parents:
diff changeset
7 end subroutine
kono
parents:
diff changeset
8 elemental function fn2 (x)
kono
parents:
diff changeset
9 integer, intent(in) :: x
kono
parents:
diff changeset
10 integer :: fn2
kono
parents:
diff changeset
11 end function
kono
parents:
diff changeset
12 end interface
kono
parents:
diff changeset
13 !$omp declare reduction (foo : integer : omp_out = omp_out + omp_in) initializer (omp_priv = 0)
kono
parents:
diff changeset
14 !$omp declare reduction (bar : integer : omp_out = fn1 (omp_out, omp_in)) &
kono
parents:
diff changeset
15 !$omp & initializer (sub1 (omp_priv, omp_orig))
kono
parents:
diff changeset
16 !$omp declare reduction (baz : integer : sub2 (omp_out, omp_in)) &
kono
parents:
diff changeset
17 !$omp initializer (omp_priv = fn2 (omp_orig))
kono
parents:
diff changeset
18 interface
kono
parents:
diff changeset
19 elemental function fn1 (x, y)
kono
parents:
diff changeset
20 integer, intent(in) :: x, y
kono
parents:
diff changeset
21 integer :: fn1
kono
parents:
diff changeset
22 end function
kono
parents:
diff changeset
23 elemental subroutine sub2 (x, y)
kono
parents:
diff changeset
24 integer, intent(in) :: y
kono
parents:
diff changeset
25 integer, intent(inout) :: x
kono
parents:
diff changeset
26 end subroutine
kono
parents:
diff changeset
27 end interface
kono
parents:
diff changeset
28 integer :: a(10), b, r
kono
parents:
diff changeset
29 a(:) = 0
kono
parents:
diff changeset
30 b = 0
kono
parents:
diff changeset
31 r = 0
kono
parents:
diff changeset
32 !$omp parallel reduction (foo : a, b) reduction (+: r)
kono
parents:
diff changeset
33 a = a + 2
kono
parents:
diff changeset
34 b = b + 3
kono
parents:
diff changeset
35 r = r + 1
kono
parents:
diff changeset
36 !$omp end parallel
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
37 if (any (a /= 2 * r) .or. b /= 3 * r) STOP 1
111
kono
parents:
diff changeset
38 a(:) = 0
kono
parents:
diff changeset
39 b = 0
kono
parents:
diff changeset
40 r = 0
kono
parents:
diff changeset
41 !$omp parallel reduction (bar : a, b) reduction (+: r)
kono
parents:
diff changeset
42 a = a + 2
kono
parents:
diff changeset
43 b = b + 3
kono
parents:
diff changeset
44 r = r + 1
kono
parents:
diff changeset
45 !$omp end parallel
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
46 if (any (a /= 4 * r) .or. b /= 6 * r) STOP 2
111
kono
parents:
diff changeset
47 a(:) = 0
kono
parents:
diff changeset
48 b = 0
kono
parents:
diff changeset
49 r = 0
kono
parents:
diff changeset
50 !$omp parallel reduction (baz : a, b) reduction (+: r)
kono
parents:
diff changeset
51 a = a + 2
kono
parents:
diff changeset
52 b = b + 3
kono
parents:
diff changeset
53 r = r + 1
kono
parents:
diff changeset
54 !$omp end parallel
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
55 if (any (a /= 2 * r) .or. b /= 3 * r) STOP 3
111
kono
parents:
diff changeset
56 end
kono
parents:
diff changeset
57 elemental function fn1 (x, y)
kono
parents:
diff changeset
58 integer, intent(in) :: x, y
kono
parents:
diff changeset
59 integer :: fn1
kono
parents:
diff changeset
60 fn1 = x + 2 * y
kono
parents:
diff changeset
61 end function
kono
parents:
diff changeset
62 elemental subroutine sub1 (x, y)
kono
parents:
diff changeset
63 integer, intent(in) :: y
kono
parents:
diff changeset
64 integer, intent(out) :: x
kono
parents:
diff changeset
65 x = 0
kono
parents:
diff changeset
66 end subroutine
kono
parents:
diff changeset
67 elemental function fn2 (x)
kono
parents:
diff changeset
68 integer, intent(in) :: x
kono
parents:
diff changeset
69 integer :: fn2
kono
parents:
diff changeset
70 fn2 = x
kono
parents:
diff changeset
71 end function
kono
parents:
diff changeset
72 elemental subroutine sub2 (x, y)
kono
parents:
diff changeset
73 integer, intent(inout) :: x
kono
parents:
diff changeset
74 integer, intent(in) :: y
kono
parents:
diff changeset
75 x = x + y
kono
parents:
diff changeset
76 end subroutine