diff options
Diffstat (limited to 'libgfortran')
162 files changed, 3536 insertions, 2724 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index e9832a0e24e..10e6009d864 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -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 diff --git a/libgfortran/generated/matmul_l16.c b/libgfortran/generated/matmul_l16.c index 7e7f2f9c658..f4fb0b3770e 100644 --- a/libgfortran/generated/matmul_l16.c +++ b/libgfortran/generated/matmul_l16.c @@ -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 + diff --git a/libgfortran/generated/matmul_l4.c b/libgfortran/generated/matmul_l4.c index 8428ff9dc0b..0b822f63e4d 100644 --- a/libgfortran/generated/matmul_l4.c +++ b/libgfortran/generated/matmul_l4.c @@ -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 + diff --git a/libgfortran/generated/matmul_l8.c b/libgfortran/generated/matmul_l8.c index 76dee0a48d7..2fe09830760 100644 --- a/libgfortran/generated/matmul_l8.c +++ b/libgfortran/generated/matmul_l8.c @@ -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 + diff --git a/libgfortran/generated/maxloc0_16_i1.c b/libgfortran/generated/maxloc0_16_i1.c index 37b0bb06614..aa52dece020 100644 --- a/libgfortran/generated/maxloc0_16_i1.c +++ b/libgfortran/generated/maxloc0_16_i1.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c index efd421b053c..30c91f5736c 100644 --- a/libgfortran/generated/maxloc0_16_i16.c +++ b/libgfortran/generated/maxloc0_16_i16.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_16_i2.c b/libgfortran/generated/maxloc0_16_i2.c index df2466b7776..bf55fbd1d2d 100644 --- a/libgfortran/generated/maxloc0_16_i2.c +++ b/libgfortran/generated/maxloc0_16_i2.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c index 0154bf37c33..ffe10a8e0cc 100644 --- a/libgfortran/generated/maxloc0_16_i4.c +++ b/libgfortran/generated/maxloc0_16_i4.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c index 8f7804b201d..9f619178d4e 100644 --- a/libgfortran/generated/maxloc0_16_i8.c +++ b/libgfortran/generated/maxloc0_16_i8.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c index 48910a9ce8d..4da00f2176a 100644 --- a/libgfortran/generated/maxloc0_16_r10.c +++ b/libgfortran/generated/maxloc0_16_r10.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c index 8492293e9b3..3f33f63d679 100644 --- a/libgfortran/generated/maxloc0_16_r16.c +++ b/libgfortran/generated/maxloc0_16_r16.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c index 602f334b381..0868d1fb41b 100644 --- a/libgfortran/generated/maxloc0_16_r4.c +++ b/libgfortran/generated/maxloc0_16_r4.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c index 1dbdda034a9..5fe64123d91 100644 --- a/libgfortran/generated/maxloc0_16_r8.c +++ b/libgfortran/generated/maxloc0_16_r8.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_i1.c b/libgfortran/generated/maxloc0_4_i1.c index de62212f47b..10ed2d0a51c 100644 --- a/libgfortran/generated/maxloc0_4_i1.c +++ b/libgfortran/generated/maxloc0_4_i1.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c index 98245df9814..4e80d675d7d 100644 --- a/libgfortran/generated/maxloc0_4_i16.c +++ b/libgfortran/generated/maxloc0_4_i16.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_i2.c b/libgfortran/generated/maxloc0_4_i2.c index 0a0a04e82dc..15d975c7d59 100644 --- a/libgfortran/generated/maxloc0_4_i2.c +++ b/libgfortran/generated/maxloc0_4_i2.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c index e8fe5982483..813c8bd7acc 100644 --- a/libgfortran/generated/maxloc0_4_i4.c +++ b/libgfortran/generated/maxloc0_4_i4.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c index 80ef84206d7..8c3fb9540a4 100644 --- a/libgfortran/generated/maxloc0_4_i8.c +++ b/libgfortran/generated/maxloc0_4_i8.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c index 0059d3bad05..74be989cf4b 100644 --- a/libgfortran/generated/maxloc0_4_r10.c +++ b/libgfortran/generated/maxloc0_4_r10.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c index 9cb04bf30ce..a6cf8bc011a 100644 --- a/libgfortran/generated/maxloc0_4_r16.c +++ b/libgfortran/generated/maxloc0_4_r16.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c index e568a444b2a..50915d4f652 100644 --- a/libgfortran/generated/maxloc0_4_r4.c +++ b/libgfortran/generated/maxloc0_4_r4.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c index e84235ea76f..ec613e77413 100644 --- a/libgfortran/generated/maxloc0_4_r8.c +++ b/libgfortran/generated/maxloc0_4_r8.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_i1.c b/libgfortran/generated/maxloc0_8_i1.c index da132d4b5f1..916e4dcb1a2 100644 --- a/libgfortran/generated/maxloc0_8_i1.c +++ b/libgfortran/generated/maxloc0_8_i1.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c index 3b94adeffb3..e554f46e2a6 100644 --- a/libgfortran/generated/maxloc0_8_i16.c +++ b/libgfortran/generated/maxloc0_8_i16.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_i2.c b/libgfortran/generated/maxloc0_8_i2.c index 41f6457ab63..40ebe0f3628 100644 --- a/libgfortran/generated/maxloc0_8_i2.c +++ b/libgfortran/generated/maxloc0_8_i2.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c index 93fa3581437..df9a43e67dd 100644 --- a/libgfortran/generated/maxloc0_8_i4.c +++ b/libgfortran/generated/maxloc0_8_i4.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c index 49a8d5255a0..eedd6e69f11 100644 --- a/libgfortran/generated/maxloc0_8_i8.c +++ b/libgfortran/generated/maxloc0_8_i8.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c index ebe3f04d195..215b5397606 100644 --- a/libgfortran/generated/maxloc0_8_r10.c +++ b/libgfortran/generated/maxloc0_8_r10.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c index 800f5c6d7a0..32f4b859806 100644 --- a/libgfortran/generated/maxloc0_8_r16.c +++ b/libgfortran/generated/maxloc0_8_r16.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c index f68a5ea4531..140f6cb8f74 100644 --- a/libgfortran/generated/maxloc0_8_r4.c +++ b/libgfortran/generated/maxloc0_8_r4.c @@ -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++) diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c index 5ec6afede23..907dbc7e03f 100644 --- a/libgfortran/generated/maxloc0_8_r8.c +++ b/libgfortran/generated/maxloc0_8_r8.c @@ -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++) diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c index 009ea6de124..dc42f603df8 100644 --- a/libgfortran/generated/maxloc1_16_i1.c +++ b/libgfortran/generated/maxloc1_16_i1.c @@ -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; diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c index 94bab619f19..5b69dea88c9 100644 --- a/libgfortran/generated/maxloc1_16_i16.c +++ b/libgfortran/generated/maxloc1_16_i16.c @@ -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; diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c index 9cdd41814d3..25360bc7cca 100644 --- a/libgfortran/generated/maxloc1_16_i2.c +++ b/libgfortran/generated/maxloc1_16_i2.c @@ -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; diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c index 564b378c4ed..d089126c934 100644 --- a/libgfortran/generated/maxloc1_16_i4.c +++ b/libgfortran/generated/maxloc1_16_i4.c @@ -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; diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c index 91b68bf1b76..502c951e90e 100644 --- a/libgfortran/generated/maxloc1_16_i8.c +++ b/libgfortran/generated/maxloc1_16_i8.c @@ -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; diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c index f60e044d6f9..721b3902251 100644 --- a/libgfortran/generated/maxloc1_16_r10.c +++ b/libgfortran/generated/maxloc1_16_r10.c @@ -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; diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c index 22bdb6d545f..1a8e113b393 100644 --- a/libgfortran/generated/maxloc1_16_r16.c +++ b/libgfortran/generated/maxloc1_16_r16.c @@ -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; diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c index 4af1841322b..fda1bfaf53d 100644 --- a/libgfortran/generated/maxloc1_16_r4.c +++ b/libgfortran/generated/maxloc1_16_r4.c @@ -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; diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c index 34d5ada7dc9..4d2208a12e0 100644 --- a/libgfortran/generated/maxloc1_16_r8.c +++ b/libgfortran/generated/maxloc1_16_r8.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c index e2f41411528..0ae1a5ba528 100644 --- a/libgfortran/generated/maxloc1_4_i1.c +++ b/libgfortran/generated/maxloc1_4_i1.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c index 30d782ca579..39a57c6f684 100644 --- a/libgfortran/generated/maxloc1_4_i16.c +++ b/libgfortran/generated/maxloc1_4_i16.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c index 1e02f75b1c6..bbf43ec4969 100644 --- a/libgfortran/generated/maxloc1_4_i2.c +++ b/libgfortran/generated/maxloc1_4_i2.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c index 249efd76354..5b00fb1eda1 100644 --- a/libgfortran/generated/maxloc1_4_i4.c +++ b/libgfortran/generated/maxloc1_4_i4.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c index b12a40b9050..f5131140355 100644 --- a/libgfortran/generated/maxloc1_4_i8.c +++ b/libgfortran/generated/maxloc1_4_i8.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c index c498bffd669..17e9cbba9a3 100644 --- a/libgfortran/generated/maxloc1_4_r10.c +++ b/libgfortran/generated/maxloc1_4_r10.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c index 71c9723c120..7b1c558e30f 100644 --- a/libgfortran/generated/maxloc1_4_r16.c +++ b/libgfortran/generated/maxloc1_4_r16.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c index 69f3ca9e268..4534e6f4739 100644 --- a/libgfortran/generated/maxloc1_4_r4.c +++ b/libgfortran/generated/maxloc1_4_r4.c @@ -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; diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c index cab8eebbfa2..7917aae76eb 100644 --- a/libgfortran/generated/maxloc1_4_r8.c +++ b/libgfortran/generated/maxloc1_4_r8.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c index a6a796672e1..33966a235b6 100644 --- a/libgfortran/generated/maxloc1_8_i1.c +++ b/libgfortran/generated/maxloc1_8_i1.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c index b366e68cf71..612003ef74a 100644 --- a/libgfortran/generated/maxloc1_8_i16.c +++ b/libgfortran/generated/maxloc1_8_i16.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c index 0cfe019ad4b..04018e37919 100644 --- a/libgfortran/generated/maxloc1_8_i2.c +++ b/libgfortran/generated/maxloc1_8_i2.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c index e43ba950ade..833e4bed806 100644 --- a/libgfortran/generated/maxloc1_8_i4.c +++ b/libgfortran/generated/maxloc1_8_i4.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c index 733462baffe..880ad7ca4ae 100644 --- a/libgfortran/generated/maxloc1_8_i8.c +++ b/libgfortran/generated/maxloc1_8_i8.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c index deef31c91ec..6de90ead1de 100644 --- a/libgfortran/generated/maxloc1_8_r10.c +++ b/libgfortran/generated/maxloc1_8_r10.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c index 24d55c34bca..06e00dc0eb4 100644 --- a/libgfortran/generated/maxloc1_8_r16.c +++ b/libgfortran/generated/maxloc1_8_r16.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c index 3dd01b3bd6a..3d9d5c6df98 100644 --- a/libgfortran/generated/maxloc1_8_r4.c +++ b/libgfortran/generated/maxloc1_8_r4.c @@ -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; diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c index 1adc4c88838..ea2769ebc70 100644 --- a/libgfortran/generated/maxloc1_8_r8.c +++ b/libgfortran/generated/maxloc1_8_r8.c @@ -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; diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c index 3c63c225821..08334d5bf5e 100644 --- a/libgfortran/generated/maxval_i1.c +++ b/libgfortran/generated/maxval_i1.c @@ -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; diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c index 9a217ac9dbd..56d7854021d 100644 --- a/libgfortran/generated/maxval_i16.c +++ b/libgfortran/generated/maxval_i16.c @@ -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; diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c index c8fd718f8dc..111f5b91083 100644 --- a/libgfortran/generated/maxval_i2.c +++ b/libgfortran/generated/maxval_i2.c @@ -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; diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c index c800f1a733d..4413477f8b8 100644 --- a/libgfortran/generated/maxval_i4.c +++ b/libgfortran/generated/maxval_i4.c @@ -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; diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c index 898ef3c5956..7e3cb16dd69 100644 --- a/libgfortran/generated/maxval_i8.c +++ b/libgfortran/generated/maxval_i8.c @@ -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; diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c index 3123d06cf58..14338644b40 100644 --- a/libgfortran/generated/maxval_r10.c +++ b/libgfortran/generated/maxval_r10.c @@ -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; diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c index bdef6167916..6b4c409452d 100644 --- a/libgfortran/generated/maxval_r16.c +++ b/libgfortran/generated/maxval_r16.c @@ -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; diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c index ebdb9684fb6..9e797d3f077 100644 --- a/libgfortran/generated/maxval_r4.c +++ b/libgfortran/generated/maxval_r4.c @@ -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; diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c index 6a05df76381..ff4ed07d5ea 100644 --- a/libgfortran/generated/maxval_r8.c +++ b/libgfortran/generated/maxval_r8.c @@ -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; diff --git a/libgfortran/generated/minloc0_16_i1.c b/libgfortran/generated/minloc0_16_i1.c index e8f985627d8..5afd38763d1 100644 --- a/libgfortran/generated/minloc0_16_i1.c +++ b/libgfortran/generated/minloc0_16_i1.c @@ -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++) diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c index 31ade2421ea..5f49874324b 100644 --- a/libgfortran/generated/minloc0_16_i16.c +++ b/libgfortran/generated/minloc0_16_i16.c @@ -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++) diff --git a/libgfortran/generated/minloc0_16_i2.c b/libgfortran/generated/minloc0_16_i2.c index 772519dbebd..fed80151594 100644 --- a/libgfortran/generated/minloc0_16_i2.c +++ b/libgfortran/generated/minloc0_16_i2.c @@ -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++) diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c index 3096ec02049..bfb45413886 100644 --- a/libgfortran/generated/minloc0_16_i4.c +++ b/libgfortran/generated/minloc0_16_i4.c @@ -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++) diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c index 99b53bef5eb..d07297e90c3 100644 --- a/libgfortran/generated/minloc0_16_i8.c +++ b/libgfortran/generated/minloc0_16_i8.c @@ -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++) diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c index 5c043f899d9..34b1d56735a 100644 --- a/libgfortran/generated/minloc0_16_r10.c +++ b/libgfortran/generated/minloc0_16_r10.c @@ -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++) diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c index 9a87bb61ee7..6e60e19203f 100644 --- a/libgfortran/generated/minloc0_16_r16.c +++ b/libgfortran/generated/minloc0_16_r16.c @@ -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++) diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c index dbe167ecfea..7e98c18b81e 100644 --- a/libgfortran/generated/minloc0_16_r4.c +++ b/libgfortran/generated/minloc0_16_r4.c @@ -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++) diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c index 8c43bb5a7c4..4c2044b981e 100644 --- a/libgfortran/generated/minloc0_16_r8.c +++ b/libgfortran/generated/minloc0_16_r8.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_i1.c b/libgfortran/generated/minloc0_4_i1.c index 42d64a8750d..645af760ba0 100644 --- a/libgfortran/generated/minloc0_4_i1.c +++ b/libgfortran/generated/minloc0_4_i1.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c index 19b960e912a..5160d2e90a5 100644 --- a/libgfortran/generated/minloc0_4_i16.c +++ b/libgfortran/generated/minloc0_4_i16.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_i2.c b/libgfortran/generated/minloc0_4_i2.c index c57d5e72643..28d0a7f9d44 100644 --- a/libgfortran/generated/minloc0_4_i2.c +++ b/libgfortran/generated/minloc0_4_i2.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c index a8c5a5e8ff2..a820231df49 100644 --- a/libgfortran/generated/minloc0_4_i4.c +++ b/libgfortran/generated/minloc0_4_i4.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c index 61eab8cdd0c..4d63109f8b9 100644 --- a/libgfortran/generated/minloc0_4_i8.c +++ b/libgfortran/generated/minloc0_4_i8.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c index 20a22520f3f..c2d8d82eba4 100644 --- a/libgfortran/generated/minloc0_4_r10.c +++ b/libgfortran/generated/minloc0_4_r10.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c index 83f293c203f..9a42aab2938 100644 --- a/libgfortran/generated/minloc0_4_r16.c +++ b/libgfortran/generated/minloc0_4_r16.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c index 669a8c1c325..a2c67257476 100644 --- a/libgfortran/generated/minloc0_4_r4.c +++ b/libgfortran/generated/minloc0_4_r4.c @@ -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++) diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c index fbe9abd83bb..ceefacf6cf1 100644 --- a/libgfortran/generated/minloc0_4_r8.c +++ b/libgfortran/generated/minloc0_4_r8.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_i1.c b/libgfortran/generated/minloc0_8_i1.c index e1b95ced532..2629591cb7d 100644 --- a/libgfortran/generated/minloc0_8_i1.c +++ b/libgfortran/generated/minloc0_8_i1.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c index 390b74a7f75..30d8551cd8a 100644 --- a/libgfortran/generated/minloc0_8_i16.c +++ b/libgfortran/generated/minloc0_8_i16.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_i2.c b/libgfortran/generated/minloc0_8_i2.c index c07042989e9..34c23637642 100644 --- a/libgfortran/generated/minloc0_8_i2.c +++ b/libgfortran/generated/minloc0_8_i2.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c index 524af749728..e1053e0b3f5 100644 --- a/libgfortran/generated/minloc0_8_i4.c +++ b/libgfortran/generated/minloc0_8_i4.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c index 510973cb35f..851645e1389 100644 --- a/libgfortran/generated/minloc0_8_i8.c +++ b/libgfortran/generated/minloc0_8_i8.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c index 7e4dcb017e7..569efa08b79 100644 --- a/libgfortran/generated/minloc0_8_r10.c +++ b/libgfortran/generated/minloc0_8_r10.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c index dfb6bd67ead..4e19efab4f2 100644 --- a/libgfortran/generated/minloc0_8_r16.c +++ b/libgfortran/generated/minloc0_8_r16.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c index d10f942e2ab..0bcf5c63447 100644 --- a/libgfortran/generated/minloc0_8_r4.c +++ b/libgfortran/generated/minloc0_8_r4.c @@ -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++) diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c index 781f0caaef4..778963376d3 100644 --- a/libgfortran/generated/minloc0_8_r8.c +++ b/libgfortran/generated/minloc0_8_r8.c @@ -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++) diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c index fa25b3d82d6..1e7b09bd131 100644 --- a/libgfortran/generated/minloc1_16_i1.c +++ b/libgfortran/generated/minloc1_16_i1.c @@ -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; diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c index 4ea816f6539..0570e1686ad 100644 --- a/libgfortran/generated/minloc1_16_i16.c +++ b/libgfortran/generated/minloc1_16_i16.c @@ -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; diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c index 6251f19d2eb..3ec829ee7c0 100644 --- a/libgfortran/generated/minloc1_16_i2.c +++ b/libgfortran/generated/minloc1_16_i2.c @@ -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; diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c index c70b028122f..1d2a22982c7 100644 --- a/libgfortran/generated/minloc1_16_i4.c +++ b/libgfortran/generated/minloc1_16_i4.c @@ -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; diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c index 913532711c4..009bfc84b1a 100644 --- a/libgfortran/generated/minloc1_16_i8.c +++ b/libgfortran/generated/minloc1_16_i8.c @@ -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; diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c index 77cc6442b99..18e7d9038ba 100644 --- a/libgfortran/generated/minloc1_16_r10.c +++ b/libgfortran/generated/minloc1_16_r10.c @@ -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; diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c index 146a66f29a7..11d66700d04 100644 --- a/libgfortran/generated/minloc1_16_r16.c +++ b/libgfortran/generated/minloc1_16_r16.c @@ -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; diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c index 93bf9e99b4e..36ab93342a1 100644 --- a/libgfortran/generated/minloc1_16_r4.c +++ b/libgfortran/generated/minloc1_16_r4.c @@ -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; diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c index 8313589bd7b..4bc2f7e9468 100644 --- a/libgfortran/generated/minloc1_16_r8.c +++ b/libgfortran/generated/minloc1_16_r8.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c index 637a7ec2be6..b94775d748d 100644 --- a/libgfortran/generated/minloc1_4_i1.c +++ b/libgfortran/generated/minloc1_4_i1.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c index abc9d792c90..720d35c0066 100644 --- a/libgfortran/generated/minloc1_4_i16.c +++ b/libgfortran/generated/minloc1_4_i16.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c index 0183035d462..10a3537f8cf 100644 --- a/libgfortran/generated/minloc1_4_i2.c +++ b/libgfortran/generated/minloc1_4_i2.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c index 8e746c8bc40..941ac82ae01 100644 --- a/libgfortran/generated/minloc1_4_i4.c +++ b/libgfortran/generated/minloc1_4_i4.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index a05e972817b..36768068183 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c index 2c36814d3fe..84631c091e5 100644 --- a/libgfortran/generated/minloc1_4_r10.c +++ b/libgfortran/generated/minloc1_4_r10.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c index 7258ddaed42..d3e9b5fef8c 100644 --- a/libgfortran/generated/minloc1_4_r16.c +++ b/libgfortran/generated/minloc1_4_r16.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c index b36cee2d1fa..e2ccd58572e 100644 --- a/libgfortran/generated/minloc1_4_r4.c +++ b/libgfortran/generated/minloc1_4_r4.c @@ -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; diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c index a4ad1382b57..6e96a65cdeb 100644 --- a/libgfortran/generated/minloc1_4_r8.c +++ b/libgfortran/generated/minloc1_4_r8.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c index 36f49828bae..caa48af2a2e 100644 --- a/libgfortran/generated/minloc1_8_i1.c +++ b/libgfortran/generated/minloc1_8_i1.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c index 907454dc50a..1928c401004 100644 --- a/libgfortran/generated/minloc1_8_i16.c +++ b/libgfortran/generated/minloc1_8_i16.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c index 1d6526ec6b6..6c40de8040f 100644 --- a/libgfortran/generated/minloc1_8_i2.c +++ b/libgfortran/generated/minloc1_8_i2.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c index cebf4527e13..9f563d5cdce 100644 --- a/libgfortran/generated/minloc1_8_i4.c +++ b/libgfortran/generated/minloc1_8_i4.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c index 1b822e2c6a5..6cdeec75db1 100644 --- a/libgfortran/generated/minloc1_8_i8.c +++ b/libgfortran/generated/minloc1_8_i8.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c index f7fb3bf3c13..1dc5be69197 100644 --- a/libgfortran/generated/minloc1_8_r10.c +++ b/libgfortran/generated/minloc1_8_r10.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index cbba161c84c..5bec2992ff6 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c index 75081789788..99521480937 100644 --- a/libgfortran/generated/minloc1_8_r4.c +++ b/libgfortran/generated/minloc1_8_r4.c @@ -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; diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c index 372ff2135fa..44e3eecb7cf 100644 --- a/libgfortran/generated/minloc1_8_r8.c +++ b/libgfortran/generated/minloc1_8_r8.c @@ -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; diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c index 6ac105b2cd9..5c72eb93062 100644 --- a/libgfortran/generated/minval_i1.c +++ b/libgfortran/generated/minval_i1.c @@ -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; diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c index 3dd1678b617..eedadadc058 100644 --- a/libgfortran/generated/minval_i16.c +++ b/libgfortran/generated/minval_i16.c @@ -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; diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c index 6d0d3eb8668..2ca35064421 100644 --- a/libgfortran/generated/minval_i2.c +++ b/libgfortran/generated/minval_i2.c @@ -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; diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c index 2d6c1dee749..2f5796efbe2 100644 --- a/libgfortran/generated/minval_i4.c +++ b/libgfortran/generated/minval_i4.c @@ -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; diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c index 78158ca98b3..0bdbb81b230 100644 --- a/libgfortran/generated/minval_i8.c +++ b/libgfortran/generated/minval_i8.c @@ -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; diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c index fe87af41ac1..aa5c576d2eb 100644 --- a/libgfortran/generated/minval_r10.c +++ b/libgfortran/generated/minval_r10.c @@ -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; diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c index 58596b5eea6..ada6f8c6227 100644 --- a/libgfortran/generated/minval_r16.c +++ b/libgfortran/generated/minval_r16.c @@ -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; diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c index a11549ee974..7143b2b604a 100644 --- a/libgfortran/generated/minval_r4.c +++ b/libgfortran/generated/minval_r4.c @@ -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; diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c index 14ca0552bda..c21dc2350a9 100644 --- a/libgfortran/generated/minval_r8.c +++ b/libgfortran/generated/minval_r8.c @@ -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; diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c index 0d73a9b799c..b63cb6afabd 100644 --- a/libgfortran/generated/product_c10.c +++ b/libgfortran/generated/product_c10.c @@ -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; diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c index a5c8bd07e74..3b6265a2720 100644 --- a/libgfortran/generated/product_c16.c +++ b/libgfortran/generated/product_c16.c @@ -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; diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c index 45a62c9cfb9..07e0df0b85e 100644 --- a/libgfortran/generated/product_c4.c +++ b/libgfortran/generated/product_c4.c @@ -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; diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c index 69bcb87c399..a81241eca2c 100644 --- a/libgfortran/generated/product_c8.c +++ b/libgfortran/generated/product_c8.c @@ -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; diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c index 76427e4cbb7..4c68414247c 100644 --- a/libgfortran/generated/product_i1.c +++ b/libgfortran/generated/product_i1.c @@ -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; diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c index 7b735783094..9e81e595931 100644 --- a/libgfortran/generated/product_i16.c +++ b/libgfortran/generated/product_i16.c @@ -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; diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c index bdb51a65c52..dde442a7433 100644 --- a/libgfortran/generated/product_i2.c +++ b/libgfortran/generated/product_i2.c @@ -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; diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c index 72d0e1afbad..50875daafd3 100644 --- a/libgfortran/generated/product_i4.c +++ b/libgfortran/generated/product_i4.c @@ -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; diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c index d1ae82e4303..0b9d268a6c7 100644 --- a/libgfortran/generated/product_i8.c +++ b/libgfortran/generated/product_i8.c @@ -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; diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c index f19b67ba949..28732503501 100644 --- a/libgfortran/generated/product_r10.c +++ b/libgfortran/generated/product_r10.c @@ -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; diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c index 3d0a76a4ade..61149515b7f 100644 --- a/libgfortran/generated/product_r16.c +++ b/libgfortran/generated/product_r16.c @@ -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; diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c index 069b0d0c0e7..b3c9a0b25ca 100644 --- a/libgfortran/generated/product_r4.c +++ b/libgfortran/generated/product_r4.c @@ -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; diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c index e9cfae39782..8d49b279894 100644 --- a/libgfortran/generated/product_r8.c +++ b/libgfortran/generated/product_r8.c @@ -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; diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c index 96b878b7fcd..2fa759450aa 100644 --- a/libgfortran/generated/sum_c10.c +++ b/libgfortran/generated/sum_c10.c @@ -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; diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c index a99d4f65b62..b74aa43b250 100644 --- a/libgfortran/generated/sum_c16.c +++ b/libgfortran/generated/sum_c16.c @@ -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; diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c index 83979fbdf21..bf41330a2f5 100644 --- a/libgfortran/generated/sum_c4.c +++ b/libgfortran/generated/sum_c4.c @@ -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; diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c index d82092a1b6b..d7c3c9dadc2 100644 --- a/libgfortran/generated/sum_c8.c +++ b/libgfortran/generated/sum_c8.c @@ -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; diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c index 87205b8f716..0b0d3c8135d 100644 --- a/libgfortran/generated/sum_i1.c +++ b/libgfortran/generated/sum_i1.c @@ -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; diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c index 83857734a00..0f0bc55e373 100644 --- a/libgfortran/generated/sum_i16.c +++ b/libgfortran/generated/sum_i16.c @@ -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; diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c index c4452c3ce9d..c951d670177 100644 --- a/libgfortran/generated/sum_i2.c +++ b/libgfortran/generated/sum_i2.c @@ -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; diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c index e97d15c62ba..973b8f10297 100644 --- a/libgfortran/generated/sum_i4.c +++ b/libgfortran/generated/sum_i4.c @@ -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; diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c index da913442b4f..87e7ec650f0 100644 --- a/libgfortran/generated/sum_i8.c +++ b/libgfortran/generated/sum_i8.c @@ -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; diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c index 0433c90f90b..f552026e446 100644 --- a/libgfortran/generated/sum_r10.c +++ b/libgfortran/generated/sum_r10.c @@ -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; diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c index 2c9fdf5b221..58610542011 100644 --- a/libgfortran/generated/sum_r16.c +++ b/libgfortran/generated/sum_r16.c @@ -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; diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c index e3c33fbf1d4..4b07477d56e 100644 --- a/libgfortran/generated/sum_r4.c +++ b/libgfortran/generated/sum_r4.c @@ -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; diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c index 4d331e277a7..43df4a6f23b 100644 --- a/libgfortran/generated/sum_r8.c +++ b/libgfortran/generated/sum_r8.c @@ -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; diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c index a1998ad580b..30255f04686 100644 --- a/libgfortran/intrinsics/pack_generic.c +++ b/libgfortran/intrinsics/pack_generic.c @@ -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) diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c index b349f0d60fd..86c70fb7e45 100644 --- a/libgfortran/intrinsics/unpack_generic.c +++ b/libgfortran/intrinsics/unpack_generic.c @@ -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) diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 6c687f7b12b..555c6bfd4a8 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -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 diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4 index af53cef7ecc..720a4c05851 100644 --- a/libgfortran/m4/iforeach.m4 +++ b/libgfortran/m4/iforeach.m4 @@ -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++) diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index 225b89a7562..d8a661c2a89 100644 --- a/libgfortran/m4/ifunction.m4 +++ b/libgfortran/m4/ifunction.m4 @@ -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; diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4 index d4b0008e951..4e999fc34da 100644 --- a/libgfortran/m4/matmull.m4 +++ b/libgfortran/m4/matmull.m4 @@ -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 +' |