Debian Codegraph @

libgomp/testsuite/libgomp.fortran/unroll-6.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-g" }
3
4 module test_functions
5 contains
6 integer function compute_sum4 (step,n) result(sum)
7 implicit none
8 integer :: i, step, n
9
10 sum = 0
11 !$omp parallel do reduction(+:sum) lastprivate(i)
12 !$omp unroll partial(5)
13 do i = 1,n,step
14 sum = sum + 1
15 end do
16 end function compute_sum4
17
18 integer function compute_sum5 (step,n) result(sum)
19 implicit none
20 integer :: i, step, n
21
22 sum = 0
23 !$omp parallel do reduction(+:sum) lastprivate(i)
24 !$omp unroll partial(5)
25 !$omp unroll partial(10)
26 do i = 1,n,step
27 sum = sum + 1
28 end do
29 end function compute_sum5
30
31 integer function compute_sum6 (step,n) result(sum)
32 implicit none
33 integer :: i, j, step, n
34
35 sum = 0
36 !$omp parallel do reduction(+:sum) lastprivate(i) &
37 !$omp & private(j)
38 do i = 1,n,step
39 !$omp unroll full
40 !$omp unroll partial(10)
41 do j = 1, 1000
42 sum = sum + 1
43 end do
44 end do
45 end function compute_sum6
46 end module test_functions
47
48 program test
49 use test_functions
50 implicit none
51 integer :: result
52
53 result = compute_sum4 (1, 100)
54 if (result .ne. 100) then
55 stop 1
56 end if
57
58 result = compute_sum4 (1, 9)
59 if (result .ne. 9) then
60 stop 2
61 end if
62
63 result = compute_sum4 (2, 96)
64 if (result .ne. 48) then
65 stop 3
66 end if
67
68 result = compute_sum4 (-2, -98)
69 if (result .ne. 50) then
70 stop 4
71 end if
72
73 result = compute_sum4 (-2, -100)
74 if (result .ne. 51) then
75 stop 5
76 end if
77
78 result = compute_sum5 (1, 100)
79 if (result .ne. 100) then
80 stop 6
81 end if
82
83 result = compute_sum5 (1, 9)
84 if (result .ne. 9) then
85 stop 7
86 end if
87
88 result = compute_sum5 (2, 96)
89 if (result .ne. 48) then
90 stop 8
91 end if
92
93 result = compute_sum5 (-2, -98)
94 if (result .ne. 50) then
95 stop 9
96 end if
97
98 result = compute_sum5 (-2, -100)
99 if (result .ne. 51) then
100 stop 10
101 end if
102 end program