diff options
Diffstat (limited to 'libgfortran/generated/minloc1_16_i2.c')
-rw-r--r-- | libgfortran/generated/minloc1_16_i2.c | 59 |
1 files changed, 39 insertions, 20 deletions
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; } |