summaryrefslogtreecommitdiff
path: root/libgfortran/m4
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2005-11-14 21:48:31 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2005-11-14 21:48:31 +0200
commit8520690170c14805001693fe2fb88bc7b58a8cbf (patch)
treeea9d35216d30a0f95f4bdaf4358cdd30d1cf0613 /libgfortran/m4
parentd0568f737a5f9e620a14a372a713a54ba1328764 (diff)
downloadgcc-8520690170c14805001693fe2fb88bc7b58a8cbf.tar.gz
re PR libfortran/21468 (vectorizing libfortran)
2005-11-14 Janne Blomqvist <jb@gcc.gnu.org> PR fortran/21468 * Makefile.am: Add -ftree-vectorize for compiling matmul. * m4/matmul.m4: Add const and restrict to type declarations as appropriate. * m4/matmull.m4: Likewise. * Makefile.in: Regenerated. * generated/matmul_*.c: Likewise. From-SVN: r106898
Diffstat (limited to 'libgfortran/m4')
-rw-r--r--libgfortran/m4/matmul.m424
-rw-r--r--libgfortran/m4/matmull.m416
2 files changed, 21 insertions, 19 deletions
diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4
index aca2da06bab..730e4d78fd3 100644
--- a/libgfortran/m4/matmul.m4
+++ b/libgfortran/m4/matmul.m4
@@ -49,15 +49,17 @@ include(iparm.m4)dnl
C(I,J) = C(I,J)+A(I,K)*B(K,J)
*/
-extern void matmul_`'rtype_code (rtype * retarray, rtype * a, rtype * b);
+extern void matmul_`'rtype_code (rtype * const restrict retarray,
+ rtype * const restrict a, rtype * const restrict b);
export_proto(matmul_`'rtype_code);
void
-matmul_`'rtype_code (rtype * retarray, rtype * a, rtype * b)
+matmul_`'rtype_code (rtype * const restrict retarray,
+ rtype * const restrict a, rtype * const restrict b)
{
- rtype_name *abase;
- rtype_name *bbase;
- rtype_name *dest;
+ const rtype_name * restrict abase;
+ const rtype_name * restrict bbase;
+ rtype_name * restrict dest;
index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
index_type x, y, n, count, xcount, ycount;
@@ -106,12 +108,10 @@ matmul_`'rtype_code (rtype * retarray, rtype * a, rtype * b)
retarray->offset = 0;
}
- abase = a->data;
- bbase = b->data;
- dest = retarray->data;
-
if (retarray->dim[0].stride == 0)
retarray->dim[0].stride = 1;
+
+ /* This prevents constifying the input arguments. */
if (a->dim[0].stride == 0)
a->dim[0].stride = 1;
if (b->dim[0].stride == 0)
@@ -177,9 +177,9 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
if (rxstride == 1 && axstride == 1 && bxstride == 1)
{
- rtype_name *bbase_y;
- rtype_name *dest_y;
- rtype_name *abase_n;
+ const rtype_name * restrict bbase_y;
+ rtype_name * restrict dest_y;
+ const rtype_name * restrict abase_n;
rtype_name bbase_yn;
if (rystride == ycount)
diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4
index 9632a6ab76d..5acb4cb06cd 100644
--- a/libgfortran/m4/matmull.m4
+++ b/libgfortran/m4/matmull.m4
@@ -39,15 +39,17 @@ include(iparm.m4)dnl
/* Dimensions: retarray(x,y) a(x, count) b(count,y).
Either a or b can be rank 1. In this case x or y is 1. */
-extern void matmul_`'rtype_code (rtype *, gfc_array_l4 *, gfc_array_l4 *);
+extern void matmul_`'rtype_code (rtype * const restrict,
+ gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
export_proto(matmul_`'rtype_code);
void
-matmul_`'rtype_code (rtype * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
+matmul_`'rtype_code (rtype * const restrict retarray,
+ gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
{
- GFC_INTEGER_4 *abase;
- GFC_INTEGER_4 *bbase;
- rtype_name *dest;
+ const GFC_INTEGER_4 * restrict abase;
+ const GFC_INTEGER_4 * restrict bbase;
+ rtype_name * restrict dest;
index_type rxstride;
index_type rystride;
index_type xcount;
@@ -57,8 +59,8 @@ matmul_`'rtype_code (rtype * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
index_type x;
index_type y;
- GFC_INTEGER_4 *pa;
- GFC_INTEGER_4 *pb;
+ const GFC_INTEGER_4 * restrict pa;
+ const GFC_INTEGER_4 * restrict pb;
index_type astride;
index_type bstride;
index_type count;