summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog19
-rw-r--r--libgfortran/generated/matmul_c10.c39
-rw-r--r--libgfortran/generated/matmul_c16.c39
-rw-r--r--libgfortran/generated/matmul_c4.c39
-rw-r--r--libgfortran/generated/matmul_c8.c39
-rw-r--r--libgfortran/generated/matmul_i16.c39
-rw-r--r--libgfortran/generated/matmul_i4.c39
-rw-r--r--libgfortran/generated/matmul_i8.c39
-rw-r--r--libgfortran/generated/matmul_r10.c39
-rw-r--r--libgfortran/generated/matmul_r16.c39
-rw-r--r--libgfortran/generated/matmul_r4.c39
-rw-r--r--libgfortran/generated/matmul_r8.c39
-rw-r--r--libgfortran/m4/matmul.m439
13 files changed, 355 insertions, 132 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 8517cae1ee8..8ab88b75037 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,22 @@
+2006-06-20 Paul Thomas <pault@gcc.gnu.org>
+
+ PR libfortran/28005
+ * m4/matmul.m4: aystride = 1 does not uniquely detect the
+ presence of a temporary transpose; an array element in the
+ first dimension produces the same signature. Detect this
+ using the rank of a and add specific code.
+ * generated/matmul_r4.c: Regenerate.
+ * generated/matmul_r8.c: Regenerate.
+ * generated/matmul_r10.c: Regenerate.
+ * generated/matmul_r16.c: Regenerate.
+ * generated/matmul_c4.c: Regenerate.
+ * generated/matmul_c8.c: Regenerate.
+ * generated/matmul_c10.c: Regenerate.
+ * generated/matmul_c16.c: Regenerate.
+ * generated/matmul_i4.c: Regenerate.
+ * generated/matmul_i8.c: Regenerate.
+ * generated/matmul_i16.c: Regenerate.
+
2006-06-18 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR libgomp/27254
diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c
index 72c3a7dba72..7b67ddd86a9 100644
--- a/libgfortran/generated/matmul_c10.c
+++ b/libgfortran/generated/matmul_c10.c
@@ -210,22 +210,39 @@ matmul_c10 (gfc_array_c10 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_COMPLEX_10 *restrict abase_x;
- const GFC_COMPLEX_10 *restrict bbase_y;
- GFC_COMPLEX_10 *restrict dest_y;
- GFC_COMPLEX_10 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_COMPLEX_10 *restrict abase_x;
+ const GFC_COMPLEX_10 *restrict bbase_y;
+ GFC_COMPLEX_10 *restrict dest_y;
+ GFC_COMPLEX_10 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_COMPLEX_10) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_COMPLEX_10 *restrict bbase_y;
+ GFC_COMPLEX_10 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_COMPLEX_10) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c
index d87eea1a273..c17bcaaa42c 100644
--- a/libgfortran/generated/matmul_c16.c
+++ b/libgfortran/generated/matmul_c16.c
@@ -210,22 +210,39 @@ matmul_c16 (gfc_array_c16 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_COMPLEX_16 *restrict abase_x;
- const GFC_COMPLEX_16 *restrict bbase_y;
- GFC_COMPLEX_16 *restrict dest_y;
- GFC_COMPLEX_16 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_COMPLEX_16 *restrict abase_x;
+ const GFC_COMPLEX_16 *restrict bbase_y;
+ GFC_COMPLEX_16 *restrict dest_y;
+ GFC_COMPLEX_16 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_COMPLEX_16) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_COMPLEX_16 *restrict bbase_y;
+ GFC_COMPLEX_16 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_COMPLEX_16) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c
index 339c9c03554..d85bd277fde 100644
--- a/libgfortran/generated/matmul_c4.c
+++ b/libgfortran/generated/matmul_c4.c
@@ -210,22 +210,39 @@ matmul_c4 (gfc_array_c4 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_COMPLEX_4 *restrict abase_x;
- const GFC_COMPLEX_4 *restrict bbase_y;
- GFC_COMPLEX_4 *restrict dest_y;
- GFC_COMPLEX_4 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_COMPLEX_4 *restrict abase_x;
+ const GFC_COMPLEX_4 *restrict bbase_y;
+ GFC_COMPLEX_4 *restrict dest_y;
+ GFC_COMPLEX_4 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_COMPLEX_4) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_COMPLEX_4 *restrict bbase_y;
+ GFC_COMPLEX_4 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_COMPLEX_4) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c
index 13a9e3720d3..be4ee6ce6b5 100644
--- a/libgfortran/generated/matmul_c8.c
+++ b/libgfortran/generated/matmul_c8.c
@@ -210,22 +210,39 @@ matmul_c8 (gfc_array_c8 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_COMPLEX_8 *restrict abase_x;
- const GFC_COMPLEX_8 *restrict bbase_y;
- GFC_COMPLEX_8 *restrict dest_y;
- GFC_COMPLEX_8 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_COMPLEX_8 *restrict abase_x;
+ const GFC_COMPLEX_8 *restrict bbase_y;
+ GFC_COMPLEX_8 *restrict dest_y;
+ GFC_COMPLEX_8 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_COMPLEX_8) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_COMPLEX_8 *restrict bbase_y;
+ GFC_COMPLEX_8 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_COMPLEX_8) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c
index b6136ef702c..c4de78a9282 100644
--- a/libgfortran/generated/matmul_i16.c
+++ b/libgfortran/generated/matmul_i16.c
@@ -210,22 +210,39 @@ matmul_i16 (gfc_array_i16 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_INTEGER_16 *restrict abase_x;
- const GFC_INTEGER_16 *restrict bbase_y;
- GFC_INTEGER_16 *restrict dest_y;
- GFC_INTEGER_16 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_INTEGER_16 *restrict abase_x;
+ const GFC_INTEGER_16 *restrict bbase_y;
+ GFC_INTEGER_16 *restrict dest_y;
+ GFC_INTEGER_16 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_INTEGER_16) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_INTEGER_16 *restrict bbase_y;
+ GFC_INTEGER_16 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_INTEGER_16) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c
index 4cffcf05dd8..cd506a03943 100644
--- a/libgfortran/generated/matmul_i4.c
+++ b/libgfortran/generated/matmul_i4.c
@@ -210,22 +210,39 @@ matmul_i4 (gfc_array_i4 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_INTEGER_4 *restrict abase_x;
- const GFC_INTEGER_4 *restrict bbase_y;
- GFC_INTEGER_4 *restrict dest_y;
- GFC_INTEGER_4 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_INTEGER_4 *restrict abase_x;
+ const GFC_INTEGER_4 *restrict bbase_y;
+ GFC_INTEGER_4 *restrict dest_y;
+ GFC_INTEGER_4 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_INTEGER_4) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_INTEGER_4 *restrict bbase_y;
+ GFC_INTEGER_4 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_INTEGER_4) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c
index c4fb0c7e5b9..7bdfb6f7154 100644
--- a/libgfortran/generated/matmul_i8.c
+++ b/libgfortran/generated/matmul_i8.c
@@ -210,22 +210,39 @@ matmul_i8 (gfc_array_i8 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_INTEGER_8 *restrict abase_x;
- const GFC_INTEGER_8 *restrict bbase_y;
- GFC_INTEGER_8 *restrict dest_y;
- GFC_INTEGER_8 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_INTEGER_8 *restrict abase_x;
+ const GFC_INTEGER_8 *restrict bbase_y;
+ GFC_INTEGER_8 *restrict dest_y;
+ GFC_INTEGER_8 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_INTEGER_8) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_INTEGER_8 *restrict bbase_y;
+ GFC_INTEGER_8 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_INTEGER_8) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c
index e90ac57c5c2..2bdaaf51c5b 100644
--- a/libgfortran/generated/matmul_r10.c
+++ b/libgfortran/generated/matmul_r10.c
@@ -210,22 +210,39 @@ matmul_r10 (gfc_array_r10 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_REAL_10 *restrict abase_x;
- const GFC_REAL_10 *restrict bbase_y;
- GFC_REAL_10 *restrict dest_y;
- GFC_REAL_10 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_REAL_10 *restrict abase_x;
+ const GFC_REAL_10 *restrict bbase_y;
+ GFC_REAL_10 *restrict dest_y;
+ GFC_REAL_10 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_REAL_10) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_REAL_10 *restrict bbase_y;
+ GFC_REAL_10 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_REAL_10) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c
index 3823fa6d5c4..f120e7fdc56 100644
--- a/libgfortran/generated/matmul_r16.c
+++ b/libgfortran/generated/matmul_r16.c
@@ -210,22 +210,39 @@ matmul_r16 (gfc_array_r16 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_REAL_16 *restrict abase_x;
- const GFC_REAL_16 *restrict bbase_y;
- GFC_REAL_16 *restrict dest_y;
- GFC_REAL_16 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_REAL_16 *restrict abase_x;
+ const GFC_REAL_16 *restrict bbase_y;
+ GFC_REAL_16 *restrict dest_y;
+ GFC_REAL_16 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_REAL_16) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_REAL_16 *restrict bbase_y;
+ GFC_REAL_16 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_REAL_16) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c
index 3757b65eaff..085513346e0 100644
--- a/libgfortran/generated/matmul_r4.c
+++ b/libgfortran/generated/matmul_r4.c
@@ -210,22 +210,39 @@ matmul_r4 (gfc_array_r4 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_REAL_4 *restrict abase_x;
- const GFC_REAL_4 *restrict bbase_y;
- GFC_REAL_4 *restrict dest_y;
- GFC_REAL_4 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_REAL_4 *restrict abase_x;
+ const GFC_REAL_4 *restrict bbase_y;
+ GFC_REAL_4 *restrict dest_y;
+ GFC_REAL_4 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_REAL_4) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_REAL_4 *restrict bbase_y;
+ GFC_REAL_4 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_REAL_4) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c
index 2bd607cc40a..ba177a8e473 100644
--- a/libgfortran/generated/matmul_r8.c
+++ b/libgfortran/generated/matmul_r8.c
@@ -210,22 +210,39 @@ matmul_r8 (gfc_array_r8 * const restrict retarray,
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const GFC_REAL_8 *restrict abase_x;
- const GFC_REAL_8 *restrict bbase_y;
- GFC_REAL_8 *restrict dest_y;
- GFC_REAL_8 s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const GFC_REAL_8 *restrict abase_x;
+ const GFC_REAL_8 *restrict bbase_y;
+ GFC_REAL_8 *restrict dest_y;
+ GFC_REAL_8 s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (GFC_REAL_8) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const GFC_REAL_8 *restrict bbase_y;
+ GFC_REAL_8 s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (GFC_REAL_8) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}
diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4
index f83837b77a9..f55e2cfaa64 100644
--- a/libgfortran/m4/matmul.m4
+++ b/libgfortran/m4/matmul.m4
@@ -212,22 +212,39 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
}
else if (rxstride == 1 && aystride == 1 && bxstride == 1)
{
- const rtype_name *restrict abase_x;
- const rtype_name *restrict bbase_y;
- rtype_name *restrict dest_y;
- rtype_name s;
+ if (GFC_DESCRIPTOR_RANK (a) != 1)
+ {
+ const rtype_name *restrict abase_x;
+ const rtype_name *restrict bbase_y;
+ rtype_name *restrict dest_y;
+ rtype_name s;
- for (y = 0; y < ycount; y++)
+ for (y = 0; y < ycount; y++)
+ {
+ bbase_y = &bbase[y*bystride];
+ dest_y = &dest[y*rystride];
+ for (x = 0; x < xcount; x++)
+ {
+ abase_x = &abase[x*axstride];
+ s = (rtype_name) 0;
+ for (n = 0; n < count; n++)
+ s += abase_x[n] * bbase_y[n];
+ dest_y[x] = s;
+ }
+ }
+ }
+ else
{
- bbase_y = &bbase[y*bystride];
- dest_y = &dest[y*rystride];
- for (x = 0; x < xcount; x++)
+ const rtype_name *restrict bbase_y;
+ rtype_name s;
+
+ for (y = 0; y < ycount; y++)
{
- abase_x = &abase[x*axstride];
+ bbase_y = &bbase[y*bystride];
s = (rtype_name) 0;
for (n = 0; n < count; n++)
- s += abase_x[n] * bbase_y[n];
- dest_y[x] = s;
+ s += abase[n*axstride] * bbase_y[n];
+ dest[y*rystride] = s;
}
}
}