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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [cdce3.C] - Blame information for rev 320

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
/* { dg-do run } */
2
/* { dg-require-effective-target c99_runtime } */
3
/* { dg-skip-if "exp2* missing despite C99 runtime" { alpha*-dec-osf5* } } */
4
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details  -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { pow10 && large_long_double } } } */
5
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { {! pow10 } && large_long_double } } } */
6
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target { pow10 && {! large_long_double } } } } */
7
/* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! pow10 } && {! large_long_double } } } } */
8
/* { dg-add-options ieee } */
9
/* { dg-final { scan-tree-dump  "cdce3.C:93: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
10
/* { dg-final { scan-tree-dump  "cdce3.C:94: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
11
/* { dg-final { scan-tree-dump  "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
12
/* { dg-final { scan-tree-dump  "cdce3.C:97: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
13
/* { dg-final { scan-tree-dump  "cdce3.C:98: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
14
/* { dg-final { scan-tree-dump  "cdce3.C:99: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
15
/* { dg-final { scan-tree-dump  "cdce3.C:100: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
16
/* { dg-final { scan-tree-dump  "cdce3.C:101: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
17
/* { dg-final { scan-tree-dump  "cdce3.C:102: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
18
/* { dg-final { scan-tree-dump  "cdce3.C:103: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
19
/* { dg-final { scan-tree-dump  "cdce3.C:104: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
20
/* { dg-final { scan-tree-dump  "cdce3.C:105: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
21
/* { dg-final { scan-tree-dump  "cdce3.C:106: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
22
/* { dg-final { scan-tree-dump  "cdce3.C:107: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
23
/* { dg-final { scan-tree-dump  "cdce3.C:108: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
24
/* { dg-final { scan-tree-dump  "cdce3.C:109: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
25
/* { dg-final { cleanup-tree-dump "cdce" } } */
26
#include 
27
#include 
28
#ifdef DEBUG
29
#include 
30
#endif
31
#include 
32
typedef void (*FP) (int xp);
33
#define NI __attribute__((noinline))
34
 
35
#if defined(LARGE_LONG_DOUBLE)
36
typedef long double ldouble;
37
ldouble result;
38
 
39
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
40
{ \
41
  float yy = name##f ((float) x); \
42
  STORE_RESULT; \
43
} \
44
NI void prefix##name (int x) \
45
{ \
46
  double yy = name ((double)x); \
47
  STORE_RESULT; \
48
} \
49
NI void prefix##name##l (int x) \
50
{ \
51
  ldouble yy = name##l ((ldouble)x); \
52
  STORE_RESULT; \
53
}
54
#else
55
double result;
56
 
57
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
58
{ \
59
  float yy = name##f ((float) x); \
60
  STORE_RESULT; \
61
} \
62
NI void prefix##name (int x) \
63
{ \
64
  double yy = name ((double)x); \
65
  STORE_RESULT; \
66
}
67
#endif
68
 
69
#undef STORE_RESULT
70
#define STORE_RESULT result = yy
71
#if defined(GNU_EXTENSION)
72
DEF_MATH_FUNC (m,pow10)
73
DEF_MATH_FUNC (m,exp10)
74
#endif
75
DEF_MATH_FUNC (m,exp2)
76
DEF_MATH_FUNC (m,exp)
77
DEF_MATH_FUNC (m,expm1)
78
DEF_MATH_FUNC (m,cosh)
79
DEF_MATH_FUNC (m,sinh)
80
DEF_MATH_FUNC (m,acos)
81
DEF_MATH_FUNC (m,asin)
82
DEF_MATH_FUNC (m,acosh)
83
DEF_MATH_FUNC (m,atanh)
84
DEF_MATH_FUNC (m,log)
85
DEF_MATH_FUNC (m,log2)
86
DEF_MATH_FUNC (m,log10)
87
DEF_MATH_FUNC (m,log1p)
88
DEF_MATH_FUNC (m,sqrt)
89
 
90
#undef STORE_RESULT
91
#define STORE_RESULT
92
#if defined(GNU_EXTENSION)
93
DEF_MATH_FUNC (o,pow10)
94
DEF_MATH_FUNC (o,exp10)
95
#endif
96
DEF_MATH_FUNC (o,exp2)
97
DEF_MATH_FUNC (o,exp)
98
DEF_MATH_FUNC (o,expm1)
99
DEF_MATH_FUNC (o,cosh)
100
DEF_MATH_FUNC (o,sinh)
101
DEF_MATH_FUNC (o,acos)
102
DEF_MATH_FUNC (o,asin)
103
DEF_MATH_FUNC (o,acosh)
104
DEF_MATH_FUNC (o,atanh)
105
DEF_MATH_FUNC (o,log)
106
DEF_MATH_FUNC (o,log2)
107
DEF_MATH_FUNC (o,log10)
108
DEF_MATH_FUNC (o,log1p)
109
DEF_MATH_FUNC (o,sqrt)
110
 
