Mercurial > hg > CbC > CbC_gcc
diff libgfortran/generated/maxloc0_8_i2.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/libgfortran/generated/maxloc0_8_i2.c Fri Oct 27 22:46:09 2017 +0900 +++ b/libgfortran/generated/maxloc0_8_i2.c Thu Oct 25 07:37:49 2018 +0900 @@ -1,5 +1,5 @@ /* Implementation of the MAXLOC intrinsic - Copyright (C) 2002-2017 Free Software Foundation, Inc. + Copyright (C) 2002-2018 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> This file is part of the GNU Fortran 95 runtime library (libgfortran). @@ -24,18 +24,19 @@ <http://www.gnu.org/licenses/>. */ #include "libgfortran.h" +#include <assert.h> #if defined (HAVE_GFC_INTEGER_2) && defined (HAVE_GFC_INTEGER_8) extern void maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, - gfc_array_i2 * const restrict array); + gfc_array_i2 * const restrict array, GFC_LOGICAL_4); export_proto(maxloc0_8_i2); void maxloc0_8_i2 (gfc_array_i8 * const restrict retarray, - gfc_array_i2 * const restrict array) + gfc_array_i2 * const restrict array, GFC_LOGICAL_4 back) { index_type count[GFC_MAX_DIMENSIONS]; index_type extent[GFC_MAX_DIMENSIONS]; @@ -53,7 +54,7 @@ if (retarray->base_addr == NULL) { GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); - retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->dtype.rank = 1; retarray->offset = 0; retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } @@ -99,13 +100,9 @@ #endif while (base) { - do - { /* Implementation start. */ #if defined(GFC_INTEGER_2_QUIET_NAN) - } - while (0); if (unlikely (!fast)) { do @@ -124,15 +121,29 @@ 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]; @@ -165,15 +176,15 @@ } } - extern void mmaxloc0_8_i2 (gfc_array_i8 * const restrict, - gfc_array_i2 * const restrict, gfc_array_l1 * const restrict); + gfc_array_i2 * const restrict, gfc_array_l1 * const restrict, + GFC_LOGICAL_4); export_proto(mmaxloc0_8_i2); void mmaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, gfc_array_i2 * const restrict array, - gfc_array_l1 * const restrict mask) + gfc_array_l1 * const restrict mask, GFC_LOGICAL_4 back) { index_type count[GFC_MAX_DIMENSIONS]; index_type extent[GFC_MAX_DIMENSIONS]; @@ -194,7 +205,7 @@ if (retarray->base_addr == NULL) { GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1); - retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->dtype.rank = 1; retarray->offset = 0; retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); } @@ -257,12 +268,8 @@ #endif while (base) { - do - { /* Implementation start. */ - } - while (0); if (unlikely (!fast)) { do @@ -290,14 +297,28 @@ 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]; @@ -335,13 +356,13 @@ extern void smaxloc0_8_i2 (gfc_array_i8 * const restrict, - gfc_array_i2 * const restrict, GFC_LOGICAL_4 *); + gfc_array_i2 * const restrict, GFC_LOGICAL_4 *, GFC_LOGICAL_4); export_proto(smaxloc0_8_i2); void smaxloc0_8_i2 (gfc_array_i8 * const restrict retarray, gfc_array_i2 * const restrict array, - GFC_LOGICAL_4 * mask) + GFC_LOGICAL_4 * mask, GFC_LOGICAL_4 back) { index_type rank; index_type dstride; @@ -350,7 +371,7 @@ if (*mask) { - maxloc0_8_i2 (retarray, array); + maxloc0_8_i2 (retarray, array, back); return; } @@ -362,7 +383,7 @@ if (retarray->base_addr == NULL) { GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1); - retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1; + retarray->dtype.rank = 1; retarray->offset = 0; retarray->base_addr = xmallocarray (rank, sizeof (GFC_INTEGER_8)); }