re PR libfortran/32972 (performance of pack/unpack)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 24 Aug 2007 16:16:16 +0000 (16:16 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 24 Aug 2007 16:16:16 +0000 (16:16 +0000)
2007-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/32972
* iresolve.c:  Don't convert array masks.

2007-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/32972
* libgfortran.h:  Remove GFOR_POINTER_L8_TO_L4 macro.
Add GFOR_POINTER_TO_L1 macro.
* m4/iforeach.m4(`m'name`'rtype_qual`_'atype_code):
Change argument 'mask' to gfc_array_l1.  Adjust prototype.
Change mask pointer to GFC_LOGICAL_1.  Multiply strides
by kind of mask
* m4/ifunction.m4:  Likewise.
* intrinsics/pack_generic.c(pack_internal):  Likewise.
* intrinsics/unpack_generic.c(unpack_internal):  Likewise.
* m4/matmull.m4:  Switch to GFC_LOGICAL_1.  Multiply strides by
kind of logical arguments a and b.
* generated/matmul_l16.c: Regenerated.
* generated/matmul_l4.c: Regenerated.
* generated/matmul_l8.c: Regenerated.
* generated/maxloc0_16_i1.c: Regenerated.
* generated/maxloc0_16_i16.c: Regenerated.
* generated/maxloc0_16_i2.c: Regenerated.
* generated/maxloc0_16_i4.c: Regenerated.
* generated/maxloc0_16_i8.c: Regenerated.
* generated/maxloc0_16_r10.c: Regenerated.
* generated/maxloc0_16_r16.c: Regenerated.
* generated/maxloc0_16_r4.c: Regenerated.
* generated/maxloc0_16_r8.c: Regenerated.
* generated/maxloc0_4_i1.c: Regenerated.
* generated/maxloc0_4_i16.c: Regenerated.
* generated/maxloc0_4_i2.c: Regenerated.
* generated/maxloc0_4_i4.c: Regenerated.
* generated/maxloc0_4_i8.c: Regenerated.
* generated/maxloc0_4_r10.c: Regenerated.
* generated/maxloc0_4_r16.c: Regenerated.
* generated/maxloc0_4_r4.c: Regenerated.
* generated/maxloc0_4_r8.c: Regenerated.
* generated/maxloc0_8_i1.c: Regenerated.
* generated/maxloc0_8_i16.c: Regenerated.
* generated/maxloc0_8_i2.c: Regenerated.
* generated/maxloc0_8_i4.c: Regenerated.
* generated/maxloc0_8_i8.c: Regenerated.
* generated/maxloc0_8_r10.c: Regenerated.
* generated/maxloc0_8_r16.c: Regenerated.
* generated/maxloc0_8_r4.c: Regenerated.
* generated/maxloc0_8_r8.c: Regenerated.
* generated/maxloc1_16_i1.c: Regenerated.
* generated/maxloc1_16_i16.c: Regenerated.
* generated/maxloc1_16_i2.c: Regenerated.
* generated/maxloc1_16_i4.c: Regenerated.
* generated/maxloc1_16_i8.c: Regenerated.
* generated/maxloc1_16_r10.c: Regenerated.
* generated/maxloc1_16_r16.c: Regenerated.
* generated/maxloc1_16_r4.c: Regenerated.
* generated/maxloc1_16_r8.c: Regenerated.
* generated/maxloc1_4_i1.c: Regenerated.
* generated/maxloc1_4_i16.c: Regenerated.
* generated/maxloc1_4_i2.c: Regenerated.
* generated/maxloc1_4_i4.c: Regenerated.
* generated/maxloc1_4_i8.c: Regenerated.
* generated/maxloc1_4_r10.c: Regenerated.
* generated/maxloc1_4_r16.c: Regenerated.
* generated/maxloc1_4_r4.c: Regenerated.
* generated/maxloc1_4_r8.c: Regenerated.
* generated/maxloc1_8_i1.c: Regenerated.
* generated/maxloc1_8_i16.c: Regenerated.
* generated/maxloc1_8_i2.c: Regenerated.
* generated/maxloc1_8_i4.c: Regenerated.
* generated/maxloc1_8_i8.c: Regenerated.
* generated/maxloc1_8_r10.c: Regenerated.
* generated/maxloc1_8_r16.c: Regenerated.
* generated/maxloc1_8_r4.c: Regenerated.
* generated/maxloc1_8_r8.c: Regenerated.
* generated/maxval_i1.c: Regenerated.
* generated/maxval_i16.c: Regenerated.
* generated/maxval_i2.c: Regenerated.
* generated/maxval_i4.c: Regenerated.
* generated/maxval_i8.c: Regenerated.
* generated/maxval_r10.c: Regenerated.
* generated/maxval_r16.c: Regenerated.
* generated/maxval_r4.c: Regenerated.
* generated/maxval_r8.c: Regenerated.
* generated/minloc0_16_i1.c: Regenerated.
* generated/minloc0_16_i16.c: Regenerated.
* generated/minloc0_16_i2.c: Regenerated.
* generated/minloc0_16_i4.c: Regenerated.
* generated/minloc0_16_i8.c: Regenerated.
* generated/minloc0_16_r10.c: Regenerated.
* generated/minloc0_16_r16.c: Regenerated.
* generated/minloc0_16_r4.c: Regenerated.
* generated/minloc0_16_r8.c: Regenerated.
* generated/minloc0_4_i1.c: Regenerated.
* generated/minloc0_4_i16.c: Regenerated.
* generated/minloc0_4_i2.c: Regenerated.
* generated/minloc0_4_i4.c: Regenerated.
* generated/minloc0_4_i8.c: Regenerated.
* generated/minloc0_4_r10.c: Regenerated.
* generated/minloc0_4_r16.c: Regenerated.
* generated/minloc0_4_r4.c: Regenerated.
* generated/minloc0_4_r8.c: Regenerated.
* generated/minloc0_8_i1.c: Regenerated.
* generated/minloc0_8_i16.c: Regenerated.
* generated/minloc0_8_i2.c: Regenerated.
* generated/minloc0_8_i4.c: Regenerated.
* generated/minloc0_8_i8.c: Regenerated.
* generated/minloc0_8_r10.c: Regenerated.
* generated/minloc0_8_r16.c: Regenerated.
* generated/minloc0_8_r4.c: Regenerated.
* generated/minloc0_8_r8.c: Regenerated.
* generated/minloc1_16_i1.c: Regenerated.
* generated/minloc1_16_i16.c: Regenerated.
* generated/minloc1_16_i2.c: Regenerated.
* generated/minloc1_16_i4.c: Regenerated.
* generated/minloc1_16_i8.c: Regenerated.
* generated/minloc1_16_r10.c: Regenerated.
* generated/minloc1_16_r16.c: Regenerated.
* generated/minloc1_16_r4.c: Regenerated.
* generated/minloc1_16_r8.c: Regenerated.
* generated/minloc1_4_i1.c: Regenerated.
* generated/minloc1_4_i16.c: Regenerated.
* generated/minloc1_4_i2.c: Regenerated.
* generated/minloc1_4_i4.c: Regenerated.
* generated/minloc1_4_i8.c: Regenerated.
* generated/minloc1_4_r10.c: Regenerated.
* generated/minloc1_4_r16.c: Regenerated.
* generated/minloc1_4_r4.c: Regenerated.
* generated/minloc1_4_r8.c: Regenerated.
* generated/minloc1_8_i1.c: Regenerated.
* generated/minloc1_8_i16.c: Regenerated.
* generated/minloc1_8_i2.c: Regenerated.
* generated/minloc1_8_i4.c: Regenerated.
* generated/minloc1_8_i8.c: Regenerated.
* generated/minloc1_8_r10.c: Regenerated.
* generated/minloc1_8_r16.c: Regenerated.
* generated/minloc1_8_r4.c: Regenerated.
* generated/minloc1_8_r8.c: Regenerated.
* generated/minval_i1.c: Regenerated.
* generated/minval_i16.c: Regenerated.
* generated/minval_i2.c: Regenerated.
* generated/minval_i4.c: Regenerated.
* generated/minval_i8.c: Regenerated.
* generated/minval_r10.c: Regenerated.
* generated/minval_r16.c: Regenerated.
* generated/minval_r4.c: Regenerated.
* generated/minval_r8.c: Regenerated.
* generated/product_c10.c: Regenerated.
* generated/product_c16.c: Regenerated.
* generated/product_c4.c: Regenerated.
* generated/product_c8.c: Regenerated.
* generated/product_i1.c: Regenerated.
* generated/product_i16.c: Regenerated.
* generated/product_i2.c: Regenerated.
* generated/product_i4.c: Regenerated.
* generated/product_i8.c: Regenerated.
* generated/product_r10.c: Regenerated.
* generated/product_r16.c: Regenerated.
* generated/product_r4.c: Regenerated.
* generated/product_r8.c: Regenerated.
* generated/sum_c10.c: Regenerated.
* generated/sum_c16.c: Regenerated.
* generated/sum_c4.c: Regenerated.
* generated/sum_c8.c: Regenerated.
* generated/sum_i1.c: Regenerated.
* generated/sum_i16.c: Regenerated.
* generated/sum_i2.c: Regenerated.
* generated/sum_i4.c: Regenerated.
* generated/sum_i8.c: Regenerated.
* generated/sum_r10.c: Regenerated.
* generated/sum_r16.c: Regenerated.
* generated/sum_r4.c: Regenerated.
* generated/sum_r8.c: Regenerated.

From-SVN: r127774

164 files changed:
gcc/fortran/ChangeLog
gcc/fortran/iresolve.c
libgfortran/ChangeLog
libgfortran/generated/matmul_l16.c
libgfortran/generated/matmul_l4.c
libgfortran/generated/matmul_l8.c
libgfortran/generated/maxloc0_16_i1.c
libgfortran/generated/maxloc0_16_i16.c
libgfortran/generated/maxloc0_16_i2.c
libgfortran/generated/maxloc0_16_i4.c
libgfortran/generated/maxloc0_16_i8.c
libgfortran/generated/maxloc0_16_r10.c
libgfortran/generated/maxloc0_16_r16.c
libgfortran/generated/maxloc0_16_r4.c
libgfortran/generated/maxloc0_16_r8.c
libgfortran/generated/maxloc0_4_i1.c
libgfortran/generated/maxloc0_4_i16.c
libgfortran/generated/maxloc0_4_i2.c
libgfortran/generated/maxloc0_4_i4.c
libgfortran/generated/maxloc0_4_i8.c
libgfortran/generated/maxloc0_4_r10.c
libgfortran/generated/maxloc0_4_r16.c
libgfortran/generated/maxloc0_4_r4.c
libgfortran/generated/maxloc0_4_r8.c
libgfortran/generated/maxloc0_8_i1.c
libgfortran/generated/maxloc0_8_i16.c
libgfortran/generated/maxloc0_8_i2.c
libgfortran/generated/maxloc0_8_i4.c
libgfortran/generated/maxloc0_8_i8.c
libgfortran/generated/maxloc0_8_r10.c
libgfortran/generated/maxloc0_8_r16.c
libgfortran/generated/maxloc0_8_r4.c
libgfortran/generated/maxloc0_8_r8.c
libgfortran/generated/maxloc1_16_i1.c
libgfortran/generated/maxloc1_16_i16.c
libgfortran/generated/maxloc1_16_i2.c
libgfortran/generated/maxloc1_16_i4.c
libgfortran/generated/maxloc1_16_i8.c
libgfortran/generated/maxloc1_16_r10.c
libgfortran/generated/maxloc1_16_r16.c
libgfortran/generated/maxloc1_16_r4.c
libgfortran/generated/maxloc1_16_r8.c
libgfortran/generated/maxloc1_4_i1.c
libgfortran/generated/maxloc1_4_i16.c
libgfortran/generated/maxloc1_4_i2.c
libgfortran/generated/maxloc1_4_i4.c
libgfortran/generated/maxloc1_4_i8.c
libgfortran/generated/maxloc1_4_r10.c
libgfortran/generated/maxloc1_4_r16.c
libgfortran/generated/maxloc1_4_r4.c
libgfortran/generated/maxloc1_4_r8.c
libgfortran/generated/maxloc1_8_i1.c
libgfortran/generated/maxloc1_8_i16.c
libgfortran/generated/maxloc1_8_i2.c
libgfortran/generated/maxloc1_8_i4.c
libgfortran/generated/maxloc1_8_i8.c
libgfortran/generated/maxloc1_8_r10.c
libgfortran/generated/maxloc1_8_r16.c
libgfortran/generated/maxloc1_8_r4.c
libgfortran/generated/maxloc1_8_r8.c
libgfortran/generated/maxval_i1.c
libgfortran/generated/maxval_i16.c
libgfortran/generated/maxval_i2.c
libgfortran/generated/maxval_i4.c
libgfortran/generated/maxval_i8.c
libgfortran/generated/maxval_r10.c
libgfortran/generated/maxval_r16.c
libgfortran/generated/maxval_r4.c
libgfortran/generated/maxval_r8.c
libgfortran/generated/minloc0_16_i1.c
libgfortran/generated/minloc0_16_i16.c
libgfortran/generated/minloc0_16_i2.c
libgfortran/generated/minloc0_16_i4.c
libgfortran/generated/minloc0_16_i8.c
libgfortran/generated/minloc0_16_r10.c
libgfortran/generated/minloc0_16_r16.c
libgfortran/generated/minloc0_16_r4.c
libgfortran/generated/minloc0_16_r8.c
libgfortran/generated/minloc0_4_i1.c
libgfortran/generated/minloc0_4_i16.c
libgfortran/generated/minloc0_4_i2.c
libgfortran/generated/minloc0_4_i4.c
libgfortran/generated/minloc0_4_i8.c
libgfortran/generated/minloc0_4_r10.c
libgfortran/generated/minloc0_4_r16.c
libgfortran/generated/minloc0_4_r4.c
libgfortran/generated/minloc0_4_r8.c
libgfortran/generated/minloc0_8_i1.c
libgfortran/generated/minloc0_8_i16.c
libgfortran/generated/minloc0_8_i2.c
libgfortran/generated/minloc0_8_i4.c
libgfortran/generated/minloc0_8_i8.c
libgfortran/generated/minloc0_8_r10.c
libgfortran/generated/minloc0_8_r16.c
libgfortran/generated/minloc0_8_r4.c
libgfortran/generated/minloc0_8_r8.c
libgfortran/generated/minloc1_16_i1.c
libgfortran/generated/minloc1_16_i16.c
libgfortran/generated/minloc1_16_i2.c
libgfortran/generated/minloc1_16_i4.c
libgfortran/generated/minloc1_16_i8.c
libgfortran/generated/minloc1_16_r10.c
libgfortran/generated/minloc1_16_r16.c
libgfortran/generated/minloc1_16_r4.c
libgfortran/generated/minloc1_16_r8.c
libgfortran/generated/minloc1_4_i1.c
libgfortran/generated/minloc1_4_i16.c
libgfortran/generated/minloc1_4_i2.c
libgfortran/generated/minloc1_4_i4.c
libgfortran/generated/minloc1_4_i8.c
libgfortran/generated/minloc1_4_r10.c
libgfortran/generated/minloc1_4_r16.c
libgfortran/generated/minloc1_4_r4.c
libgfortran/generated/minloc1_4_r8.c
libgfortran/generated/minloc1_8_i1.c
libgfortran/generated/minloc1_8_i16.c
libgfortran/generated/minloc1_8_i2.c
libgfortran/generated/minloc1_8_i4.c
libgfortran/generated/minloc1_8_i8.c
libgfortran/generated/minloc1_8_r10.c
libgfortran/generated/minloc1_8_r16.c
libgfortran/generated/minloc1_8_r4.c
libgfortran/generated/minloc1_8_r8.c
libgfortran/generated/minval_i1.c
libgfortran/generated/minval_i16.c
libgfortran/generated/minval_i2.c
libgfortran/generated/minval_i4.c
libgfortran/generated/minval_i8.c
libgfortran/generated/minval_r10.c
libgfortran/generated/minval_r16.c
libgfortran/generated/minval_r4.c
libgfortran/generated/minval_r8.c
libgfortran/generated/product_c10.c
libgfortran/generated/product_c16.c
libgfortran/generated/product_c4.c
libgfortran/generated/product_c8.c
libgfortran/generated/product_i1.c
libgfortran/generated/product_i16.c
libgfortran/generated/product_i2.c
libgfortran/generated/product_i4.c
libgfortran/generated/product_i8.c
libgfortran/generated/product_r10.c
libgfortran/generated/product_r16.c
libgfortran/generated/product_r4.c
libgfortran/generated/product_r8.c
libgfortran/generated/sum_c10.c
libgfortran/generated/sum_c16.c
libgfortran/generated/sum_c4.c
libgfortran/generated/sum_c8.c
libgfortran/generated/sum_i1.c
libgfortran/generated/sum_i16.c
libgfortran/generated/sum_i2.c
libgfortran/generated/sum_i4.c
libgfortran/generated/sum_i8.c
libgfortran/generated/sum_r10.c
libgfortran/generated/sum_r16.c
libgfortran/generated/sum_r4.c
libgfortran/generated/sum_r8.c
libgfortran/intrinsics/pack_generic.c
libgfortran/intrinsics/unpack_generic.c
libgfortran/libgfortran.h
libgfortran/m4/iforeach.m4
libgfortran/m4/ifunction.m4
libgfortran/m4/matmull.m4

index 67d779181c03b0f4a232f62cedb575c65419b803..7ab6c1eddd7cc0d9d94daf9937ee123e01170c4e 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/32972
+       * iresolve.c:  Don't convert array masks.
+
 2007-08-24  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/33139
index c030898a43b546e3bf97bfb3d15834328bbe3fa0..fc837e1fcd0191a3f88ebbaada0674e93aecb852 100644 (file)
@@ -77,32 +77,18 @@ check_charlen_present (gfc_expr *source)
 static void
 resolve_mask_arg (gfc_expr *mask)
 {
-  int newkind;
 
-  /* The mask can be kind 4 or 8 for the array case.
+  /* The mask can be any kind for an array.
      For the scalar case, coerce it to kind=4 unconditionally
      (because this is the only kind we have a library function
      for).  */
 
-  newkind = 0;
-
-  if (mask->rank == 0)
-    {
-      if (mask->ts.kind != 4)
-       newkind = 4;
-    }
-  else
-    {
-      if (mask->ts.kind < 4)
-       newkind = gfc_default_logical_kind;
-    }
-
-  if (newkind)
+  if (mask->rank == 0 && mask->ts.kind != 4)
     {
       gfc_typespec ts;
 
       ts.type = BT_LOGICAL;
-      ts.kind = newkind;
+      ts.kind = 4;
       gfc_convert_type (mask, &ts, 2);
     }
 }
index e9832a0e24e5e807c79d3c0f39632dc60e371c80..10e6009d8649da23602ec2e15dc3279990328d03 100644 (file)
@@ -1,3 +1,173 @@
+2007-08-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/32972
+       * libgfortran.h:  Remove GFOR_POINTER_L8_TO_L4 macro.
+       Add GFOR_POINTER_TO_L1 macro.
+       * m4/iforeach.m4(`m'name`'rtype_qual`_'atype_code):
+       Change argument 'mask' to gfc_array_l1.  Adjust prototype.
+       Change mask pointer to GFC_LOGICAL_1.  Multiply strides
+       by kind of mask
+       * m4/ifunction.m4:  Likewise.
+       * intrinsics/pack_generic.c(pack_internal):  Likewise.
+       * intrinsics/unpack_generic.c(unpack_internal):  Likewise.
+       * m4/matmull.m4:  Switch to GFC_LOGICAL_1.  Multiply strides by
+       kind of logical arguments a and b.
+       * generated/matmul_l16.c: Regenerated.
+       * generated/matmul_l4.c: Regenerated.
+       * generated/matmul_l8.c: Regenerated.
+       * generated/maxloc0_16_i1.c: Regenerated.
+       * generated/maxloc0_16_i16.c: Regenerated.
+       * generated/maxloc0_16_i2.c: Regenerated.
+       * generated/maxloc0_16_i4.c: Regenerated.
+       * generated/maxloc0_16_i8.c: Regenerated.
+       * generated/maxloc0_16_r10.c: Regenerated.
+       * generated/maxloc0_16_r16.c: Regenerated.
+       * generated/maxloc0_16_r4.c: Regenerated.
+       * generated/maxloc0_16_r8.c: Regenerated.
+       * generated/maxloc0_4_i1.c: Regenerated.
+       * generated/maxloc0_4_i16.c: Regenerated.
+       * generated/maxloc0_4_i2.c: Regenerated.
+       * generated/maxloc0_4_i4.c: Regenerated.
+       * generated/maxloc0_4_i8.c: Regenerated.
+       * generated/maxloc0_4_r10.c: Regenerated.
+       * generated/maxloc0_4_r16.c: Regenerated.
+       * generated/maxloc0_4_r4.c: Regenerated.
+       * generated/maxloc0_4_r8.c: Regenerated.
+       * generated/maxloc0_8_i1.c: Regenerated.
+       * generated/maxloc0_8_i16.c: Regenerated.
+       * generated/maxloc0_8_i2.c: Regenerated.
+       * generated/maxloc0_8_i4.c: Regenerated.
+       * generated/maxloc0_8_i8.c: Regenerated.
+       * generated/maxloc0_8_r10.c: Regenerated.
+       * generated/maxloc0_8_r16.c: Regenerated.
+       * generated/maxloc0_8_r4.c: Regenerated.
+       * generated/maxloc0_8_r8.c: Regenerated.
+       * generated/maxloc1_16_i1.c: Regenerated.
+       * generated/maxloc1_16_i16.c: Regenerated.
+       * generated/maxloc1_16_i2.c: Regenerated.
+       * generated/maxloc1_16_i4.c: Regenerated.
+       * generated/maxloc1_16_i8.c: Regenerated.
+       * generated/maxloc1_16_r10.c: Regenerated.
+       * generated/maxloc1_16_r16.c: Regenerated.
+       * generated/maxloc1_16_r4.c: Regenerated.
+       * generated/maxloc1_16_r8.c: Regenerated.
+       * generated/maxloc1_4_i1.c: Regenerated.
+       * generated/maxloc1_4_i16.c: Regenerated.
+       * generated/maxloc1_4_i2.c: Regenerated.
+       * generated/maxloc1_4_i4.c: Regenerated.
+       * generated/maxloc1_4_i8.c: Regenerated.
+       * generated/maxloc1_4_r10.c: Regenerated.
+       * generated/maxloc1_4_r16.c: Regenerated.
+       * generated/maxloc1_4_r4.c: Regenerated.
+       * generated/maxloc1_4_r8.c: Regenerated.
+       * generated/maxloc1_8_i1.c: Regenerated.
+       * generated/maxloc1_8_i16.c: Regenerated.
+       * generated/maxloc1_8_i2.c: Regenerated.
+       * generated/maxloc1_8_i4.c: Regenerated.
+       * generated/maxloc1_8_i8.c: Regenerated.
+       * generated/maxloc1_8_r10.c: Regenerated.
+       * generated/maxloc1_8_r16.c: Regenerated.
+       * generated/maxloc1_8_r4.c: Regenerated.
+       * generated/maxloc1_8_r8.c: Regenerated.
+       * generated/maxval_i1.c: Regenerated.
+       * generated/maxval_i16.c: Regenerated.
+       * generated/maxval_i2.c: Regenerated.
+       * generated/maxval_i4.c: Regenerated.
+       * generated/maxval_i8.c: Regenerated.
+       * generated/maxval_r10.c: Regenerated.
+       * generated/maxval_r16.c: Regenerated.
+       * generated/maxval_r4.c: Regenerated.
+       * generated/maxval_r8.c: Regenerated.
+       * generated/minloc0_16_i1.c: Regenerated.
+       * generated/minloc0_16_i16.c: Regenerated.
+       * generated/minloc0_16_i2.c: Regenerated.
+       * generated/minloc0_16_i4.c: Regenerated.
+       * generated/minloc0_16_i8.c: Regenerated.
+       * generated/minloc0_16_r10.c: Regenerated.
+       * generated/minloc0_16_r16.c: Regenerated.
+       * generated/minloc0_16_r4.c: Regenerated.
+       * generated/minloc0_16_r8.c: Regenerated.
+       * generated/minloc0_4_i1.c: Regenerated.
+       * generated/minloc0_4_i16.c: Regenerated.
+       * generated/minloc0_4_i2.c: Regenerated.
+       * generated/minloc0_4_i4.c: Regenerated.
+       * generated/minloc0_4_i8.c: Regenerated.
+       * generated/minloc0_4_r10.c: Regenerated.
+       * generated/minloc0_4_r16.c: Regenerated.
+       * generated/minloc0_4_r4.c: Regenerated.
+       * generated/minloc0_4_r8.c: Regenerated.
+       * generated/minloc0_8_i1.c: Regenerated.
+       * generated/minloc0_8_i16.c: Regenerated.
+       * generated/minloc0_8_i2.c: Regenerated.
+       * generated/minloc0_8_i4.c: Regenerated.
+       * generated/minloc0_8_i8.c: Regenerated.
+       * generated/minloc0_8_r10.c: Regenerated.
+       * generated/minloc0_8_r16.c: Regenerated.
+       * generated/minloc0_8_r4.c: Regenerated.
+       * generated/minloc0_8_r8.c: Regenerated.
+       * generated/minloc1_16_i1.c: Regenerated.
+       * generated/minloc1_16_i16.c: Regenerated.
+       * generated/minloc1_16_i2.c: Regenerated.
+       * generated/minloc1_16_i4.c: Regenerated.
+       * generated/minloc1_16_i8.c: Regenerated.
+       * generated/minloc1_16_r10.c: Regenerated.
+       * generated/minloc1_16_r16.c: Regenerated.
+       * generated/minloc1_16_r4.c: Regenerated.
+       * generated/minloc1_16_r8.c: Regenerated.
+       * generated/minloc1_4_i1.c: Regenerated.
+       * generated/minloc1_4_i16.c: Regenerated.
+       * generated/minloc1_4_i2.c: Regenerated.
+       * generated/minloc1_4_i4.c: Regenerated.
+       * generated/minloc1_4_i8.c: Regenerated.
+       * generated/minloc1_4_r10.c: Regenerated.
+       * generated/minloc1_4_r16.c: Regenerated.
+       * generated/minloc1_4_r4.c: Regenerated.
+       * generated/minloc1_4_r8.c: Regenerated.
+       * generated/minloc1_8_i1.c: Regenerated.
+       * generated/minloc1_8_i16.c: Regenerated.
+       * generated/minloc1_8_i2.c: Regenerated.
+       * generated/minloc1_8_i4.c: Regenerated.
+       * generated/minloc1_8_i8.c: Regenerated.
+       * generated/minloc1_8_r10.c: Regenerated.
+       * generated/minloc1_8_r16.c: Regenerated.
+       * generated/minloc1_8_r4.c: Regenerated.
+       * generated/minloc1_8_r8.c: Regenerated.
+       * generated/minval_i1.c: Regenerated.
+       * generated/minval_i16.c: Regenerated.
+       * generated/minval_i2.c: Regenerated.
+       * generated/minval_i4.c: Regenerated.
+       * generated/minval_i8.c: Regenerated.
+       * generated/minval_r10.c: Regenerated.
+       * generated/minval_r16.c: Regenerated.
+       * generated/minval_r4.c: Regenerated.
+       * generated/minval_r8.c: Regenerated.
+       * generated/product_c10.c: Regenerated.
+       * generated/product_c16.c: Regenerated.
+       * generated/product_c4.c: Regenerated.
+       * generated/product_c8.c: Regenerated.
+       * generated/product_i1.c: Regenerated.
+       * generated/product_i16.c: Regenerated.
+       * generated/product_i2.c: Regenerated.
+       * generated/product_i4.c: Regenerated.
+       * generated/product_i8.c: Regenerated.
+       * generated/product_r10.c: Regenerated.
+       * generated/product_r16.c: Regenerated.
+       * generated/product_r4.c: Regenerated.
+       * generated/product_r8.c: Regenerated.
+       * generated/sum_c10.c: Regenerated.
+       * generated/sum_c16.c: Regenerated.
+       * generated/sum_c4.c: Regenerated.
+       * generated/sum_c8.c: Regenerated.
+       * generated/sum_i1.c: Regenerated.
+       * generated/sum_i16.c: Regenerated.
+       * generated/sum_i2.c: Regenerated.
+       * generated/sum_i4.c: Regenerated.
+       * generated/sum_i8.c: Regenerated.
+       * generated/sum_r10.c: Regenerated.
+       * generated/sum_r16.c: Regenerated.
+       * generated/sum_r4.c: Regenerated.
+       * generated/sum_r8.c: Regenerated.
+       
 2007-08-23  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR libfortran/23138
index 7e7f2f9c658017990c668b53787004c5e79b6b2e..f4fb0b3770eb78cab0c12945dfb06ea97a339b23 100644 (file)
@@ -39,15 +39,15 @@ Boston, MA 02110-1301, USA.  */
    Either a or b can be rank 1.  In this case x or y is 1.  */
 
 extern void matmul_l16 (gfc_array_l16 * const restrict, 
-       gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(matmul_l16);
 
 void
 matmul_l16 (gfc_array_l16 * const restrict retarray, 
-       gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
+       gfc_array_l1 * const restrict a, gfc_array_l1 * const restrict b)
 {
-  const GFC_INTEGER_4 * restrict abase;
-  const GFC_INTEGER_4 * restrict bbase;
+  const GFC_LOGICAL_1 * restrict abase;
+  const GFC_LOGICAL_1 * restrict bbase;
   GFC_LOGICAL_16 * restrict dest;
   index_type rxstride;
   index_type rystride;
@@ -57,9 +57,11 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
   index_type ystride;
   index_type x;
   index_type y;
+  int a_kind;
+  int b_kind;
 
-  const GFC_INTEGER_4 * restrict pa;
-  const GFC_INTEGER_4 * restrict pb;
+  const GFC_LOGICAL_1 * restrict pa;
+  const GFC_LOGICAL_1 * restrict pb;
   index_type astride;
   index_type bstride;
   index_type count;
@@ -99,17 +101,29 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
     }
 
   abase = a->data;
-  if (GFC_DESCRIPTOR_SIZE (a) != 4)
-    {
-      assert (GFC_DESCRIPTOR_SIZE (a) == 8);
-      abase = GFOR_POINTER_L8_TO_L4 (abase);
-    }
+  a_kind = GFC_DESCRIPTOR_SIZE (a);
+
+  if (a_kind == 1 || a_kind == 2 || a_kind == 4 || a_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+     || a_kind == 16
+#endif
+     )
+    abase = GFOR_POINTER_TO_L1 (abase, a_kind);
+  else
+    internal_error (NULL, "Funny sized logical array");
+
   bbase = b->data;
-  if (GFC_DESCRIPTOR_SIZE (b) != 4)
-    {
-      assert (GFC_DESCRIPTOR_SIZE (b) == 8);
-      bbase = GFOR_POINTER_L8_TO_L4 (bbase);
-    }
+  b_kind = GFC_DESCRIPTOR_SIZE (b);
+
+  if (b_kind == 1 || b_kind == 2 || b_kind == 4 || b_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+     || b_kind == 16
+#endif
+     )
+    bbase = GFOR_POINTER_TO_L1 (bbase, b_kind);
+  else
+    internal_error (NULL, "Funny sized logical array");
+
   dest = retarray->data;
 
 
@@ -128,7 +142,7 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
      one.  */
   if (GFC_DESCRIPTOR_RANK (a) == 1)
     {
-      astride = a->dim[0].stride;
+      astride = a->dim[0].stride * a_kind;
       count = a->dim[0].ubound + 1 - a->dim[0].lbound;
       xstride = 0;
       rxstride = 0;
@@ -136,14 +150,14 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
     }
   else
     {
-      astride = a->dim[1].stride;
+      astride = a->dim[1].stride * a_kind;
       count = a->dim[1].ubound + 1 - a->dim[1].lbound;
       xstride = a->dim[0].stride;
       xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
     }
   if (GFC_DESCRIPTOR_RANK (b) == 1)
     {
-      bstride = b->dim[0].stride;
+      bstride = b->dim[0].stride * b_kind;
       assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
       ystride = 0;
       rystride = 0;
@@ -151,7 +165,7 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
     }
   else
     {
-      bstride = b->dim[0].stride;
+      bstride = b->dim[0].stride * b_kind;
       assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
       ystride = b->dim[1].stride;
       ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
@@ -189,3 +203,4 @@ matmul_l16 (gfc_array_l16 * const restrict retarray,
 }
 
 #endif
+
index 8428ff9dc0ba355c6fe53de9207a765bdab7a6a2..0b822f63e4de6143ff4b18804186c638aa72df00 100644 (file)
@@ -39,15 +39,15 @@ Boston, MA 02110-1301, USA.  */
    Either a or b can be rank 1.  In this case x or y is 1.  */
 
 extern void matmul_l4 (gfc_array_l4 * const restrict, 
-       gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(matmul_l4);
 
 void
 matmul_l4 (gfc_array_l4 * const restrict retarray, 
-       gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
+       gfc_array_l1 * const restrict a, gfc_array_l1 * const restrict b)
 {
-  const GFC_INTEGER_4 * restrict abase;
-  const GFC_INTEGER_4 * restrict bbase;
+  const GFC_LOGICAL_1 * restrict abase;
+  const GFC_LOGICAL_1 * restrict bbase;
   GFC_LOGICAL_4 * restrict dest;
   index_type rxstride;
   index_type rystride;
@@ -57,9 +57,11 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
   index_type ystride;
   index_type x;
   index_type y;
+  int a_kind;
+  int b_kind;
 
-  const GFC_INTEGER_4 * restrict pa;
-  const GFC_INTEGER_4 * restrict pb;
+  const GFC_LOGICAL_1 * restrict pa;
+  const GFC_LOGICAL_1 * restrict pb;
   index_type astride;
   index_type bstride;
   index_type count;
@@ -99,17 +101,29 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
     }
 
   abase = a->data;
-  if (GFC_DESCRIPTOR_SIZE (a) != 4)
-    {
-      assert (GFC_DESCRIPTOR_SIZE (a) == 8);
-      abase = GFOR_POINTER_L8_TO_L4 (abase);
-    }
+  a_kind = GFC_DESCRIPTOR_SIZE (a);
+
+  if (a_kind == 1 || a_kind == 2 || a_kind == 4 || a_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+     || a_kind == 16
+#endif
+     )
+    abase = GFOR_POINTER_TO_L1 (abase, a_kind);
+  else
+    internal_error (NULL, "Funny sized logical array");
+
   bbase = b->data;
-  if (GFC_DESCRIPTOR_SIZE (b) != 4)
-    {
-      assert (GFC_DESCRIPTOR_SIZE (b) == 8);
-      bbase = GFOR_POINTER_L8_TO_L4 (bbase);
-    }
+  b_kind = GFC_DESCRIPTOR_SIZE (b);
+
+  if (b_kind == 1 || b_kind == 2 || b_kind == 4 || b_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+     || b_kind == 16
+#endif
+     )
+    bbase = GFOR_POINTER_TO_L1 (bbase, b_kind);
+  else
+    internal_error (NULL, "Funny sized logical array");
+
   dest = retarray->data;
 
 
@@ -128,7 +142,7 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
      one.  */
   if (GFC_DESCRIPTOR_RANK (a) == 1)
     {
-      astride = a->dim[0].stride;
+      astride = a->dim[0].stride * a_kind;
       count = a->dim[0].ubound + 1 - a->dim[0].lbound;
       xstride = 0;
       rxstride = 0;
@@ -136,14 +150,14 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
     }
   else
     {
-      astride = a->dim[1].stride;
+      astride = a->dim[1].stride * a_kind;
       count = a->dim[1].ubound + 1 - a->dim[1].lbound;
       xstride = a->dim[0].stride;
       xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
     }
   if (GFC_DESCRIPTOR_RANK (b) == 1)
     {
-      bstride = b->dim[0].stride;
+      bstride = b->dim[0].stride * b_kind;
       assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
       ystride = 0;
       rystride = 0;
@@ -151,7 +165,7 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
     }
   else
     {
-      bstride = b->dim[0].stride;
+      bstride = b->dim[0].stride * b_kind;
       assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
       ystride = b->dim[1].stride;
       ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
@@ -189,3 +203,4 @@ matmul_l4 (gfc_array_l4 * const restrict retarray,
 }
 
 #endif
+
index 76dee0a48d7fc9e710ee5e05a220980797c32a5d..2fe0983076089554d0030138817c43e920cccea0 100644 (file)
@@ -39,15 +39,15 @@ Boston, MA 02110-1301, USA.  */
    Either a or b can be rank 1.  In this case x or y is 1.  */
 
 extern void matmul_l8 (gfc_array_l8 * const restrict, 
-       gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(matmul_l8);
 
 void
 matmul_l8 (gfc_array_l8 * const restrict retarray, 
-       gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
+       gfc_array_l1 * const restrict a, gfc_array_l1 * const restrict b)
 {
-  const GFC_INTEGER_4 * restrict abase;
-  const GFC_INTEGER_4 * restrict bbase;
+  const GFC_LOGICAL_1 * restrict abase;
+  const GFC_LOGICAL_1 * restrict bbase;
   GFC_LOGICAL_8 * restrict dest;
   index_type rxstride;
   index_type rystride;
@@ -57,9 +57,11 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
   index_type ystride;
   index_type x;
   index_type y;
+  int a_kind;
+  int b_kind;
 
-  const GFC_INTEGER_4 * restrict pa;
-  const GFC_INTEGER_4 * restrict pb;
+  const GFC_LOGICAL_1 * restrict pa;
+  const GFC_LOGICAL_1 * restrict pb;
   index_type astride;
   index_type bstride;
   index_type count;
@@ -99,17 +101,29 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
     }
 
   abase = a->data;
-  if (GFC_DESCRIPTOR_SIZE (a) != 4)
-    {
-      assert (GFC_DESCRIPTOR_SIZE (a) == 8);
-      abase = GFOR_POINTER_L8_TO_L4 (abase);
-    }
+  a_kind = GFC_DESCRIPTOR_SIZE (a);
+
+  if (a_kind == 1 || a_kind == 2 || a_kind == 4 || a_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+     || a_kind == 16
+#endif
+     )
+    abase = GFOR_POINTER_TO_L1 (abase, a_kind);
+  else
+    internal_error (NULL, "Funny sized logical array");
+
   bbase = b->data;
-  if (GFC_DESCRIPTOR_SIZE (b) != 4)
-    {
-      assert (GFC_DESCRIPTOR_SIZE (b) == 8);
-      bbase = GFOR_POINTER_L8_TO_L4 (bbase);
-    }
+  b_kind = GFC_DESCRIPTOR_SIZE (b);
+
+  if (b_kind == 1 || b_kind == 2 || b_kind == 4 || b_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+     || b_kind == 16
+#endif
+     )
+    bbase = GFOR_POINTER_TO_L1 (bbase, b_kind);
+  else
+    internal_error (NULL, "Funny sized logical array");
+
   dest = retarray->data;
 
 
@@ -128,7 +142,7 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
      one.  */
   if (GFC_DESCRIPTOR_RANK (a) == 1)
     {
-      astride = a->dim[0].stride;
+      astride = a->dim[0].stride * a_kind;
       count = a->dim[0].ubound + 1 - a->dim[0].lbound;
       xstride = 0;
       rxstride = 0;
@@ -136,14 +150,14 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
     }
   else
     {
-      astride = a->dim[1].stride;
+      astride = a->dim[1].stride * a_kind;
       count = a->dim[1].ubound + 1 - a->dim[1].lbound;
       xstride = a->dim[0].stride;
       xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
     }
   if (GFC_DESCRIPTOR_RANK (b) == 1)
     {
-      bstride = b->dim[0].stride;
+      bstride = b->dim[0].stride * b_kind;
       assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
       ystride = 0;
       rystride = 0;
@@ -151,7 +165,7 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
     }
   else
     {
-      bstride = b->dim[0].stride;
+      bstride = b->dim[0].stride * b_kind;
       assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
       ystride = b->dim[1].stride;
       ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
@@ -189,3 +203,4 @@ matmul_l8 (gfc_array_l8 * const restrict retarray,
 }
 
 #endif
+
index 37b0bb0661435ccaf18c9fe2bd7ed899c932e4f3..aa52dece020f04e817ec4676c34bdbd97eebe641 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_i1 (gfc_array_i16 * const restrict, 
-       gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_i1);
 
 void
 mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i1 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_1 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index efd421b053ce41df34f3448a79841568d1688f30..30c91f5736caee734cbe3e35a4abd2d497c17871 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_i16 (gfc_array_i16 * const restrict, 
-       gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_i16);
 
 void
 mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index df2466b7776a2cb7c865e1508fb17f769db89fe3..bf55fbd1d2d037ab4c508d36dc607596b2033c4d 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_i2 (gfc_array_i16 * const restrict, 
-       gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_i2);
 
 void
 mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i2 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_2 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 0154bf37c336249bd657fb508766e29ff2ce5149..ffe10a8e0ccbd55ffbfef0d397105f156ac707b8 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_i4 (gfc_array_i16 * const restrict, 
-       gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_i4);
 
 void
 mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 8f7804b201dd8e8deba7d5ba013581453d9781fb..9f619178d4e7f7c0ec921b7e700b150a172e1f08 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_i8 (gfc_array_i16 * const restrict, 
-       gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_i8);
 
 void
 mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 48910a9ce8ddb0cb1c5972c32d2809e84c5046a2..4da00f2176af09289e899a8a4e68c77ae6700c8c 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_r10 (gfc_array_i16 * const restrict, 
-       gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_r10);
 
 void
 mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r10 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_REAL_10 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 8492293e9b3f372dab7bc0238add1c026a2cf97c..3f33f63d679c811932303f8a9319f2c1dfbcc7ab 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_r16 (gfc_array_i16 * const restrict, 
-       gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_r16);
 
 void
 mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_REAL_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 602f334b381eb96a2c2cc52bebe518984f243e2c..0868d1fb41bdc5f13ec7c42379ddb87449cc9c4e 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_r4 (gfc_array_i16 * const restrict, 
-       gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_r4);
 
 void
 mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_REAL_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 1dbdda034a9bfd2b1691c585da5f2c28a2f57512..5fe64123d914f9f0d16b71d3f3325328bafd1389 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mmaxloc0_16_r8 (gfc_array_i16 * const restrict, 
-       gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_16_r8);
 
 void
 mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_REAL_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index de62212f47b6b6a4027ccace126c4bac48ab5ebd..10ed2d0a51c63dba615b2970ea43e4ecacc3b310 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_i1 (gfc_array_i4 * const restrict, 
-       gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_i1);
 
 void
 mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i1 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_1 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 98245df98146d30433e0c3498b58d340ad652097..4e80d675d7d6f46319d9f12ce477f55344e7b881 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_i16 (gfc_array_i4 * const restrict, 
-       gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_i16);
 
 void
 mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 0a0a04e82dca73b4b004936b0d0ccea58cc9e8de..15d975c7d59b90f880e07259aa546848278427be 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_i2 (gfc_array_i4 * const restrict, 
-       gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_i2);
 
 void
 mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i2 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_2 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index e8fe5982483d1f1869f99ce9e28e1fc9500b01b4..813c8bd7accefee441ac130bd43e0da37370319b 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_i4 (gfc_array_i4 * const restrict, 
-       gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_i4);
 
 void
 mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 80ef84206d72ad94aa97dad131a1e9aabe0ce62f..8c3fb9540a47c2e0d600088f9d4a12d0a9c2a9b0 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_i8 (gfc_array_i4 * const restrict, 
-       gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_i8);
 
 void
 mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 0059d3bad055ef4e97049511d185603013bc28be..74be989cf4b83b3e7e5ecb0791b4b5a28cdca1f2 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_r10 (gfc_array_i4 * const restrict, 
-       gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_r10);
 
 void
 mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r10 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_REAL_10 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 9cb04bf30ce4a332d5bc9bcdba1b30e05d181c19..a6cf8bc011a25916b9eb8eff991a2a7232f8316a 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_r16 (gfc_array_i4 * const restrict, 
-       gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_r16);
 
 void
 mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_REAL_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index e568a444b2a0800df99687c7b83e97c9c972f2f6..50915d4f6524efbacbe363e5bc728e597b1a46d2 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_r4 (gfc_array_i4 * const restrict, 
-       gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_r4);
 
 void
 mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_REAL_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index e84235ea76f35a410995cb9bae39871532169f70..ec613e7741329ef8c667f02940b3b8724f755815 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mmaxloc0_4_r8 (gfc_array_i4 * const restrict, 
-       gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_4_r8);
 
 void
 mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_REAL_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index da132d4b5f128a380f95d5abd46b75f95df92955..916e4dcb1a254303e9f89d22efe6fed8d4c14766 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_i1 (gfc_array_i8 * const restrict, 
-       gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_i1);
 
 void
 mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i1 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_1 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 3b94adeffb3929716bb16a43104e5ebb11dde308..e554f46e2a6116e3285f445bc0a7032f4920a453 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_i16 (gfc_array_i8 * const restrict, 
-       gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_i16);
 
 void
 mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 41f6457ab63015ad030ac914a1d004730061555c..40ebe0f3628d9e1a1cfa72a990475576c23f09ea 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_i2 (gfc_array_i8 * const restrict, 
-       gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_i2);
 
 void
 mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i2 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_2 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 93fa35814374e0cdcc1d0a2aff040780f16adecb..df9a43e67dd3eba2e6af8fa328167f2788092338 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_i4 (gfc_array_i8 * const restrict, 
-       gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_i4);
 
 void
 mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 49a8d5255a01baf9727fea4d133247f83159067a..eedd6e69f116dc1c6f8da91ad2c0427f34b2a40d 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_i8 (gfc_array_i8 * const restrict, 
-       gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_i8);
 
 void
 mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index ebe3f04d195c6230357fee574686a3a800dfa259..215b53976064fcb57102be13267d0ab9531c6ac3 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_r10 (gfc_array_i8 * const restrict, 
-       gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_r10);
 
 void
 mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r10 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_REAL_10 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 800f5c6d7a042ca5bf31c21e572f26fd11ca16f5..32f4b859806021459144db1e07d72ca0be8ef9fe 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_r16 (gfc_array_i8 * const restrict, 
-       gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_r16);
 
 void
 mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_REAL_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index f68a5ea4531d7a599a3689c705e5beafa59e8152..140f6cb8f743afbe2d0f47a1176db57e93b5808f 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_r4 (gfc_array_i8 * const restrict, 
-       gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_r4);
 
 void
 mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_REAL_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 5ec6afede23d1deeecf20e07983fdb025788a98a..907dbc7e03fd0a4d6eff35db190741e9e745d885 100644 (file)
@@ -148,13 +148,13 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mmaxloc0_8_r8 (gfc_array_i8 * const restrict, 
-       gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mmaxloc0_8_r8);
 
 void
 mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_REAL_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 009ea6de1248cc1d3961eb448963b111195fa615..dc42f603df8ff8949de5eb4c1c9ded3a2021f303 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_i1 (gfc_array_i16 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_i1);
 
 void
 mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 94bab619f196064f181aaf519b79fb7566563214..5b69dea88c9ec8245595562d4ca5eca6753217f9 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_i16 (gfc_array_i16 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_i16);
 
 void
 mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 9cdd41814d3ebda9c894a53b2ca764c11f7308cf..25360bc7ccaaa1567896027244e8da7390e45074 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_i2 (gfc_array_i16 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_i2);
 
 void
 mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 564b378c4edd6f0394ebe68aeffa9fc13d1a1c80..d089126c934b0791fd3a2b7a41daddc057209f56 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_i4 (gfc_array_i16 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_i4);
 
 void
 mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 91b68bf1b76bb3ac58a84ac72b1ef358a7e8e692..502c951e90eeeaaa19a9bcb5e64d00cfd3819660 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_i8 (gfc_array_i16 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_i8);
 
 void
 mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index f60e044d6f90431d82f990f190c6f0d698dcae4f..721b390225131e7276691fa140b4492c28733e9c 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_r10 (gfc_array_i16 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_r10);
 
 void
 mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 22bdb6d545f4adececcff2d6671f6a3a9c3b3d74..1a8e113b393f239e410bc69455e63a528382f89e 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_r16 (gfc_array_i16 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_r16);
 
 void
 mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 4af1841322b5c9068e2d906a62f91d25b29d3fab..fda1bfaf53dbef647d202a91c54ae8b4282c21f6 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_r4 (gfc_array_i16 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_r4);
 
 void
 mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 34d5ada7dc9b22c29a0b15829409fbe57a332642..4d2208a12e0ae75f3e954be9038e9f14e2b4ed4e 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxloc1_16_r8 (gfc_array_i16 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_16_r8);
 
 void
 mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index e2f414115287ff3761b8645ddcb0e8cd71a07a7f..0ae1a5ba528100c7f615d5c667554c08c3cdd0a9 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_i1 (gfc_array_i4 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_i1);
 
 void
 mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 30d782ca579d41f95559e3512e2646e1151a6ce8..39a57c6f6848ea509dda29f78d1c7ef3b3664a1d 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_i16 (gfc_array_i4 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_i16);
 
 void
 mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 1e02f75b1c61280157c10c88e30e151c93eb6466..bbf43ec4969ce1ec597a9a677b05e179032e3a96 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_i2 (gfc_array_i4 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_i2);
 
 void
 mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 249efd7635460bebedf57c7603a9faa479b0316a..5b00fb1eda104c32ed729c2610062571bae0081c 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_i4 (gfc_array_i4 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_i4);
 
 void
 mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index b12a40b90509161f175204958d27a799a17d41dc..f5131140355318eb46dc9eab5d7e24d93ebdbfd5 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_i8 (gfc_array_i4 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_i8);
 
 void
 mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index c498bffd669da93a3f41ebd666df595a84cbe1f9..17e9cbba9a335255fdda6556e44df92cb3b691e5 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_r10 (gfc_array_i4 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_r10);
 
 void
 mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 71c9723c120f2d5c7fe6f4884cc46784f53823de..7b1c558e30fa68cf6902560e13f4a7b1a8587969 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_r16 (gfc_array_i4 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_r16);
 
 void
 mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 69f3ca9e2683826af57adaeca5edc8bf1908b3a2..4534e6f47393553253645e7c8bb81a3f6e3dadd1 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_r4 (gfc_array_i4 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_r4);
 
 void
 mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index cab8eebbfa2e7a4adfabba7e6ddb7ae90d3899f4..7917aae76ebbe9c8cbb1f536f5cf6d691668f940 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxloc1_4_r8 (gfc_array_i4 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_4_r8);
 
 void
 mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index a6a796672e17482bd7715c0c77efe0e6159b9f00..33966a235b6f3fdbd260ae32d6cc3502983925ef 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_i1 (gfc_array_i8 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_i1);
 
 void
 mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index b366e68cf71758db41f29321cb0fcf55bf56d155..612003ef74a19dc3cd645efcccbb4c1672b4fc07 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_i16 (gfc_array_i8 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_i16);
 
 void
 mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 0cfe019ad4b383b5548c3c138242d8f435f5a3f9..04018e3791974c98e4b9b161cb7505251e0ff531 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_i2 (gfc_array_i8 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_i2);
 
 void
 mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index e43ba950ade26c24bef7acc4a90fcd38549eee2d..833e4bed806ca41432346f336ff9cb202a12d23a 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_i4 (gfc_array_i8 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_i4);
 
 void
 mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 733462baffe93ccbaf0ddc4d3bed865cdfe2cf70..880ad7ca4aeda34b91f18484316c84f409ab158e 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_i8 (gfc_array_i8 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_i8);
 
 void
 mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index deef31c91eced11f679bbc86bb5cbfad73f78e45..6de90ead1de34e370843485836d3f2681d16a132 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_r10 (gfc_array_i8 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_r10);
 
 void
 mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 24d55c34bca1b4b49a7d37e17fb70a5ebe4a55e9..06e00dc0eb4992313ba5040165cbd4aa4105f0ee 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_r16 (gfc_array_i8 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_r16);
 
 void
 mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 3dd01b3bd6a3f50232fcde87d7260fe3434eb93b..3d9d5c6df987e510c4ee280748dcce934f7a6b95 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_r4 (gfc_array_i8 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_r4);
 
 void
 mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 1adc4c88838465fb659590bdcc9b4ec78c581cf3..ea2769ebc70ce63b9af6aeaaffbde0dcb85e3ac4 100644 (file)
@@ -191,14 +191,14 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxloc1_8_r8 (gfc_array_i8 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxloc1_8_r8);
 
 void
 mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 3c63c2258218dd5cfb8963b53f958add62125d42..08334d5bf5ef48366473b34966f845efdb65284e 100644 (file)
@@ -185,14 +185,14 @@ maxval_i1 (gfc_array_i1 * const restrict retarray,
 
 extern void mmaxval_i1 (gfc_array_i1 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_i1);
 
 void
 mmaxval_i1 (gfc_array_i1 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_1 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_1 result;
       src = base;
       msrc = mbase;
index 9a217ac9dbdde2245dd0886760737861f427a509..56d7854021d6a5fa349990d38a8b9c771e449f48 100644 (file)
@@ -185,14 +185,14 @@ maxval_i16 (gfc_array_i16 * const restrict retarray,
 
 extern void mmaxval_i16 (gfc_array_i16 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_i16);
 
 void
 mmaxval_i16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index c8fd718f8dcf5c8e6e931977af1dd282abc919c3..111f5b910831df7f6108452231d097964aa72ed7 100644 (file)
@@ -185,14 +185,14 @@ maxval_i2 (gfc_array_i2 * const restrict retarray,
 
 extern void mmaxval_i2 (gfc_array_i2 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_i2);
 
 void
 mmaxval_i2 (gfc_array_i2 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_2 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_2 result;
       src = base;
       msrc = mbase;
index c800f1a733dccee93c136c2e2876e2094869cf2c..4413477f8b823ab936c39285d37b8538c90e870b 100644 (file)
@@ -185,14 +185,14 @@ maxval_i4 (gfc_array_i4 * const restrict retarray,
 
 extern void mmaxval_i4 (gfc_array_i4 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_i4);
 
 void
 mmaxval_i4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 898ef3c5956776b0d0331252d5e9703442f29ca9..7e3cb16dd69cc3a00ed66c85870351e47c0d21d8 100644 (file)
@@ -185,14 +185,14 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
 
 extern void mmaxval_i8 (gfc_array_i8 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_i8);
 
 void
 mmaxval_i8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 3123d06cf586b476fdb2548263c7dc6dc3699d91..14338644b40c7a13eb8518a000f74f62613482cb 100644 (file)
@@ -185,14 +185,14 @@ maxval_r10 (gfc_array_r10 * const restrict retarray,
 
 extern void mmaxval_r10 (gfc_array_r10 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_r10);
 
 void
 mmaxval_r10 (gfc_array_r10 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_10 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_10 result;
       src = base;
       msrc = mbase;
index bdef61679160c9b54e5e65420cc5692e721da657..6b4c409452d81cc2f2b099a619a4047a03cd41fb 100644 (file)
@@ -185,14 +185,14 @@ maxval_r16 (gfc_array_r16 * const restrict retarray,
 
 extern void mmaxval_r16 (gfc_array_r16 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_r16);
 
 void
 mmaxval_r16 (gfc_array_r16 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_16 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_16 result;
       src = base;
       msrc = mbase;
index ebdb9684fb6eddff48c66ac352ff80dccececd37..9e797d3f077494e0628f6a09f14a994767dc02b7 100644 (file)
@@ -185,14 +185,14 @@ maxval_r4 (gfc_array_r4 * const restrict retarray,
 
 extern void mmaxval_r4 (gfc_array_r4 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_r4);
 
 void
 mmaxval_r4 (gfc_array_r4 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_4 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_4 result;
       src = base;
       msrc = mbase;
index 6a05df76381239ec357bc8faa5ebee110357be67..ff4ed07d5ea0d2b3f764550a36d57cd2340daf75 100644 (file)
@@ -185,14 +185,14 @@ maxval_r8 (gfc_array_r8 * const restrict retarray,
 
 extern void mmaxval_r8 (gfc_array_r8 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mmaxval_r8);
 
 void
 mmaxval_r8 (gfc_array_r8 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_8 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_8 result;
       src = base;
       msrc = mbase;
index e8f985627d892287689cc76a7614be4c57ca9a01..5afd38763d188a64111b6f8aea0962944c03bfa4 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_i1 (gfc_array_i16 * const restrict, 
-       gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_i1);
 
 void
 mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i1 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_1 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 31ade2421ead6c802b92e43a1c3912dcfc2e8d62..5f49874324b206c0833438efe20a09efb916ba96 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_i16 (gfc_array_i16 * const restrict, 
-       gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_i16);
 
 void
 mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 772519dbebd3956f636a4330592c01e5185da3df..fed801515947cc6dbd15f8e00b716d996cb3da94 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_i2 (gfc_array_i16 * const restrict, 
-       gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_i2);
 
 void
 mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i2 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_2 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 3096ec02049d1463eaf210c4951c43a39d56856c..bfb45413886d6b56081d8f890df07a3c8a47dfad 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_i4 (gfc_array_i16 * const restrict, 
-       gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_i4);
 
 void
 mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 99b53bef5eb40a6423b07ccd179f5ecad69569b5..d07297e90c31a63d43967e88dcd0c5eeab03f363 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_i8 (gfc_array_i16 * const restrict, 
-       gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_i8);
 
 void
 mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_INTEGER_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 5c043f899d91f3d5ebd5e5adaecd0eb0882ceddf..34b1d56735a82168201495ae73535c5f0b1eaef2 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_r10 (gfc_array_i16 * const restrict, 
-       gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_r10);
 
 void
 mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r10 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_REAL_10 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 9a87bb61ee7c69a806923e4b4fd5e8c6cac190fa..6e60e19203f1677d6ed57cd29125ed23dcfa4a93 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_r16 (gfc_array_i16 * const restrict, 
-       gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_r16);
 
 void
 mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_REAL_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index dbe167ecfeaff47c591dd04bbb7cec9541c29fcd..7e98c18b81e78d49a4db3472309be4e0ff207cf8 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_r4 (gfc_array_i16 * const restrict, 
-       gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_r4);
 
 void
 mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_REAL_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 8c43bb5a7c4fef6f5d238a584212cf7b0bd65672..4c2044b981eafad8d5ae01f0777a0255d3b2d63f 100644 (file)
@@ -148,13 +148,13 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray,
 
 
 extern void mminloc0_16_r8 (gfc_array_i16 * const restrict, 
-       gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_16_r8);
 
 void
 mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_16 *dest;
   const GFC_REAL_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 42d64a8750dd0664aa1053a08b1ab38921a2fc39..645af760ba023cde6747fbccf501277aeeaa69de 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_i1 (gfc_array_i4 * const restrict, 
-       gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_i1);
 
 void
 mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i1 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_1 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 19b960e912a2ff8fde464745fca3db002e6db227..5160d2e90a5b6f244c4afa4939b1deb25b217b4e 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_i16 (gfc_array_i4 * const restrict, 
-       gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_i16);
 
 void
 mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index c57d5e7264356e4de34606bfcb5250abd8746062..28d0a7f9d44f3a671f4900fc646fe6d7b9018ece 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_i2 (gfc_array_i4 * const restrict, 
-       gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_i2);
 
 void
 mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i2 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_2 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index a8c5a5e8ff26e8fa9b3d6de7594b2c1e9c2328ea..a820231df4945a81f33c2a7a0b5be75154230a00 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_i4 (gfc_array_i4 * const restrict, 
-       gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_i4);
 
 void
 mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 61eab8cdd0c75625c39ec7cdcca92ece5e76bf95..4d63109f8b907b21101deaed8e4b771ce9282eef 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_i8 (gfc_array_i4 * const restrict, 
-       gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_i8);
 
 void
 mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_INTEGER_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 20a22520f3f861b6eeb0ccc99301808efb75e0e0..c2d8d82eba4031286727895da48a3add4cd98a8c 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_r10 (gfc_array_i4 * const restrict, 
-       gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_r10);
 
 void
 mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r10 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_REAL_10 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 83f293c203f4953b87fa05ff8573666b6fbb452a..9a42aab29380e55c174caaba5c55b54fc6a932f8 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_r16 (gfc_array_i4 * const restrict, 
-       gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_r16);
 
 void
 mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_REAL_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 669a8c1c325d04efff240e76966e0b4befd30435..a2c67257476d419723111fa5093df477f31794e0 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_r4 (gfc_array_i4 * const restrict, 
-       gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_r4);
 
 void
 mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_REAL_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index fbe9abd83bbef61f1ac8528e1e5984649e05b045..ceefacf6cf158743229c5802844ed8974cc1143f 100644 (file)
@@ -148,13 +148,13 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray,
 
 
 extern void mminloc0_4_r8 (gfc_array_i4 * const restrict, 
-       gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_4_r8);
 
 void
 mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_4 *dest;
   const GFC_REAL_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index e1b95ced5326c0f13e25e169fe7a056e0fc4c6b6..2629591cb7d56c3d5818b540ac8dfcf53d298e18 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_i1 (gfc_array_i8 * const restrict, 
-       gfc_array_i1 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_i1);
 
 void
 mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i1 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_1 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 390b74a7f7503c4f38d9903f62e7ae4a4adaf0f6..30d8551cd8a4e195d1ed9700e9939f900911b278 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_i16 (gfc_array_i8 * const restrict, 
-       gfc_array_i16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_i16);
 
 void
 mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index c07042989e9b0667321825bb11788d9aa1e69fc0..34c236376423668f3895ac1ac0f5fb495757986f 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_i2 (gfc_array_i8 * const restrict, 
-       gfc_array_i2 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i2 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_i2);
 
 void
 mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i2 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_2 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 524af749728862a44be657f92e84dfdd00e140d2..e1053e0b3f51ea6edbd869e8ea4b2fa2858f7081 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_i4 (gfc_array_i8 * const restrict, 
-       gfc_array_i4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_i4);
 
 void
 mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 510973cb35f8ea0a14b74b1d1828141ffbef50f0..851645e138962fdade9eec407a33484c84ea74f3 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_i8 (gfc_array_i8 * const restrict, 
-       gfc_array_i8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_i8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_i8);
 
 void
 mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_INTEGER_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 7e4dcb017e74059baca64ae1824f29661eae6f67..569efa08b79e9283e8b3337683124a77cb59b04b 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_r10 (gfc_array_i8 * const restrict, 
-       gfc_array_r10 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r10 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_r10);
 
 void
 mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r10 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_REAL_10 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index dfb6bd67eadc78dd4e3da136149ca77e640d842b..4e19efab4f2ba0c367f7050cdc195124d813a6c1 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_r16 (gfc_array_i8 * const restrict, 
-       gfc_array_r16 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r16 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_r16);
 
 void
 mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r16 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_REAL_16 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index d10f942e2abe5acc48673a0f69caff9c8b08b8e9..0bcf5c6344721bb37693a900ebfe113dfa65f93f 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_r4 (gfc_array_i8 * const restrict, 
-       gfc_array_r4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r4 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_r4);
 
 void
 mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r4 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_REAL_4 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 781f0caaef40d77dfd8b1fb0520ec4a5df7c610b..778963376d3454665b786c887e4ecc029c3f634d 100644 (file)
@@ -148,13 +148,13 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray,
 
 
 extern void mminloc0_8_r8 (gfc_array_i8 * const restrict, 
-       gfc_array_r8 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_r8 * const restrict, gfc_array_l1 * const restrict);
 export_proto(mminloc0_8_r8);
 
 void
 mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r8 * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -163,9 +163,10 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
   index_type dstride;
   GFC_INTEGER_8 *dest;
   const GFC_REAL_8 *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -189,12 +190,25 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -207,17 +221,6 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray,
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index fa25b3d82d664260d0fa6835830bd2a1c400f760..1e7b09bd1312afc866133913b1bcf096c858d016 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_i1 (gfc_array_i16 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_i1);
 
 void
 mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 4ea816f6539e486047dab279a36fbf2809bf9ad3..0570e1686ad1a3f7bef87f3454e3f72905297e10 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_i16 (gfc_array_i16 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_i16);
 
 void
 mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 6251f19d2ebee1a001a12ad150694e25de7c5945..3ec829ee7c07e696c3f502a38d1caeaf2ea9b676 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_i2 (gfc_array_i16 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_i2);
 
 void
 mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index c70b028122fcad638b48bf1687a1aab13b259b51..1d2a22982c744e0eeaf581e4655f72c82125c3b3 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_i4 (gfc_array_i16 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_i4);
 
 void
 mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 913532711c41b99c13c2c8ea55a3d64f4eca08b1..009bfc84b1a3906eacc8b5e42fbb2f8a0ec19ce3 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_i8 (gfc_array_i16 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_i8);
 
 void
 mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 77cc6442b9951517b48959555fa1ad45d2e3026f..18e7d9038ba3d095c3d9dd2a61c03efd9a97458c 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_r10 (gfc_array_i16 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_r10);
 
 void
 mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 146a66f29a7100985bdb8b1015f4626ea3d7afcd..11d66700d047d69f73a2402cda21cfd6b51fc591 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_r16 (gfc_array_i16 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_r16);
 
 void
 mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 93bf9e99b4e588a773e4d5086af3fd39a8ac1703..36ab93342a1928a7ddd71dadf6a96c095e1fd9c5 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_r4 (gfc_array_i16 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_r4);
 
 void
 mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 8313589bd7b963e9bf7edbeebd1b5ca6c305390d..4bc2f7e9468dbaee9bc790b9605cdd4e2a10912d 100644 (file)
@@ -191,14 +191,14 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray,
 
 extern void mminloc1_16_r8 (gfc_array_i16 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_16_r8);
 
 void
 mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 637a7ec2be6b00fcedeee96d15dfb03b8475971c..b94775d748dbc7e2e30356ab9367353c11e56a4d 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_i1 (gfc_array_i4 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_i1);
 
 void
 mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index abc9d792c90e509a79b372e541a5b08ef2d5cdb8..720d35c00662b0bc8890b91f336295ef6e21db68 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_i16 (gfc_array_i4 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_i16);
 
 void
 mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 0183035d462cfe505b1e14aef2181b6ead231f51..10a3537f8cfd9cdc3dc3ca69eea8f44e164cbd79 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_i2 (gfc_array_i4 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_i2);
 
 void
 mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 8e746c8bc40917918249fb5649753a2e0b6642bb..941ac82ae019a4708ca1d2d4cae40303964bd279 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_i4 (gfc_array_i4 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_i4);
 
 void
 mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index a05e972817b7009600c2e9586b99bc3eeb79b742..36768068183ca77e0d584a51d750606c3c1942ce 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_i8 (gfc_array_i4 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_i8);
 
 void
 mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 2c36814d3fe9f37dd56fdaa95892742db05fc520..84631c091e5e4b0629c4de3b612c913c22eb0954 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_r10 (gfc_array_i4 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_r10);
 
 void
 mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 7258ddaed428d06c2ab668a0fa9b603e9f738bb8..d3e9b5fef8c77d64e14f94d1c5a6e81e026b3364 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_r16 (gfc_array_i4 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_r16);
 
 void
 mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index b36cee2d1fa0bdb4e456f1e1eb2cb4ef2fac2987..e2ccd58572e671f834c25ab2fa18ed03fbb0f748 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_r4 (gfc_array_i4 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_r4);
 
 void
 mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index a4ad1382b57c4240b8f4eefa90b8215825ba60ea..6e96a65cdebec5bb3da778b3ecd2da54072b3fb4 100644 (file)
@@ -191,14 +191,14 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray,
 
 extern void mminloc1_4_r8 (gfc_array_i4 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_4_r8);
 
 void
 mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 36f49828baeb88e2d0f32bf7b0e144e3aa05005f..caa48af2a2e997d8d01be5a0ad59ea9be95d01e2 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_i1 (gfc_array_i8 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_i1);
 
 void
 mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 907454dc50a1e39c89e5d79de6bbd6eca9ab9514..1928c401004ada9f49fa41dfb62a5cbc1bf875e1 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_i16 (gfc_array_i8 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_i16);
 
 void
 mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 1d6526ec6b6c40890fcda564eb58e79dfadc0518..6c40de8040f4001b51a0f43c3dd88531e757967a 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_i2 (gfc_array_i8 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_i2);
 
 void
 mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index cebf4527e1337829f549bd9302ce8195c0da8789..9f563d5cdcef91396a68df7be9c4821681d002f7 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_i4 (gfc_array_i8 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_i4);
 
 void
 mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 1b822e2c6a5def196978e6f499c231299d415545..6cdeec75db17dff9e8492041143a5541b5214736 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_i8 (gfc_array_i8 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_i8);
 
 void
 mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index f7fb3bf3c1386c7afa6f0677e0d14f95cf4c4668..1dc5be691979ea6eaf459bfcfef565b1434be2f2 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_r10 (gfc_array_i8 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_r10);
 
 void
 mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index cbba161c84c6d553ace80dc9b8da858171c73049..5bec2992ff6ba88fe34cc7a70f5afcd05fb80d77 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_r16 (gfc_array_i8 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_r16);
 
 void
 mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 75081789788da3c092050870fe0548b0fe5015b0..9952148093718e29550b4e2ab202dff794a26ff5 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_r4 (gfc_array_i8 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_r4);
 
 void
 mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 372ff2135faa6caf5b0dacab645e4a42166e3371..44e3eecb7cf8e3939494d13cdb0a7257f946bdb5 100644 (file)
@@ -191,14 +191,14 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
 extern void mminloc1_8_r8 (gfc_array_i8 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminloc1_8_r8);
 
 void
 mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -207,13 +207,14 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -221,13 +222,27 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -237,7 +252,7 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -292,22 +307,11 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 6ac105b2cd9e68463b776bb6d047c04bc1b90d2a..5c72eb9306274de1e9eee4ba9106a38525a9efea 100644 (file)
@@ -185,14 +185,14 @@ minval_i1 (gfc_array_i1 * const restrict retarray,
 
 extern void mminval_i1 (gfc_array_i1 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_i1);
 
 void
 mminval_i1 (gfc_array_i1 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_1 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_i1 (gfc_array_i1 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_1 result;
       src = base;
       msrc = mbase;
index 3dd1678b617c9322a3360cab80c55cf5d9d9d544..eedadadc05897aa66b098a561533bc09965405fc 100644 (file)
@@ -185,14 +185,14 @@ minval_i16 (gfc_array_i16 * const restrict retarray,
 
 extern void mminval_i16 (gfc_array_i16 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_i16);
 
 void
 mminval_i16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_i16 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index 6d0d3eb86682bf19a6de18e3fbbe44d11e3b702d..2ca350644214bfafb9b0f54283483553db57e36e 100644 (file)
@@ -185,14 +185,14 @@ minval_i2 (gfc_array_i2 * const restrict retarray,
 
 extern void mminval_i2 (gfc_array_i2 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_i2);
 
 void
 mminval_i2 (gfc_array_i2 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_2 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_i2 (gfc_array_i2 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_2 result;
       src = base;
       msrc = mbase;
index 2d6c1dee7497425bd806e97944adf43b27e3aac7..2f5796efbe2a09bdf322ff33e1a805d47fcb02f2 100644 (file)
@@ -185,14 +185,14 @@ minval_i4 (gfc_array_i4 * const restrict retarray,
 
 extern void mminval_i4 (gfc_array_i4 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_i4);
 
 void
 mminval_i4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_i4 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index 78158ca98b38b7152a2885497d7c17a6aaa0e8ee..0bdbb81b230ed69cba8c36f5212f948647ce9ce5 100644 (file)
@@ -185,14 +185,14 @@ minval_i8 (gfc_array_i8 * const restrict retarray,
 
 extern void mminval_i8 (gfc_array_i8 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_i8);
 
 void
 mminval_i8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_i8 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index fe87af41ac11dcb4af50e50d630018e531b02e98..aa5c576d2ebb0e66e41770e3922bce29d455c67b 100644 (file)
@@ -185,14 +185,14 @@ minval_r10 (gfc_array_r10 * const restrict retarray,
 
 extern void mminval_r10 (gfc_array_r10 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_r10);
 
 void
 mminval_r10 (gfc_array_r10 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_10 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_r10 (gfc_array_r10 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_10 result;
       src = base;
       msrc = mbase;
index 58596b5eea645f3e942e5ef6fef8d9a9164fc960..ada6f8c6227eff9ffad5a675b92d38d34cea9179 100644 (file)
@@ -185,14 +185,14 @@ minval_r16 (gfc_array_r16 * const restrict retarray,
 
 extern void mminval_r16 (gfc_array_r16 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_r16);
 
 void
 mminval_r16 (gfc_array_r16 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_16 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_r16 (gfc_array_r16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_16 result;
       src = base;
       msrc = mbase;
index a11549ee974f50f84f37ae9a0c71fc4e080baec5..7143b2b604a232b317d70554450bc7edb9970844 100644 (file)
@@ -185,14 +185,14 @@ minval_r4 (gfc_array_r4 * const restrict retarray,
 
 extern void mminval_r4 (gfc_array_r4 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_r4);
 
 void
 mminval_r4 (gfc_array_r4 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_4 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_r4 (gfc_array_r4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_4 result;
       src = base;
       msrc = mbase;
index 14ca0552bda271406790727fc8fe69c683ae29fe..c21dc2350a921f99c0af8922f141dcc15f863678 100644 (file)
@@ -185,14 +185,14 @@ minval_r8 (gfc_array_r8 * const restrict retarray,
 
 extern void mminval_r8 (gfc_array_r8 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mminval_r8);
 
 void
 mminval_r8 (gfc_array_r8 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -201,13 +201,14 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_8 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -215,13 +216,27 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -231,7 +246,7 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -286,22 +301,11 @@ mminval_r8 (gfc_array_r8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_8 result;
       src = base;
       msrc = mbase;
index 0d73a9b799cb23b476fcaedbc0b4fdf3600c7a49..b63cb6afabd931c6a91f90367348dca348f5bcf5 100644 (file)
@@ -184,14 +184,14 @@ product_c10 (gfc_array_c10 * const restrict retarray,
 
 extern void mproduct_c10 (gfc_array_c10 * const restrict, 
        gfc_array_c10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_c10);
 
 void
 mproduct_c10 (gfc_array_c10 * const restrict retarray, 
        gfc_array_c10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_COMPLEX_10 * restrict dest;
   const GFC_COMPLEX_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_COMPLEX_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_COMPLEX_10 result;
       src = base;
       msrc = mbase;
index a5c8bd07e741a231a5ea3d0b0e5fbd8a4bc939fb..3b6265a2720c9649a8bd4113d8e67307acc90057 100644 (file)
@@ -184,14 +184,14 @@ product_c16 (gfc_array_c16 * const restrict retarray,
 
 extern void mproduct_c16 (gfc_array_c16 * const restrict, 
        gfc_array_c16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_c16);
 
 void
 mproduct_c16 (gfc_array_c16 * const restrict retarray, 
        gfc_array_c16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_COMPLEX_16 * restrict dest;
   const GFC_COMPLEX_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_COMPLEX_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_COMPLEX_16 result;
       src = base;
       msrc = mbase;
index 45a62c9cfb9a14b1e7d6096d969d813372efd428..07e0df0b85edb62dec95013d8d587722d391776a 100644 (file)
@@ -184,14 +184,14 @@ product_c4 (gfc_array_c4 * const restrict retarray,
 
 extern void mproduct_c4 (gfc_array_c4 * const restrict, 
        gfc_array_c4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_c4);
 
 void
 mproduct_c4 (gfc_array_c4 * const restrict retarray, 
        gfc_array_c4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_COMPLEX_4 * restrict dest;
   const GFC_COMPLEX_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_COMPLEX_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_COMPLEX_4 result;
       src = base;
       msrc = mbase;
index 69bcb87c39971dc2c9e71f33fc37935e32828ae3..a81241eca2cf4b87dd7fe87fc46223b407a7f8a6 100644 (file)
@@ -184,14 +184,14 @@ product_c8 (gfc_array_c8 * const restrict retarray,
 
 extern void mproduct_c8 (gfc_array_c8 * const restrict, 
        gfc_array_c8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_c8);
 
 void
 mproduct_c8 (gfc_array_c8 * const restrict retarray, 
        gfc_array_c8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_COMPLEX_8 * restrict dest;
   const GFC_COMPLEX_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_COMPLEX_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_COMPLEX_8 result;
       src = base;
       msrc = mbase;
index 76427e4cbb7ac5170142284efe7e792a48e0f60a..4c68414247ce9ceb5e65e99177c4af03a0c556d3 100644 (file)
@@ -184,14 +184,14 @@ product_i1 (gfc_array_i1 * const restrict retarray,
 
 extern void mproduct_i1 (gfc_array_i1 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_i1);
 
 void
 mproduct_i1 (gfc_array_i1 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_1 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_1 result;
       src = base;
       msrc = mbase;
index 7b73578309406a6c3a37255494e8e45442060f7f..9e81e595931dbf21255d2ce1b02c4c615cda5475 100644 (file)
@@ -184,14 +184,14 @@ product_i16 (gfc_array_i16 * const restrict retarray,
 
 extern void mproduct_i16 (gfc_array_i16 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_i16);
 
 void
 mproduct_i16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index bdb51a65c529e035c6fc21d8663502f32bc131de..dde442a7433e3d635041531d1c8fb0358455ce79 100644 (file)
@@ -184,14 +184,14 @@ product_i2 (gfc_array_i2 * const restrict retarray,
 
 extern void mproduct_i2 (gfc_array_i2 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_i2);
 
 void
 mproduct_i2 (gfc_array_i2 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_2 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_2 result;
       src = base;
       msrc = mbase;
index 72d0e1afbad1ff9afd1304efa75feff4907794e9..50875daafd3348ae3ac412f0daf5aa0d54e23859 100644 (file)
@@ -184,14 +184,14 @@ product_i4 (gfc_array_i4 * const restrict retarray,
 
 extern void mproduct_i4 (gfc_array_i4 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_i4);
 
 void
 mproduct_i4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index d1ae82e4303188aeae8cf6a0af4d8713e8f00ebf..0b9d268a6c76ef25973df39dc490683b6507ffae 100644 (file)
@@ -184,14 +184,14 @@ product_i8 (gfc_array_i8 * const restrict retarray,
 
 extern void mproduct_i8 (gfc_array_i8 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_i8);
 
 void
 mproduct_i8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index f19b67ba949106ba7bb033f17367cefc21447147..28732503501aedba9c37c6f8ec80ba5cd2b943db 100644 (file)
@@ -184,14 +184,14 @@ product_r10 (gfc_array_r10 * const restrict retarray,
 
 extern void mproduct_r10 (gfc_array_r10 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_r10);
 
 void
 mproduct_r10 (gfc_array_r10 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_10 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_10 result;
       src = base;
       msrc = mbase;
index 3d0a76a4ade29cacca3d6ce3a814d4c65139052a..61149515b7f18067c153d42b6545807015d6511e 100644 (file)
@@ -184,14 +184,14 @@ product_r16 (gfc_array_r16 * const restrict retarray,
 
 extern void mproduct_r16 (gfc_array_r16 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_r16);
 
 void
 mproduct_r16 (gfc_array_r16 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_16 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_16 result;
       src = base;
       msrc = mbase;
index 069b0d0c0e790b60b3f6f48a99e9dd3e47511ab1..b3c9a0b25ca8707e004b65f803504d5a2ba3295a 100644 (file)
@@ -184,14 +184,14 @@ product_r4 (gfc_array_r4 * const restrict retarray,
 
 extern void mproduct_r4 (gfc_array_r4 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_r4);
 
 void
 mproduct_r4 (gfc_array_r4 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_4 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_4 result;
       src = base;
       msrc = mbase;
index e9cfae39782ee60ac7eb8bfee706c7d26a0d34a5..8d49b27989470e9d6e41526924f48b9b09f5e617 100644 (file)
@@ -184,14 +184,14 @@ product_r8 (gfc_array_r8 * const restrict retarray,
 
 extern void mproduct_r8 (gfc_array_r8 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(mproduct_r8);
 
 void
 mproduct_r8 (gfc_array_r8 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_8 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_8 result;
       src = base;
       msrc = mbase;
index 96b878b7fcd03f9ddb8108ad086d4870478e6918..2fa759450aa54661dca378d0e6b486c6cc1ca953 100644 (file)
@@ -184,14 +184,14 @@ sum_c10 (gfc_array_c10 * const restrict retarray,
 
 extern void msum_c10 (gfc_array_c10 * const restrict, 
        gfc_array_c10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_c10);
 
 void
 msum_c10 (gfc_array_c10 * const restrict retarray, 
        gfc_array_c10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_COMPLEX_10 * restrict dest;
   const GFC_COMPLEX_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_c10 (gfc_array_c10 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_COMPLEX_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_COMPLEX_10 result;
       src = base;
       msrc = mbase;
index a99d4f65b62fb3d8bf6fde4032a2dfa1ce057393..b74aa43b25041fd458d015bb512d3bc40da6625e 100644 (file)
@@ -184,14 +184,14 @@ sum_c16 (gfc_array_c16 * const restrict retarray,
 
 extern void msum_c16 (gfc_array_c16 * const restrict, 
        gfc_array_c16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_c16);
 
 void
 msum_c16 (gfc_array_c16 * const restrict retarray, 
        gfc_array_c16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_COMPLEX_16 * restrict dest;
   const GFC_COMPLEX_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_c16 (gfc_array_c16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_COMPLEX_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_COMPLEX_16 result;
       src = base;
       msrc = mbase;
index 83979fbdf217f5af1af81e97071223208335cce5..bf41330a2f58b66b8fc7e8fa1f87023be5a6e764 100644 (file)
@@ -184,14 +184,14 @@ sum_c4 (gfc_array_c4 * const restrict retarray,
 
 extern void msum_c4 (gfc_array_c4 * const restrict, 
        gfc_array_c4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_c4);
 
 void
 msum_c4 (gfc_array_c4 * const restrict retarray, 
        gfc_array_c4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_COMPLEX_4 * restrict dest;
   const GFC_COMPLEX_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_c4 (gfc_array_c4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_COMPLEX_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_COMPLEX_4 result;
       src = base;
       msrc = mbase;
index d82092a1b6b35be7c63121cd03182e80cd9570ed..d7c3c9dadc2e92e09817abc66bcb0494bbe3ee60 100644 (file)
@@ -184,14 +184,14 @@ sum_c8 (gfc_array_c8 * const restrict retarray,
 
 extern void msum_c8 (gfc_array_c8 * const restrict, 
        gfc_array_c8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_c8);
 
 void
 msum_c8 (gfc_array_c8 * const restrict retarray, 
        gfc_array_c8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_COMPLEX_8 * restrict dest;
   const GFC_COMPLEX_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_c8 (gfc_array_c8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_COMPLEX_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_COMPLEX_8 result;
       src = base;
       msrc = mbase;
index 87205b8f7166ccb14f0310843135455c05bae5a5..0b0d3c8135db0632b439ceb7f902d438831d6589 100644 (file)
@@ -184,14 +184,14 @@ sum_i1 (gfc_array_i1 * const restrict retarray,
 
 extern void msum_i1 (gfc_array_i1 * const restrict, 
        gfc_array_i1 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_i1);
 
 void
 msum_i1 (gfc_array_i1 * const restrict retarray, 
        gfc_array_i1 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_1 * restrict dest;
   const GFC_INTEGER_1 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_i1 (gfc_array_i1 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_1 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_1 result;
       src = base;
       msrc = mbase;
index 83857734a006e8ce77452571c8b5826f171f5de6..0f0bc55e373b600b4d645ee10b6ff1f85b2a1454 100644 (file)
@@ -184,14 +184,14 @@ sum_i16 (gfc_array_i16 * const restrict retarray,
 
 extern void msum_i16 (gfc_array_i16 * const restrict, 
        gfc_array_i16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_i16);
 
 void
 msum_i16 (gfc_array_i16 * const restrict retarray, 
        gfc_array_i16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_16 * restrict dest;
   const GFC_INTEGER_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_i16 (gfc_array_i16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_16 result;
       src = base;
       msrc = mbase;
index c4452c3ce9d8636f0919c01a4f902128635c906d..c951d670177f00d1214f7153dd65b0439675112b 100644 (file)
@@ -184,14 +184,14 @@ sum_i2 (gfc_array_i2 * const restrict retarray,
 
 extern void msum_i2 (gfc_array_i2 * const restrict, 
        gfc_array_i2 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_i2);
 
 void
 msum_i2 (gfc_array_i2 * const restrict retarray, 
        gfc_array_i2 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_2 * restrict dest;
   const GFC_INTEGER_2 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_i2 (gfc_array_i2 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_2 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_2 result;
       src = base;
       msrc = mbase;
index e97d15c62bac51040ca63cc120a511a33cd43131..973b8f10297da857fb2ebb8dea8e9358d3a75476 100644 (file)
@@ -184,14 +184,14 @@ sum_i4 (gfc_array_i4 * const restrict retarray,
 
 extern void msum_i4 (gfc_array_i4 * const restrict, 
        gfc_array_i4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_i4);
 
 void
 msum_i4 (gfc_array_i4 * const restrict retarray, 
        gfc_array_i4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_4 * restrict dest;
   const GFC_INTEGER_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_i4 (gfc_array_i4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_4 result;
       src = base;
       msrc = mbase;
index da913442b4f6090227ef3d9c3e40a5d3422214c6..87e7ec650f02d6b1aeac4dd459386f1d806a6ba6 100644 (file)
@@ -184,14 +184,14 @@ sum_i8 (gfc_array_i8 * const restrict retarray,
 
 extern void msum_i8 (gfc_array_i8 * const restrict, 
        gfc_array_i8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_i8);
 
 void
 msum_i8 (gfc_array_i8 * const restrict retarray, 
        gfc_array_i8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_INTEGER_8 * restrict dest;
   const GFC_INTEGER_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_i8 (gfc_array_i8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_INTEGER_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_INTEGER_8 result;
       src = base;
       msrc = mbase;
index 0433c90f90bbd4995cf9cf6c1c330f506339acdd..f552026e4464304fb156ea5ef072f0cbf7a48b3d 100644 (file)
@@ -184,14 +184,14 @@ sum_r10 (gfc_array_r10 * const restrict retarray,
 
 extern void msum_r10 (gfc_array_r10 * const restrict, 
        gfc_array_r10 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_r10);
 
 void
 msum_r10 (gfc_array_r10 * const restrict retarray, 
        gfc_array_r10 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_10 * restrict dest;
   const GFC_REAL_10 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_r10 (gfc_array_r10 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_10 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_10 result;
       src = base;
       msrc = mbase;
index 2c9fdf5b2218b3a5d0f7ca55ee83913cbbb5042a..586105420119f119fe0176ee677dee818d8af79b 100644 (file)
@@ -184,14 +184,14 @@ sum_r16 (gfc_array_r16 * const restrict retarray,
 
 extern void msum_r16 (gfc_array_r16 * const restrict, 
        gfc_array_r16 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_r16);
 
 void
 msum_r16 (gfc_array_r16 * const restrict retarray, 
        gfc_array_r16 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_16 * restrict dest;
   const GFC_REAL_16 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_r16 (gfc_array_r16 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_16 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_16 result;
       src = base;
       msrc = mbase;
index e3c33fbf1d4fa301f28e82ea4c9ccbe159a03ee1..4b07477d56e4b160df0698052de175f6ac51136f 100644 (file)
@@ -184,14 +184,14 @@ sum_r4 (gfc_array_r4 * const restrict retarray,
 
 extern void msum_r4 (gfc_array_r4 * const restrict, 
        gfc_array_r4 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_r4);
 
 void
 msum_r4 (gfc_array_r4 * const restrict retarray, 
        gfc_array_r4 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_4 * restrict dest;
   const GFC_REAL_4 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_r4 (gfc_array_r4 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_4 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_4 result;
       src = base;
       msrc = mbase;
index 4d331e277a75f88aa612b962b465bb6e74e7d2ca..43df4a6f23b1970427d634cbeeb20e75a5147788 100644 (file)
@@ -184,14 +184,14 @@ sum_r8 (gfc_array_r8 * const restrict retarray,
 
 extern void msum_r8 (gfc_array_r8 * const restrict, 
        gfc_array_r8 * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(msum_r8);
 
 void
 msum_r8 (gfc_array_r8 * const restrict retarray, 
        gfc_array_r8 * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -200,13 +200,14 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
   index_type mstride[GFC_MAX_DIMENSIONS];
   GFC_REAL_8 * restrict dest;
   const GFC_REAL_8 * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -214,13 +215,27 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -230,7 +245,7 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -285,22 +300,11 @@ msum_r8 (gfc_array_r8 * const restrict retarray,
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const GFC_REAL_8 * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       GFC_REAL_8 result;
       src = base;
       msrc = mbase;
index a1998ad580b6a71ec02c0e6532019f7e96633b6d..30255f046865c5e19f958096d77ef52ad68b80c9 100644 (file)
@@ -76,7 +76,7 @@ array valued, and the other one where MASK is scalar.  */
 
 static void
 pack_internal (gfc_array_char *ret, const gfc_array_char *array,
-              const gfc_array_l4 *mask, const gfc_array_char *vector,
+              const gfc_array_l1 *mask, const gfc_array_char *vector,
               index_type size)
 {
   /* r.* indicates the return array.  */
@@ -89,7 +89,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
   /* m.* indicates the mask array.  */
   index_type mstride[GFC_MAX_DIMENSIONS];
   index_type mstride0;
-  const GFC_LOGICAL_4 *mptr;
+  const GFC_LOGICAL_1 *mptr;
 
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -98,8 +98,31 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
   index_type dim;
   index_type nelem;
   index_type total;
+  int mask_kind;
 
   dim = GFC_DESCRIPTOR_RANK (array);
+
+  sptr = array->data;
+  mptr = mask->data;
+
+  /* Use the same loop for all logical types, by using GFC_LOGICAL_1
+     and using shifting to address size and endian issues.  */
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    {
+      /*  Don't convert a NULL pointer as we use test for NULL below.  */
+      if (mptr)
+       mptr = GFOR_POINTER_TO_L1 (mptr, mask_kind);
+    }
+  else
+    runtime_error ("Funny sized logical array");
+
   zero_sized = 0;
   for (n = 0; n < dim; n++)
     {
@@ -108,25 +131,12 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
       if (extent[n] <= 0)
        zero_sized = 1;
       sstride[n] = array->dim[n].stride * size;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
     }
   if (sstride[0] == 0)
     sstride[0] = size;
   if (mstride[0] == 0)
-    mstride[0] = 1;
-
-  sptr = array->data;
-  mptr = mask->data;
-
-  /* Use the same loop for both logical types. */
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      if (GFC_DESCRIPTOR_SIZE (mask) != 8)
-        runtime_error ("Funny sized logical array");
-      for (n = 0; n < dim; n++)
-        mstride[n] <<= 1;
-      mptr = GFOR_POINTER_L8_TO_L4 (mptr);
-    }
+    mstride[0] = mask_kind;
 
   if (ret->data == NULL || compile_options.bounds_check)
     {
@@ -156,7 +166,7 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
             cache behavior in the case where our cache is not big
             enough to hold all elements that have to be copied.  */
 
-         const GFC_LOGICAL_4 *m = mptr;
+         const GFC_LOGICAL_1 *m = mptr;
 
          total = 0;
          if (zero_sized)
index b349f0d60fd0efcb4ce071b2a0f57cc4528a640f..86c70fb7e45944a7d7ea2cf95fc52cdd0052deef 100644 (file)
@@ -36,7 +36,7 @@ Boston, MA 02110-1301, USA.  */
 
 static void
 unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
-                const gfc_array_l4 *mask, const gfc_array_char *field,
+                const gfc_array_l1 *mask, const gfc_array_char *field,
                 index_type size, index_type fsize)
 {
   /* r.* indicates the return array.  */
@@ -54,7 +54,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
   /* m.* indicates the mask array.  */
   index_type mstride[GFC_MAX_DIMENSIONS];
   index_type mstride0;
-  const GFC_LOGICAL_4 *mptr;
+  const GFC_LOGICAL_1 *mptr;
 
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -62,8 +62,30 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
   index_type dim;
 
   int empty;
+  int mask_kind;
 
   empty = 0;
+
+  mptr = mask->data;
+
+  /* Use the same loop for all logical types, by using GFC_LOGICAL_1
+     and using shifting to address size and endian issues.  */
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    {
+      /*  Don't convert a NULL pointer as we use test for NULL below.  */
+      if (mptr)
+       mptr = GFOR_POINTER_TO_L1 (mptr, mask_kind);
+    }
+  else
+    runtime_error ("Funny sized logical array");
+
   if (ret->data == NULL)
     {
       /* The front end has signalled that we need to populate the
@@ -80,7 +102,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
          empty = empty || extent[n] <= 0;
          rstride[n] = ret->dim[n].stride * size;
          fstride[n] = field->dim[n].stride * fsize;
-         mstride[n] = mask->dim[n].stride;
+         mstride[n] = mask->dim[n].stride * mask_kind;
          rs *= extent[n];
        }
       ret->offset = 0;
@@ -96,7 +118,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
          empty = empty || extent[n] <= 0;
          rstride[n] = ret->dim[n].stride * size;
          fstride[n] = field->dim[n].stride * fsize;
-         mstride[n] = mask->dim[n].stride;
+         mstride[n] = mask->dim[n].stride * mask_kind;
        }
       if (rstride[0] == 0)
        rstride[0] = size;
@@ -118,20 +140,8 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
   mstride0 = mstride[0];
   rptr = ret->data;
   fptr = field->data;
-  mptr = mask->data;
   vptr = vector->data;
 
-  /* Use the same loop for both logical types. */
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      if (GFC_DESCRIPTOR_SIZE (mask) != 8)
-        runtime_error ("Funny sized logical array");
-      for (n = 0; n < dim; n++)
-        mstride[n] <<= 1;
-      mstride0 <<= 1;
-      mptr = GFOR_POINTER_L8_TO_L4 (mptr);
-    }
-
   while (rptr)
     {
       if (*mptr)
index 6c687f7b12b7886db7e5a4c881923722aa8bb924..555c6bfd4a8035e1545d3e1edf4b4353d05c9989 100644 (file)
@@ -233,8 +233,8 @@ typedef GFC_INTEGER_4 gfc_charlen_type;
 extern int l8_to_l4_offset;
 internal_proto(l8_to_l4_offset);
 
-#define GFOR_POINTER_L8_TO_L4(p8) \
-  (l8_to_l4_offset + (GFC_LOGICAL_4 *)(p8))
+#define GFOR_POINTER_TO_L1(p, kind) \
+  (l8_to_l4_offset * (kind - 1) + (GFC_LOGICAL_1 *)(p))
 
 #define GFC_INTEGER_1_HUGE \
   (GFC_INTEGER_1)((((GFC_UINTEGER_1)1) << 7) - 1)
@@ -322,6 +322,8 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_10) gfc_array_c10;
 #ifdef HAVE_GFC_COMPLEX_16
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_16) gfc_array_c16;
 #endif
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_1) gfc_array_l1;
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_2) gfc_array_l2;
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4;
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8;
 #ifdef HAVE_GFC_LOGICAL_16
index af53cef7ecc5fbb3942c1fd5d672eb6230ce4019..720a4c05851ce917e03454b554a6149c840192d7 100644 (file)
@@ -106,13 +106,13 @@ define(FINISH_FOREACH_FUNCTION,
 define(START_MASKED_FOREACH_FUNCTION,
 `
 extern void `m'name`'rtype_qual`_'atype_code (rtype * const restrict, 
-       atype * const restrict, gfc_array_l4 * const restrict);
+       atype * const restrict, gfc_array_l1 * const restrict);
 export_proto(`m'name`'rtype_qual`_'atype_code);
 
 void
 `m'name`'rtype_qual`_'atype_code (rtype * const restrict retarray, 
        atype * const restrict array,
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -121,9 +121,10 @@ void
   index_type dstride;
   rtype_name *dest;
   const atype_name *base;
-  GFC_LOGICAL_4 *mbase;
+  GFC_LOGICAL_1 *mbase;
   int rank;
   index_type n;
+  int mask_kind;
 
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
@@ -147,12 +148,25 @@ void
         runtime_error ("dimension of return array incorrect");
     }
 
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  mbase = mask->data;
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   dstride = retarray->dim[0].stride;
   dest = retarray->data;
   for (n = 0; n < rank; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
       count[n] = 0;
       if (extent[n] <= 0)
@@ -165,17 +179,6 @@ void
     }
 
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
-
 
   /* Initialize the return value.  */
   for (n = 0; n < rank; n++)
index 225b89a7562b6aa15ecde85e114e9a1e5e25d4fb..d8a661c2a8908c6f169c443a60d41e8951669240 100644 (file)
@@ -166,14 +166,14 @@ define(START_MASKED_ARRAY_FUNCTION,
 `
 extern void `m'name`'rtype_qual`_'atype_code (rtype * const restrict, 
        atype * const restrict, const index_type * const restrict,
-       gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict);
 export_proto(`m'name`'rtype_qual`_'atype_code);
 
 void
 `m'name`'rtype_qual`_'atype_code (rtype * const restrict retarray, 
        atype * const restrict array, 
        const index_type * const restrict pdim, 
-       gfc_array_l4 * const restrict mask)
+       gfc_array_l1 * const restrict mask)
 {
   index_type count[GFC_MAX_DIMENSIONS];
   index_type extent[GFC_MAX_DIMENSIONS];
@@ -182,13 +182,14 @@ void
   index_type mstride[GFC_MAX_DIMENSIONS];
   rtype_name * restrict dest;
   const atype_name * restrict base;
-  const GFC_LOGICAL_4 * restrict mbase;
+  const GFC_LOGICAL_1 * restrict mbase;
   int rank;
   int dim;
   index_type n;
   index_type len;
   index_type delta;
   index_type mdelta;
+  int mask_kind;
 
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
@@ -196,13 +197,27 @@ void
   len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
   if (len <= 0)
     return;
+
+  mbase = mask->data;
+
+  mask_kind = GFC_DESCRIPTOR_SIZE (mask);
+
+  if (mask_kind == 1 || mask_kind == 2 || mask_kind == 4 || mask_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+      || mask_kind == 16
+#endif
+      )
+    mbase = GFOR_POINTER_TO_L1 (mbase, mask_kind);
+  else
+    runtime_error ("Funny sized logical array");
+
   delta = array->dim[dim].stride;
-  mdelta = mask->dim[dim].stride;
+  mdelta = mask->dim[dim].stride * mask_kind;
 
   for (n = 0; n < dim; n++)
     {
       sstride[n] = array->dim[n].stride;
-      mstride[n] = mask->dim[n].stride;
+      mstride[n] = mask->dim[n].stride * mask_kind;
       extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
 
       if (extent[n] < 0)
@@ -212,7 +227,7 @@ void
   for (n = dim; n < rank; n++)
     {
       sstride[n] = array->dim[n + 1].stride;
-      mstride[n] = mask->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride * mask_kind;
       extent[n] =
         array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
 
@@ -267,22 +282,11 @@ void
 
   dest = retarray->data;
   base = array->data;
-  mbase = mask->data;
-
-  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
-    {
-      /* This allows the same loop to be used for all logical types.  */
-      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
-      for (n = 0; n < rank; n++)
-        mstride[n] <<= 1;
-      mdelta <<= 1;
-      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
-    }
 
   while (base)
     {
       const atype_name * restrict src;
-      const GFC_LOGICAL_4 * restrict msrc;
+      const GFC_LOGICAL_1 * restrict msrc;
       rtype_name result;
       src = base;
       msrc = mbase;
index d4b0008e951bbe01948f1793a1f5bcc8cd22b377..4e999fc34da67a269c5e65f478a308f1e9a9dd89 100644 (file)
@@ -40,15 +40,15 @@ include(iparm.m4)dnl
    Either a or b can be rank 1.  In this case x or y is 1.  */
 
 extern void matmul_'rtype_code` ('rtype` * const restrict, 
-       gfc_array_l4 * const restrict, gfc_array_l4 * const restrict);
+       gfc_array_l1 * const restrict, gfc_array_l1 * const restrict);
 export_proto(matmul_'rtype_code`);
 
 void
 matmul_'rtype_code` ('rtype` * const restrict retarray, 
-       gfc_array_l4 * const restrict a, gfc_array_l4 * const restrict b)
+       gfc_array_l1 * const restrict a, gfc_array_l1 * const restrict b)
 {
-  const GFC_INTEGER_4 * restrict abase;
-  const GFC_INTEGER_4 * restrict bbase;
+  const GFC_LOGICAL_1 * restrict abase;
+  const GFC_LOGICAL_1 * restrict bbase;
   'rtype_name` * restrict dest;
   index_type rxstride;
   index_type rystride;
@@ -58,9 +58,11 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
   index_type ystride;
   index_type x;
   index_type y;
+  int a_kind;
+  int b_kind;
 
-  const GFC_INTEGER_4 * restrict pa;
-  const GFC_INTEGER_4 * restrict pb;
+  const GFC_LOGICAL_1 * restrict pa;
+  const GFC_LOGICAL_1 * restrict pb;
   index_type astride;
   index_type bstride;
   index_type count;
@@ -100,17 +102,29 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
     }
 
   abase = a->data;
-  if (GFC_DESCRIPTOR_SIZE (a) != 4)
-    {
-      assert (GFC_DESCRIPTOR_SIZE (a) == 8);
-      abase = GFOR_POINTER_L8_TO_L4 (abase);
-    }
+  a_kind = GFC_DESCRIPTOR_SIZE (a);
+
+  if (a_kind == 1 || a_kind == 2 || a_kind == 4 || a_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+     || a_kind == 16
+#endif
+     )
+    abase = GFOR_POINTER_TO_L1 (abase, a_kind);
+  else
+    internal_error (NULL, "Funny sized logical array");
+
   bbase = b->data;
-  if (GFC_DESCRIPTOR_SIZE (b) != 4)
-    {
-      assert (GFC_DESCRIPTOR_SIZE (b) == 8);
-      bbase = GFOR_POINTER_L8_TO_L4 (bbase);
-    }
+  b_kind = GFC_DESCRIPTOR_SIZE (b);
+
+  if (b_kind == 1 || b_kind == 2 || b_kind == 4 || b_kind == 8
+#ifdef HAVE_GFC_LOGICAL_16
+     || b_kind == 16
+#endif
+     )
+    bbase = GFOR_POINTER_TO_L1 (bbase, b_kind);
+  else
+    internal_error (NULL, "Funny sized logical array");
+
   dest = retarray->data;
 '
 sinclude(`matmul_asm_'rtype_code`.m4')dnl
@@ -130,7 +144,7 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
      one.  */
   if (GFC_DESCRIPTOR_RANK (a) == 1)
     {
-      astride = a->dim[0].stride;
+      astride = a->dim[0].stride * a_kind;
       count = a->dim[0].ubound + 1 - a->dim[0].lbound;
       xstride = 0;
       rxstride = 0;
@@ -138,14 +152,14 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
     }
   else
     {
-      astride = a->dim[1].stride;
+      astride = a->dim[1].stride * a_kind;
       count = a->dim[1].ubound + 1 - a->dim[1].lbound;
       xstride = a->dim[0].stride;
       xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
     }
   if (GFC_DESCRIPTOR_RANK (b) == 1)
     {
-      bstride = b->dim[0].stride;
+      bstride = b->dim[0].stride * b_kind;
       assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
       ystride = 0;
       rystride = 0;
@@ -153,7 +167,7 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
     }
   else
     {
-      bstride = b->dim[0].stride;
+      bstride = b->dim[0].stride * b_kind;
       assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
       ystride = b->dim[1].stride;
       ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
@@ -191,4 +205,4 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
 }
 
 #endif
-'
\ No newline at end of file
+'