Debian Codegraph @

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

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-g" }
3
4 module test_functions
5 contains
6 integer function compute_sum1 () result(sum)
7 implicit none
8 integer :: i
9
10 sum = 0
11 !$omp unroll partial(2)
12 do i = 1,50
13 sum = sum + 1
14 end do
15 end function compute_sum1
16
17 integer function compute_sum3 (step,n) result(sum)
18 implicit none
19 integer :: i, step, n
20
21 sum = 0
22 !$omp unroll partial(5)
23 do i = 1,n,step
24 sum = sum + 1
25 end do
26 end function compute_sum3
27 end module test_functions
28
29 program test
30 use test_functions
31 implicit none
32 integer :: result
33
34 result = compute_sum1 ()
35 if (result .ne. 50) then
36 stop 1
37 end if
38
39 result = compute_sum3 (1, 100)
40 if (result .ne. 100) then
41 stop 2
42 end if
43
44 result = compute_sum3 (1, 9)
45 if (result .ne. 9) then
46 stop 3
47 end if
48
49 result = compute_sum3 (2, 96)
50 if (result .ne. 48) then
51 stop 4
52 end if
53
54 result = compute_sum3 (-2, -98)
55 if (result .ne. 50) then
56 stop 5
57 end if
58
59 result = compute_sum3 (-2, -100)
60 if (result .ne. 51) then
61 stop 6
62 end if
63 end program