summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/loop_versioning_2.f90
blob: 522ef912947ea789047e9ee71682aceb193e51e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
! { dg-options "-O3 -fdump-tree-lversion-details -fno-frontend-loop-interchange" }

! We could version the loop for when the first dimension has a stride
! of 1, but at present there's no real benefit.  The gimple loop
! interchange pass couldn't handle the versioned loop, and interchange
! is instead done by the frontend (but disabled by the options above).

subroutine f1(x)
  real :: x(:, :)
  do i = lbound(x, 1), ubound(x, 1)
     do j = lbound(x, 2), ubound(x, 2)
        x(i, j) = 100
     end do
  end do
end subroutine f1

subroutine f2(x, n, step)
  integer :: n, step
  real :: x(100, 100)
  do i = 1, n
     do j = 1, n
        x(i * step, j) = 100
     end do
  end do
end subroutine f2

subroutine f3(x, n, step)
  integer :: n, step
  real :: x(n * step, n)
  do i = 1, n
     do j = 1, n
        x(i * step, j) = 100
     end do
  end do
end subroutine f3

! { dg-final { scan-tree-dump-times {likely to be the innermost dimension} 1 "lversion" } }
! { dg-final { scan-tree-dump-not {want to version} "lversion" } }
! { dg-final { scan-tree-dump-not {versioned} "lversion" } }