111
#if defined(LARGE_LONG_DOUBLE)
112
#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
113
{ prefix##name, #name, 0, 0, lb, ub }, \
114
{ prefix##name##l, #name "l" , 0, 0, lb, ub },
115
#else
116
#define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
117
{ prefix##name, #name, 0, 0, lb, ub },
118
#endif
119
 
120
struct MathFuncInfo
121
{
122
  FP math_func;
123
  const char*  name;
124
  int lb;
125
  int ub;
126
  bool has_lb;
127
  bool has_ub;
128
} math_func_arr[] = {
129
#if defined(GNU_EXTENSION)
130
  INIT_MATH_FUNC (m,pow10, false, true)
131
  INIT_MATH_FUNC (m,exp10, false, true)
132
#endif
133
  INIT_MATH_FUNC (m,exp2, false, true)
134
  INIT_MATH_FUNC (m,expm1, false, true)
135
  INIT_MATH_FUNC (m,exp, false, true)
136
  INIT_MATH_FUNC (m,cosh, true, true)
137
  INIT_MATH_FUNC (m,sinh, true, true)
138
  INIT_MATH_FUNC (m,acos, true, true)
139
  INIT_MATH_FUNC (m,asin, true, true)
140
  INIT_MATH_FUNC (m,acosh, true, false)
141
  INIT_MATH_FUNC (m,atanh, true, true)
142
  INIT_MATH_FUNC (m,log10, true, false)
143
  INIT_MATH_FUNC (m,log, true, false)
144
  INIT_MATH_FUNC (m,log2, true, false)
145
  INIT_MATH_FUNC (m,log1p, true, false)
146
  INIT_MATH_FUNC (m,sqrt, true, false)
147
  { 0, 0,  0, 0, 0, 0} };
148
 
149
MathFuncInfo opt_math_func_arr[] =
150
{
151
#if defined(GNU_EXTENSION)
152
  INIT_MATH_FUNC (o,pow10, false, true)
153
  INIT_MATH_FUNC (o,exp10, false, true)
154
#endif
155
  INIT_MATH_FUNC (o,exp2, false, true)
156
  INIT_MATH_FUNC (o,expm1, false, true)
157
  INIT_MATH_FUNC (o,exp, false, true)
158
  INIT_MATH_FUNC (o,cosh, true, true)
159
  INIT_MATH_FUNC (o,sinh, true, true)
160
  INIT_MATH_FUNC (o,acos, true, true)
161
  INIT_MATH_FUNC (o,asin, true, true)
162
  INIT_MATH_FUNC (o,acosh, true, false)
163
  INIT_MATH_FUNC (o,atanh, true, true)
164
  INIT_MATH_FUNC (o,log10, true, false)
165
  INIT_MATH_FUNC (o,log, true, false)
166
  INIT_MATH_FUNC (o,log2, true, false)
167
  INIT_MATH_FUNC (o,log1p, true, false)
168
  INIT_MATH_FUNC (o,sqrt, true, false)
169
  { 0, 0,  0, 0, 0, 0} };
170
 
171
int test (MathFuncInfo* math_func_infos)
172
{
173
  int i = 0;
174
  int te = 0;
175
 
176
  for (i = 0; math_func_infos[i].math_func; i++)
177
    {
178
      MathFuncInfo& info = math_func_infos[i];
179
      int j;
180
      if (info.has_lb)
181
        {
182
          for (j = 0; j > -500000; j--)
183
            {
184
 
185
              errno = 0;
186
              info.math_func (j);
187
              if (errno != 0)
188
                {
189
                  te++;
190
                  info.lb = j ;
191
                  break;
192
                }
193
            }
194
        }
195
      if (info.has_ub)
196
        {
197
          for (j = 0; j < 500000; j++)
198
            {
199
              errno = 0;
200
              info.math_func (j);
201
              if (errno != 0)
202
              {
203
                te++;
204
                info.ub = j ;
205
                break;
206
              }
207
            }
208
        }
209
    }
210
  return te;
211
}
212
 
213
int main()
214
{
215
   int te1, te2;
216
 
217
   te1 = test (&math_func_arr[0]);
218
   te2 = test (&opt_math_func_arr[0]);
219
 
220
   // Now examine the result
221
   int i = 0;
222
   int errcnt = 0;
223
   for (i = 0; math_func_arr[i].math_func; i++)
224
   {
225
      MathFuncInfo& info = math_func_arr[i];
226
      MathFuncInfo& opt_info = opt_math_func_arr[i];
227
#ifdef DEBUG
228
      fprintf (stderr," %s: lb = %d, ub = %d: lb_opt = %d, ub_opt = %d\n",
229
        info.name, info.lb, info.ub, opt_info.lb, opt_info.ub);
230
#endif
231
      if (info.lb != opt_info.lb) errcnt ++;
232
      if (info.ub != opt_info.ub) errcnt ++;
233
   }
234
   if (errcnt) abort();
235
   return 0;
236
}

powered by: WebSVN 2.1.0

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