]>
Commit | Line | Data |
---|---|---|
1c298d08 | 1 | /* Test compilation of tgmath macros. |
dff8da6b | 2 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
1c298d08 | 3 | This file is part of the GNU C Library. |
1c298d08 UD |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
59ba27a6 | 16 | License along with the GNU C Library; if not, see |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
1c298d08 UD |
18 | |
19 | #ifndef HAVE_MAIN | |
51737193 | 20 | #include <float.h> |
1c298d08 UD |
21 | #include <math.h> |
22 | #include <complex.h> | |
23 | #include <stdio.h> | |
24 | #include <string.h> | |
25 | #include <tgmath.h> | |
26 | ||
1b97a9f2 MR |
27 | #include <support/check.h> |
28 | ||
1c298d08 UD |
29 | //#define DEBUG |
30 | ||
31 | typedef complex float cfloat; | |
32 | typedef complex double cdouble; | |
51737193 | 33 | #if LDBL_MANT_DIG > DBL_MANT_DIG |
1c298d08 UD |
34 | typedef long double ldouble; |
35 | typedef complex long double cldouble; | |
36 | #else | |
37 | typedef double ldouble; | |
38 | typedef complex double cldouble; | |
39 | #endif | |
40 | ||
41 | float vfloat1, vfloat2, vfloat3; | |
42 | double vdouble1, vdouble2, vdouble3; | |
43 | ldouble vldouble1, vldouble2, vldouble3; | |
44 | cfloat vcfloat1, vcfloat2, vcfloat3; | |
45 | cdouble vcdouble1, vcdouble2, vcdouble3; | |
46 | cldouble vcldouble1, vcldouble2, vcldouble4; | |
47 | int vint1, vint2, vint3; | |
48 | long int vlong1, vlong2, vlong3; | |
49 | long long int vllong1, vllong2, vllong3; | |
50 | const float Vfloat1 = 1, Vfloat2 = 2, Vfloat3 = 3; | |
51 | const double Vdouble1 = 1, Vdouble2 = 2, Vdouble3 = 3; | |
52 | const ldouble Vldouble1 = 1, Vldouble2 = 2, Vldouble3 = 3; | |
53 | const cfloat Vcfloat1 = 1, Vcfloat2 = 2, Vcfloat3 = 3; | |
54 | const cdouble Vcdouble1 = 1, Vcdouble2 = 2, Vcdouble3 = 3; | |
55 | const cldouble Vcldouble1 = 1, Vcldouble2 = 2, Vcldouble4 = 3; | |
56 | const int Vint1 = 1, Vint2 = 2, Vint3 = 3; | |
57 | const long int Vlong1 = 1, Vlong2 = 2, Vlong3 = 3; | |
58 | const long long int Vllong1 = 1, Vllong2 = 2, Vllong3 = 3; | |
59 | enum | |
60 | { | |
61 | Tfloat = 0, | |
62 | Tcfloat, | |
63 | Tdouble, | |
64 | Tcdouble, | |
51737193 | 65 | #if LDBL_MANT_DIG > DBL_MANT_DIG |
1c298d08 UD |
66 | Tldouble, |
67 | Tcldouble, | |
68 | #else | |
69 | Tldouble = Tdouble, | |
70 | Tcldouble = Tcdouble, | |
71 | #endif | |
72 | Tlast | |
73 | }; | |
74 | enum | |
75 | { | |
76 | C_cos = 0, | |
77 | C_fabs, | |
78 | C_cabs, | |
79 | C_conj, | |
80 | C_expm1, | |
81 | C_lrint, | |
82 | C_ldexp, | |
83 | C_atan2, | |
84 | C_remquo, | |
85 | C_pow, | |
86 | C_fma, | |
87 | C_last | |
88 | }; | |
89 | int count; | |
90 | int counts[Tlast][C_last]; | |
91 | ||
1c298d08 UD |
92 | #define TEST_TYPE_ONLY(expr, rettype) \ |
93 | do \ | |
94 | { \ | |
95 | __typeof__ (expr) texpr = 0; \ | |
96 | __typeof__ (rettype) ttype = 0, *ptype; \ | |
97 | if (sizeof (expr) != sizeof (rettype)) \ | |
98 | FAIL ("type"); \ | |
99 | if (__alignof__ (expr) != __alignof__ (rettype)) \ | |
100 | FAIL ("type"); \ | |
101 | __asm ("" : "=r" (ptype) : "0" (&ttype), "r" (&texpr)); \ | |
102 | if (&texpr == ptype) \ | |
103 | FAIL ("type"); \ | |
104 | } \ | |
105 | while (0) | |
106 | #define TEST2(expr, type, rettype, fn) \ | |
107 | do \ | |
108 | { \ | |
109 | __typeof__ (expr) texpr = 0; \ | |
110 | TEST_TYPE_ONLY (expr, rettype); \ | |
111 | if (count != 0) \ | |
112 | FAIL ("internal error"); \ | |
113 | if (counts[T##type][C_##fn] != 0) \ | |
114 | FAIL ("internal error"); \ | |
115 | texpr = expr; \ | |
116 | __asm __volatile ("" : : "r" (&texpr)); \ | |
117 | if (count != 1 || counts[T##type][C_##fn] != 1) \ | |
118 | { \ | |
cc528f9a | 119 | FAIL ("wrong function called, "#fn" ("#type")"); \ |
1c298d08 UD |
120 | memset (counts, 0, sizeof (counts)); \ |
121 | } \ | |
122 | count = 0; \ | |
123 | counts[T##type][C_##fn] = 0; \ | |
124 | } \ | |
125 | while (0) | |
126 | #define TEST(expr, type, fn) TEST2(expr, type, type, fn) | |
127 | ||
31c351e2 SE |
128 | int |
129 | test_cos (const int Vint4, const long long int Vllong4) | |
130 | { | |
1c298d08 UD |
131 | TEST (cos (vfloat1), float, cos); |
132 | TEST (cos (vdouble1), double, cos); | |
133 | TEST (cos (vldouble1), ldouble, cos); | |
134 | TEST (cos (vint1), double, cos); | |
135 | TEST (cos (vllong1), double, cos); | |
136 | TEST (cos (vcfloat1), cfloat, cos); | |
137 | TEST (cos (vcdouble1), cdouble, cos); | |
138 | TEST (cos (vcldouble1), cldouble, cos); | |
139 | TEST (cos (Vfloat1), float, cos); | |
140 | TEST (cos (Vdouble1), double, cos); | |
141 | TEST (cos (Vldouble1), ldouble, cos); | |
142 | TEST (cos (Vint1), double, cos); | |
143 | TEST (cos (Vllong1), double, cos); | |
144 | TEST (cos (Vcfloat1), cfloat, cos); | |
145 | TEST (cos (Vcdouble1), cdouble, cos); | |
146 | TEST (cos (Vcldouble1), cldouble, cos); | |
147 | ||
1b97a9f2 | 148 | return 0; |
31c351e2 SE |
149 | } |
150 | ||
151 | int | |
152 | test_fabs (const int Vint4, const long long int Vllong4) | |
153 | { | |
154 | int result = 0; | |
155 | ||
1c298d08 UD |
156 | TEST (fabs (vfloat1), float, fabs); |
157 | TEST (fabs (vdouble1), double, fabs); | |
158 | TEST (fabs (vldouble1), ldouble, fabs); | |
159 | TEST (fabs (vint1), double, fabs); | |
160 | TEST (fabs (vllong1), double, fabs); | |
161 | TEST (fabs (vcfloat1), float, cabs); | |
162 | TEST (fabs (vcdouble1), double, cabs); | |
163 | TEST (fabs (vcldouble1), ldouble, cabs); | |
164 | TEST (fabs (Vfloat1), float, fabs); | |
165 | TEST (fabs (Vdouble1), double, fabs); | |
cc528f9a | 166 | TEST (fabs (Vldouble2), ldouble, fabs); |
1c298d08 UD |
167 | #ifndef __OPTIMIZE__ |
168 | /* GCC is too smart to optimize these out. */ | |
169 | TEST (fabs (Vint1), double, fabs); | |
170 | TEST (fabs (Vllong1), double, fabs); | |
171 | #else | |
172 | TEST_TYPE_ONLY (fabs (vllong1), double); | |
173 | TEST_TYPE_ONLY (fabs (vllong1), double); | |
174 | #endif | |
175 | TEST (fabs (Vint4), double, fabs); | |
176 | TEST (fabs (Vllong4), double, fabs); | |
177 | TEST (fabs (Vcfloat1), float, cabs); | |
178 | TEST (fabs (Vcdouble1), double, cabs); | |
179 | TEST (fabs (Vcldouble1), ldouble, cabs); | |
180 | ||
31c351e2 SE |
181 | return result; |
182 | } | |
183 | ||
184 | int | |
185 | test_conj (const int Vint4, const long long int Vllong4) | |
186 | { | |
187 | int result = 0; | |
1c298d08 UD |
188 | TEST (conj (vfloat1), cfloat, conj); |
189 | TEST (conj (vdouble1), cdouble, conj); | |
190 | TEST (conj (vldouble1), cldouble, conj); | |
191 | TEST (conj (vint1), cdouble, conj); | |
192 | TEST (conj (vllong1), cdouble, conj); | |
193 | TEST (conj (vcfloat1), cfloat, conj); | |
194 | TEST (conj (vcdouble1), cdouble, conj); | |
195 | TEST (conj (vcldouble1), cldouble, conj); | |
196 | TEST (conj (Vfloat1), cfloat, conj); | |
197 | TEST (conj (Vdouble1), cdouble, conj); | |
198 | TEST (conj (Vldouble1), cldouble, conj); | |
199 | TEST (conj (Vint1), cdouble, conj); | |
200 | TEST (conj (Vllong1), cdouble, conj); | |
201 | TEST (conj (Vcfloat1), cfloat, conj); | |
202 | TEST (conj (Vcdouble1), cdouble, conj); | |
203 | TEST (conj (Vcldouble1), cldouble, conj); | |
204 | ||
31c351e2 SE |
205 | return result; |
206 | } | |
207 | ||
208 | int | |
209 | test_expm1 (const int Vint4, const long long int Vllong4) | |
210 | { | |
211 | int result = 0; | |
212 | ||
1c298d08 UD |
213 | TEST (expm1 (vfloat1), float, expm1); |
214 | TEST (expm1 (vdouble1), double, expm1); | |
215 | TEST (expm1 (vldouble1), ldouble, expm1); | |
216 | TEST (expm1 (vint1), double, expm1); | |
217 | TEST (expm1 (vllong1), double, expm1); | |
218 | TEST (expm1 (Vfloat1), float, expm1); | |
219 | TEST (expm1 (Vdouble1), double, expm1); | |
220 | TEST (expm1 (Vldouble1), ldouble, expm1); | |
221 | TEST (expm1 (Vint1), double, expm1); | |
222 | TEST (expm1 (Vllong1), double, expm1); | |
223 | ||
31c351e2 SE |
224 | return result; |
225 | } | |
226 | ||
227 | int | |
228 | test_lrint (const int Vint4, const long long int Vllong4) | |
229 | { | |
230 | int result = 0; | |
1c298d08 UD |
231 | TEST2 (lrint (vfloat1), float, long int, lrint); |
232 | TEST2 (lrint (vdouble1), double, long int, lrint); | |
233 | TEST2 (lrint (vldouble1), ldouble, long int, lrint); | |
234 | TEST2 (lrint (vint1), double, long int, lrint); | |
235 | TEST2 (lrint (vllong1), double, long int, lrint); | |
236 | TEST2 (lrint (Vfloat1), float, long int, lrint); | |
237 | TEST2 (lrint (Vdouble1), double, long int, lrint); | |
238 | TEST2 (lrint (Vldouble1), ldouble, long int, lrint); | |
239 | TEST2 (lrint (Vint1), double, long int, lrint); | |
240 | TEST2 (lrint (Vllong1), double, long int, lrint); | |
241 | ||
31c351e2 SE |
242 | return result; |
243 | } | |
244 | ||
245 | int | |
246 | test_ldexp (const int Vint4, const long long int Vllong4) | |
247 | { | |
248 | int result = 0; | |
249 | ||
1c298d08 UD |
250 | TEST (ldexp (vfloat1, 6), float, ldexp); |
251 | TEST (ldexp (vdouble1, 6), double, ldexp); | |
252 | TEST (ldexp (vldouble1, 6), ldouble, ldexp); | |
253 | TEST (ldexp (vint1, 6), double, ldexp); | |
254 | TEST (ldexp (vllong1, 6), double, ldexp); | |
255 | TEST (ldexp (Vfloat1, 6), float, ldexp); | |
256 | TEST (ldexp (Vdouble1, 6), double, ldexp); | |
257 | TEST (ldexp (Vldouble1, 6), ldouble, ldexp); | |
258 | TEST (ldexp (Vint1, 6), double, ldexp); | |
259 | TEST (ldexp (Vllong1, 6), double, ldexp); | |
260 | ||
31c351e2 SE |
261 | return result; |
262 | } | |
263 | ||
1c298d08 UD |
264 | #define FIRST(x, y) (y, x) |
265 | #define SECOND(x, y) (x, y) | |
266 | #define NON_LDBL_TEST(fn, argm, arg, type, fnt) \ | |
267 | TEST (fn argm (arg, vfloat1), type, fnt); \ | |
268 | TEST (fn argm (arg, vdouble1), type, fnt); \ | |
269 | TEST (fn argm (arg, vint1), type, fnt); \ | |
270 | TEST (fn argm (arg, vllong1), type, fnt); \ | |
271 | TEST (fn argm (arg, Vfloat1), type, fnt); \ | |
272 | TEST (fn argm (arg, Vdouble1), type, fnt); \ | |
273 | TEST (fn argm (arg, Vint1), type, fnt); \ | |
274 | TEST (fn argm (arg, Vllong1), type, fnt); | |
275 | #define NON_LDBL_CTEST(fn, argm, arg, type, fnt) \ | |
276 | NON_LDBL_TEST(fn, argm, arg, type, fnt); \ | |
277 | TEST (fn argm (arg, vcfloat1), type, fnt); \ | |
278 | TEST (fn argm (arg, vcdouble1), type, fnt); \ | |
279 | TEST (fn argm (arg, Vcfloat1), type, fnt); \ | |
280 | TEST (fn argm (arg, Vcdouble1), type, fnt); | |
281 | #define BINARY_TEST(fn, fnt) \ | |
282 | TEST (fn (vfloat1, vfloat2), float, fnt); \ | |
283 | TEST (fn (Vfloat1, vfloat2), float, fnt); \ | |
284 | TEST (fn (vfloat1, Vfloat2), float, fnt); \ | |
285 | TEST (fn (Vfloat1, Vfloat2), float, fnt); \ | |
286 | TEST (fn (vldouble1, vldouble2), ldouble, fnt); \ | |
287 | TEST (fn (Vldouble1, vldouble2), ldouble, fnt); \ | |
288 | TEST (fn (vldouble1, Vldouble2), ldouble, fnt); \ | |
289 | TEST (fn (Vldouble1, Vldouble2), ldouble, fnt); \ | |
290 | NON_LDBL_TEST (fn, FIRST, vldouble2, ldouble, fnt); \ | |
291 | NON_LDBL_TEST (fn, SECOND, vldouble2, ldouble, fnt); \ | |
292 | NON_LDBL_TEST (fn, FIRST, Vldouble2, ldouble, fnt); \ | |
293 | NON_LDBL_TEST (fn, SECOND, Vldouble2, ldouble, fnt); \ | |
294 | NON_LDBL_TEST (fn, FIRST, vdouble2, double, fnt); \ | |
295 | NON_LDBL_TEST (fn, SECOND, vdouble2, double, fnt); \ | |
296 | NON_LDBL_TEST (fn, FIRST, Vdouble2, double, fnt); \ | |
297 | NON_LDBL_TEST (fn, SECOND, Vdouble2, double, fnt); \ | |
298 | NON_LDBL_TEST (fn, FIRST, vint2, double, fnt); \ | |
299 | NON_LDBL_TEST (fn, SECOND, vint2, double, fnt); \ | |
300 | NON_LDBL_TEST (fn, FIRST, Vint2, double, fnt); \ | |
301 | NON_LDBL_TEST (fn, SECOND, Vint2, double, fnt); \ | |
302 | NON_LDBL_TEST (fn, FIRST, vllong2, double, fnt); \ | |
303 | NON_LDBL_TEST (fn, SECOND, vllong2, double, fnt); \ | |
304 | NON_LDBL_TEST (fn, FIRST, Vllong2, double, fnt); \ | |
305 | NON_LDBL_TEST (fn, SECOND, Vllong2, double, fnt); | |
306 | #define BINARY_CTEST(fn, fnt) \ | |
307 | BINARY_TEST (fn, fnt); \ | |
308 | TEST (fn (vcfloat1, vfloat2), cfloat, fnt); \ | |
309 | TEST (fn (Vcfloat1, vfloat2), cfloat, fnt); \ | |
310 | TEST (fn (vcfloat1, Vfloat2), cfloat, fnt); \ | |
311 | TEST (fn (Vcfloat1, Vfloat2), cfloat, fnt); \ | |
312 | TEST (fn (vcldouble1, vldouble2), cldouble, fnt); \ | |
313 | TEST (fn (Vcldouble1, vldouble2), cldouble, fnt); \ | |
314 | TEST (fn (vcldouble1, Vldouble2), cldouble, fnt); \ | |
315 | TEST (fn (Vcldouble1, Vldouble2), cldouble, fnt); \ | |
316 | TEST (fn (vcfloat1, vfloat2), cfloat, fnt); \ | |
317 | TEST (fn (Vcfloat1, vfloat2), cfloat, fnt); \ | |
318 | TEST (fn (vcfloat1, Vfloat2), cfloat, fnt); \ | |
319 | TEST (fn (Vcfloat1, Vfloat2), cfloat, fnt); \ | |
320 | TEST (fn (vcldouble1, vldouble2), cldouble, fnt); \ | |
321 | TEST (fn (Vcldouble1, vldouble2), cldouble, fnt); \ | |
322 | TEST (fn (vcldouble1, Vldouble2), cldouble, fnt); \ | |
323 | TEST (fn (Vcldouble1, Vldouble2), cldouble, fnt); \ | |
324 | TEST (fn (vcfloat1, vcfloat2), cfloat, fnt); \ | |
325 | TEST (fn (Vcfloat1, vcfloat2), cfloat, fnt); \ | |
326 | TEST (fn (vcfloat1, Vcfloat2), cfloat, fnt); \ | |
327 | TEST (fn (Vcfloat1, Vcfloat2), cfloat, fnt); \ | |
328 | TEST (fn (vcldouble1, vcldouble2), cldouble, fnt); \ | |
329 | TEST (fn (Vcldouble1, vcldouble2), cldouble, fnt); \ | |
330 | TEST (fn (vcldouble1, Vcldouble2), cldouble, fnt); \ | |
331 | TEST (fn (Vcldouble1, Vcldouble2), cldouble, fnt); \ | |
332 | NON_LDBL_CTEST (fn, FIRST, vcldouble2, cldouble, fnt); \ | |
333 | NON_LDBL_CTEST (fn, SECOND, vcldouble2, cldouble, fnt); \ | |
334 | NON_LDBL_CTEST (fn, FIRST, Vcldouble2, cldouble, fnt); \ | |
335 | NON_LDBL_CTEST (fn, SECOND, Vcldouble2, cldouble, fnt); \ | |
336 | NON_LDBL_CTEST (fn, FIRST, vcdouble2, cdouble, fnt); \ | |
337 | NON_LDBL_CTEST (fn, SECOND, vcdouble2, cdouble, fnt); \ | |
338 | NON_LDBL_CTEST (fn, FIRST, Vcdouble2, cdouble, fnt); \ | |
339 | NON_LDBL_CTEST (fn, SECOND, Vcdouble2, cdouble, fnt); | |
340 | ||
31c351e2 SE |
341 | int |
342 | test_atan2 (const int Vint4, const long long int Vllong4) | |
343 | { | |
344 | int result = 0; | |
345 | ||
1c298d08 UD |
346 | BINARY_TEST (atan2, atan2); |
347 | ||
31c351e2 SE |
348 | return result; |
349 | } | |
350 | ||
351 | int | |
352 | test_remquo (const int Vint4, const long long int Vllong4) | |
353 | { | |
354 | int result = 0; | |
355 | int quo = 0; | |
356 | ||
1c298d08 UD |
357 | #define my_remquo(x, y) remquo (x, y, &quo) |
358 | BINARY_TEST (my_remquo, remquo); | |
359 | #undef my_remquo | |
360 | ||
31c351e2 SE |
361 | return result; |
362 | } | |
363 | ||
364 | int | |
365 | test_pow (const int Vint4, const long long int Vllong4) | |
366 | { | |
367 | int result = 0; | |
368 | ||
1c298d08 UD |
369 | BINARY_CTEST (pow, pow); |
370 | ||
31c351e2 SE |
371 | return result; |
372 | } | |
373 | ||
374 | /* Testing all arguments of fma would be just too expensive, | |
375 | so test just some. */ | |
376 | ||
377 | int | |
378 | test_fma_1 (const int Vint4, const long long int Vllong4) | |
379 | { | |
380 | int result = 0; | |
381 | ||
1c298d08 UD |
382 | #define my_fma(x, y) fma (x, y, vfloat3) |
383 | BINARY_TEST (my_fma, fma); | |
384 | #undef my_fma | |
31c351e2 SE |
385 | |
386 | return result; | |
387 | } | |
388 | ||
389 | int | |
390 | test_fma_2 (const int Vint4, const long long int Vllong4) | |
391 | { | |
392 | int result = 0; | |
393 | ||
1c298d08 UD |
394 | #define my_fma(x, y) fma (x, vfloat3, y) |
395 | BINARY_TEST (my_fma, fma); | |
396 | #undef my_fma | |
31c351e2 SE |
397 | |
398 | return result; | |
399 | } | |
400 | ||
401 | int | |
402 | test_fma_3 (const int Vint4, const long long int Vllong4) | |
403 | { | |
404 | int result = 0; | |
405 | ||
1c298d08 UD |
406 | #define my_fma(x, y) fma (Vfloat3, x, y) |
407 | BINARY_TEST (my_fma, fma); | |
408 | #undef my_fma | |
31c351e2 SE |
409 | |
410 | return result; | |
411 | } | |
412 | ||
413 | int | |
414 | test_fma_4 (const int Vint4, const long long int Vllong4) | |
415 | { | |
416 | int result = 0; | |
1c298d08 UD |
417 | TEST (fma (vdouble1, Vdouble2, vllong3), double, fma); |
418 | TEST (fma (vint1, Vint2, vint3), double, fma); | |
419 | TEST (fma (Vldouble1, vldouble2, Vldouble3), ldouble, fma); | |
420 | TEST (fma (vldouble1, vint2, Vdouble3), ldouble, fma); | |
421 | ||
422 | return result; | |
423 | } | |
424 | ||
0035851c AS |
425 | static int |
426 | do_test (void) | |
1c298d08 | 427 | { |
31c351e2 SE |
428 | int result; |
429 | ||
430 | result = test_cos (vint1, vllong1); | |
431 | result |= test_fabs (vint1, vllong1); | |
432 | result |= test_conj (vint1, vllong1); | |
433 | result |= test_expm1 (vint1, vllong1); | |
434 | result |= test_lrint (vint1, vllong1); | |
435 | result |= test_ldexp (vint1, vllong1); | |
436 | result |= test_atan2 (vint1, vllong1); | |
437 | result |= test_remquo (vint1, vllong1); | |
438 | result |= test_pow (vint1, vllong1); | |
439 | result |= test_fma_1 (vint1, vllong1); | |
440 | result |= test_fma_2 (vint1, vllong1); | |
441 | result |= test_fma_3 (vint1, vllong1); | |
442 | result |= test_fma_4 (vint1, vllong1); | |
443 | ||
444 | return result; | |
1c298d08 UD |
445 | } |
446 | ||
447 | /* Now generate the three functions. */ | |
448 | #define HAVE_MAIN | |
449 | ||
450 | #define F(name) name | |
451 | #define TYPE double | |
452 | #define CTYPE cdouble | |
453 | #define T Tdouble | |
454 | #define C Tcdouble | |
455 | #include "test-tgmath2.c" | |
456 | ||
457 | #define F(name) name##f | |
458 | #define TYPE float | |
459 | #define CTYPE cfloat | |
460 | #define T Tfloat | |
461 | #define C Tcfloat | |
462 | #include "test-tgmath2.c" | |
463 | ||
51737193 | 464 | #if LDBL_MANT_DIG > DBL_MANT_DIG |
1c298d08 UD |
465 | #define F(name) name##l |
466 | #define TYPE ldouble | |
467 | #define CTYPE cldouble | |
468 | #define T Tldouble | |
469 | #define C Tcldouble | |
470 | #include "test-tgmath2.c" | |
471 | #endif | |
472 | ||
0035851c AS |
473 | #define TEST_FUNCTION do_test () |
474 | #include "../test-skeleton.c" | |
475 | ||
1c298d08 UD |
476 | #else |
477 | ||
478 | #ifdef DEBUG | |
479 | #define P() puts (__FUNCTION__); count++ | |
480 | #else | |
481 | #define P() count++; | |
482 | #endif | |
483 | ||
484 | TYPE | |
485 | (F(cos)) (TYPE x) | |
486 | { | |
487 | counts[T][C_cos]++; | |
488 | P (); | |
489 | return x; | |
490 | } | |
491 | ||
492 | CTYPE | |
493 | (F(ccos)) (CTYPE x) | |
494 | { | |
495 | counts[C][C_cos]++; | |
496 | P (); | |
497 | return x; | |
498 | } | |
499 | ||
500 | TYPE | |
501 | (F(fabs)) (TYPE x) | |
502 | { | |
503 | counts[T][C_fabs]++; | |
504 | P (); | |
505 | return x; | |
506 | } | |
507 | ||
508 | TYPE | |
509 | (F(cabs)) (CTYPE x) | |
510 | { | |
511 | counts[T][C_cabs]++; | |
512 | P (); | |
513 | return x; | |
514 | } | |
515 | ||
516 | CTYPE | |
517 | (F(conj)) (CTYPE x) | |
518 | { | |
519 | counts[C][C_conj]++; | |
520 | P (); | |
521 | return x; | |
522 | } | |
523 | ||
524 | TYPE | |
525 | (F(expm1)) (TYPE x) | |
526 | { | |
527 | counts[T][C_expm1]++; | |
528 | P (); | |
529 | return x; | |
530 | } | |
531 | ||
532 | long int | |
533 | (F(lrint)) (TYPE x) | |
534 | { | |
535 | counts[T][C_lrint]++; | |
536 | P (); | |
537 | return x; | |
538 | } | |
539 | ||
540 | TYPE | |
541 | (F(ldexp)) (TYPE x, int y) | |
542 | { | |
543 | counts[T][C_ldexp]++; | |
544 | P (); | |
545 | return x + y; | |
546 | } | |
547 | ||
548 | TYPE | |
549 | (F(atan2)) (TYPE x, TYPE y) | |
550 | { | |
551 | counts[T][C_atan2]++; | |
552 | P (); | |
553 | return x + y; | |
554 | } | |
555 | ||
556 | TYPE | |
557 | (F(remquo)) (TYPE x, TYPE y, int *z) | |
558 | { | |
559 | counts[T][C_remquo]++; | |
560 | P (); | |
561 | return x + y + *z; | |
562 | } | |
563 | ||
564 | TYPE | |
565 | (F(pow)) (TYPE x, TYPE y) | |
566 | { | |
567 | counts[T][C_pow]++; | |
568 | P (); | |
569 | return x + y; | |
570 | } | |
571 | ||
572 | CTYPE | |
573 | (F(cpow)) (CTYPE x, CTYPE y) | |
574 | { | |
575 | counts[C][C_pow]++; | |
576 | P (); | |
577 | return x + y; | |
578 | } | |
579 | ||
580 | TYPE | |
581 | (F(fma)) (TYPE x, TYPE y, TYPE z) | |
582 | { | |
583 | counts[T][C_fma]++; | |
584 | P (); | |
585 | return x + y + z; | |
586 | } | |
587 | ||
588 | #undef F | |
589 | #undef TYPE | |
590 | #undef CTYPE | |
591 | #undef T | |
592 | #undef C | |
593 | #undef P | |
594 | #endif |