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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
! { dg-options "-O3 -fdump-tree-lversion-details -fno-frontend-loop-interchange" }
! Test cases in which versioning is useful for a two-dimensional array.
subroutine f1(x)
real :: x(:, :)
x(:, :) = 100
end subroutine f1
subroutine f2(x)
real :: x(:, :)
do i = lbound(x, 1), ubound(x, 1)
do j = lbound(x, 2), ubound(x, 2)
x(j, i) = 100
end do
end do
end subroutine f2
subroutine f3(x, n, step)
integer :: n, step
real :: x(100, 100)
do i = 1, n
do j = 1, n
x(j * step, i) = 100
end do
end do
end subroutine f3
subroutine f4(x, n, step)
integer :: n, step
real :: x(n * step, n)
do i = 1, n
do j = 1, n
x(j * step, i) = 100
end do
end do
end subroutine f4
subroutine f5(x, n, limit, step)
integer :: n, limit, step
real :: x(limit, n)
do i = 1, n
do j = 1, limit, step
x(j, i) = 100
end do
end do
end subroutine f5
subroutine f6(x, y)
real :: x(:, :), y(:)
do i = lbound(x, 1), ubound(x, 1)
do j = lbound(x, 2), ubound(x, 2)
x(j, i) = 100
end do
y(i) = 200
end do
end subroutine f6
subroutine f7(x, y, n, step)
integer :: n, step
real :: x(100, 100), y(100)
do i = 1, n
do j = 1, n
x(j * step, i) = 100
end do
y(i * step) = 200
end do
end subroutine f7
subroutine f8(x, y, n, step)
integer :: n, step
real :: x(n * step, n), y(n * step)
do i = 1, n
do j = 1, n
x(j * step, i) = 100
end do
y(i * step) = 200
end do
end subroutine f8
subroutine f9(x, n, limit, step)
integer :: n, limit, step
real :: x(limit, n), y(limit)
do i = 1, n
do j = 1, limit, step
x(j, i) = 100
end do
y(i) = 200
end do
end subroutine f9
! { dg-final { scan-tree-dump-times {likely to be the innermost dimension} 3 "lversion" } }
! { dg-final { scan-tree-dump-times {want to version containing loop} 9 "lversion" } }
! { dg-final { scan-tree-dump-times {hoisting check} 9 "lversion" } }
! { dg-final { scan-tree-dump-times {versioned this loop} 9 "lversion" } }
|