* tree-outof-ssa.h (ssaexpand): Add partitions_for_undefined_values.
[official-gcc.git] / libgfortran / m4 / minloc0.m4
blob90090dc35705d3233b2e36a09c8678c78f4bb67a
1 `/* Implementation of the MINLOC intrinsic
2    Copyright (C) 2002-2017 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"'
28 include(iparm.m4)dnl
29 include(iforeach.m4)dnl
31 `#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
33 FOREACH_FUNCTION(
34 `    atype_name minval;
35 #if defined('atype_nan`)
36     int fast = 0;
37 #endif
39 #if defined('atype_inf`)
40     minval = atype_inf;
41 #else
42     minval = atype_max;
43 #endif',
44 `#if defined('atype_nan`)
45         }
46       while (0);
47       if (unlikely (!fast))
48         {
49           do
50             {
51               if (*base <= minval)
52                 {
53                   fast = 1;
54                   minval = *base;
55                   for (n = 0; n < rank; n++)
56                     dest[n * dstride] = count[n] + 1;
57                   break;
58                 }
59               base += sstride[0];
60             }
61           while (++count[0] != extent[0]);
62           if (likely (fast))
63             continue;
64         }
65       else do
66         {
67 #endif
68           if (*base < minval)
69             {
70               minval = *base;
71               for (n = 0; n < rank; n++)
72                 dest[n * dstride] = count[n] + 1;
73             }')
75 MASKED_FOREACH_FUNCTION(
76 `  atype_name minval;
77    int fast = 0;
79 #if defined('atype_inf`)
80     minval = atype_inf;
81 #else
82     minval = atype_max;
83 #endif',
84 `       }
85       while (0);
86       if (unlikely (!fast))
87         {
88           do
89             {
90               if (*mbase)
91                 {
92 #if defined('atype_nan`)
93                   if (unlikely (dest[0] == 0))
94                     for (n = 0; n < rank; n++)
95                       dest[n * dstride] = count[n] + 1;
96                   if (*base <= minval)
97 #endif
98                     {
99                       fast = 1;
100                       minval = *base;
101                       for (n = 0; n < rank; n++)
102                         dest[n * dstride] = count[n] + 1;
103                       break;
104                     }
105                 }
106               base += sstride[0];
107               mbase += mstride[0];
108             }
109           while (++count[0] != extent[0]);
110           if (likely (fast))
111             continue;
112         }
113       else do
114         {
115           if (*mbase && *base < minval)
116             {
117               minval = *base;
118               for (n = 0; n < rank; n++)
119                 dest[n * dstride] = count[n] + 1;
120             }')
122 SCALAR_FOREACH_FUNCTION(`0')
123 #endif