Debian Codegraph @

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

raw
1 ! Test lowering of the internal representation of "omp unroll" loops
2 ! which are not unrolled.
3
4 ! { dg-do run }
5
6 module test_functions
7 contains
8 integer function compute_sum1 () result(sum)
9 implicit none
10 integer :: i
11
12 sum = 0
13 !$omp unroll
14 do i = 0,50
15 sum = sum + 1
16 end do
17 end function compute_sum1
18
19 integer function compute_sum3 (step,n) result(sum)
20 implicit none
21 integer :: i, step, n
22
23 sum = 0
24 !$omp unroll
25 do i = 0,n,step
26 sum = sum + 1
27 end do
28 end function compute_sum3
29 end module test_functions
30
31 program test
32 use test_functions
33 implicit none
34
35 integer :: result
36
37 result = compute_sum1 ()
38 if (result .ne. 51) then
39 stop 1
40 end if
41
42 result = compute_sum3 (1, 100)
43 if (result .ne. 101) then
44 stop 2
45 end if
46
47 result = compute_sum3 (2, 100)
48 if (result .ne. 51) then
49 stop 3
50 end if
51
52 result = compute_sum3 (-2, -100)
53 if (result .ne. 51) then
54 stop 4
55 end if
56 end program