summaryrefslogtreecommitdiff
path: root/libgfortran/generated/maxval_i8.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/generated/maxval_i8.c')
-rw-r--r--libgfortran/generated/maxval_i8.c217
1 files changed, 129 insertions, 88 deletions
diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c
index 2ff17283e79..a979d6647b5 100644
--- a/libgfortran/generated/maxval_i8.c
+++ b/libgfortran/generated/maxval_i8.c
@@ -84,15 +84,15 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
size_t alloc_size, str;
for (n = 0; n < rank; n++)
- {
- if (n == 0)
+ {
+ if (n == 0)
str = 1;
- else
- str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+ else
+ str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
- }
+ }
retarray->offset = 0;
retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -128,7 +128,7 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
count[n] = 0;
dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
if (extent[n] <= 0)
- len = 0;
+ len = 0;
}
base = array->data;
@@ -142,17 +142,30 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
src = base;
{
- result = (-GFC_INTEGER_8_HUGE-1);
- if (len <= 0)
+#if defined (GFC_INTEGER_8_INFINITY)
+ result = -GFC_INTEGER_8_INFINITY;
+#else
+ result = (-GFC_INTEGER_8_HUGE-1);
+#endif
+ if (len <= 0)
*dest = (-GFC_INTEGER_8_HUGE-1);
else
{
for (n = 0; n < len; n++, src += delta)
{
- if (*src > result)
- result = *src;
- }
+#if defined (GFC_INTEGER_8_QUIET_NAN)
+ if (*src >= result)
+ break;
+ }
+ if (unlikely (n >= len))
+ result = GFC_INTEGER_8_QUIET_NAN;
+ else for (; n < len; n++, src += delta)
+ {
+#endif
+ if (*src > result)
+ result = *src;
+ }
*dest = result;
}
}
@@ -162,28 +175,28 @@ maxval_i8 (gfc_array_i8 * const restrict retarray,
dest += dstride[0];
n = 0;
while (count[n] == extent[n])
- {
- /* When we get to the end of a dimension, reset it and increment
- the next dimension. */
- count[n] = 0;
- /* We could precalculate these products, but this is a less
- frequently used path so probably not worth it. */
- base -= sstride[n] * extent[n];
- dest -= dstride[n] * extent[n];
- n++;
- if (n == rank)
- {
- /* Break out of the look. */
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ base -= sstride[n] * extent[n];
+ dest -= dstride[n] * extent[n];
+ n++;
+ if (n == rank)
+ {
+ /* Break out of the look. */
continue_loop = 0;
break;
- }
- else
- {
- count[n]++;
- base += sstride[n];
- dest += dstride[n];
- }
- }
+ }
+ else
+ {
+ count[n]++;
+ base += sstride[n];
+ dest += dstride[n];
+ }
+ }
}
}
@@ -263,15 +276,15 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
size_t alloc_size, str;
for (n = 0; n < rank; n++)
- {
- if (n == 0)
- str = 1;
- else
- str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+ {
+ if (n == 0)
+ str = 1;
+ else
+ str= GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
- }
+ }
alloc_size = sizeof (GFC_INTEGER_8) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
* extent[rank-1];
@@ -308,7 +321,7 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
count[n] = 0;
dstride[n] = GFC_DESCRIPTOR_STRIDE(retarray,n);
if (extent[n] <= 0)
- return;
+ return;
}
dest = retarray->data;
@@ -323,17 +336,45 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
msrc = mbase;
{
- result = (-GFC_INTEGER_8_HUGE-1);
- if (len <= 0)
+#if defined (GFC_INTEGER_8_INFINITY)
+ result = -GFC_INTEGER_8_INFINITY;
+#else
+ result = (-GFC_INTEGER_8_HUGE-1);
+#endif
+#if defined (GFC_INTEGER_8_QUIET_NAN)
+ int non_empty_p = 0;
+#endif
+ if (len <= 0)
*dest = (-GFC_INTEGER_8_HUGE-1);
else
{
for (n = 0; n < len; n++, src += delta, msrc += mdelta)
{
- if (*msrc && *src > result)
- result = *src;
- }
+#if defined (GFC_INTEGER_8_INFINITY) || defined (GFC_INTEGER_8_QUIET_NAN)
+ if (*msrc)
+ {
+#if defined (GFC_INTEGER_8_QUIET_NAN)
+ non_empty_p = 1;
+ if (*src >= result)
+#endif
+ break;
+ }
+ }
+ if (unlikely (n >= len))
+ {
+#if defined (GFC_INTEGER_8_QUIET_NAN)
+ result = non_empty_p ? GFC_INTEGER_8_QUIET_NAN : (-GFC_INTEGER_8_HUGE-1);
+#else
+ result = (-GFC_INTEGER_8_HUGE-1);
+#endif
+ }
+ else for (; n < len; n++, src += delta, msrc += mdelta)
+ {
+#endif
+ if (*msrc && *src > result)
+ result = *src;
+ }
*dest = result;
}
}
@@ -344,30 +385,30 @@ mmaxval_i8 (gfc_array_i8 * const restrict retarray,
dest += dstride[0];
n = 0;
while (count[n] == extent[n])
- {
- /* When we get to the end of a dimension, reset it and increment
- the next dimension. */
- count[n] = 0;
- /* We could precalculate these products, but this is a less
- frequently used path so probably not worth it. */
- base -= sstride[n] * extent[n];
- mbase -= mstride[n] * extent[n];
- dest -= dstride[n] * extent[n];
- n++;
- if (n == rank)
- {
- /* Break out of the look. */
- base = NULL;
- break;
- }
- else
- {
- count[n]++;
- base += sstride[n];
- mbase += mstride[n];
- dest += dstride[n];
- }
- }
+ {
+ /* When we get to the end of a dimension, reset it and increment
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ base -= sstride[n] * extent[n];
+ mbase -= mstride[n] * extent[n];
+ dest -= dstride[n] * extent[n];
+ n++;
+ if (n == rank)
+ {
+ /* Break out of the look. */
+ base = NULL;
+ break;
+ }
+ else
+ {
+ count[n]++;
+ base += sstride[n];
+ mbase += mstride[n];
+ dest += dstride[n];
+ }
+ }
}
}
@@ -415,10 +456,10 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
{
sstride[n] = GFC_DESCRIPTOR_STRIDE(array,n + 1);
extent[n] =
- GFC_DESCRIPTOR_EXTENT(array,n + 1);
+ GFC_DESCRIPTOR_EXTENT(array,n + 1);
if (extent[n] <= 0)
- extent[n] = 0;
+ extent[n] = 0;
}
if (retarray->data == NULL)
@@ -426,15 +467,15 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
size_t alloc_size, str;
for (n = 0; n < rank; n++)
- {
- if (n == 0)
- str = 1;
- else
- str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
+ {
+ if (n == 0)
+ str = 1;
+ else
+ str = GFC_DESCRIPTOR_STRIDE(retarray,n-1) * extent[n-1];
GFC_DIMENSION_SET(retarray->dim[n], 0, extent[n] - 1, str);
- }
+ }
retarray->offset = 0;
retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
@@ -490,21 +531,21 @@ smaxval_i8 (gfc_array_i8 * const restrict retarray,
dest += dstride[0];
n = 0;
while (count[n] == extent[n])
- {
+ {
/* When we get to the end of a dimension, reset it and increment
- the next dimension. */
- count[n] = 0;
- /* We could precalculate these products, but this is a less
- frequently used path so probably not worth it. */
- dest -= dstride[n] * extent[n];
- n++;
- if (n == rank)
+ the next dimension. */
+ count[n] = 0;
+ /* We could precalculate these products, but this is a less
+ frequently used path so probably not worth it. */
+ dest -= dstride[n] * extent[n];
+ n++;
+ if (n == rank)
return;
- else
- {
- count[n]++;
- dest += dstride[n];
- }
+ else
+ {
+ count[n]++;
+ dest += dstride[n];
+ }
}
}
}