| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-O -fdump-tree-optimized -finline-matmul-limit=1000" } |
| 3 |
module x |
| 4 |
implicit none |
| 5 |
contains |
| 6 |
function afunc() |
| 7 |
real, dimension(3,3) :: afunc |
| 8 |
afunc = reshape([ 2., 3., 5., 7., 11., 13., 17., 19., 23. ], [3,3]) |
| 9 |
end function afunc |
| 10 |
|
| 11 |
function bfunc() |
| 12 |
real, dimension(3,3) :: bfunc |
| 13 |
bfunc = reshape([29., 31., 37., 41., 43., 47., 53., 59., 61., 67.],[3,3]) |
| 14 |
end function bfunc |
| 15 |
end module x |
| 16 |
|
| 17 |
program main |
| 18 |
use x |
| 19 |
implicit none |
| 20 |
real, dimension(3,3), parameter :: & |
| 21 |
& aval = reshape([ 2., 3., 5., 7., 11., 13., 17., 19., 23. ], [3,3]), & |
| 22 |
& bval = reshape([29., 31., 37., 41., 43., 47., 53., 59., 61., 67.],[3,3]) |
| 23 |
integer, dimension(3) :: ind |
| 24 |
real, dimension(3,3) :: a, b,c,d, ri |
| 25 |
data ri /120430., 187861., 151737., 161022., 251139., 202847., 212566., 331537., 267781./ |
| 26 |
data d/904., 1131., 1399., 1182., 1489., 1845., 1556., 1967., 2435. / |
| 27 |
a = aval |
| 28 |
b = bval |
| 29 |
c = matmul(a,b) |
| 30 |
a = matmul(a,b) |
| 31 |
if (any(a-c /= 0)) STOP 1 |
| 32 |
a = aval |
| 33 |
b = bval |
| 34 |
b = matmul(a,b) |
| 35 |
if (any(b-c /= 0)) STOP 2 |
| 36 |
b = bval |
| 37 |
a = matmul(aval, b) |
| 38 |
if (any(a-c /= 0)) STOP 3 |
| 39 |
ind = [1, 3, 2] |
| 40 |
c = matmul(a(ind,:),b) |
| 41 |
if (any(c-ri /= 0)) STOP 4 |
| 42 |
c = matmul(afunc(),b) |
| 43 |
if (any(c-d /= 0)) STOP 5 |
| 44 |
a = afunc() |
| 45 |
c = matmul(a, bfunc()) |
| 46 |
if (any(c-d /= 0)) STOP 6 |
| 47 |
end program main |
| 48 |
! { dg-final { scan-tree-dump-not "matmul_r4" "optimized" } } |