]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gfortran.dg/loop_versioning_2.f90
Add a loop versioning pass
[thirdparty/gcc.git] / gcc / testsuite / gfortran.dg / loop_versioning_2.f90
1 ! { dg-options "-O3 -fdump-tree-lversion-details -fno-frontend-loop-interchange" }
2
3 ! We could version the loop for when the first dimension has a stride
4 ! of 1, but at present there's no real benefit. The gimple loop
5 ! interchange pass couldn't handle the versioned loop, and interchange
6 ! is instead done by the frontend (but disabled by the options above).
7
8 subroutine f1(x)
9 real :: x(:, :)
10 do i = lbound(x, 1), ubound(x, 1)
11 do j = lbound(x, 2), ubound(x, 2)
12 x(i, j) = 100
13 end do
14 end do
15 end subroutine f1
16
17 subroutine f2(x, n, step)
18 integer :: n, step
19 real :: x(100, 100)
20 do i = 1, n
21 do j = 1, n
22 x(i * step, j) = 100
23 end do
24 end do
25 end subroutine f2
26
27 subroutine f3(x, n, step)
28 integer :: n, step
29 real :: x(n * step, n)
30 do i = 1, n
31 do j = 1, n
32 x(i * step, j) = 100
33 end do
34 end do
35 end subroutine f3
36
37 ! { dg-final { scan-tree-dump-times {likely to be the innermost dimension} 1 "lversion" } }
38 ! { dg-final { scan-tree-dump-not {want to version} "lversion" } }
39 ! { dg-final { scan-tree-dump-not {versioned} "lversion" } }