tree-optimization/113385 - wrong loop father with early exit vectorization
[official-gcc.git] / gcc / testsuite / gfortran.dg / directive_unroll_2.f90
blobc72622709ae3366b4187d0eda4fad573b9aadee3
1 ! { dg-do compile }
2 ! { dg-options "-O -fdump-tree-cunroll-details -fdump-rtl-loop2_unroll-details" }
3 ! Test that
4 ! #pragma GCC unroll n
5 ! works
7 subroutine test1(a)
8 implicit NONE
9 integer :: a(8)
10 integer (kind=4) :: i
11 !GCC$ unroll 8
12 DO i=1, 8, 1
13 call dummy(a(i))
14 ENDDO
15 ! { dg-final { scan-tree-dump "12:.*: loop with 7 iterations completely unrolled" "cunroll" } } */
16 end subroutine test1
18 subroutine test2(a, n)
19 implicit NONE
20 integer :: a(n)
21 integer (kind=1), intent(in) :: n
22 integer (kind=4) :: i
23 !GCC$ unroll 8
24 DO i=1, n, 1
25 call dummy(a(i))
26 ENDDO
27 ! { dg-final { scan-rtl-dump "24:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
28 end subroutine test2
30 subroutine test3(a, n)
31 implicit NONE
32 integer (kind=1), intent(in) :: n
33 integer :: a(n)
34 integer (kind=4) :: i
35 !GCC$ unroll 8
36 DO i=n, 1, -1
37 call dummy(a(i))
38 ENDDO
39 ! { dg-final { scan-rtl-dump "36:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
40 end subroutine test3
42 subroutine test4(a, n)
43 implicit NONE
44 integer (kind=1), intent(in) :: n
45 integer :: a(n)
46 integer (kind=4) :: i
47 !GCC$ unroll 8
48 DO i=1, n, 2
49 call dummy(a(i))
50 ENDDO
51 ! { dg-final { scan-rtl-dump "48:.: optimized: loop unrolled 7 times" "loop2_unroll" } }
52 end subroutine test4