diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-05-08 07:47:19 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2018-05-08 07:47:19 +0000 |
commit | b573f931988b43a322ee454241b2af3a74f2fa84 (patch) | |
tree | 13876af9f83ad04e9dc0c13c19d75b93550ab84a /libgfortran/generated | |
parent | 6404980cf36b5d335de634c5bd76099330754682 (diff) | |
download | gcc-b573f931988b43a322ee454241b2af3a74f2fa84.tar.gz |
re PR fortran/54613 ([F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=)
2018-05-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/54613
* check.c (gfc_check_minmaxloc): Remove error for BACK not being
implemented. Use gfc_logical_4_kind for BACK.
* simplify.c (min_max_choose): Add optional argument back_val.
Handle it.
(simplify_minmaxloc_to_scalar): Add argument back_val. Pass
back_val to min_max_choose.
(simplify_minmaxloc_to_nodim): Likewise.
(simplify_minmaxloc_to_array): Likewise.
(gfc_simplify_minmaxloc): Add argument back, handle it.
Pass back_val to specific simplification functions.
(gfc_simplify_minloc): Remove ATTRIBUTE_UNUSED from argument back,
pass it on to gfc_simplify_minmaxloc.
(gfc_simplify_maxloc): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): Adjust
comment. If BACK is true, use greater or equal (or lesser or
equal) insteal of greater (or lesser). Mark the condition of
having found a value which exceeds the limit as unlikely.
2018-05-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/54613
* m4/iforeach-s.m4: Remove assertion that back is zero.
* m4/iforeach.m4: Likewise. Remove leading 'do'
before implementation start.
* m4/ifunction-s.m4: Remove assertion that back is zero.
* m4/ifunction.m4: Likewise. Remove for loop if HAVE_BACK_ARG
is defined.
* m4/maxloc0.m4: Reorganize loops. Split loops between >= and =,
depending if back is true. Mark the condition of having
found a value which exceeds the limit as unlikely.
* m4/minloc0.m4: Likewise.
* m4/maxloc1.m4: Likewise.
* m4/minloc1.m4: Likewise.
* m4/maxloc1s.m4: Handle back argument.
* m4/minloc1s.m4: Likewise.
* m4/maxloc2s.m4: Remove assertion that back is zero.
Remove special handling of loop start. Handle back argument.
* m4/minloc2s.m4: Likewise.
* generated/iall_i1.c: Regenerated.
* generated/iall_i16.c: Regenerated.
* generated/iall_i2.c: Regenerated.
* generated/iall_i4.c: Regenerated.
* generated/iall_i8.c: Regenerated.
* generated/iany_i1.c: Regenerated.
* generated/iany_i16.c: Regenerated.
* generated/iany_i2.c: Regenerated.
* generated/iany_i4.c: Regenerated.
* generated/iany_i8.c: Regenerated.
* generated/iparity_i1.c: Regenerated.
* generated/iparity_i16.c: Regenerated.
* generated/iparity_i2.c: Regenerated.
* generated/iparity_i4.c: Regenerated.
* generated/iparity_i8.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_16_s1.c: Regenerated.
* generated/maxloc0_16_s4.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_4_s1.c: Regenerated.
* generated/maxloc0_4_s4.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/maxloc0_8_s1.c: Regenerated.
* generated/maxloc0_8_s4.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_16_s1.c: Regenerated.
* generated/maxloc1_16_s4.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_4_s1.c: Regenerated.
* generated/maxloc1_4_s4.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/maxloc1_8_s1.c: Regenerated.
* generated/maxloc1_8_s4.c: Regenerated.
* generated/maxloc2_16_s1.c: Regenerated.
* generated/maxloc2_16_s4.c: Regenerated.
* generated/maxloc2_4_s1.c: Regenerated.
* generated/maxloc2_4_s4.c: Regenerated.
* generated/maxloc2_8_s1.c: Regenerated.
* generated/maxloc2_8_s4.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_16_s1.c: Regenerated.
* generated/minloc0_16_s4.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_4_s1.c: Regenerated.
* generated/minloc0_4_s4.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/minloc0_8_s1.c: Regenerated.
* generated/minloc0_8_s4.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_16_s1.c: Regenerated.
* generated/minloc1_16_s4.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_4_s1.c: Regenerated.
* generated/minloc1_4_s4.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/minloc1_8_s1.c: Regenerated.
* generated/minloc1_8_s4.c: Regenerated.
* generated/minloc2_16_s1.c: Regenerated.
* generated/minloc2_16_s4.c: Regenerated.
* generated/minloc2_4_s1.c: Regenerated.
* generated/minloc2_4_s4.c: Regenerated.
* generated/minloc2_8_s1.c: Regenerated.
* generated/minloc2_8_s4.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/norm2_r10.c: Regenerated.
* generated/norm2_r16.c: Regenerated.
* generated/norm2_r4.c: Regenerated.
* generated/norm2_r8.c: Regenerated.
* generated/parity_l1.c: Regenerated.
* generated/parity_l16.c: Regenerated.
* generated/parity_l2.c: Regenerated.
* generated/parity_l4.c: Regenerated.
* generated/parity_l8.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.
2018-05-08 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/54613
* gfortran.dg/minmaxloc_12.f90: New test case.
* gfortran.dg/minmaxloc_13.f90: New test case.
From-SVN: r260023
Diffstat (limited to 'libgfortran/generated')
212 files changed, 4243 insertions, 3011 deletions
diff --git a/libgfortran/generated/iall_i1.c b/libgfortran/generated/iall_i1.c index a171ed21053..f02f7afa4b0 100644 --- a/libgfortran/generated/iall_i1.c +++ b/libgfortran/generated/iall_i1.c @@ -51,10 +51,6 @@ iall_i1 (gfc_array_i1 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iall_i1 (gfc_array_i1 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result &= *src; } @@ -222,9 +220,6 @@ miall_i1 (gfc_array_i1 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iall_i16.c b/libgfortran/generated/iall_i16.c index 80c89e828dd..e739fad7abd 100644 --- a/libgfortran/generated/iall_i16.c +++ b/libgfortran/generated/iall_i16.c @@ -51,10 +51,6 @@ iall_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iall_i16 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result &= *src; } @@ -222,9 +220,6 @@ miall_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iall_i2.c b/libgfortran/generated/iall_i2.c index 618b02479b2..ff958a9cd33 100644 --- a/libgfortran/generated/iall_i2.c +++ b/libgfortran/generated/iall_i2.c @@ -51,10 +51,6 @@ iall_i2 (gfc_array_i2 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iall_i2 (gfc_array_i2 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result &= *src; } @@ -222,9 +220,6 @@ miall_i2 (gfc_array_i2 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iall_i4.c b/libgfortran/generated/iall_i4.c index 808e073003d..ece32e481d9 100644 --- a/libgfortran/generated/iall_i4.c +++ b/libgfortran/generated/iall_i4.c @@ -51,10 +51,6 @@ iall_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iall_i4 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result &= *src; } @@ -222,9 +220,6 @@ miall_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iall_i8.c b/libgfortran/generated/iall_i8.c index c487b6cacfb..f181f153c74 100644 --- a/libgfortran/generated/iall_i8.c +++ b/libgfortran/generated/iall_i8.c @@ -51,10 +51,6 @@ iall_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iall_i8 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result &= *src; } @@ -222,9 +220,6 @@ miall_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iany_i1.c b/libgfortran/generated/iany_i1.c index 0890eed633a..20088edee3a 100644 --- a/libgfortran/generated/iany_i1.c +++ b/libgfortran/generated/iany_i1.c @@ -51,10 +51,6 @@ iany_i1 (gfc_array_i1 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iany_i1 (gfc_array_i1 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result |= *src; } @@ -222,9 +220,6 @@ miany_i1 (gfc_array_i1 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iany_i16.c b/libgfortran/generated/iany_i16.c index 126db338d33..90844e884f4 100644 --- a/libgfortran/generated/iany_i16.c +++ b/libgfortran/generated/iany_i16.c @@ -51,10 +51,6 @@ iany_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iany_i16 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result |= *src; } @@ -222,9 +220,6 @@ miany_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iany_i2.c b/libgfortran/generated/iany_i2.c index 3a26b2ced84..e7343895301 100644 --- a/libgfortran/generated/iany_i2.c +++ b/libgfortran/generated/iany_i2.c @@ -51,10 +51,6 @@ iany_i2 (gfc_array_i2 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iany_i2 (gfc_array_i2 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result |= *src; } @@ -222,9 +220,6 @@ miany_i2 (gfc_array_i2 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iany_i4.c b/libgfortran/generated/iany_i4.c index 8b81d001be1..48043eefd2a 100644 --- a/libgfortran/generated/iany_i4.c +++ b/libgfortran/generated/iany_i4.c @@ -51,10 +51,6 @@ iany_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iany_i4 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result |= *src; } @@ -222,9 +220,6 @@ miany_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iany_i8.c b/libgfortran/generated/iany_i8.c index 9ffc9b6c89a..078160b24b7 100644 --- a/libgfortran/generated/iany_i8.c +++ b/libgfortran/generated/iany_i8.c @@ -51,10 +51,6 @@ iany_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iany_i8 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result |= *src; } @@ -222,9 +220,6 @@ miany_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iparity_i1.c b/libgfortran/generated/iparity_i1.c index b4d4240291c..911f9f5a6e5 100644 --- a/libgfortran/generated/iparity_i1.c +++ b/libgfortran/generated/iparity_i1.c @@ -51,10 +51,6 @@ iparity_i1 (gfc_array_i1 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iparity_i1 (gfc_array_i1 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result ^= *src; } @@ -222,9 +220,6 @@ miparity_i1 (gfc_array_i1 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iparity_i16.c b/libgfortran/generated/iparity_i16.c index 96cb108b0ee..b434f01b4f1 100644 --- a/libgfortran/generated/iparity_i16.c +++ b/libgfortran/generated/iparity_i16.c @@ -51,10 +51,6 @@ iparity_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iparity_i16 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result ^= *src; } @@ -222,9 +220,6 @@ miparity_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iparity_i2.c b/libgfortran/generated/iparity_i2.c index b077f29c381..998df01fd8d 100644 --- a/libgfortran/generated/iparity_i2.c +++ b/libgfortran/generated/iparity_i2.c @@ -51,10 +51,6 @@ iparity_i2 (gfc_array_i2 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iparity_i2 (gfc_array_i2 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result ^= *src; } @@ -222,9 +220,6 @@ miparity_i2 (gfc_array_i2 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iparity_i4.c b/libgfortran/generated/iparity_i4.c index 1b5dfe0397a..a0c515c7717 100644 --- a/libgfortran/generated/iparity_i4.c +++ b/libgfortran/generated/iparity_i4.c @@ -51,10 +51,6 @@ iparity_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iparity_i4 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result ^= *src; } @@ -222,9 +220,6 @@ miparity_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/iparity_i8.c b/libgfortran/generated/iparity_i8.c index 056a59bfaea..3225513273e 100644 --- a/libgfortran/generated/iparity_i8.c +++ b/libgfortran/generated/iparity_i8.c @@ -51,10 +51,6 @@ iparity_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ iparity_i8 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result ^= *src; } @@ -222,9 +220,6 @@ miparity_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxloc0_16_i1.c b/libgfortran/generated/maxloc0_16_i1.c index 25398cc7989..3bb69059e55 100644 --- a/libgfortran/generated/maxloc0_16_i1.c +++ b/libgfortran/generated/maxloc0_16_i1.c @@ -47,7 +47,6 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_1_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c index 3a4a7446274..7c2967fedde 100644 --- a/libgfortran/generated/maxloc0_16_i16.c +++ b/libgfortran/generated/maxloc0_16_i16.c @@ -47,7 +47,6 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_i2.c b/libgfortran/generated/maxloc0_16_i2.c index 0ff8ca0b183..87edb85cdc6 100644 --- a/libgfortran/generated/maxloc0_16_i2.c +++ b/libgfortran/generated/maxloc0_16_i2.c @@ -47,7 +47,6 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_2_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c index 84cff67ea08..38daf6d77a7 100644 --- a/libgfortran/generated/maxloc0_16_i4.c +++ b/libgfortran/generated/maxloc0_16_i4.c @@ -47,7 +47,6 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c index e276295027b..f48e943d9fc 100644 --- a/libgfortran/generated/maxloc0_16_i8.c +++ b/libgfortran/generated/maxloc0_16_i8.c @@ -47,7 +47,6 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c index 384487fadeb..f1dc89be33e 100644 --- a/libgfortran/generated/maxloc0_16_r10.c +++ b/libgfortran/generated/maxloc0_16_r10.c @@ -47,7 +47,6 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_10_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c index 10c7673f73c..7003a60ac68 100644 --- a/libgfortran/generated/maxloc0_16_r16.c +++ b/libgfortran/generated/maxloc0_16_r16.c @@ -47,7 +47,6 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c index b7aaa3d5cef..0ada2d1b208 100644 --- a/libgfortran/generated/maxloc0_16_r4.c +++ b/libgfortran/generated/maxloc0_16_r4.c @@ -47,7 +47,6 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c index 2ca3479d3f9..75b59841aaa 100644 --- a/libgfortran/generated/maxloc0_16_r8.c +++ b/libgfortran/generated/maxloc0_16_r8.c @@ -47,7 +47,6 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_16_s1.c b/libgfortran/generated/maxloc0_16_s1.c index a05d17893e3..33f73e7d62c 100644 --- a/libgfortran/generated/maxloc0_16_s1.c +++ b/libgfortran/generated/maxloc0_16_s1.c @@ -61,10 +61,6 @@ maxloc0_16_s1 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ maxloc0_16_s1 (gfc_array_i16 * const restrict retarray, { const GFC_INTEGER_1 *maxval; - maxval = base; + maxval = NULL; while (base) { @@ -115,7 +111,8 @@ maxloc0_16_s1 (gfc_array_i16 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0 : + compare_fcn (base, maxval, len) > 0)) { maxval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mmaxloc0_16_s1 (gfc_array_i16 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (maxval == NULL || compare_fcn (base, maxval, len) > 0)) + if (*mbase && + (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0: + compare_fcn (base, maxval, len) > 0))) { maxval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/maxloc0_16_s4.c b/libgfortran/generated/maxloc0_16_s4.c index f6adf95c356..8eec34160cb 100644 --- a/libgfortran/generated/maxloc0_16_s4.c +++ b/libgfortran/generated/maxloc0_16_s4.c @@ -61,10 +61,6 @@ maxloc0_16_s4 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ maxloc0_16_s4 (gfc_array_i16 * const restrict retarray, { const GFC_INTEGER_4 *maxval; - maxval = base; + maxval = NULL; while (base) { @@ -115,7 +111,8 @@ maxloc0_16_s4 (gfc_array_i16 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0 : + compare_fcn (base, maxval, len) > 0)) { maxval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mmaxloc0_16_s4 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mmaxloc0_16_s4 (gfc_array_i16 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (maxval == NULL || compare_fcn (base, maxval, len) > 0)) + if (*mbase && + (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0: + compare_fcn (base, maxval, len) > 0))) { maxval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/maxloc0_4_i1.c b/libgfortran/generated/maxloc0_4_i1.c index dc31e1d4b65..63a5d544c72 100644 --- a/libgfortran/generated/maxloc0_4_i1.c +++ b/libgfortran/generated/maxloc0_4_i1.c @@ -47,7 +47,6 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_1_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c index f7226001282..b515ee0c097 100644 --- a/libgfortran/generated/maxloc0_4_i16.c +++ b/libgfortran/generated/maxloc0_4_i16.c @@ -47,7 +47,6 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_i2.c b/libgfortran/generated/maxloc0_4_i2.c index f78e20ec405..563aebe28b7 100644 --- a/libgfortran/generated/maxloc0_4_i2.c +++ b/libgfortran/generated/maxloc0_4_i2.c @@ -47,7 +47,6 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_2_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c index 58c3cf1d4b4..7760807bac2 100644 --- a/libgfortran/generated/maxloc0_4_i4.c +++ b/libgfortran/generated/maxloc0_4_i4.c @@ -47,7 +47,6 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c index ded9b5bcade..e9113183aab 100644 --- a/libgfortran/generated/maxloc0_4_i8.c +++ b/libgfortran/generated/maxloc0_4_i8.c @@ -47,7 +47,6 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c index c64bd532380..b335b2ed5eb 100644 --- a/libgfortran/generated/maxloc0_4_r10.c +++ b/libgfortran/generated/maxloc0_4_r10.c @@ -47,7 +47,6 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_10_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c index 4fd46a3371b..6a27d69f077 100644 --- a/libgfortran/generated/maxloc0_4_r16.c +++ b/libgfortran/generated/maxloc0_4_r16.c @@ -47,7 +47,6 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c index c168aee4d57..76732d7f6bb 100644 --- a/libgfortran/generated/maxloc0_4_r4.c +++ b/libgfortran/generated/maxloc0_4_r4.c @@ -47,7 +47,6 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c index 655a6527304..13e371030b7 100644 --- a/libgfortran/generated/maxloc0_4_r8.c +++ b/libgfortran/generated/maxloc0_4_r8.c @@ -47,7 +47,6 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_4_s1.c b/libgfortran/generated/maxloc0_4_s1.c index b13a9b94146..ba8e6340118 100644 --- a/libgfortran/generated/maxloc0_4_s1.c +++ b/libgfortran/generated/maxloc0_4_s1.c @@ -61,10 +61,6 @@ maxloc0_4_s1 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ maxloc0_4_s1 (gfc_array_i4 * const restrict retarray, { const GFC_INTEGER_1 *maxval; - maxval = base; + maxval = NULL; while (base) { @@ -115,7 +111,8 @@ maxloc0_4_s1 (gfc_array_i4 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0 : + compare_fcn (base, maxval, len) > 0)) { maxval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mmaxloc0_4_s1 (gfc_array_i4 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (maxval == NULL || compare_fcn (base, maxval, len) > 0)) + if (*mbase && + (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0: + compare_fcn (base, maxval, len) > 0))) { maxval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/maxloc0_4_s4.c b/libgfortran/generated/maxloc0_4_s4.c index 971e8680804..90a54b6aed8 100644 --- a/libgfortran/generated/maxloc0_4_s4.c +++ b/libgfortran/generated/maxloc0_4_s4.c @@ -61,10 +61,6 @@ maxloc0_4_s4 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ maxloc0_4_s4 (gfc_array_i4 * const restrict retarray, { const GFC_INTEGER_4 *maxval; - maxval = base; + maxval = NULL; while (base) { @@ -115,7 +111,8 @@ maxloc0_4_s4 (gfc_array_i4 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0 : + compare_fcn (base, maxval, len) > 0)) { maxval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mmaxloc0_4_s4 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mmaxloc0_4_s4 (gfc_array_i4 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (maxval == NULL || compare_fcn (base, maxval, len) > 0)) + if (*mbase && + (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0: + compare_fcn (base, maxval, len) > 0))) { maxval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/maxloc0_8_i1.c b/libgfortran/generated/maxloc0_8_i1.c index b86f0cb2946..c7852b5c8e7 100644 --- a/libgfortran/generated/maxloc0_8_i1.c +++ b/libgfortran/generated/maxloc0_8_i1.c @@ -47,7 +47,6 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_1_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c index 710d26097b6..88d50d97518 100644 --- a/libgfortran/generated/maxloc0_8_i16.c +++ b/libgfortran/generated/maxloc0_8_i16.c @@ -47,7 +47,6 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_i2.c b/libgfortran/generated/maxloc0_8_i2.c index e85fb07ab4b..b763e3b462e 100644 --- a/libgfortran/generated/maxloc0_8_i2.c +++ b/libgfortran/generated/maxloc0_8_i2.c @@ -47,7 +47,6 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_2_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c index bb6d51ee69a..e338364f951 100644 --- a/libgfortran/generated/maxloc0_8_i4.c +++ b/libgfortran/generated/maxloc0_8_i4.c @@ -47,7 +47,6 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c index d6c6e850ed4..11fd73de774 100644 --- a/libgfortran/generated/maxloc0_8_i8.c +++ b/libgfortran/generated/maxloc0_8_i8.c @@ -47,7 +47,6 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c index 333e57095fd..315c8d7e613 100644 --- a/libgfortran/generated/maxloc0_8_r10.c +++ b/libgfortran/generated/maxloc0_8_r10.c @@ -47,7 +47,6 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_10_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c index ebb3118864d..6fcc69ec394 100644 --- a/libgfortran/generated/maxloc0_8_r16.c +++ b/libgfortran/generated/maxloc0_8_r16.c @@ -47,7 +47,6 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c index afc46960059..3ecd60ed7ad 100644 --- a/libgfortran/generated/maxloc0_8_r4.c +++ b/libgfortran/generated/maxloc0_8_r4.c @@ -47,7 +47,6 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c index e6a2feffa97..299be1a5c0d 100644 --- a/libgfortran/generated/maxloc0_8_r8.c +++ b/libgfortran/generated/maxloc0_8_r8.c @@ -47,7 +47,6 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ maxloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base > maxval) - { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; - } + if (back) + do + { + if (unlikely (*base >= maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mmaxloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base > maxval) + else + if (back) + do { - maxval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (*mbase && *base >= maxval) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (*mbase && unlikely (*base > maxval)) + { + maxval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; diff --git a/libgfortran/generated/maxloc0_8_s1.c b/libgfortran/generated/maxloc0_8_s1.c index 2e95fa35d1c..405162338c7 100644 --- a/libgfortran/generated/maxloc0_8_s1.c +++ b/libgfortran/generated/maxloc0_8_s1.c @@ -61,10 +61,6 @@ maxloc0_8_s1 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ maxloc0_8_s1 (gfc_array_i8 * const restrict retarray, { const GFC_INTEGER_1 *maxval; - maxval = base; + maxval = NULL; while (base) { @@ -115,7 +111,8 @@ maxloc0_8_s1 (gfc_array_i8 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0 : + compare_fcn (base, maxval, len) > 0)) { maxval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mmaxloc0_8_s1 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mmaxloc0_8_s1 (gfc_array_i8 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (maxval == NULL || compare_fcn (base, maxval, len) > 0)) + if (*mbase && + (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0: + compare_fcn (base, maxval, len) > 0))) { maxval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/maxloc0_8_s4.c b/libgfortran/generated/maxloc0_8_s4.c index 5cc1f11fb85..40ea75d257f 100644 --- a/libgfortran/generated/maxloc0_8_s4.c +++ b/libgfortran/generated/maxloc0_8_s4.c @@ -61,10 +61,6 @@ maxloc0_8_s4 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ maxloc0_8_s4 (gfc_array_i8 * const restrict retarray, { const GFC_INTEGER_4 *maxval; - maxval = base; + maxval = NULL; while (base) { @@ -115,7 +111,8 @@ maxloc0_8_s4 (gfc_array_i8 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0 : + compare_fcn (base, maxval, len) > 0)) { maxval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mmaxloc0_8_s4 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mmaxloc0_8_s4 (gfc_array_i8 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (maxval == NULL || compare_fcn (base, maxval, len) > 0)) + if (*mbase && + (maxval == NULL || (back ? compare_fcn (base, maxval, len) >= 0: + compare_fcn (base, maxval, len) > 0))) { maxval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c index ff2124d2803..cb04e9417ee 100644 --- a/libgfortran/generated/maxloc1_16_i1.c +++ b/libgfortran/generated/maxloc1_16_i1.c @@ -54,10 +54,6 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_1_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_i1 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c index 2b0bd54ba8a..871bf028341 100644 --- a/libgfortran/generated/maxloc1_16_i16.c +++ b/libgfortran/generated/maxloc1_16_i16.c @@ -54,10 +54,6 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_i16 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c index 26c3f142b9f..3bba4bc9297 100644 --- a/libgfortran/generated/maxloc1_16_i2.c +++ b/libgfortran/generated/maxloc1_16_i2.c @@ -54,10 +54,6 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_2_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_i2 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c index aedc22a1cfd..043a9874d72 100644 --- a/libgfortran/generated/maxloc1_16_i4.c +++ b/libgfortran/generated/maxloc1_16_i4.c @@ -54,10 +54,6 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_i4 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c index d08561d4aff..fe9704fa68b 100644 --- a/libgfortran/generated/maxloc1_16_i8.c +++ b/libgfortran/generated/maxloc1_16_i8.c @@ -54,10 +54,6 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_i8 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c index a5929ee47e4..25b0449d586 100644 --- a/libgfortran/generated/maxloc1_16_r10.c +++ b/libgfortran/generated/maxloc1_16_r10.c @@ -54,10 +54,6 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_10_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_r10 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c index 09da74031d1..4b0bddc4104 100644 --- a/libgfortran/generated/maxloc1_16_r16.c +++ b/libgfortran/generated/maxloc1_16_r16.c @@ -54,10 +54,6 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_r16 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c index 927830008e2..9a021a05cfe 100644 --- a/libgfortran/generated/maxloc1_16_r4.c +++ b/libgfortran/generated/maxloc1_16_r4.c @@ -54,10 +54,6 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_r4 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c index 84c0c650641..2cb8db38fb5 100644 --- a/libgfortran/generated/maxloc1_16_r8.c +++ b/libgfortran/generated/maxloc1_16_r8.c @@ -54,10 +54,6 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_16_r8 (gfc_array_i16 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_16)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_16)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_16_s1.c b/libgfortran/generated/maxloc1_16_s1.c index 84b12f3e26c..ae17ccd788e 100644 --- a/libgfortran/generated/maxloc1_16_s1.c +++ b/libgfortran/generated/maxloc1_16_s1.c @@ -66,10 +66,6 @@ maxloc1_16_s1 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ maxloc1_16_s1 (gfc_array_i16 * const restrict retarray, { const GFC_INTEGER_1 *maxval; - maxval = base; - result = 1; + maxval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ maxloc1_16_s1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, maxval, string_len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_16)n + 1; @@ -244,9 +241,6 @@ mmaxloc1_16_s1 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mmaxloc1_16_s1 (gfc_array_i16 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, maxval, string_len) > 0) + if (*msrc && (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_16)n + 1; diff --git a/libgfortran/generated/maxloc1_16_s4.c b/libgfortran/generated/maxloc1_16_s4.c index 70696f2ac3f..6b436d64a69 100644 --- a/libgfortran/generated/maxloc1_16_s4.c +++ b/libgfortran/generated/maxloc1_16_s4.c @@ -66,10 +66,6 @@ maxloc1_16_s4 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ maxloc1_16_s4 (gfc_array_i16 * const restrict retarray, { const GFC_INTEGER_4 *maxval; - maxval = base; - result = 1; + maxval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ maxloc1_16_s4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, maxval, string_len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_16)n + 1; @@ -244,9 +241,6 @@ mmaxloc1_16_s4 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mmaxloc1_16_s4 (gfc_array_i16 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, maxval, string_len) > 0) + if (*msrc && (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_16)n + 1; diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c index 7fc1f88c2d9..43d541e01f2 100644 --- a/libgfortran/generated/maxloc1_4_i1.c +++ b/libgfortran/generated/maxloc1_4_i1.c @@ -54,10 +54,6 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_1_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_i1 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c index 14b5e5578b8..7d006abbd14 100644 --- a/libgfortran/generated/maxloc1_4_i16.c +++ b/libgfortran/generated/maxloc1_4_i16.c @@ -54,10 +54,6 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_i16 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c index 9d5a98ed341..6f3751be021 100644 --- a/libgfortran/generated/maxloc1_4_i2.c +++ b/libgfortran/generated/maxloc1_4_i2.c @@ -54,10 +54,6 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_2_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_i2 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c index 23d702850f4..47c5d825fe8 100644 --- a/libgfortran/generated/maxloc1_4_i4.c +++ b/libgfortran/generated/maxloc1_4_i4.c @@ -54,10 +54,6 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_i4 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c index 178a20aa2ff..e8380aa7206 100644 --- a/libgfortran/generated/maxloc1_4_i8.c +++ b/libgfortran/generated/maxloc1_4_i8.c @@ -54,10 +54,6 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_i8 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c index f35961338bf..fe922ba3f2f 100644 --- a/libgfortran/generated/maxloc1_4_r10.c +++ b/libgfortran/generated/maxloc1_4_r10.c @@ -54,10 +54,6 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_10_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_r10 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c index a0f283e7cec..eeab770df1c 100644 --- a/libgfortran/generated/maxloc1_4_r16.c +++ b/libgfortran/generated/maxloc1_4_r16.c @@ -54,10 +54,6 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_r16 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c index aeb4b8f1068..c0b80b0817d 100644 --- a/libgfortran/generated/maxloc1_4_r4.c +++ b/libgfortran/generated/maxloc1_4_r4.c @@ -54,10 +54,6 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_r4 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c index 43852049c9c..3560c3b7434 100644 --- a/libgfortran/generated/maxloc1_4_r8.c +++ b/libgfortran/generated/maxloc1_4_r8.c @@ -54,10 +54,6 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_4_r8 (gfc_array_i4 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_4)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_4)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_4_s1.c b/libgfortran/generated/maxloc1_4_s1.c index b7b7d8cfe93..cdcd7fb2652 100644 --- a/libgfortran/generated/maxloc1_4_s1.c +++ b/libgfortran/generated/maxloc1_4_s1.c @@ -66,10 +66,6 @@ maxloc1_4_s1 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ maxloc1_4_s1 (gfc_array_i4 * const restrict retarray, { const GFC_INTEGER_1 *maxval; - maxval = base; - result = 1; + maxval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ maxloc1_4_s1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, maxval, string_len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_4)n + 1; @@ -244,9 +241,6 @@ mmaxloc1_4_s1 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mmaxloc1_4_s1 (gfc_array_i4 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, maxval, string_len) > 0) + if (*msrc && (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_4)n + 1; diff --git a/libgfortran/generated/maxloc1_4_s4.c b/libgfortran/generated/maxloc1_4_s4.c index da7594993d1..f1e79cf9002 100644 --- a/libgfortran/generated/maxloc1_4_s4.c +++ b/libgfortran/generated/maxloc1_4_s4.c @@ -66,10 +66,6 @@ maxloc1_4_s4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ maxloc1_4_s4 (gfc_array_i4 * const restrict retarray, { const GFC_INTEGER_4 *maxval; - maxval = base; - result = 1; + maxval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ maxloc1_4_s4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, maxval, string_len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_4)n + 1; @@ -244,9 +241,6 @@ mmaxloc1_4_s4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mmaxloc1_4_s4 (gfc_array_i4 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, maxval, string_len) > 0) + if (*msrc && (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_4)n + 1; diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c index fa5bc4aadfd..1ff5cd3c90c 100644 --- a/libgfortran/generated/maxloc1_8_i1.c +++ b/libgfortran/generated/maxloc1_8_i1.c @@ -54,10 +54,6 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_1_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_i1 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c index 2cf75312ece..9341c2744df 100644 --- a/libgfortran/generated/maxloc1_8_i16.c +++ b/libgfortran/generated/maxloc1_8_i16.c @@ -54,10 +54,6 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_i16 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c index e32eafe2f05..4d443ae595e 100644 --- a/libgfortran/generated/maxloc1_8_i2.c +++ b/libgfortran/generated/maxloc1_8_i2.c @@ -54,10 +54,6 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_2_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_i2 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c index e348550787e..2058ab2ad69 100644 --- a/libgfortran/generated/maxloc1_8_i4.c +++ b/libgfortran/generated/maxloc1_8_i4.c @@ -54,10 +54,6 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_i4 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c index 802b74d9461..9dc002f6c72 100644 --- a/libgfortran/generated/maxloc1_8_i8.c +++ b/libgfortran/generated/maxloc1_8_i8.c @@ -54,10 +54,6 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_i8 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c index bc5f1b1af2c..1a963d18c56 100644 --- a/libgfortran/generated/maxloc1_8_r10.c +++ b/libgfortran/generated/maxloc1_8_r10.c @@ -54,10 +54,6 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_10_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_r10 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c index 54d12030c11..e04c70e5065 100644 --- a/libgfortran/generated/maxloc1_8_r16.c +++ b/libgfortran/generated/maxloc1_8_r16.c @@ -54,10 +54,6 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_r16 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c index 5895585c403..b06820bce61 100644 --- a/libgfortran/generated/maxloc1_8_r4.c +++ b/libgfortran/generated/maxloc1_8_r4.c @@ -54,10 +54,6 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_r4 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c index 8c79dd46ab0..1963746d422 100644 --- a/libgfortran/generated/maxloc1_8_r8.c +++ b/libgfortran/generated/maxloc1_8_r8.c @@ -54,10 +54,6 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src >= maxval) { maxval = *src; @@ -174,10 +174,12 @@ maxloc1_8_r8 (gfc_array_i8 * const restrict retarray, break; } } +#else + n = 0; +#endif for (; n < len; n++, src += delta) { -#endif - if (*src > maxval) + if (back ? *src >= maxval : *src > maxval) { maxval = *src; result = (GFC_INTEGER_8)n + 1; @@ -246,9 +248,6 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +395,23 @@ mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src > maxval) - { - maxval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src >= maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src > maxval)) + { + maxval = *src; + result = (GFC_INTEGER_8)n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/maxloc1_8_s1.c b/libgfortran/generated/maxloc1_8_s1.c index aab24491ba9..2b16e065245 100644 --- a/libgfortran/generated/maxloc1_8_s1.c +++ b/libgfortran/generated/maxloc1_8_s1.c @@ -66,10 +66,6 @@ maxloc1_8_s1 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ maxloc1_8_s1 (gfc_array_i8 * const restrict retarray, { const GFC_INTEGER_1 *maxval; - maxval = base; - result = 1; + maxval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ maxloc1_8_s1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, maxval, string_len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_8)n + 1; @@ -244,9 +241,6 @@ mmaxloc1_8_s1 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mmaxloc1_8_s1 (gfc_array_i8 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, maxval, string_len) > 0) + if (*msrc && (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_8)n + 1; diff --git a/libgfortran/generated/maxloc1_8_s4.c b/libgfortran/generated/maxloc1_8_s4.c index f02e2a54526..c4557e0e001 100644 --- a/libgfortran/generated/maxloc1_8_s4.c +++ b/libgfortran/generated/maxloc1_8_s4.c @@ -66,10 +66,6 @@ maxloc1_8_s4 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ maxloc1_8_s4 (gfc_array_i8 * const restrict retarray, { const GFC_INTEGER_4 *maxval; - maxval = base; - result = 1; + maxval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ maxloc1_8_s4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, maxval, string_len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_8)n + 1; @@ -244,9 +241,6 @@ mmaxloc1_8_s4 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mmaxloc1_8_s4 (gfc_array_i8 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, maxval, string_len) > 0) + if (*msrc && (back ? compare_fcn (src, maxval, string_len) >= 0 : + compare_fcn (src, maxval, string_len) > 0)) { maxval = src; result = (GFC_INTEGER_8)n + 1; diff --git a/libgfortran/generated/maxloc2_16_s1.c b/libgfortran/generated/maxloc2_16_s1.c index bfba7074bcc..9efa7cb7778 100644 --- a/libgfortran/generated/maxloc2_16_s1.c +++ b/libgfortran/generated/maxloc2_16_s1.c @@ -53,7 +53,6 @@ maxloc2_16_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, gfc_char const GFC_INTEGER_1 *maxval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -62,15 +61,16 @@ maxloc2_16_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, gfc_char ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + maxval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; } + src += sstride; } return ret; } @@ -95,7 +95,6 @@ mmaxloc2_16_s1 (gfc_array_s1 * const restrict array, int mask_kind; index_type mstride; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -133,7 +132,8 @@ mmaxloc2_16_s1 (gfc_array_s1 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) > 0) + if (*mbase && (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/maxloc2_16_s4.c b/libgfortran/generated/maxloc2_16_s4.c index cf1235e92c9..65573f8da4c 100644 --- a/libgfortran/generated/maxloc2_16_s4.c +++ b/libgfortran/generated/maxloc2_16_s4.c @@ -53,7 +53,6 @@ maxloc2_16_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, gfc_char const GFC_INTEGER_4 *maxval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -62,15 +61,16 @@ maxloc2_16_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, gfc_char ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + maxval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; } + src += sstride; } return ret; } @@ -95,7 +95,6 @@ mmaxloc2_16_s4 (gfc_array_s4 * const restrict array, int mask_kind; index_type mstride; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -133,7 +132,8 @@ mmaxloc2_16_s4 (gfc_array_s4 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) > 0) + if (*mbase && (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/maxloc2_4_s1.c b/libgfortran/generated/maxloc2_4_s1.c index e88ecca6eb4..68e02f55134 100644 --- a/libgfortran/generated/maxloc2_4_s1.c +++ b/libgfortran/generated/maxloc2_4_s1.c @@ -53,7 +53,6 @@ maxloc2_4_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, gfc_charl const GFC_INTEGER_1 *maxval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -62,15 +61,16 @@ maxloc2_4_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, gfc_charl ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + maxval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; } + src += sstride; } return ret; } @@ -95,7 +95,6 @@ mmaxloc2_4_s1 (gfc_array_s1 * const restrict array, int mask_kind; index_type mstride; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -133,7 +132,8 @@ mmaxloc2_4_s1 (gfc_array_s1 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) > 0) + if (*mbase && (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/maxloc2_4_s4.c b/libgfortran/generated/maxloc2_4_s4.c index adeba9321ec..aa5a47aed4c 100644 --- a/libgfortran/generated/maxloc2_4_s4.c +++ b/libgfortran/generated/maxloc2_4_s4.c @@ -53,7 +53,6 @@ maxloc2_4_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, gfc_charl const GFC_INTEGER_4 *maxval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -62,15 +61,16 @@ maxloc2_4_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, gfc_charl ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + maxval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; } + src += sstride; } return ret; } @@ -95,7 +95,6 @@ mmaxloc2_4_s4 (gfc_array_s4 * const restrict array, int mask_kind; index_type mstride; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -133,7 +132,8 @@ mmaxloc2_4_s4 (gfc_array_s4 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) > 0) + if (*mbase && (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/maxloc2_8_s1.c b/libgfortran/generated/maxloc2_8_s1.c index 1a32e13949a..c9c316017b5 100644 --- a/libgfortran/generated/maxloc2_8_s1.c +++ b/libgfortran/generated/maxloc2_8_s1.c @@ -53,7 +53,6 @@ maxloc2_8_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, gfc_charl const GFC_INTEGER_1 *maxval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -62,15 +61,16 @@ maxloc2_8_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, gfc_charl ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + maxval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; } + src += sstride; } return ret; } @@ -95,7 +95,6 @@ mmaxloc2_8_s1 (gfc_array_s1 * const restrict array, int mask_kind; index_type mstride; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -133,7 +132,8 @@ mmaxloc2_8_s1 (gfc_array_s1 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) > 0) + if (*mbase && (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/maxloc2_8_s4.c b/libgfortran/generated/maxloc2_8_s4.c index ae22a51c527..f707b140c47 100644 --- a/libgfortran/generated/maxloc2_8_s4.c +++ b/libgfortran/generated/maxloc2_8_s4.c @@ -53,7 +53,6 @@ maxloc2_8_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, gfc_charl const GFC_INTEGER_4 *maxval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -62,15 +61,16 @@ maxloc2_8_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, gfc_charl ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + maxval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) > 0) + if (maxval == NULL || (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; } + src += sstride; } return ret; } @@ -95,7 +95,6 @@ mmaxloc2_8_s4 (gfc_array_s4 * const restrict array, int mask_kind; index_type mstride; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -133,7 +132,8 @@ mmaxloc2_8_s4 (gfc_array_s4 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) > 0) + if (*mbase && (back ? compare_fcn (src, maxval, len) >= 0 : + compare_fcn (src, maxval, len) > 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c index 2c6b865d60a..86c9fb90189 100644 --- a/libgfortran/generated/maxval_i1.c +++ b/libgfortran/generated/maxval_i1.c @@ -51,10 +51,6 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_i1 (gfc_array_i1 * const restrict retarray, *dest = (-GFC_INTEGER_1_HUGE-1); else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_1_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_i1 (gfc_array_i1 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c index 060463601a7..30a440e042a 100644 --- a/libgfortran/generated/maxval_i16.c +++ b/libgfortran/generated/maxval_i16.c @@ -51,10 +51,6 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_i16 (gfc_array_i16 * const restrict retarray, *dest = (-GFC_INTEGER_16_HUGE-1); else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_16_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c index bcd4343ae08..2a329060c39 100644 --- a/libgfortran/generated/maxval_i2.c +++ b/libgfortran/generated/maxval_i2.c @@ -51,10 +51,6 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_i2 (gfc_array_i2 * const restrict retarray, *dest = (-GFC_INTEGER_2_HUGE-1); else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_2_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_i2 (gfc_array_i2 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c index bef1c291c35..2954e8ada4a 100644 --- a/libgfortran/generated/maxval_i4.c +++ b/libgfortran/generated/maxval_i4.c @@ -51,10 +51,6 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_i4 (gfc_array_i4 * const restrict retarray, *dest = (-GFC_INTEGER_4_HUGE-1); else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_4_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c index 14deb70de47..fde234cfcbf 100644 --- a/libgfortran/generated/maxval_i8.c +++ b/libgfortran/generated/maxval_i8.c @@ -51,10 +51,6 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_i8 (gfc_array_i8 * const restrict retarray, *dest = (-GFC_INTEGER_8_HUGE-1); else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_8_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c index 85d6d83b24a..9671fdfc98f 100644 --- a/libgfortran/generated/maxval_r10.c +++ b/libgfortran/generated/maxval_r10.c @@ -51,10 +51,6 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_r10 (gfc_array_r10 * const restrict retarray, *dest = -GFC_REAL_10_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_10_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_r10 (gfc_array_r10 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c index 18ef36725a8..14e6ce0d091 100644 --- a/libgfortran/generated/maxval_r16.c +++ b/libgfortran/generated/maxval_r16.c @@ -51,10 +51,6 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_r16 (gfc_array_r16 * const restrict retarray, *dest = -GFC_REAL_16_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_16_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_r16 (gfc_array_r16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c index 862fe633c0c..9b5dba09818 100644 --- a/libgfortran/generated/maxval_r4.c +++ b/libgfortran/generated/maxval_r4.c @@ -51,10 +51,6 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_r4 (gfc_array_r4 * const restrict retarray, *dest = -GFC_REAL_4_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_4_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_r4 (gfc_array_r4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c index 9315483d39e..13f491114ab 100644 --- a/libgfortran/generated/maxval_r8.c +++ b/libgfortran/generated/maxval_r8.c @@ -51,10 +51,6 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ maxval_r8 (gfc_array_r8 * const restrict retarray, *dest = -GFC_REAL_8_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_8_QUIET_NAN) if (*src >= result) @@ -236,9 +234,6 @@ mmaxval_r8 (gfc_array_r8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minloc0_16_i1.c b/libgfortran/generated/minloc0_16_i1.c index 88720df56f7..1e1cd6180a3 100644 --- a/libgfortran/generated/minloc0_16_i1.c +++ b/libgfortran/generated/minloc0_16_i1.c @@ -47,7 +47,6 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_1_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_i1 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_i1 (gfc_array_i16 * const restrict, gfc_array_i1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_i1); diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c index 4e2b6d0ca54..b3663d6199d 100644 --- a/libgfortran/generated/minloc0_16_i16.c +++ b/libgfortran/generated/minloc0_16_i16.c @@ -47,7 +47,6 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_i16 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_i16 (gfc_array_i16 * const restrict, gfc_array_i16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_i16); diff --git a/libgfortran/generated/minloc0_16_i2.c b/libgfortran/generated/minloc0_16_i2.c index c9032c7a970..3a173ea6f37 100644 --- a/libgfortran/generated/minloc0_16_i2.c +++ b/libgfortran/generated/minloc0_16_i2.c @@ -47,7 +47,6 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_2_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_i2 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_i2 (gfc_array_i16 * const restrict, gfc_array_i2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_i2); diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c index a27405a3ff6..4141fa1f22f 100644 --- a/libgfortran/generated/minloc0_16_i4.c +++ b/libgfortran/generated/minloc0_16_i4.c @@ -47,7 +47,6 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_i4 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_i4 (gfc_array_i16 * const restrict, gfc_array_i4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_i4); diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c index 6874f66ae56..0d2f3504408 100644 --- a/libgfortran/generated/minloc0_16_i8.c +++ b/libgfortran/generated/minloc0_16_i8.c @@ -47,7 +47,6 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_i8 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_i8 (gfc_array_i16 * const restrict, gfc_array_i8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_i8); diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c index ad97459d443..3fd94099798 100644 --- a/libgfortran/generated/minloc0_16_r10.c +++ b/libgfortran/generated/minloc0_16_r10.c @@ -47,7 +47,6 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_10_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_r10 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_r10 (gfc_array_i16 * const restrict, gfc_array_r10 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_r10); diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c index f8245ed3059..d04fdda43c9 100644 --- a/libgfortran/generated/minloc0_16_r16.c +++ b/libgfortran/generated/minloc0_16_r16.c @@ -47,7 +47,6 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_r16 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_r16 (gfc_array_i16 * const restrict, gfc_array_r16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_r16); diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c index ed41783dd5e..8b029151031 100644 --- a/libgfortran/generated/minloc0_16_r4.c +++ b/libgfortran/generated/minloc0_16_r4.c @@ -47,7 +47,6 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_r4 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_r4 (gfc_array_i16 * const restrict, gfc_array_r4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_r4); diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c index 0799d4dfca8..45ab7874177 100644 --- a/libgfortran/generated/minloc0_16_r8.c +++ b/libgfortran/generated/minloc0_16_r8.c @@ -47,7 +47,6 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_16_r8 (gfc_array_i16 * const restrict retarray, } } - extern void sminloc0_16_r8 (gfc_array_i16 * const restrict, gfc_array_r8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_16_r8); diff --git a/libgfortran/generated/minloc0_16_s1.c b/libgfortran/generated/minloc0_16_s1.c index e566d749fb7..95a38a6b5d9 100644 --- a/libgfortran/generated/minloc0_16_s1.c +++ b/libgfortran/generated/minloc0_16_s1.c @@ -61,10 +61,6 @@ minloc0_16_s1 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ minloc0_16_s1 (gfc_array_i16 * const restrict retarray, { const GFC_INTEGER_1 *minval; - minval = base; + minval = NULL; while (base) { @@ -115,7 +111,8 @@ minloc0_16_s1 (gfc_array_i16 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, minval, len) < 0) + if (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0)) { minval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mminloc0_16_s1 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mminloc0_16_s1 (gfc_array_i16 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (minval == NULL || compare_fcn (base, minval, len) < 0)) + if (*mbase && + (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0))) { minval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/minloc0_16_s4.c b/libgfortran/generated/minloc0_16_s4.c index 2a0b13c240f..091afb7a6e9 100644 --- a/libgfortran/generated/minloc0_16_s4.c +++ b/libgfortran/generated/minloc0_16_s4.c @@ -61,10 +61,6 @@ minloc0_16_s4 (gfc_array_i16 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ minloc0_16_s4 (gfc_array_i16 * const restrict retarray, { const GFC_INTEGER_4 *minval; - minval = base; + minval = NULL; while (base) { @@ -115,7 +111,8 @@ minloc0_16_s4 (gfc_array_i16 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, minval, len) < 0) + if (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0)) { minval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mminloc0_16_s4 (gfc_array_i16 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mminloc0_16_s4 (gfc_array_i16 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (minval == NULL || compare_fcn (base, minval, len) < 0)) + if (*mbase && + (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0))) { minval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/minloc0_4_i1.c b/libgfortran/generated/minloc0_4_i1.c index 577c9ddf655..7120f000d89 100644 --- a/libgfortran/generated/minloc0_4_i1.c +++ b/libgfortran/generated/minloc0_4_i1.c @@ -47,7 +47,6 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_1_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_i1 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_i1 (gfc_array_i4 * const restrict, gfc_array_i1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_i1); diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c index 48da69e3982..c9debdbd457 100644 --- a/libgfortran/generated/minloc0_4_i16.c +++ b/libgfortran/generated/minloc0_4_i16.c @@ -47,7 +47,6 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_i16 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_i16 (gfc_array_i4 * const restrict, gfc_array_i16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_i16); diff --git a/libgfortran/generated/minloc0_4_i2.c b/libgfortran/generated/minloc0_4_i2.c index 815ea85c221..55fb58d4021 100644 --- a/libgfortran/generated/minloc0_4_i2.c +++ b/libgfortran/generated/minloc0_4_i2.c @@ -47,7 +47,6 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_2_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_i2 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_i2 (gfc_array_i4 * const restrict, gfc_array_i2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_i2); diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c index 36b0a58f250..351b4a1cc5c 100644 --- a/libgfortran/generated/minloc0_4_i4.c +++ b/libgfortran/generated/minloc0_4_i4.c @@ -47,7 +47,6 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_i4 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_i4 (gfc_array_i4 * const restrict, gfc_array_i4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_i4); diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c index a66280cd074..a736c59a105 100644 --- a/libgfortran/generated/minloc0_4_i8.c +++ b/libgfortran/generated/minloc0_4_i8.c @@ -47,7 +47,6 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_i8 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_i8 (gfc_array_i4 * const restrict, gfc_array_i8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_i8); diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c index 461ad0d477b..f714417518b 100644 --- a/libgfortran/generated/minloc0_4_r10.c +++ b/libgfortran/generated/minloc0_4_r10.c @@ -47,7 +47,6 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_10_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_r10 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_r10 (gfc_array_i4 * const restrict, gfc_array_r10 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_r10); diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c index 27e6d1d6a42..7d7ece40a95 100644 --- a/libgfortran/generated/minloc0_4_r16.c +++ b/libgfortran/generated/minloc0_4_r16.c @@ -47,7 +47,6 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_r16 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_r16 (gfc_array_i4 * const restrict, gfc_array_r16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_r16); diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c index 1b85544a292..74757394d33 100644 --- a/libgfortran/generated/minloc0_4_r4.c +++ b/libgfortran/generated/minloc0_4_r4.c @@ -47,7 +47,6 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_r4 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_r4 (gfc_array_i4 * const restrict, gfc_array_r4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_r4); diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c index 7c6d6bfbec2..0ac6e6b3264 100644 --- a/libgfortran/generated/minloc0_4_r8.c +++ b/libgfortran/generated/minloc0_4_r8.c @@ -47,7 +47,6 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_4_r8 (gfc_array_i4 * const restrict retarray, } } - extern void sminloc0_4_r8 (gfc_array_i4 * const restrict, gfc_array_r8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_4_r8); diff --git a/libgfortran/generated/minloc0_4_s1.c b/libgfortran/generated/minloc0_4_s1.c index 4d58df41b4f..aeb0ae9f425 100644 --- a/libgfortran/generated/minloc0_4_s1.c +++ b/libgfortran/generated/minloc0_4_s1.c @@ -61,10 +61,6 @@ minloc0_4_s1 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ minloc0_4_s1 (gfc_array_i4 * const restrict retarray, { const GFC_INTEGER_1 *minval; - minval = base; + minval = NULL; while (base) { @@ -115,7 +111,8 @@ minloc0_4_s1 (gfc_array_i4 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, minval, len) < 0) + if (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0)) { minval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mminloc0_4_s1 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mminloc0_4_s1 (gfc_array_i4 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (minval == NULL || compare_fcn (base, minval, len) < 0)) + if (*mbase && + (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0))) { minval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/minloc0_4_s4.c b/libgfortran/generated/minloc0_4_s4.c index bea56c06b3d..f5b59065863 100644 --- a/libgfortran/generated/minloc0_4_s4.c +++ b/libgfortran/generated/minloc0_4_s4.c @@ -61,10 +61,6 @@ minloc0_4_s4 (gfc_array_i4 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ minloc0_4_s4 (gfc_array_i4 * const restrict retarray, { const GFC_INTEGER_4 *minval; - minval = base; + minval = NULL; while (base) { @@ -115,7 +111,8 @@ minloc0_4_s4 (gfc_array_i4 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, minval, len) < 0) + if (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0)) { minval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mminloc0_4_s4 (gfc_array_i4 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mminloc0_4_s4 (gfc_array_i4 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (minval == NULL || compare_fcn (base, minval, len) < 0)) + if (*mbase && + (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0))) { minval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/minloc0_8_i1.c b/libgfortran/generated/minloc0_8_i1.c index b0bccc89b99..46dfa7807fd 100644 --- a/libgfortran/generated/minloc0_8_i1.c +++ b/libgfortran/generated/minloc0_8_i1.c @@ -47,7 +47,6 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_1_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_i1 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_i1 (gfc_array_i8 * const restrict, gfc_array_i1 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_i1); diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c index b4fb041b4a6..c3da87d0e76 100644 --- a/libgfortran/generated/minloc0_8_i16.c +++ b/libgfortran/generated/minloc0_8_i16.c @@ -47,7 +47,6 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_i16 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_i16 (gfc_array_i8 * const restrict, gfc_array_i16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_i16); diff --git a/libgfortran/generated/minloc0_8_i2.c b/libgfortran/generated/minloc0_8_i2.c index 13b39040f05..8455b7d406d 100644 --- a/libgfortran/generated/minloc0_8_i2.c +++ b/libgfortran/generated/minloc0_8_i2.c @@ -47,7 +47,6 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_2_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_i2 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_i2 (gfc_array_i8 * const restrict, gfc_array_i2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_i2); diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c index 5d4dc06353e..2b022167482 100644 --- a/libgfortran/generated/minloc0_8_i4.c +++ b/libgfortran/generated/minloc0_8_i4.c @@ -47,7 +47,6 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_i4 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_i4 (gfc_array_i8 * const restrict, gfc_array_i4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_i4); diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c index d4cf9a4a977..55aafa4c634 100644 --- a/libgfortran/generated/minloc0_8_i8.c +++ b/libgfortran/generated/minloc0_8_i8.c @@ -47,7 +47,6 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_i8 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_i8 (gfc_array_i8 * const restrict, gfc_array_i8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_i8); diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c index c74fe0f6e8b..14b8a62f510 100644 --- a/libgfortran/generated/minloc0_8_r10.c +++ b/libgfortran/generated/minloc0_8_r10.c @@ -47,7 +47,6 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_10_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_r10 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_r10 (gfc_array_i8 * const restrict, gfc_array_r10 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_r10); diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c index 0ce3fd7b803..e5c48fa77d6 100644 --- a/libgfortran/generated/minloc0_8_r16.c +++ b/libgfortran/generated/minloc0_8_r16.c @@ -47,7 +47,6 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_16_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_r16 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_r16 (gfc_array_i8 * const restrict, gfc_array_r16 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_r16); diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c index 66c5b74e40a..caba6a7d49b 100644 --- a/libgfortran/generated/minloc0_8_r4.c +++ b/libgfortran/generated/minloc0_8_r4.c @@ -47,7 +47,6 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_4_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_r4 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_r4 (gfc_array_i8 * const restrict, gfc_array_r4 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_r4); diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c index bd6b217f7f9..876e9cbae29 100644 --- a/libgfortran/generated/minloc0_8_r8.c +++ b/libgfortran/generated/minloc0_8_r8.c @@ -47,7 +47,6 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -101,13 +100,9 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_REAL_8_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -126,15 +121,29 @@ minloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { + else #endif - if (*base < minval) + if (back) + do + { + if (unlikely (*base <= minval)) { minval = *base; for (n = 0; n < rank; n++) dest[n * dstride] = count[n] + 1; } + base += sstride[0]; + } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*base < minval)) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -167,7 +176,6 @@ 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_l1 * const restrict, GFC_LOGICAL_4); @@ -190,7 +198,6 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; - assert(back == 0); rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -261,12 +268,8 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -294,14 +297,28 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, if (likely (fast)) continue; } - else do - { - if (*mbase && *base < minval) + else + if (back) + do { - minval = *base; - for (n = 0; n < rank; n++) - dest[n * dstride] = count[n] + 1; + if (unlikely (*mbase && (*base <= minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } + base += sstride[0]; } + while (++count[0] != extent[0]); + else + do + { + if (unlikely (*mbase && (*base < minval))) + { + minval = *base; + for (n = 0; n < rank; n++) + dest[n * dstride] = count[n] + 1; + } /* Implementation end. */ /* Advance to the next element. */ base += sstride[0]; @@ -337,7 +354,6 @@ mminloc0_8_r8 (gfc_array_i8 * const restrict retarray, } } - extern void sminloc0_8_r8 (gfc_array_i8 * const restrict, gfc_array_r8 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(sminloc0_8_r8); diff --git a/libgfortran/generated/minloc0_8_s1.c b/libgfortran/generated/minloc0_8_s1.c index dd9be96f3dc..68b1800b4a9 100644 --- a/libgfortran/generated/minloc0_8_s1.c +++ b/libgfortran/generated/minloc0_8_s1.c @@ -61,10 +61,6 @@ minloc0_8_s1 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ minloc0_8_s1 (gfc_array_i8 * const restrict retarray, { const GFC_INTEGER_1 *minval; - minval = base; + minval = NULL; while (base) { @@ -115,7 +111,8 @@ minloc0_8_s1 (gfc_array_i8 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, minval, len) < 0) + if (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0)) { minval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mminloc0_8_s1 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mminloc0_8_s1 (gfc_array_i8 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (minval == NULL || compare_fcn (base, minval, len) < 0)) + if (*mbase && + (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0))) { minval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/minloc0_8_s4.c b/libgfortran/generated/minloc0_8_s4.c index 46d29ec0b88..715e074312a 100644 --- a/libgfortran/generated/minloc0_8_s4.c +++ b/libgfortran/generated/minloc0_8_s4.c @@ -61,10 +61,6 @@ minloc0_8_s4 (gfc_array_i8 * const restrict retarray, index_type rank; index_type n; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif - rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -107,7 +103,7 @@ minloc0_8_s4 (gfc_array_i8 * const restrict retarray, { const GFC_INTEGER_4 *minval; - minval = base; + minval = NULL; while (base) { @@ -115,7 +111,8 @@ minloc0_8_s4 (gfc_array_i8 * const restrict retarray, { /* Implementation start. */ - if (compare_fcn (base, minval, len) < 0) + if (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0)) { minval = base; for (n = 0; n < rank; n++) @@ -177,9 +174,6 @@ mminloc0_8_s4 (gfc_array_i8 * const restrict retarray, index_type n; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif rank = GFC_DESCRIPTOR_RANK (array); if (rank <= 0) runtime_error ("Rank of array needs to be > 0"); @@ -250,7 +244,9 @@ mminloc0_8_s4 (gfc_array_i8 * const restrict retarray, { /* Implementation start. */ - if (*mbase && (minval == NULL || compare_fcn (base, minval, len) < 0)) + if (*mbase && + (minval == NULL || (back ? compare_fcn (base, minval, len) <= 0 : + compare_fcn (base, minval, len) < 0))) { minval = base; for (n = 0; n < rank; n++) diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c index 20197c4ae0d..132b2f1abae 100644 --- a/libgfortran/generated/minloc1_16_i1.c +++ b/libgfortran/generated/minloc1_16_i1.c @@ -54,10 +54,6 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_1_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_i1 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_i1 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c index fc718a894c6..83a8d5928c5 100644 --- a/libgfortran/generated/minloc1_16_i16.c +++ b/libgfortran/generated/minloc1_16_i16.c @@ -54,10 +54,6 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_i16 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_i16 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c index e9352b1d730..a22e2c71770 100644 --- a/libgfortran/generated/minloc1_16_i2.c +++ b/libgfortran/generated/minloc1_16_i2.c @@ -54,10 +54,6 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_2_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_i2 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_i2 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c index 9faa5b3947c..f384ff10f0a 100644 --- a/libgfortran/generated/minloc1_16_i4.c +++ b/libgfortran/generated/minloc1_16_i4.c @@ -54,10 +54,6 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_i4 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_i4 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c index 6ad4abedf04..72b75b0329d 100644 --- a/libgfortran/generated/minloc1_16_i8.c +++ b/libgfortran/generated/minloc1_16_i8.c @@ -54,10 +54,6 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_i8 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_i8 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c index 930d077cdf9..53cf97dbd24 100644 --- a/libgfortran/generated/minloc1_16_r10.c +++ b/libgfortran/generated/minloc1_16_r10.c @@ -54,10 +54,6 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_10_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_r10 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_r10 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c index 2003d8ff9ac..93193cf92d6 100644 --- a/libgfortran/generated/minloc1_16_r16.c +++ b/libgfortran/generated/minloc1_16_r16.c @@ -54,10 +54,6 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_r16 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_r16 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c index 7b9698342cb..14369b697dc 100644 --- a/libgfortran/generated/minloc1_16_r4.c +++ b/libgfortran/generated/minloc1_16_r4.c @@ -54,10 +54,6 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_r4 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_r4 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c index d6839157cb1..8dfe8ec3eff 100644 --- a/libgfortran/generated/minloc1_16_r8.c +++ b/libgfortran/generated/minloc1_16_r8.c @@ -54,10 +54,6 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_16_r8 (gfc_array_i16 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_16_r8 (gfc_array_i16 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_16)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_16)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_16) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_16_s1.c b/libgfortran/generated/minloc1_16_s1.c index 898d124fdd3..5fea33ae1f7 100644 --- a/libgfortran/generated/minloc1_16_s1.c +++ b/libgfortran/generated/minloc1_16_s1.c @@ -66,10 +66,6 @@ minloc1_16_s1 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ minloc1_16_s1 (gfc_array_i16 * const restrict retarray, { const GFC_INTEGER_1 *minval; - minval = base; - result = 1; + minval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ minloc1_16_s1 (gfc_array_i16 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, minval, string_len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_16)n + 1; @@ -244,9 +241,6 @@ mminloc1_16_s1 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mminloc1_16_s1 (gfc_array_i16 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, minval, string_len) < 0) + if (*msrc && (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_16)n + 1; diff --git a/libgfortran/generated/minloc1_16_s4.c b/libgfortran/generated/minloc1_16_s4.c index 82eb258e009..46411b113bb 100644 --- a/libgfortran/generated/minloc1_16_s4.c +++ b/libgfortran/generated/minloc1_16_s4.c @@ -66,10 +66,6 @@ minloc1_16_s4 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ minloc1_16_s4 (gfc_array_i16 * const restrict retarray, { const GFC_INTEGER_4 *minval; - minval = base; - result = 1; + minval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ minloc1_16_s4 (gfc_array_i16 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, minval, string_len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_16)n + 1; @@ -244,9 +241,6 @@ mminloc1_16_s4 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mminloc1_16_s4 (gfc_array_i16 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, minval, string_len) < 0) + if (*msrc && (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_16)n + 1; diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c index b36f2681fe4..ce9b926f22d 100644 --- a/libgfortran/generated/minloc1_4_i1.c +++ b/libgfortran/generated/minloc1_4_i1.c @@ -54,10 +54,6 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_1_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_i1 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_i1 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c index b4454e1aca7..871aa374a1a 100644 --- a/libgfortran/generated/minloc1_4_i16.c +++ b/libgfortran/generated/minloc1_4_i16.c @@ -54,10 +54,6 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_i16 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_i16 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c index f8ab77ccded..16f7e5ef7b7 100644 --- a/libgfortran/generated/minloc1_4_i2.c +++ b/libgfortran/generated/minloc1_4_i2.c @@ -54,10 +54,6 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_2_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_i2 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_i2 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c index 6523d01fc9e..08d919aabd0 100644 --- a/libgfortran/generated/minloc1_4_i4.c +++ b/libgfortran/generated/minloc1_4_i4.c @@ -54,10 +54,6 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_i4 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_i4 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c index ab1b6bae8b3..807f6fa016b 100644 --- a/libgfortran/generated/minloc1_4_i8.c +++ b/libgfortran/generated/minloc1_4_i8.c @@ -54,10 +54,6 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_i8 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_i8 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c index a481ec459d3..b2430c4ea6e 100644 --- a/libgfortran/generated/minloc1_4_r10.c +++ b/libgfortran/generated/minloc1_4_r10.c @@ -54,10 +54,6 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_10_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_r10 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_r10 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c index f5fcb666c59..e81a0a77e90 100644 --- a/libgfortran/generated/minloc1_4_r16.c +++ b/libgfortran/generated/minloc1_4_r16.c @@ -54,10 +54,6 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_r16 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_r16 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c index 212aa2541cb..b82aeeaf730 100644 --- a/libgfortran/generated/minloc1_4_r4.c +++ b/libgfortran/generated/minloc1_4_r4.c @@ -54,10 +54,6 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_r4 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_r4 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c index 1fa41f2e084..3476a5e5adb 100644 --- a/libgfortran/generated/minloc1_4_r8.c +++ b/libgfortran/generated/minloc1_4_r8.c @@ -54,10 +54,6 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_4_r8 (gfc_array_i4 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_4_r8 (gfc_array_i4 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_4)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_4)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_4) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_4_s1.c b/libgfortran/generated/minloc1_4_s1.c index 1b7e5514cc8..f0c583ffa52 100644 --- a/libgfortran/generated/minloc1_4_s1.c +++ b/libgfortran/generated/minloc1_4_s1.c @@ -66,10 +66,6 @@ minloc1_4_s1 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ minloc1_4_s1 (gfc_array_i4 * const restrict retarray, { const GFC_INTEGER_1 *minval; - minval = base; - result = 1; + minval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ minloc1_4_s1 (gfc_array_i4 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, minval, string_len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_4)n + 1; @@ -244,9 +241,6 @@ mminloc1_4_s1 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mminloc1_4_s1 (gfc_array_i4 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, minval, string_len) < 0) + if (*msrc && (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_4)n + 1; diff --git a/libgfortran/generated/minloc1_4_s4.c b/libgfortran/generated/minloc1_4_s4.c index b3c6010efda..eaafec1018b 100644 --- a/libgfortran/generated/minloc1_4_s4.c +++ b/libgfortran/generated/minloc1_4_s4.c @@ -66,10 +66,6 @@ minloc1_4_s4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ minloc1_4_s4 (gfc_array_i4 * const restrict retarray, { const GFC_INTEGER_4 *minval; - minval = base; - result = 1; + minval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ minloc1_4_s4 (gfc_array_i4 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, minval, string_len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_4)n + 1; @@ -244,9 +241,6 @@ mminloc1_4_s4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mminloc1_4_s4 (gfc_array_i4 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, minval, string_len) < 0) + if (*msrc && (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_4)n + 1; diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c index 66771b34523..f04fd8d72d8 100644 --- a/libgfortran/generated/minloc1_8_i1.c +++ b/libgfortran/generated/minloc1_8_i1.c @@ -54,10 +54,6 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_1_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_i1 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_i1 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c index 8c7bc1908e2..d42c5feea2e 100644 --- a/libgfortran/generated/minloc1_8_i16.c +++ b/libgfortran/generated/minloc1_8_i16.c @@ -54,10 +54,6 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_i16 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_i16 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c index e31acb53b72..134617d49f3 100644 --- a/libgfortran/generated/minloc1_8_i2.c +++ b/libgfortran/generated/minloc1_8_i2.c @@ -54,10 +54,6 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_2_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_i2 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_i2 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c index 4402bdd8ffe..20f0595ae1d 100644 --- a/libgfortran/generated/minloc1_8_i4.c +++ b/libgfortran/generated/minloc1_8_i4.c @@ -54,10 +54,6 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_i4 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_i4 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c index 172cbb5d138..653393c532e 100644 --- a/libgfortran/generated/minloc1_8_i8.c +++ b/libgfortran/generated/minloc1_8_i8.c @@ -54,10 +54,6 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_i8 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_i8 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c index 557e87616b6..a51a290db1f 100644 --- a/libgfortran/generated/minloc1_8_r10.c +++ b/libgfortran/generated/minloc1_8_r10.c @@ -54,10 +54,6 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_10_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_r10 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_r10 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index 184dd1e098f..e8e1b7452ad 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -54,10 +54,6 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_16_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c index fd810209258..f4a27e1c50d 100644 --- a/libgfortran/generated/minloc1_8_r4.c +++ b/libgfortran/generated/minloc1_8_r4.c @@ -54,10 +54,6 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_4_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_r4 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_r4 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c index fc0ff7c9076..4cd0df1209f 100644 --- a/libgfortran/generated/minloc1_8_r8.c +++ b/libgfortran/generated/minloc1_8_r8.c @@ -54,10 +54,6 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,10 +159,14 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_8_QUIET_NAN) + for (n = 0; n < len; n++, src += delta) + { if (*src <= minval) { minval = *src; @@ -174,14 +174,26 @@ minloc1_8_r8 (gfc_array_i8 * const restrict retarray, break; } } - for (; n < len; n++, src += delta) - { +#else + n = 0; #endif - if (*src < minval) - { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (back) + for (; n < len; n++, src += delta) + { + if (unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta) + { + if (unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; @@ -246,9 +258,6 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -396,13 +405,23 @@ mminloc1_8_r8 (gfc_array_i8 * const restrict retarray, result = result2; else #endif - for (; n < len; n++, src += delta, msrc += mdelta) - { - if (*msrc && *src < minval) + if (back) + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && unlikely (*src <= minval)) + { + minval = *src; + result = (GFC_INTEGER_8)n + 1; + } + } + else + for (; n < len; n++, src += delta, msrc += mdelta) { - minval = *src; - result = (GFC_INTEGER_8)n + 1; - } + if (*msrc && unlikely (*src < minval)) + { + minval = *src; + result = (GFC_INTEGER_8) n + 1; + } } *dest = result; } diff --git a/libgfortran/generated/minloc1_8_s1.c b/libgfortran/generated/minloc1_8_s1.c index b5b4fd50674..ee2547bc406 100644 --- a/libgfortran/generated/minloc1_8_s1.c +++ b/libgfortran/generated/minloc1_8_s1.c @@ -66,10 +66,6 @@ minloc1_8_s1 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ minloc1_8_s1 (gfc_array_i8 * const restrict retarray, { const GFC_INTEGER_1 *minval; - minval = base; - result = 1; + minval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ minloc1_8_s1 (gfc_array_i8 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, minval, string_len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_8)n + 1; @@ -244,9 +241,6 @@ mminloc1_8_s1 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mminloc1_8_s1 (gfc_array_i8 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, minval, string_len) < 0) + if (*msrc && (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_8)n + 1; diff --git a/libgfortran/generated/minloc1_8_s4.c b/libgfortran/generated/minloc1_8_s4.c index 4181630eca2..605c5de3aef 100644 --- a/libgfortran/generated/minloc1_8_s4.c +++ b/libgfortran/generated/minloc1_8_s4.c @@ -66,10 +66,6 @@ minloc1_8_s4 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -165,8 +161,8 @@ minloc1_8_s4 (gfc_array_i8 * const restrict retarray, { const GFC_INTEGER_4 *minval; - minval = base; - result = 1; + minval = NULL; + result = 0; if (len <= 0) *dest = 0; else @@ -174,7 +170,8 @@ minloc1_8_s4 (gfc_array_i8 * const restrict retarray, for (n = 0; n < len; n++, src += delta) { - if (compare_fcn (src, minval, string_len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_8)n + 1; @@ -244,9 +241,6 @@ mminloc1_8_s4 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; @@ -377,7 +371,8 @@ mminloc1_8_s4 (gfc_array_i8 * const restrict retarray, } for (; n < len; n++, src += delta, msrc += mdelta) { - if (*msrc && compare_fcn (src, minval, string_len) < 0) + if (*msrc && (back ? compare_fcn (src, minval, string_len) <= 0 : + compare_fcn (src, minval, string_len) < 0)) { minval = src; result = (GFC_INTEGER_8)n + 1; diff --git a/libgfortran/generated/minloc2_16_s1.c b/libgfortran/generated/minloc2_16_s1.c index 3685603ecc2..30fdd82d178 100644 --- a/libgfortran/generated/minloc2_16_s1.c +++ b/libgfortran/generated/minloc2_16_s1.c @@ -51,10 +51,9 @@ minloc2_16_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, index_type sstride; index_type extent; const GFC_INTEGER_1 *src; - const GFC_INTEGER_1 *maxval; + const GFC_INTEGER_1 *minval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -63,15 +62,16 @@ minloc2_16_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + minval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, len) <= 0 : + compare_fcn (src, minval, len) < 0)) { ret = i; - maxval = src; + minval = src; } + src += sstride; } return ret; } @@ -96,7 +96,6 @@ mminloc2_16_s1 (gfc_array_s1 * const restrict array, int mask_kind; index_type mstride; - assert (back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -134,7 +133,9 @@ mminloc2_16_s1 (gfc_array_s1 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) < 0) + + if (*mbase && (back ? compare_fcn (src, maxval, len) <= 0 : + compare_fcn (src, maxval, len) < 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/minloc2_16_s4.c b/libgfortran/generated/minloc2_16_s4.c index 256784fd8ce..4b0b873bd18 100644 --- a/libgfortran/generated/minloc2_16_s4.c +++ b/libgfortran/generated/minloc2_16_s4.c @@ -51,10 +51,9 @@ minloc2_16_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, index_type sstride; index_type extent; const GFC_INTEGER_4 *src; - const GFC_INTEGER_4 *maxval; + const GFC_INTEGER_4 *minval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -63,15 +62,16 @@ minloc2_16_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + minval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, len) <= 0 : + compare_fcn (src, minval, len) < 0)) { ret = i; - maxval = src; + minval = src; } + src += sstride; } return ret; } @@ -96,7 +96,6 @@ mminloc2_16_s4 (gfc_array_s4 * const restrict array, int mask_kind; index_type mstride; - assert (back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -134,7 +133,9 @@ mminloc2_16_s4 (gfc_array_s4 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) < 0) + + if (*mbase && (back ? compare_fcn (src, maxval, len) <= 0 : + compare_fcn (src, maxval, len) < 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/minloc2_4_s1.c b/libgfortran/generated/minloc2_4_s1.c index 1ba34d1712e..f4c8bb31e61 100644 --- a/libgfortran/generated/minloc2_4_s1.c +++ b/libgfortran/generated/minloc2_4_s1.c @@ -51,10 +51,9 @@ minloc2_4_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, index_type sstride; index_type extent; const GFC_INTEGER_1 *src; - const GFC_INTEGER_1 *maxval; + const GFC_INTEGER_1 *minval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -63,15 +62,16 @@ minloc2_4_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + minval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, len) <= 0 : + compare_fcn (src, minval, len) < 0)) { ret = i; - maxval = src; + minval = src; } + src += sstride; } return ret; } @@ -96,7 +96,6 @@ mminloc2_4_s1 (gfc_array_s1 * const restrict array, int mask_kind; index_type mstride; - assert (back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -134,7 +133,9 @@ mminloc2_4_s1 (gfc_array_s1 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) < 0) + + if (*mbase && (back ? compare_fcn (src, maxval, len) <= 0 : + compare_fcn (src, maxval, len) < 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/minloc2_4_s4.c b/libgfortran/generated/minloc2_4_s4.c index cd5053d71ff..8e973f0b1d0 100644 --- a/libgfortran/generated/minloc2_4_s4.c +++ b/libgfortran/generated/minloc2_4_s4.c @@ -51,10 +51,9 @@ minloc2_4_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, index_type sstride; index_type extent; const GFC_INTEGER_4 *src; - const GFC_INTEGER_4 *maxval; + const GFC_INTEGER_4 *minval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -63,15 +62,16 @@ minloc2_4_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + minval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, len) <= 0 : + compare_fcn (src, minval, len) < 0)) { ret = i; - maxval = src; + minval = src; } + src += sstride; } return ret; } @@ -96,7 +96,6 @@ mminloc2_4_s4 (gfc_array_s4 * const restrict array, int mask_kind; index_type mstride; - assert (back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -134,7 +133,9 @@ mminloc2_4_s4 (gfc_array_s4 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) < 0) + + if (*mbase && (back ? compare_fcn (src, maxval, len) <= 0 : + compare_fcn (src, maxval, len) < 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/minloc2_8_s1.c b/libgfortran/generated/minloc2_8_s1.c index 5c73d89f8e7..44b65bf24af 100644 --- a/libgfortran/generated/minloc2_8_s1.c +++ b/libgfortran/generated/minloc2_8_s1.c @@ -51,10 +51,9 @@ minloc2_8_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, index_type sstride; index_type extent; const GFC_INTEGER_1 *src; - const GFC_INTEGER_1 *maxval; + const GFC_INTEGER_1 *minval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -63,15 +62,16 @@ minloc2_8_s1 (gfc_array_s1 * const restrict array, GFC_LOGICAL_4 back, ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + minval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, len) <= 0 : + compare_fcn (src, minval, len) < 0)) { ret = i; - maxval = src; + minval = src; } + src += sstride; } return ret; } @@ -96,7 +96,6 @@ mminloc2_8_s1 (gfc_array_s1 * const restrict array, int mask_kind; index_type mstride; - assert (back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -134,7 +133,9 @@ mminloc2_8_s1 (gfc_array_s1 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) < 0) + + if (*mbase && (back ? compare_fcn (src, maxval, len) <= 0 : + compare_fcn (src, maxval, len) < 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/minloc2_8_s4.c b/libgfortran/generated/minloc2_8_s4.c index 9b40c9140cb..f6f9341bcbb 100644 --- a/libgfortran/generated/minloc2_8_s4.c +++ b/libgfortran/generated/minloc2_8_s4.c @@ -51,10 +51,9 @@ minloc2_8_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, index_type sstride; index_type extent; const GFC_INTEGER_4 *src; - const GFC_INTEGER_4 *maxval; + const GFC_INTEGER_4 *minval; index_type i; - assert(back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -63,15 +62,16 @@ minloc2_8_s4 (gfc_array_s4 * const restrict array, GFC_LOGICAL_4 back, ret = 1; src = array->base_addr; - maxval = src; - for (i=2; i<=extent; i++) + minval = NULL; + for (i=1; i<=extent; i++) { - src += sstride; - if (compare_fcn (src, maxval, len) < 0) + if (minval == NULL || (back ? compare_fcn (src, minval, len) <= 0 : + compare_fcn (src, minval, len) < 0)) { ret = i; - maxval = src; + minval = src; } + src += sstride; } return ret; } @@ -96,7 +96,6 @@ mminloc2_8_s4 (gfc_array_s4 * const restrict array, int mask_kind; index_type mstride; - assert (back == 0); extent = GFC_DESCRIPTOR_EXTENT(array,0); if (extent <= 0) return 0; @@ -134,7 +133,9 @@ mminloc2_8_s4 (gfc_array_s4 * const restrict array, for (i=j+1; i<=extent; i++) { - if (*mbase && compare_fcn (src, maxval, len) < 0) + + if (*mbase && (back ? compare_fcn (src, maxval, len) <= 0 : + compare_fcn (src, maxval, len) < 0)) { ret = i; maxval = src; diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c index 7bb6f81b0e7..d78c04603d0 100644 --- a/libgfortran/generated/minval_i1.c +++ b/libgfortran/generated/minval_i1.c @@ -51,10 +51,6 @@ minval_i1 (gfc_array_i1 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_i1 (gfc_array_i1 * const restrict retarray, *dest = GFC_INTEGER_1_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_1_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_i1 (gfc_array_i1 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c index b2608bc102d..1dc3cf57281 100644 --- a/libgfortran/generated/minval_i16.c +++ b/libgfortran/generated/minval_i16.c @@ -51,10 +51,6 @@ minval_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_i16 (gfc_array_i16 * const restrict retarray, *dest = GFC_INTEGER_16_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_16_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c index 6539ae10b60..ca8f11028e1 100644 --- a/libgfortran/generated/minval_i2.c +++ b/libgfortran/generated/minval_i2.c @@ -51,10 +51,6 @@ minval_i2 (gfc_array_i2 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_i2 (gfc_array_i2 * const restrict retarray, *dest = GFC_INTEGER_2_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_2_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_i2 (gfc_array_i2 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c index e2c16d2e8da..59fc3b6a5be 100644 --- a/libgfortran/generated/minval_i4.c +++ b/libgfortran/generated/minval_i4.c @@ -51,10 +51,6 @@ minval_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_i4 (gfc_array_i4 * const restrict retarray, *dest = GFC_INTEGER_4_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_4_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c index 9caafd97e04..7f6e5de483d 100644 --- a/libgfortran/generated/minval_i8.c +++ b/libgfortran/generated/minval_i8.c @@ -51,10 +51,6 @@ minval_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_i8 (gfc_array_i8 * const restrict retarray, *dest = GFC_INTEGER_8_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_INTEGER_8_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c index 308f64b25b3..5a91dd23f4e 100644 --- a/libgfortran/generated/minval_r10.c +++ b/libgfortran/generated/minval_r10.c @@ -51,10 +51,6 @@ minval_r10 (gfc_array_r10 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_r10 (gfc_array_r10 * const restrict retarray, *dest = GFC_REAL_10_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_10_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_r10 (gfc_array_r10 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c index 948aee092cf..3580e309835 100644 --- a/libgfortran/generated/minval_r16.c +++ b/libgfortran/generated/minval_r16.c @@ -51,10 +51,6 @@ minval_r16 (gfc_array_r16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_r16 (gfc_array_r16 * const restrict retarray, *dest = GFC_REAL_16_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_16_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_r16 (gfc_array_r16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c index b52a3e80f4d..d5c191e1b8c 100644 --- a/libgfortran/generated/minval_r4.c +++ b/libgfortran/generated/minval_r4.c @@ -51,10 +51,6 @@ minval_r4 (gfc_array_r4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_r4 (gfc_array_r4 * const restrict retarray, *dest = GFC_REAL_4_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_4_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_r4 (gfc_array_r4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c index 34caf05fc0c..b53093c53ec 100644 --- a/libgfortran/generated/minval_r8.c +++ b/libgfortran/generated/minval_r8.c @@ -51,10 +51,6 @@ minval_r8 (gfc_array_r8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -158,8 +154,10 @@ minval_r8 (gfc_array_r8 * const restrict retarray, *dest = GFC_REAL_8_HUGE; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif #if defined (GFC_REAL_8_QUIET_NAN) if (*src <= result) @@ -236,9 +234,6 @@ mminval_r8 (gfc_array_r8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/norm2_r10.c b/libgfortran/generated/norm2_r10.c index b6e5a4a51d3..7e24f36acb9 100644 --- a/libgfortran/generated/norm2_r10.c +++ b/libgfortran/generated/norm2_r10.c @@ -54,10 +54,6 @@ norm2_r10 (gfc_array_r10 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -159,8 +155,10 @@ norm2_r10 (gfc_array_r10 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif if (*src != 0) { diff --git a/libgfortran/generated/norm2_r16.c b/libgfortran/generated/norm2_r16.c index 32237dbd6d8..e796d642d97 100644 --- a/libgfortran/generated/norm2_r16.c +++ b/libgfortran/generated/norm2_r16.c @@ -58,10 +58,6 @@ norm2_r16 (gfc_array_r16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -163,8 +159,10 @@ norm2_r16 (gfc_array_r16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif if (*src != 0) { diff --git a/libgfortran/generated/norm2_r4.c b/libgfortran/generated/norm2_r4.c index 504d31306e9..313bda300fa 100644 --- a/libgfortran/generated/norm2_r4.c +++ b/libgfortran/generated/norm2_r4.c @@ -54,10 +54,6 @@ norm2_r4 (gfc_array_r4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -159,8 +155,10 @@ norm2_r4 (gfc_array_r4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif if (*src != 0) { diff --git a/libgfortran/generated/norm2_r8.c b/libgfortran/generated/norm2_r8.c index 60e707f9206..140e93a5270 100644 --- a/libgfortran/generated/norm2_r8.c +++ b/libgfortran/generated/norm2_r8.c @@ -54,10 +54,6 @@ norm2_r8 (gfc_array_r8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -159,8 +155,10 @@ norm2_r8 (gfc_array_r8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif if (*src != 0) { diff --git a/libgfortran/generated/parity_l1.c b/libgfortran/generated/parity_l1.c index 29207994250..7f62a936181 100644 --- a/libgfortran/generated/parity_l1.c +++ b/libgfortran/generated/parity_l1.c @@ -51,10 +51,6 @@ parity_l1 (gfc_array_l1 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ parity_l1 (gfc_array_l1 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result = result != *src; } diff --git a/libgfortran/generated/parity_l16.c b/libgfortran/generated/parity_l16.c index c1ac0b26f05..5b2cb386d31 100644 --- a/libgfortran/generated/parity_l16.c +++ b/libgfortran/generated/parity_l16.c @@ -51,10 +51,6 @@ parity_l16 (gfc_array_l16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ parity_l16 (gfc_array_l16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result = result != *src; } diff --git a/libgfortran/generated/parity_l2.c b/libgfortran/generated/parity_l2.c index c588e721a6e..daf56b14aa1 100644 --- a/libgfortran/generated/parity_l2.c +++ b/libgfortran/generated/parity_l2.c @@ -51,10 +51,6 @@ parity_l2 (gfc_array_l2 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ parity_l2 (gfc_array_l2 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result = result != *src; } diff --git a/libgfortran/generated/parity_l4.c b/libgfortran/generated/parity_l4.c index 0acb039c1af..3ddb70e622f 100644 --- a/libgfortran/generated/parity_l4.c +++ b/libgfortran/generated/parity_l4.c @@ -51,10 +51,6 @@ parity_l4 (gfc_array_l4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ parity_l4 (gfc_array_l4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result = result != *src; } diff --git a/libgfortran/generated/parity_l8.c b/libgfortran/generated/parity_l8.c index 84623dffe1b..ac1ae43c8ae 100644 --- a/libgfortran/generated/parity_l8.c +++ b/libgfortran/generated/parity_l8.c @@ -51,10 +51,6 @@ parity_l8 (gfc_array_l8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ parity_l8 (gfc_array_l8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result = result != *src; } diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c index 38e8251861e..bd41da8beed 100644 --- a/libgfortran/generated/product_c10.c +++ b/libgfortran/generated/product_c10.c @@ -51,10 +51,6 @@ product_c10 (gfc_array_c10 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_c10 (gfc_array_c10 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_c10 (gfc_array_c10 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c index d1c04ec9793..47f6dc016f2 100644 --- a/libgfortran/generated/product_c16.c +++ b/libgfortran/generated/product_c16.c @@ -51,10 +51,6 @@ product_c16 (gfc_array_c16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_c16 (gfc_array_c16 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_c16 (gfc_array_c16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c index d19cfaf6d89..d3d705b36b9 100644 --- a/libgfortran/generated/product_c4.c +++ b/libgfortran/generated/product_c4.c @@ -51,10 +51,6 @@ product_c4 (gfc_array_c4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_c4 (gfc_array_c4 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_c4 (gfc_array_c4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c index ed1e12afba7..2ff0e8ca9e9 100644 --- a/libgfortran/generated/product_c8.c +++ b/libgfortran/generated/product_c8.c @@ -51,10 +51,6 @@ product_c8 (gfc_array_c8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_c8 (gfc_array_c8 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_c8 (gfc_array_c8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c index 2e86e99e569..73cbbeb1306 100644 --- a/libgfortran/generated/product_i1.c +++ b/libgfortran/generated/product_i1.c @@ -51,10 +51,6 @@ product_i1 (gfc_array_i1 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_i1 (gfc_array_i1 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_i1 (gfc_array_i1 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c index f23890ef740..cefa13f2027 100644 --- a/libgfortran/generated/product_i16.c +++ b/libgfortran/generated/product_i16.c @@ -51,10 +51,6 @@ product_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_i16 (gfc_array_i16 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c index 762e5486ac6..b135023b261 100644 --- a/libgfortran/generated/product_i2.c +++ b/libgfortran/generated/product_i2.c @@ -51,10 +51,6 @@ product_i2 (gfc_array_i2 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_i2 (gfc_array_i2 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_i2 (gfc_array_i2 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c index ecf047029d5..78a513bfbc8 100644 --- a/libgfortran/generated/product_i4.c +++ b/libgfortran/generated/product_i4.c @@ -51,10 +51,6 @@ product_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_i4 (gfc_array_i4 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c index a9530ec6907..044c5066361 100644 --- a/libgfortran/generated/product_i8.c +++ b/libgfortran/generated/product_i8.c @@ -51,10 +51,6 @@ product_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_i8 (gfc_array_i8 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c index 613ed18e9e4..067890ebfa7 100644 --- a/libgfortran/generated/product_r10.c +++ b/libgfortran/generated/product_r10.c @@ -51,10 +51,6 @@ product_r10 (gfc_array_r10 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_r10 (gfc_array_r10 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_r10 (gfc_array_r10 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c index 9befd51edc4..2641379f02f 100644 --- a/libgfortran/generated/product_r16.c +++ b/libgfortran/generated/product_r16.c @@ -51,10 +51,6 @@ product_r16 (gfc_array_r16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_r16 (gfc_array_r16 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_r16 (gfc_array_r16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c index 5e356ee8bfc..6f104b2ebba 100644 --- a/libgfortran/generated/product_r4.c +++ b/libgfortran/generated/product_r4.c @@ -51,10 +51,6 @@ product_r4 (gfc_array_r4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_r4 (gfc_array_r4 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_r4 (gfc_array_r4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c index 4e98cfa113b..d70f88c41e9 100644 --- a/libgfortran/generated/product_r8.c +++ b/libgfortran/generated/product_r8.c @@ -51,10 +51,6 @@ product_r8 (gfc_array_r8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ product_r8 (gfc_array_r8 * const restrict retarray, *dest = 1; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result *= *src; } @@ -222,9 +220,6 @@ mproduct_r8 (gfc_array_r8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c index 6923594e01f..31d80497376 100644 --- a/libgfortran/generated/sum_c10.c +++ b/libgfortran/generated/sum_c10.c @@ -51,10 +51,6 @@ sum_c10 (gfc_array_c10 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_c10 (gfc_array_c10 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_c10 (gfc_array_c10 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c index 4ed50d04dd8..f9d5c1ec3fe 100644 --- a/libgfortran/generated/sum_c16.c +++ b/libgfortran/generated/sum_c16.c @@ -51,10 +51,6 @@ sum_c16 (gfc_array_c16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_c16 (gfc_array_c16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_c16 (gfc_array_c16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c index 9d5516a3b4a..66872ddbc04 100644 --- a/libgfortran/generated/sum_c4.c +++ b/libgfortran/generated/sum_c4.c @@ -51,10 +51,6 @@ sum_c4 (gfc_array_c4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_c4 (gfc_array_c4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_c4 (gfc_array_c4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c index 84684cbcd2e..9d0e57fdf27 100644 --- a/libgfortran/generated/sum_c8.c +++ b/libgfortran/generated/sum_c8.c @@ -51,10 +51,6 @@ sum_c8 (gfc_array_c8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_c8 (gfc_array_c8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_c8 (gfc_array_c8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c index f4407028de5..7fe696bc187 100644 --- a/libgfortran/generated/sum_i1.c +++ b/libgfortran/generated/sum_i1.c @@ -51,10 +51,6 @@ sum_i1 (gfc_array_i1 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_i1 (gfc_array_i1 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_i1 (gfc_array_i1 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c index 570f8f2c441..f1840d996bc 100644 --- a/libgfortran/generated/sum_i16.c +++ b/libgfortran/generated/sum_i16.c @@ -51,10 +51,6 @@ sum_i16 (gfc_array_i16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_i16 (gfc_array_i16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_i16 (gfc_array_i16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c index ea70d508886..f8e453b68fe 100644 --- a/libgfortran/generated/sum_i2.c +++ b/libgfortran/generated/sum_i2.c @@ -51,10 +51,6 @@ sum_i2 (gfc_array_i2 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_i2 (gfc_array_i2 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_i2 (gfc_array_i2 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c index 4915ec9feb4..e8dae17c81b 100644 --- a/libgfortran/generated/sum_i4.c +++ b/libgfortran/generated/sum_i4.c @@ -51,10 +51,6 @@ sum_i4 (gfc_array_i4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_i4 (gfc_array_i4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_i4 (gfc_array_i4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c index 53f6ec24fd4..0abbaf82622 100644 --- a/libgfortran/generated/sum_i8.c +++ b/libgfortran/generated/sum_i8.c @@ -51,10 +51,6 @@ sum_i8 (gfc_array_i8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_i8 (gfc_array_i8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_i8 (gfc_array_i8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c index 9552ed84cc8..012909bcaba 100644 --- a/libgfortran/generated/sum_r10.c +++ b/libgfortran/generated/sum_r10.c @@ -51,10 +51,6 @@ sum_r10 (gfc_array_r10 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_r10 (gfc_array_r10 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_r10 (gfc_array_r10 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c index 6c8320691bf..23420b88737 100644 --- a/libgfortran/generated/sum_r16.c +++ b/libgfortran/generated/sum_r16.c @@ -51,10 +51,6 @@ sum_r16 (gfc_array_r16 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_r16 (gfc_array_r16 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_r16 (gfc_array_r16 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c index 1595336bf30..09d8f05bf74 100644 --- a/libgfortran/generated/sum_r4.c +++ b/libgfortran/generated/sum_r4.c @@ -51,10 +51,6 @@ sum_r4 (gfc_array_r4 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_r4 (gfc_array_r4 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_r4 (gfc_array_r4 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c index 7c8a186ce76..0f45648b9a8 100644 --- a/libgfortran/generated/sum_r8.c +++ b/libgfortran/generated/sum_r8.c @@ -51,10 +51,6 @@ sum_r8 (gfc_array_r8 * const restrict retarray, index_type dim; int continue_loop; -#ifdef HAVE_BACK_ARG - assert(back == 0); -#endif - /* Make dim zero based to avoid confusion. */ rank = GFC_DESCRIPTOR_RANK (array) - 1; dim = (*pdim) - 1; @@ -154,8 +150,10 @@ sum_r8 (gfc_array_r8 * const restrict retarray, *dest = 0; else { +#if ! defined HAVE_BACK_ARG for (n = 0; n < len; n++, src += delta) { +#endif result += *src; } @@ -222,9 +220,6 @@ msum_r8 (gfc_array_r8 * const restrict retarray, index_type mdelta; int mask_kind; -#ifdef HAVE_BACK_ARG - assert (back == 0); -#endif dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; |