2 /* { dg-require-effective-target c99_runtime } */
3 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { pow10 && large_long_double } } } */
4 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { {! pow10 } && large_long_double } } } */
5 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target { pow10 && {! large_long_double } } } } */
6 /* { dg-options "-O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { {! pow10 } && {! large_long_double } } } } */
7 /* { dg-options "-mieee -O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -DLARGE_LONG_DOUBLE -lm" { target { alpha*-*-* && { pow10 && large_long_double } } } } */
8 /* { dg-options "-mieee -O2 -fmath-errno -fdump-tree-cdce-details -DLARGE_LONG_DOUBLE -lm" { target { alpha*-*-* && { {! pow10 } && large_long_double } } } } */
9 /* { dg-options "-mieee -O2 -fmath-errno -fdump-tree-cdce-details -DGNU_EXTENSION -lm" { target { alpha*-*-* && { pow10 && {! large_long_double } } } } } */
10 /* { dg-options "-mieee -O2 -fmath-errno -fdump-tree-cdce-details -lm" { target { alpha*-*-* && { {! pow10 } && {! large_long_double } } } } } */
11 /* { dg-final { scan-tree-dump "cdce3.C:95: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
12 /* { dg-final { scan-tree-dump "cdce3.C:96: note: function call is shrink-wrapped into error conditions\." "cdce" { target { pow10 } } } } */
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 { scan-tree-dump "cdce3.C:110: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
26 /* { dg-final { scan-tree-dump "cdce3.C:111: note: function call is shrink-wrapped into error conditions\." "cdce" } } */
27 /* { dg-final { cleanup-tree-dump "cdce" } } */
34 typedef void (*FP) (int xp);
35 #define NI __attribute__((noinline))
37 #if defined(LARGE_LONG_DOUBLE)
38 typedef long double ldouble;
41 #define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
43 float yy = name##f ((float) x); \
46 NI void prefix##name (int x) \
48 double yy = name ((double)x); \
51 NI void prefix##name##l (int x) \
53 ldouble yy = name##l ((ldouble)x); \
59 #define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
61 float yy = name##f ((float) x); \
64 NI void prefix##name (int x) \
66 double yy = name ((double)x); \
72 #define STORE_RESULT result = yy
73 #if defined(GNU_EXTENSION)
74 DEF_MATH_FUNC (m,pow10)
75 DEF_MATH_FUNC (m,exp10)
77 DEF_MATH_FUNC (m,exp2)
79 DEF_MATH_FUNC (m,expm1)
80 DEF_MATH_FUNC (m,cosh)
81 DEF_MATH_FUNC (m,sinh)
82 DEF_MATH_FUNC (m,acos)
83 DEF_MATH_FUNC (m,asin)
84 DEF_MATH_FUNC (m,acosh)
85 DEF_MATH_FUNC (m,atanh)
87 DEF_MATH_FUNC (m,log2)
88 DEF_MATH_FUNC (m,log10)
89 DEF_MATH_FUNC (m,log1p)
90 DEF_MATH_FUNC (m,sqrt)
94 #if defined(GNU_EXTENSION)
95 DEF_MATH_FUNC (o,pow10)
96 DEF_MATH_FUNC (o,exp10)
98 DEF_MATH_FUNC (o,exp2)
100 DEF_MATH_FUNC (o,expm1)
101 DEF_MATH_FUNC (o,cosh)
102 DEF_MATH_FUNC (o,sinh)
103 DEF_MATH_FUNC (o,acos)
104 DEF_MATH_FUNC (o,asin)
105 DEF_MATH_FUNC (o,acosh)
106 DEF_MATH_FUNC (o,atanh)
107 DEF_MATH_FUNC (o,log)
108 DEF_MATH_FUNC (o,log2)
109 DEF_MATH_FUNC (o,log10)
110 DEF_MATH_FUNC (o,log1p)
111 DEF_MATH_FUNC (o,sqrt)
113 #if defined(LARGE_LONG_DOUBLE)
114 #define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
115 { prefix##name, #name, 0, 0, lb, ub }, \
116 { prefix##name##l, #name "l" , 0, 0, lb, ub },
118 #define INIT_MATH_FUNC(prefix, name, lb, ub) { prefix##name##f, #name "f", 0, 0, lb, ub }, \
119 { prefix##name, #name, 0, 0, lb, ub },
130 } math_func_arr[] = {
131 #if defined(GNU_EXTENSION)
132 INIT_MATH_FUNC (m,pow10, false, true)
133 INIT_MATH_FUNC (m,exp10, false, true)
135 INIT_MATH_FUNC (m,exp2, false, true)
136 INIT_MATH_FUNC (m,expm1, false, true)
137 INIT_MATH_FUNC (m,exp, false, true)
138 INIT_MATH_FUNC (m,cosh, true, true)
139 INIT_MATH_FUNC (m,sinh, true, true)
140 INIT_MATH_FUNC (m,acos, true, true)
141 INIT_MATH_FUNC (m,asin, true, true)
142 INIT_MATH_FUNC (m,acosh, true, false)
143 INIT_MATH_FUNC (m,atanh, true, true)
144 INIT_MATH_FUNC (m,log10, true, false)
145 INIT_MATH_FUNC (m,log, true, false)
146 INIT_MATH_FUNC (m,log2, true, false)
147 INIT_MATH_FUNC (m,log1p, true, false)
148 INIT_MATH_FUNC (m,sqrt, true, false)
149 { 0, 0, 0, 0, 0, 0} };
151 MathFuncInfo opt_math_func_arr[] =
153 #if defined(GNU_EXTENSION)
154 INIT_MATH_FUNC (o,pow10, false, true)
155 INIT_MATH_FUNC (o,exp10, false, true)
157 INIT_MATH_FUNC (o,exp2, false, true)
158 INIT_MATH_FUNC (o,expm1, false, true)
159 INIT_MATH_FUNC (o,exp, false, true)
160 INIT_MATH_FUNC (o,cosh, true, true)
161 INIT_MATH_FUNC (o,sinh, true, true)
162 INIT_MATH_FUNC (o,acos, true, true)
163 INIT_MATH_FUNC (o,asin, true, true)
164 INIT_MATH_FUNC (o,acosh, true, false)
165 INIT_MATH_FUNC (o,atanh, true, true)
166 INIT_MATH_FUNC (o,log10, true, false)
167 INIT_MATH_FUNC (o,log, true, false)
168 INIT_MATH_FUNC (o,log2, true, false)
169 INIT_MATH_FUNC (o,log1p, true, false)
170 INIT_MATH_FUNC (o,sqrt, true, false)
171 { 0, 0, 0, 0, 0, 0} };
173 int test (MathFuncInfo* math_func_infos)
178 for (i = 0; math_func_infos[i].math_func; i++)
180 MathFuncInfo& info = math_func_infos[i];
184 for (j = 0; j > -500000; j--)
199 for (j = 0; j < 500000; j++)
219 te1 = test (&math_func_arr[0]);
220 te2 = test (&opt_math_func_arr[0]);
222 // Now examine the result
225 for (i = 0; math_func_arr[i].math_func; i++)
227 MathFuncInfo& info = math_func_arr[i];
228 MathFuncInfo& opt_info = opt_math_func_arr[i];
230 fprintf (stderr," %s: lb = %d, ub = %d: lb_opt = %d, ub_opt = %d\n",
231 info.name, info.lb, info.ub, opt_info.lb, opt_info.ub);
233 if (info.lb != opt_info.lb) errcnt ++;
234 if (info.ub != opt_info.ub) errcnt ++;