Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/unroll-simd-2.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-O2 -fopenmp-simd -fdump-tree-original -fdump-tree-gimple" }
3
4 module test_functions
5 contains
6 integer function compute_sum() result(sum)
7 implicit none
8
9 integer :: i,j
10
11 !$omp simd
12 do i = 1,10,3
13 !$omp unroll full
14 do j = 1,10,3
15 sum = sum + 1
16 end do
17 end do
18 end function
19
20 integer function compute_sum2() result(sum)
21 implicit none
22
23 integer :: i,j
24
25 !$omp simd
26 !$omp unroll partial(2)
27 do i = 1,10,3
28 do j = 1,10,3
29 sum = sum + 1
30 end do
31 end do
32 end function
33 end module test_functions
34
35 program test
36 use test_functions
37 implicit none
38
39 integer :: result
40
41 result = compute_sum ()
42 write (*,*) result
43 if (result .ne. 16) then
44 call abort
45 end if
46
47 result = compute_sum2 ()
48 write (*,*) result
49 if (result .ne. 16) then
50 call abort
51 end if
52 end program
53
54 ! { dg-final { scan-tree-dump "omp unroll full" "original" } }
55 ! { dg-final { scan-tree-dump "omp unroll partial\\\(2\\\)" "original" } }
56 ! { dg-final { scan-tree-dump-not "omp unroll" "gimple" } }