OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgfortran/] [m4/] [minloc0.m4] - Blame information for rev 733

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 733 jeremybenn
`/* Implementation of the MINLOC intrinsic
2
   Copyright 2002, 2007, 2009 Free Software Foundation, Inc.
3
   Contributed by Paul Brook <paul@nowt.org>
4
 
5
This file is part of the GNU Fortran 95 runtime library (libgfortran).
6
 
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.
11
 
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.
16
 
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.
20
 
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/>.  */
25
 
26
#include "libgfortran.h"
27
#include <stdlib.h>
28
#include <assert.h>
29
#include <limits.h>'
30
 
31
include(iparm.m4)dnl
32
include(iforeach.m4)dnl
33
 
34
`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
35
 
36
FOREACH_FUNCTION(
37
`    atype_name minval;
38
#if defined('atype_nan`)
39
    int fast = 0;
40
#endif
41
 
42
#if defined('atype_inf`)
43
    minval = atype_inf;
44
#else
45
    minval = atype_max;
46
#endif',
47
`#if defined('atype_nan`)
48
        }
49
      while (0);
50
      if (unlikely (!fast))
51
        {
52
          do
53
            {
54
              if (*base <= minval)
55
                {
56
                  fast = 1;
57
                  minval = *base;
58
                  for (n = 0; n < rank; n++)
59
                    dest[n * dstride] = count[n] + 1;
60
                  break;
61
                }
62
              base += sstride[0];
63
            }
64
          while (++count[0] != extent[0]);
65
          if (likely (fast))
66
            continue;
67
        }
68
      else do
69
        {
70
#endif
71
          if (*base < minval)
72
            {
73
              minval = *base;
74
              for (n = 0; n < rank; n++)
75
                dest[n * dstride] = count[n] + 1;
76
            }')
77
 
78
MASKED_FOREACH_FUNCTION(
79
`  atype_name minval;
80
   int fast = 0;
81
 
82
#if defined('atype_inf`)
83
    minval = atype_inf;
84
#else
85
    minval = atype_max;
86
#endif',
87
`       }
88
      while (0);
89
      if (unlikely (!fast))
90
        {
91
          do
92
            {
93
              if (*mbase)
94
                {
95
#if defined('atype_nan`)
96
                  if (unlikely (dest[0] == 0))
97
                    for (n = 0; n < rank; n++)
98
                      dest[n * dstride] = count[n] + 1;
99
                  if (*base <= minval)
100
#endif
101
                    {
102
                      fast = 1;
103
                      minval = *base;
104
                      for (n = 0; n < rank; n++)
105
                        dest[n * dstride] = count[n] + 1;
106
                      break;
107
                    }
108
                }
109
              base += sstride[0];
110
              mbase += mstride[0];
111
            }
112
          while (++count[0] != extent[0]);
113
          if (likely (fast))
114
            continue;
115
        }
116
      else do
117
        {
118
          if (*mbase && *base < minval)
119
            {
120
              minval = *base;
121
              for (n = 0; n < rank; n++)
122
                dest[n * dstride] = count[n] + 1;
123
            }')
124
 
125
SCALAR_FOREACH_FUNCTION(`0')
126
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.