aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2015-05-17 13:45:07 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2015-05-17 13:45:07 +0000
commit2ea560b2b0da4ee9035ad0b56e971501a9612c0c (patch)
tree5f4a36945f1c575d82ffc04327c8a4e80591538c
parentebd5b3fd540013e538b37682cc756873afa12260 (diff)
downloadgcc-2ea560b2b0da4ee9035ad0b56e971501a9612c0c.zip
gcc-2ea560b2b0da4ee9035ad0b56e971501a9612c0c.tar.gz
gcc-2ea560b2b0da4ee9035ad0b56e971501a9612c0c.tar.bz2
re PR fortran/37131 (inline matmul for small matrix sizes)
2015-05-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/37131 * gfortran.dg/matmul_bounds_6.f90: New test. * gfortran.dg/matmul_bounds_7.f90: New test. From-SVN: r223268
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/matmul_bounds_6.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/matmul_bounds_7.f9016
3 files changed, 48 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5133549..5a36566 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-17 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/37131
+ * gfortran.dg/matmul_bounds_6.f90: New test.
+ * gfortran.dg/matmul_bounds_7.f90: New test.
+
2015-05-16 Jan Hubica <hubicka@ucw.cz>
* gfortran.dg/lto/20091028-2_1.c: Fix return value.
diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_6.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_6.f90
new file mode 100644
index 0000000..7d96c2d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/matmul_bounds_6.f90
@@ -0,0 +1,26 @@
+! { dg-do run }
+program main
+ real, dimension(3,2) :: a
+ real, dimension(6) :: b
+ real, dimension(3) :: res1
+ real, dimension(:), allocatable :: c1, c2,c3
+ real, dimension(2) :: res2
+
+ data a /-2., 3., -5., 7., -11., 13./
+ data b /17., -23., 29., -31., 37., -41./
+ data res1 /201., -320., 336./
+ data res2 /158., -353./
+
+ c1 = matmul(a,[29.,37.])
+ if (size(c1,1) /= 3) call abort
+ if (any(c1/=res1)) call abort
+
+ c2 = matmul(a,pack(b,[b>20.]))
+ if (size(c1,1) /= 3) call abort
+ if (any(c1/=res1)) call abort
+
+ c3 = matmul(pack(b,[b<0.]),a)
+ if (size(c3,1) /= 2) call abort
+ if (any(c3 /= res2)) call abort
+
+end program main
diff --git a/gcc/testsuite/gfortran.dg/matmul_bounds_7.f90 b/gcc/testsuite/gfortran.dg/matmul_bounds_7.f90
new file mode 100644
index 0000000..616869a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/matmul_bounds_7.f90
@@ -0,0 +1,16 @@
+! { dg-do run }
+! { dg-additional-options "-fcheck=bounds" }
+! { dg-shouldfail "Fortran runtime error: dimension of array B incorrect in MATMUL intrinsic" }
+
+program main
+ real, dimension(3,2) :: a
+ real, dimension(6) :: b
+ real, dimension(:), allocatable :: c
+
+ data a /-2., 3., -5., 7., -11., 13./
+ data b /17., -23., 29., -31., 37., -41./
+
+ c = matmul(pack(b,[b<20.]),a)
+ print *,sum(c)
+
+end program main