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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 733 jeremybenn
`/* Implementation of the MAXLOC intrinsic
2
   Copyright 2002, 2007, 2009, 2010 Free Software Foundation, Inc.
3
   Contributed by Paul Brook <paul@nowt.org>
4
 
5
This file is part of the GNU Fortran 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(ifunction.m4)dnl
33
 
34
`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
35
 
36
ARRAY_FUNCTION(0,
37
`       atype_name maxval;
38
#if defined ('atype_inf`)
39
        maxval = -atype_inf;
40
#else
41
        maxval = atype_min;
42
#endif
43
        result = 1;',
44
`#if defined ('atype_nan`)
45
                if (*src >= maxval)
46
                  {
47
                    maxval = *src;
48
                    result = (rtype_name)n + 1;
49
                    break;
50
                  }
51
              }
52
            for (; n < len; n++, src += delta)
53
              {
54
#endif
55
                if (*src > maxval)
56
                  {
57
                    maxval = *src;
58
                    result = (rtype_name)n + 1;
59
                  }', `')
60
 
61
MASKED_ARRAY_FUNCTION(0,
62
`       atype_name maxval;
63
#if defined ('atype_inf`)
64
        maxval = -atype_inf;
65
#else
66
        maxval = atype_min;
67
#endif
68
#if defined ('atype_nan`)
69
        rtype_name result2 = 0;
70
#endif
71
        result = 0;',
72
`               if (*msrc)
73
                  {
74
#if defined ('atype_nan`)
75
                    if (!result2)
76
                      result2 = (rtype_name)n + 1;
77
                    if (*src >= maxval)
78
#endif
79
                      {
80
                        maxval = *src;
81
                        result = (rtype_name)n + 1;
82
                        break;
83
                      }
84
                  }
85
              }
86
#if defined ('atype_nan`)
87
            if (unlikely (n >= len))
88
              result = result2;
89
            else
90
#endif
91
            for (; n < len; n++, src += delta, msrc += mdelta)
92
              {
93
                if (*msrc && *src > maxval)
94
                  {
95
                    maxval = *src;
96
                    result = (rtype_name)n + 1;
97
                  }')
98
 
99
SCALAR_ARRAY_FUNCTION(0)
100
 
101
#endif

powered by: WebSVN 2.1.0

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