1 `/* Implementation of the MINLOC intrinsic
2 Copyright (C) 2002-2018 Free Software Foundation, Inc.
3 Contributed by Paul Brook <paul@nowt.org>
5 This file is part of the GNU Fortran 95 runtime library (libgfortran).
7 Libgfortran is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either
10 version 3 of the License, or (at your option) any later version.
12 Libgfortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 Under Section 7 of GPL version 3, you are granted additional
18 permissions described in the GCC Runtime Library Exception, version
19 3.1, as published by the Free Software Foundation.
21 You should have received a copy of the GNU General Public License and
22 a copy of the GCC Runtime Library Exception along with this program;
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 <http://www.gnu.org/licenses/>. */
26 #include "libgfortran.h"
30 include(iforeach.m4)dnl
32 `#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
36 #if defined('atype_nan`)
40 #if defined('atype_inf`)
45 `#if defined('atype_nan`)
54 for (n = 0; n < rank; n++)
55 dest[n * dstride] = count[n] + 1;
60 while (++count[0] != extent[0]);
69 if (unlikely (*base <= minval))
72 for (n = 0; n < rank; n++)
73 dest[n * dstride] = count[n] + 1;
77 while (++count[0] != extent[0]);
81 if (unlikely (*base < minval))
84 for (n = 0; n < rank; n++)
85 dest[n * dstride] = count[n] + 1;
87 MASKED_FOREACH_FUNCTION(
91 #if defined('atype_inf`)
96 ` if (unlikely (!fast))
102 #if defined('atype_nan`)
103 if (unlikely (dest[0] == 0))
104 for (n = 0; n < rank; n++)
105 dest[n * dstride] = count[n] + 1;
111 for (n = 0; n < rank; n++)
112 dest[n * dstride] = count[n] + 1;
119 while (++count[0] != extent[0]);
127 if (unlikely (*mbase && (*base <= minval)))
130 for (n = 0; n < rank; n++)
131 dest[n * dstride] = count[n] + 1;
135 while (++count[0] != extent[0]);
139 if (unlikely (*mbase && (*base < minval)))
142 for (n = 0; n < rank; n++)
143 dest[n * dstride] = count[n] + 1;
145 SCALAR_FOREACH_FUNCTION(`0')