]> git.proxmox.com Git - mirror_edk2.git/blob - StdLib/LibC/Softfloat/timesoftfloat.c
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / StdLib / LibC / Softfloat / timesoftfloat.c
1 /* $NetBSD: timesoftfloat.c,v 1.1 2000/06/06 08:15:11 bjh21 Exp $ */
2
3 /*
4 ===============================================================================
5
6 This C source file is part of the SoftFloat IEC/IEEE Floating-point
7 Arithmetic Package, Release 2a.
8
9 Written by John R. Hauser. This work was made possible in part by the
10 International Computer Science Institute, located at Suite 600, 1947 Center
11 Street, Berkeley, California 94704. Funding was partially provided by the
12 National Science Foundation under grant MIP-9311980. The original version
13 of this code was written as part of a project to build a fixed-point vector
14 processor in collaboration with the University of California at Berkeley,
15 overseen by Profs. Nelson Morgan and John Wawrzynek. More information
16 is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
17 arithmetic/SoftFloat.html'.
18
19 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
20 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
21 TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
22 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
23 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
24
25 Derivative works are acceptable, even for commercial purposes, so long as
26 (1) they include prominent notice that the work is derivative, and (2) they
27 include prominent notice akin to these four paragraphs for those parts of
28 this code that are retained.
29
30 ===============================================================================
31 */
32
33 #include <sys/cdefs.h>
34 #if defined(LIBC_SCCS) && !defined(lint)
35 __RCSID("$NetBSD: timesoftfloat.c,v 1.1 2000/06/06 08:15:11 bjh21 Exp $");
36 #endif /* LIBC_SCCS and not lint */
37
38 #include <stdlib.h>
39 #include <stdarg.h>
40 #include <string.h>
41 #include <stdio.h>
42 #include <time.h>
43 #include "milieu.h"
44 #include "softfloat.h"
45
46 enum {
47 minIterations = 1000
48 };
49
50 static void fail( const char *message, ... )
51 {
52 va_list varArgs;
53
54 fputs( "timesoftfloat: ", stderr );
55 va_start( varArgs, message );
56 vfprintf( stderr, message, varArgs );
57 va_end( varArgs );
58 fputs( ".\n", stderr );
59 exit( EXIT_FAILURE );
60
61 }
62
63 static char *functionName;
64 static char *roundingPrecisionName, *roundingModeName, *tininessModeName;
65
66 static void reportTime( int32 count, long clocks )
67 {
68
69 printf(
70 "%8.1f kops/s: %s",
71 ( count / ( ( (float) clocks ) / CLOCKS_PER_SEC ) ) / 1000,
72 functionName
73 );
74 if ( roundingModeName ) {
75 if ( roundingPrecisionName ) {
76 fputs( ", precision ", stdout );
77 fputs( roundingPrecisionName, stdout );
78 }
79 fputs( ", rounding ", stdout );
80 fputs( roundingModeName, stdout );
81 if ( tininessModeName ) {
82 fputs( ", tininess ", stdout );
83 fputs( tininessModeName, stdout );
84 fputs( " rounding", stdout );
85 }
86 }
87 fputc( '\n', stdout );
88
89 }
90
91 enum {
92 numInputs_int32 = 32
93 };
94
95 static const int32 inputs_int32[ numInputs_int32 ] = {
96 0xFFFFBB79, 0x405CF80F, 0x00000000, 0xFFFFFD04,
97 0xFFF20002, 0x0C8EF795, 0xF00011FF, 0x000006CA,
98 0x00009BFE, 0xFF4862E3, 0x9FFFEFFE, 0xFFFFFFB7,
99 0x0BFF7FFF, 0x0000F37A, 0x0011DFFE, 0x00000006,
100 0xFFF02006, 0xFFFFF7D1, 0x10200003, 0xDE8DF765,
101 0x00003E02, 0x000019E8, 0x0008FFFE, 0xFFFFFB5C,
102 0xFFDF7FFE, 0x07C42FBF, 0x0FFFE3FF, 0x040B9F13,
103 0xBFFFFFF8, 0x0001BF56, 0x000017F6, 0x000A908A
104 };
105
106 static void time_a_int32_z_float32( float32 function( int32 ) )
107 {
108 clock_t startClock, endClock;
109 int32 count, i;
110 int8 inputNum;
111
112 count = 0;
113 inputNum = 0;
114 startClock = clock();
115 do {
116 for ( i = minIterations; i; --i ) {
117 function( inputs_int32[ inputNum ] );
118 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
119 }
120 count += minIterations;
121 } while ( clock() - startClock < CLOCKS_PER_SEC );
122 inputNum = 0;
123 startClock = clock();
124 for ( i = count; i; --i ) {
125 function( inputs_int32[ inputNum ] );
126 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
127 }
128 endClock = clock();
129 reportTime( count, endClock - startClock );
130
131 }
132
133 static void time_a_int32_z_float64( float64 function( int32 ) )
134 {
135 clock_t startClock, endClock;
136 int32 count, i;
137 int8 inputNum;
138
139 count = 0;
140 inputNum = 0;
141 startClock = clock();
142 do {
143 for ( i = minIterations; i; --i ) {
144 function( inputs_int32[ inputNum ] );
145 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
146 }
147 count += minIterations;
148 } while ( clock() - startClock < CLOCKS_PER_SEC );
149 inputNum = 0;
150 startClock = clock();
151 for ( i = count; i; --i ) {
152 function( inputs_int32[ inputNum ] );
153 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
154 }
155 endClock = clock();
156 reportTime( count, endClock - startClock );
157
158 }
159
160 #ifdef FLOATX80
161
162 static void time_a_int32_z_floatx80( floatx80 function( int32 ) )
163 {
164 clock_t startClock, endClock;
165 int32 count, i;
166 int8 inputNum;
167
168 count = 0;
169 inputNum = 0;
170 startClock = clock();
171 do {
172 for ( i = minIterations; i; --i ) {
173 function( inputs_int32[ inputNum ] );
174 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
175 }
176 count += minIterations;
177 } while ( clock() - startClock < CLOCKS_PER_SEC );
178 inputNum = 0;
179 startClock = clock();
180 for ( i = count; i; --i ) {
181 function( inputs_int32[ inputNum ] );
182 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
183 }
184 endClock = clock();
185 reportTime( count, endClock - startClock );
186
187 }
188
189 #endif
190
191 #ifdef FLOAT128
192
193 static void time_a_int32_z_float128( float128 function( int32 ) )
194 {
195 clock_t startClock, endClock;
196 int32 count, i;
197 int8 inputNum;
198
199 count = 0;
200 inputNum = 0;
201 startClock = clock();
202 do {
203 for ( i = minIterations; i; --i ) {
204 function( inputs_int32[ inputNum ] );
205 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
206 }
207 count += minIterations;
208 } while ( clock() - startClock < CLOCKS_PER_SEC );
209 inputNum = 0;
210 startClock = clock();
211 for ( i = count; i; --i ) {
212 function( inputs_int32[ inputNum ] );
213 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
214 }
215 endClock = clock();
216 reportTime( count, endClock - startClock );
217
218 }
219
220 #endif
221
222 enum {
223 numInputs_int64 = 32
224 };
225
226 static const int64 inputs_int64[ numInputs_int64 ] = {
227 LIT64( 0xFBFFC3FFFFFFFFFF ),
228 LIT64( 0x0000000003C589BC ),
229 LIT64( 0x00000000400013FE ),
230 LIT64( 0x0000000000186171 ),
231 LIT64( 0xFFFFFFFFFFFEFBFA ),
232 LIT64( 0xFFFFFD79E6DFFC73 ),
233 LIT64( 0x0000000010001DFF ),
234 LIT64( 0xDD1A0F0C78513710 ),
235 LIT64( 0xFFFF83FFFFFEFFFE ),
236 LIT64( 0x00756EBD1AD0C1C7 ),
237 LIT64( 0x0003FDFFFFFFFFBE ),
238 LIT64( 0x0007D0FB2C2CA951 ),
239 LIT64( 0x0007FC0007FFFFFE ),
240 LIT64( 0x0000001F942B18BB ),
241 LIT64( 0x0000080101FFFFFE ),
242 LIT64( 0xFFFFFFFFFFFF0978 ),
243 LIT64( 0x000000000008BFFF ),
244 LIT64( 0x0000000006F5AF08 ),
245 LIT64( 0xFFDEFF7FFFFFFFFE ),
246 LIT64( 0x0000000000000003 ),
247 LIT64( 0x3FFFFFFFFF80007D ),
248 LIT64( 0x0000000000000078 ),
249 LIT64( 0xFFF80000007FDFFD ),
250 LIT64( 0x1BBC775B78016AB0 ),
251 LIT64( 0xFFF9001FFFFFFFFE ),
252 LIT64( 0xFFFD4767AB98E43F ),
253 LIT64( 0xFFFFFEFFFE00001E ),
254 LIT64( 0xFFFFFFFFFFF04EFD ),
255 LIT64( 0x07FFFFFFFFFFF7FF ),
256 LIT64( 0xFFFC9EAA38F89050 ),
257 LIT64( 0x00000020FBFFFFFE ),
258 LIT64( 0x0000099AE6455357 )
259 };
260
261 static void time_a_int64_z_float32( float32 function( int64 ) )
262 {
263 clock_t startClock, endClock;
264 int32 count, i;
265 int8 inputNum;
266
267 count = 0;
268 inputNum = 0;
269 startClock = clock();
270 do {
271 for ( i = minIterations; i; --i ) {
272 function( inputs_int64[ inputNum ] );
273 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
274 }
275 count += minIterations;
276 } while ( clock() - startClock < CLOCKS_PER_SEC );
277 inputNum = 0;
278 startClock = clock();
279 for ( i = count; i; --i ) {
280 function( inputs_int64[ inputNum ] );
281 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
282 }
283 endClock = clock();
284 reportTime( count, endClock - startClock );
285
286 }
287
288 static void time_a_int64_z_float64( float64 function( int64 ) )
289 {
290 clock_t startClock, endClock;
291 int32 count, i;
292 int8 inputNum;
293
294 count = 0;
295 inputNum = 0;
296 startClock = clock();
297 do {
298 for ( i = minIterations; i; --i ) {
299 function( inputs_int64[ inputNum ] );
300 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
301 }
302 count += minIterations;
303 } while ( clock() - startClock < CLOCKS_PER_SEC );
304 inputNum = 0;
305 startClock = clock();
306 for ( i = count; i; --i ) {
307 function( inputs_int64[ inputNum ] );
308 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
309 }
310 endClock = clock();
311 reportTime( count, endClock - startClock );
312
313 }
314
315 #ifdef FLOATX80
316
317 static void time_a_int64_z_floatx80( floatx80 function( int64 ) )
318 {
319 clock_t startClock, endClock;
320 int32 count, i;
321 int8 inputNum;
322
323 count = 0;
324 inputNum = 0;
325 startClock = clock();
326 do {
327 for ( i = minIterations; i; --i ) {
328 function( inputs_int64[ inputNum ] );
329 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
330 }
331 count += minIterations;
332 } while ( clock() - startClock < CLOCKS_PER_SEC );
333 inputNum = 0;
334 startClock = clock();
335 for ( i = count; i; --i ) {
336 function( inputs_int64[ inputNum ] );
337 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
338 }
339 endClock = clock();
340 reportTime( count, endClock - startClock );
341
342 }
343
344 #endif
345
346 #ifdef FLOAT128
347
348 static void time_a_int64_z_float128( float128 function( int64 ) )
349 {
350 clock_t startClock, endClock;
351 int32 count, i;
352 int8 inputNum;
353
354 count = 0;
355 inputNum = 0;
356 startClock = clock();
357 do {
358 for ( i = minIterations; i; --i ) {
359 function( inputs_int64[ inputNum ] );
360 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
361 }
362 count += minIterations;
363 } while ( clock() - startClock < CLOCKS_PER_SEC );
364 inputNum = 0;
365 startClock = clock();
366 for ( i = count; i; --i ) {
367 function( inputs_int64[ inputNum ] );
368 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
369 }
370 endClock = clock();
371 reportTime( count, endClock - startClock );
372
373 }
374
375 #endif
376
377 enum {
378 numInputs_float32 = 32
379 };
380
381 static const float32 inputs_float32[ numInputs_float32 ] = {
382 0x4EFA0000, 0xC1D0B328, 0x80000000, 0x3E69A31E,
383 0xAF803EFF, 0x3F800000, 0x17BF8000, 0xE74A301A,
384 0x4E010003, 0x7EE3C75D, 0xBD803FE0, 0xBFFEFF00,
385 0x7981F800, 0x431FFFFC, 0xC100C000, 0x3D87EFFF,
386 0x4103FEFE, 0xBC000007, 0xBF01F7FF, 0x4E6C6B5C,
387 0xC187FFFE, 0xC58B9F13, 0x4F88007F, 0xDF004007,
388 0xB7FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
389 0xDB428661, 0x33F89B1F, 0xA3BFEFFF, 0x537BFFBE
390 };
391
392 static void time_a_float32_z_int32( int32 function( float32 ) )
393 {
394 clock_t startClock, endClock;
395 int32 count, i;
396 int8 inputNum;
397
398 count = 0;
399 inputNum = 0;
400 startClock = clock();
401 do {
402 for ( i = minIterations; i; --i ) {
403 function( inputs_float32[ inputNum ] );
404 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
405 }
406 count += minIterations;
407 } while ( clock() - startClock < CLOCKS_PER_SEC );
408 inputNum = 0;
409 startClock = clock();
410 for ( i = count; i; --i ) {
411 function( inputs_float32[ inputNum ] );
412 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
413 }
414 endClock = clock();
415 reportTime( count, endClock - startClock );
416
417 }
418
419 static void time_a_float32_z_int64( int64 function( float32 ) )
420 {
421 clock_t startClock, endClock;
422 int32 count, i;
423 int8 inputNum;
424
425 count = 0;
426 inputNum = 0;
427 startClock = clock();
428 do {
429 for ( i = minIterations; i; --i ) {
430 function( inputs_float32[ inputNum ] );
431 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
432 }
433 count += minIterations;
434 } while ( clock() - startClock < CLOCKS_PER_SEC );
435 inputNum = 0;
436 startClock = clock();
437 for ( i = count; i; --i ) {
438 function( inputs_float32[ inputNum ] );
439 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
440 }
441 endClock = clock();
442 reportTime( count, endClock - startClock );
443
444 }
445
446 static void time_a_float32_z_float64( float64 function( float32 ) )
447 {
448 clock_t startClock, endClock;
449 int32 count, i;
450 int8 inputNum;
451
452 count = 0;
453 inputNum = 0;
454 startClock = clock();
455 do {
456 for ( i = minIterations; i; --i ) {
457 function( inputs_float32[ inputNum ] );
458 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
459 }
460 count += minIterations;
461 } while ( clock() - startClock < CLOCKS_PER_SEC );
462 inputNum = 0;
463 startClock = clock();
464 for ( i = count; i; --i ) {
465 function( inputs_float32[ inputNum ] );
466 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
467 }
468 endClock = clock();
469 reportTime( count, endClock - startClock );
470
471 }
472
473 #ifdef FLOATX80
474
475 static void time_a_float32_z_floatx80( floatx80 function( float32 ) )
476 {
477 clock_t startClock, endClock;
478 int32 count, i;
479 int8 inputNum;
480
481 count = 0;
482 inputNum = 0;
483 startClock = clock();
484 do {
485 for ( i = minIterations; i; --i ) {
486 function( inputs_float32[ inputNum ] );
487 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
488 }
489 count += minIterations;
490 } while ( clock() - startClock < CLOCKS_PER_SEC );
491 inputNum = 0;
492 startClock = clock();
493 for ( i = count; i; --i ) {
494 function( inputs_float32[ inputNum ] );
495 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
496 }
497 endClock = clock();
498 reportTime( count, endClock - startClock );
499
500 }
501
502 #endif
503
504 #ifdef FLOAT128
505
506 static void time_a_float32_z_float128( float128 function( float32 ) )
507 {
508 clock_t startClock, endClock;
509 int32 count, i;
510 int8 inputNum;
511
512 count = 0;
513 inputNum = 0;
514 startClock = clock();
515 do {
516 for ( i = minIterations; i; --i ) {
517 function( inputs_float32[ inputNum ] );
518 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
519 }
520 count += minIterations;
521 } while ( clock() - startClock < CLOCKS_PER_SEC );
522 inputNum = 0;
523 startClock = clock();
524 for ( i = count; i; --i ) {
525 function( inputs_float32[ inputNum ] );
526 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
527 }
528 endClock = clock();
529 reportTime( count, endClock - startClock );
530
531 }
532
533 #endif
534
535 static void time_az_float32( float32 function( float32 ) )
536 {
537 clock_t startClock, endClock;
538 int32 count, i;
539 int8 inputNum;
540
541 count = 0;
542 inputNum = 0;
543 startClock = clock();
544 do {
545 for ( i = minIterations; i; --i ) {
546 function( inputs_float32[ inputNum ] );
547 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
548 }
549 count += minIterations;
550 } while ( clock() - startClock < CLOCKS_PER_SEC );
551 inputNum = 0;
552 startClock = clock();
553 for ( i = count; i; --i ) {
554 function( inputs_float32[ inputNum ] );
555 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
556 }
557 endClock = clock();
558 reportTime( count, endClock - startClock );
559
560 }
561
562 static void time_ab_float32_z_flag( flag function( float32, float32 ) )
563 {
564 clock_t startClock, endClock;
565 int32 count, i;
566 int8 inputNumA, inputNumB;
567
568 count = 0;
569 inputNumA = 0;
570 inputNumB = 0;
571 startClock = clock();
572 do {
573 for ( i = minIterations; i; --i ) {
574 function(
575 inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
576 inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
577 if ( inputNumA == 0 ) ++inputNumB;
578 inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
579 }
580 count += minIterations;
581 } while ( clock() - startClock < CLOCKS_PER_SEC );
582 inputNumA = 0;
583 inputNumB = 0;
584 startClock = clock();
585 for ( i = count; i; --i ) {
586 function(
587 inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
588 inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
589 if ( inputNumA == 0 ) ++inputNumB;
590 inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
591 }
592 endClock = clock();
593 reportTime( count, endClock - startClock );
594
595 }
596
597 static void time_abz_float32( float32 function( float32, float32 ) )
598 {
599 clock_t startClock, endClock;
600 int32 count, i;
601 int8 inputNumA, inputNumB;
602
603 count = 0;
604 inputNumA = 0;
605 inputNumB = 0;
606 startClock = clock();
607 do {
608 for ( i = minIterations; i; --i ) {
609 function(
610 inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
611 inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
612 if ( inputNumA == 0 ) ++inputNumB;
613 inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
614 }
615 count += minIterations;
616 } while ( clock() - startClock < CLOCKS_PER_SEC );
617 inputNumA = 0;
618 inputNumB = 0;
619 startClock = clock();
620 for ( i = count; i; --i ) {
621 function(
622 inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
623 inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
624 if ( inputNumA == 0 ) ++inputNumB;
625 inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
626 }
627 endClock = clock();
628 reportTime( count, endClock - startClock );
629
630 }
631
632 static const float32 inputs_float32_pos[ numInputs_float32 ] = {
633 0x4EFA0000, 0x41D0B328, 0x00000000, 0x3E69A31E,
634 0x2F803EFF, 0x3F800000, 0x17BF8000, 0x674A301A,
635 0x4E010003, 0x7EE3C75D, 0x3D803FE0, 0x3FFEFF00,
636 0x7981F800, 0x431FFFFC, 0x4100C000, 0x3D87EFFF,
637 0x4103FEFE, 0x3C000007, 0x3F01F7FF, 0x4E6C6B5C,
638 0x4187FFFE, 0x458B9F13, 0x4F88007F, 0x5F004007,
639 0x37FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
640 0x5B428661, 0x33F89B1F, 0x23BFEFFF, 0x537BFFBE
641 };
642
643 static void time_az_float32_pos( float32 function( float32 ) )
644 {
645 clock_t startClock, endClock;
646 int32 count, i;
647 int8 inputNum;
648
649 count = 0;
650 inputNum = 0;
651 startClock = clock();
652 do {
653 for ( i = minIterations; i; --i ) {
654 function( inputs_float32_pos[ inputNum ] );
655 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
656 }
657 count += minIterations;
658 } while ( clock() - startClock < CLOCKS_PER_SEC );
659 inputNum = 0;
660 startClock = clock();
661 for ( i = count; i; --i ) {
662 function( inputs_float32_pos[ inputNum ] );
663 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
664 }
665 endClock = clock();
666 reportTime( count, endClock - startClock );
667
668 }
669
670 enum {
671 numInputs_float64 = 32
672 };
673
674 static const float64 inputs_float64[ numInputs_float64 ] = {
675 LIT64( 0x422FFFC008000000 ),
676 LIT64( 0xB7E0000480000000 ),
677 LIT64( 0xF3FD2546120B7935 ),
678 LIT64( 0x3FF0000000000000 ),
679 LIT64( 0xCE07F766F09588D6 ),
680 LIT64( 0x8000000000000000 ),
681 LIT64( 0x3FCE000400000000 ),
682 LIT64( 0x8313B60F0032BED8 ),
683 LIT64( 0xC1EFFFFFC0002000 ),
684 LIT64( 0x3FB3C75D224F2B0F ),
685 LIT64( 0x7FD00000004000FF ),
686 LIT64( 0xA12FFF8000001FFF ),
687 LIT64( 0x3EE0000000FE0000 ),
688 LIT64( 0x0010000080000004 ),
689 LIT64( 0x41CFFFFE00000020 ),
690 LIT64( 0x40303FFFFFFFFFFD ),
691 LIT64( 0x3FD000003FEFFFFF ),
692 LIT64( 0xBFD0000010000000 ),
693 LIT64( 0xB7FC6B5C16CA55CF ),
694 LIT64( 0x413EEB940B9D1301 ),
695 LIT64( 0xC7E00200001FFFFF ),
696 LIT64( 0x47F00021FFFFFFFE ),
697 LIT64( 0xBFFFFFFFF80000FF ),
698 LIT64( 0xC07FFFFFE00FFFFF ),
699 LIT64( 0x001497A63740C5E8 ),
700 LIT64( 0xC4BFFFE0001FFFFF ),
701 LIT64( 0x96FFDFFEFFFFFFFF ),
702 LIT64( 0x403FC000000001FE ),
703 LIT64( 0xFFD00000000001F6 ),
704 LIT64( 0x0640400002000000 ),
705 LIT64( 0x479CEE1E4F789FE0 ),
706 LIT64( 0xC237FFFFFFFFFDFE )
707 };
708
709 static void time_a_float64_z_int32( int32 function( float64 ) )
710 {
711 clock_t startClock, endClock;
712 int32 count, i;
713 int8 inputNum;
714
715 count = 0;
716 inputNum = 0;
717 startClock = clock();
718 do {
719 for ( i = minIterations; i; --i ) {
720 function( inputs_float64[ inputNum ] );
721 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
722 }
723 count += minIterations;
724 } while ( clock() - startClock < CLOCKS_PER_SEC );
725 inputNum = 0;
726 startClock = clock();
727 for ( i = count; i; --i ) {
728 function( inputs_float64[ inputNum ] );
729 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
730 }
731 endClock = clock();
732 reportTime( count, endClock - startClock );
733
734 }
735
736 static void time_a_float64_z_int64( int64 function( float64 ) )
737 {
738 clock_t startClock, endClock;
739 int32 count, i;
740 int8 inputNum;
741
742 count = 0;
743 inputNum = 0;
744 startClock = clock();
745 do {
746 for ( i = minIterations; i; --i ) {
747 function( inputs_float64[ inputNum ] );
748 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
749 }
750 count += minIterations;
751 } while ( clock() - startClock < CLOCKS_PER_SEC );
752 inputNum = 0;
753 startClock = clock();
754 for ( i = count; i; --i ) {
755 function( inputs_float64[ inputNum ] );
756 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
757 }
758 endClock = clock();
759 reportTime( count, endClock - startClock );
760
761 }
762
763 static void time_a_float64_z_float32( float32 function( float64 ) )
764 {
765 clock_t startClock, endClock;
766 int32 count, i;
767 int8 inputNum;
768
769 count = 0;
770 inputNum = 0;
771 startClock = clock();
772 do {
773 for ( i = minIterations; i; --i ) {
774 function( inputs_float64[ inputNum ] );
775 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
776 }
777 count += minIterations;
778 } while ( clock() - startClock < CLOCKS_PER_SEC );
779 inputNum = 0;
780 startClock = clock();
781 for ( i = count; i; --i ) {
782 function( inputs_float64[ inputNum ] );
783 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
784 }
785 endClock = clock();
786 reportTime( count, endClock - startClock );
787
788 }
789
790 #ifdef FLOATX80
791
792 static void time_a_float64_z_floatx80( floatx80 function( float64 ) )
793 {
794 clock_t startClock, endClock;
795 int32 count, i;
796 int8 inputNum;
797
798 count = 0;
799 inputNum = 0;
800 startClock = clock();
801 do {
802 for ( i = minIterations; i; --i ) {
803 function( inputs_float64[ inputNum ] );
804 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
805 }
806 count += minIterations;
807 } while ( clock() - startClock < CLOCKS_PER_SEC );
808 inputNum = 0;
809 startClock = clock();
810 for ( i = count; i; --i ) {
811 function( inputs_float64[ inputNum ] );
812 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
813 }
814 endClock = clock();
815 reportTime( count, endClock - startClock );
816
817 }
818
819 #endif
820
821 #ifdef FLOAT128
822
823 static void time_a_float64_z_float128( float128 function( float64 ) )
824 {
825 clock_t startClock, endClock;
826 int32 count, i;
827 int8 inputNum;
828
829 count = 0;
830 inputNum = 0;
831 startClock = clock();
832 do {
833 for ( i = minIterations; i; --i ) {
834 function( inputs_float64[ inputNum ] );
835 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
836 }
837 count += minIterations;
838 } while ( clock() - startClock < CLOCKS_PER_SEC );
839 inputNum = 0;
840 startClock = clock();
841 for ( i = count; i; --i ) {
842 function( inputs_float64[ inputNum ] );
843 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
844 }
845 endClock = clock();
846 reportTime( count, endClock - startClock );
847
848 }
849
850 #endif
851
852 static void time_az_float64( float64 function( float64 ) )
853 {
854 clock_t startClock, endClock;
855 int32 count, i;
856 int8 inputNum;
857
858 count = 0;
859 inputNum = 0;
860 startClock = clock();
861 do {
862 for ( i = minIterations; i; --i ) {
863 function( inputs_float64[ inputNum ] );
864 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
865 }
866 count += minIterations;
867 } while ( clock() - startClock < CLOCKS_PER_SEC );
868 inputNum = 0;
869 startClock = clock();
870 for ( i = count; i; --i ) {
871 function( inputs_float64[ inputNum ] );
872 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
873 }
874 endClock = clock();
875 reportTime( count, endClock - startClock );
876
877 }
878
879 static void time_ab_float64_z_flag( flag function( float64, float64 ) )
880 {
881 clock_t startClock, endClock;
882 int32 count, i;
883 int8 inputNumA, inputNumB;
884
885 count = 0;
886 inputNumA = 0;
887 inputNumB = 0;
888 startClock = clock();
889 do {
890 for ( i = minIterations; i; --i ) {
891 function(
892 inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
893 inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
894 if ( inputNumA == 0 ) ++inputNumB;
895 inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
896 }
897 count += minIterations;
898 } while ( clock() - startClock < CLOCKS_PER_SEC );
899 inputNumA = 0;
900 inputNumB = 0;
901 startClock = clock();
902 for ( i = count; i; --i ) {
903 function(
904 inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
905 inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
906 if ( inputNumA == 0 ) ++inputNumB;
907 inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
908 }
909 endClock = clock();
910 reportTime( count, endClock - startClock );
911
912 }
913
914 static void time_abz_float64( float64 function( float64, float64 ) )
915 {
916 clock_t startClock, endClock;
917 int32 count, i;
918 int8 inputNumA, inputNumB;
919
920 count = 0;
921 inputNumA = 0;
922 inputNumB = 0;
923 startClock = clock();
924 do {
925 for ( i = minIterations; i; --i ) {
926 function(
927 inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
928 inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
929 if ( inputNumA == 0 ) ++inputNumB;
930 inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
931 }
932 count += minIterations;
933 } while ( clock() - startClock < CLOCKS_PER_SEC );
934 inputNumA = 0;
935 inputNumB = 0;
936 startClock = clock();
937 for ( i = count; i; --i ) {
938 function(
939 inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
940 inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
941 if ( inputNumA == 0 ) ++inputNumB;
942 inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
943 }
944 endClock = clock();
945 reportTime( count, endClock - startClock );
946
947 }
948
949 static const float64 inputs_float64_pos[ numInputs_float64 ] = {
950 LIT64( 0x422FFFC008000000 ),
951 LIT64( 0x37E0000480000000 ),
952 LIT64( 0x73FD2546120B7935 ),
953 LIT64( 0x3FF0000000000000 ),
954 LIT64( 0x4E07F766F09588D6 ),
955 LIT64( 0x0000000000000000 ),
956 LIT64( 0x3FCE000400000000 ),
957 LIT64( 0x0313B60F0032BED8 ),
958 LIT64( 0x41EFFFFFC0002000 ),
959 LIT64( 0x3FB3C75D224F2B0F ),
960 LIT64( 0x7FD00000004000FF ),
961 LIT64( 0x212FFF8000001FFF ),
962 LIT64( 0x3EE0000000FE0000 ),
963 LIT64( 0x0010000080000004 ),
964 LIT64( 0x41CFFFFE00000020 ),
965 LIT64( 0x40303FFFFFFFFFFD ),
966 LIT64( 0x3FD000003FEFFFFF ),
967 LIT64( 0x3FD0000010000000 ),
968 LIT64( 0x37FC6B5C16CA55CF ),
969 LIT64( 0x413EEB940B9D1301 ),
970 LIT64( 0x47E00200001FFFFF ),
971 LIT64( 0x47F00021FFFFFFFE ),
972 LIT64( 0x3FFFFFFFF80000FF ),
973 LIT64( 0x407FFFFFE00FFFFF ),
974 LIT64( 0x001497A63740C5E8 ),
975 LIT64( 0x44BFFFE0001FFFFF ),
976 LIT64( 0x16FFDFFEFFFFFFFF ),
977 LIT64( 0x403FC000000001FE ),
978 LIT64( 0x7FD00000000001F6 ),
979 LIT64( 0x0640400002000000 ),
980 LIT64( 0x479CEE1E4F789FE0 ),
981 LIT64( 0x4237FFFFFFFFFDFE )
982 };
983
984 static void time_az_float64_pos( float64 function( float64 ) )
985 {
986 clock_t startClock, endClock;
987 int32 count, i;
988 int8 inputNum;
989
990 count = 0;
991 inputNum = 0;
992 startClock = clock();
993 do {
994 for ( i = minIterations; i; --i ) {
995 function( inputs_float64_pos[ inputNum ] );
996 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
997 }
998 count += minIterations;
999 } while ( clock() - startClock < CLOCKS_PER_SEC );
1000 inputNum = 0;
1001 startClock = clock();
1002 for ( i = count; i; --i ) {
1003 function( inputs_float64_pos[ inputNum ] );
1004 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
1005 }
1006 endClock = clock();
1007 reportTime( count, endClock - startClock );
1008
1009 }
1010
1011 #ifdef FLOATX80
1012
1013 enum {
1014 numInputs_floatx80 = 32
1015 };
1016
1017 static const struct {
1018 bits16 high;
1019 bits64 low;
1020 } inputs_floatx80[ numInputs_floatx80 ] = {
1021 { 0xC03F, LIT64( 0xA9BE15A19C1E8B62 ) },
1022 { 0x8000, LIT64( 0x0000000000000000 ) },
1023 { 0x75A8, LIT64( 0xE59591E4788957A5 ) },
1024 { 0xBFFF, LIT64( 0xFFF0000000000040 ) },
1025 { 0x0CD8, LIT64( 0xFC000000000007FE ) },
1026 { 0x43BA, LIT64( 0x99A4000000000000 ) },
1027 { 0x3FFF, LIT64( 0x8000000000000000 ) },
1028 { 0x4081, LIT64( 0x94FBF1BCEB5545F0 ) },
1029 { 0x403E, LIT64( 0xFFF0000000002000 ) },
1030 { 0x3FFE, LIT64( 0xC860E3C75D224F28 ) },
1031 { 0x407E, LIT64( 0xFC00000FFFFFFFFE ) },
1032 { 0x737A, LIT64( 0x800000007FFDFFFE ) },
1033 { 0x4044, LIT64( 0xFFFFFF80000FFFFF ) },
1034 { 0xBBFE, LIT64( 0x8000040000001FFE ) },
1035 { 0xC002, LIT64( 0xFF80000000000020 ) },
1036 { 0xDE8D, LIT64( 0xFFFFFFFFFFE00004 ) },
1037 { 0xC004, LIT64( 0x8000000000003FFB ) },
1038 { 0x407F, LIT64( 0x800000000003FFFE ) },
1039 { 0xC000, LIT64( 0xA459EE6A5C16CA55 ) },
1040 { 0x8003, LIT64( 0xC42CBF7399AEEB94 ) },
1041 { 0xBF7F, LIT64( 0xF800000000000006 ) },
1042 { 0xC07F, LIT64( 0xBF56BE8871F28FEA ) },
1043 { 0xC07E, LIT64( 0xFFFF77FFFFFFFFFE ) },
1044 { 0xADC9, LIT64( 0x8000000FFFFFFFDE ) },
1045 { 0xC001, LIT64( 0xEFF7FFFFFFFFFFFF ) },
1046 { 0x4001, LIT64( 0xBE84F30125C497A6 ) },
1047 { 0xC06B, LIT64( 0xEFFFFFFFFFFFFFFF ) },
1048 { 0x4080, LIT64( 0xFFFFFFFFBFFFFFFF ) },
1049 { 0x87E9, LIT64( 0x81FFFFFFFFFFFBFF ) },
1050 { 0xA63F, LIT64( 0x801FFFFFFEFFFFFE ) },
1051 { 0x403C, LIT64( 0x801FFFFFFFF7FFFF ) },
1052 { 0x4018, LIT64( 0x8000000000080003 ) }
1053 };
1054
1055 static void time_a_floatx80_z_int32( int32 function( floatx80 ) )
1056 {
1057 clock_t startClock, endClock;
1058 int32 count, i;
1059 int8 inputNum;
1060 floatx80 a;
1061
1062 count = 0;
1063 inputNum = 0;
1064 startClock = clock();
1065 do {
1066 for ( i = minIterations; i; --i ) {
1067 a.low = inputs_floatx80[ inputNum ].low;
1068 a.high = inputs_floatx80[ inputNum ].high;
1069 function( a );
1070 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1071 }
1072 count += minIterations;
1073 } while ( clock() - startClock < CLOCKS_PER_SEC );
1074 inputNum = 0;
1075 startClock = clock();
1076 for ( i = count; i; --i ) {
1077 a.low = inputs_floatx80[ inputNum ].low;
1078 a.high = inputs_floatx80[ inputNum ].high;
1079 function( a );
1080 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1081 }
1082 endClock = clock();
1083 reportTime( count, endClock - startClock );
1084
1085 }
1086
1087 static void time_a_floatx80_z_int64( int64 function( floatx80 ) )
1088 {
1089 clock_t startClock, endClock;
1090 int32 count, i;
1091 int8 inputNum;
1092 floatx80 a;
1093
1094 count = 0;
1095 inputNum = 0;
1096 startClock = clock();
1097 do {
1098 for ( i = minIterations; i; --i ) {
1099 a.low = inputs_floatx80[ inputNum ].low;
1100 a.high = inputs_floatx80[ inputNum ].high;
1101 function( a );
1102 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1103 }
1104 count += minIterations;
1105 } while ( clock() - startClock < CLOCKS_PER_SEC );
1106 inputNum = 0;
1107 startClock = clock();
1108 for ( i = count; i; --i ) {
1109 a.low = inputs_floatx80[ inputNum ].low;
1110 a.high = inputs_floatx80[ inputNum ].high;
1111 function( a );
1112 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1113 }
1114 endClock = clock();
1115 reportTime( count, endClock - startClock );
1116
1117 }
1118
1119 static void time_a_floatx80_z_float32( float32 function( floatx80 ) )
1120 {
1121 clock_t startClock, endClock;
1122 int32 count, i;
1123 int8 inputNum;
1124 floatx80 a;
1125
1126 count = 0;
1127 inputNum = 0;
1128 startClock = clock();
1129 do {
1130 for ( i = minIterations; i; --i ) {
1131 a.low = inputs_floatx80[ inputNum ].low;
1132 a.high = inputs_floatx80[ inputNum ].high;
1133 function( a );
1134 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1135 }
1136 count += minIterations;
1137 } while ( clock() - startClock < CLOCKS_PER_SEC );
1138 inputNum = 0;
1139 startClock = clock();
1140 for ( i = count; i; --i ) {
1141 a.low = inputs_floatx80[ inputNum ].low;
1142 a.high = inputs_floatx80[ inputNum ].high;
1143 function( a );
1144 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1145 }
1146 endClock = clock();
1147 reportTime( count, endClock - startClock );
1148
1149 }
1150
1151 static void time_a_floatx80_z_float64( float64 function( floatx80 ) )
1152 {
1153 clock_t startClock, endClock;
1154 int32 count, i;
1155 int8 inputNum;
1156 floatx80 a;
1157
1158 count = 0;
1159 inputNum = 0;
1160 startClock = clock();
1161 do {
1162 for ( i = minIterations; i; --i ) {
1163 a.low = inputs_floatx80[ inputNum ].low;
1164 a.high = inputs_floatx80[ inputNum ].high;
1165 function( a );
1166 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1167 }
1168 count += minIterations;
1169 } while ( clock() - startClock < CLOCKS_PER_SEC );
1170 inputNum = 0;
1171 startClock = clock();
1172 for ( i = count; i; --i ) {
1173 a.low = inputs_floatx80[ inputNum ].low;
1174 a.high = inputs_floatx80[ inputNum ].high;
1175 function( a );
1176 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1177 }
1178 endClock = clock();
1179 reportTime( count, endClock - startClock );
1180
1181 }
1182
1183 #ifdef FLOAT128
1184
1185 static void time_a_floatx80_z_float128( float128 function( floatx80 ) )
1186 {
1187 clock_t startClock, endClock;
1188 int32 count, i;
1189 int8 inputNum;
1190 floatx80 a;
1191
1192 count = 0;
1193 inputNum = 0;
1194 startClock = clock();
1195 do {
1196 for ( i = minIterations; i; --i ) {
1197 a.low = inputs_floatx80[ inputNum ].low;
1198 a.high = inputs_floatx80[ inputNum ].high;
1199 function( a );
1200 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1201 }
1202 count += minIterations;
1203 } while ( clock() - startClock < CLOCKS_PER_SEC );
1204 inputNum = 0;
1205 startClock = clock();
1206 for ( i = count; i; --i ) {
1207 a.low = inputs_floatx80[ inputNum ].low;
1208 a.high = inputs_floatx80[ inputNum ].high;
1209 function( a );
1210 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1211 }
1212 endClock = clock();
1213 reportTime( count, endClock - startClock );
1214
1215 }
1216
1217 #endif
1218
1219 static void time_az_floatx80( floatx80 function( floatx80 ) )
1220 {
1221 clock_t startClock, endClock;
1222 int32 count, i;
1223 int8 inputNum;
1224 floatx80 a;
1225
1226 count = 0;
1227 inputNum = 0;
1228 startClock = clock();
1229 do {
1230 for ( i = minIterations; i; --i ) {
1231 a.low = inputs_floatx80[ inputNum ].low;
1232 a.high = inputs_floatx80[ inputNum ].high;
1233 function( a );
1234 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1235 }
1236 count += minIterations;
1237 } while ( clock() - startClock < CLOCKS_PER_SEC );
1238 inputNum = 0;
1239 startClock = clock();
1240 for ( i = count; i; --i ) {
1241 a.low = inputs_floatx80[ inputNum ].low;
1242 a.high = inputs_floatx80[ inputNum ].high;
1243 function( a );
1244 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1245 }
1246 endClock = clock();
1247 reportTime( count, endClock - startClock );
1248
1249 }
1250
1251 static void time_ab_floatx80_z_flag( flag function( floatx80, floatx80 ) )
1252 {
1253 clock_t startClock, endClock;
1254 int32 count, i;
1255 int8 inputNumA, inputNumB;
1256 floatx80 a, b;
1257
1258 count = 0;
1259 inputNumA = 0;
1260 inputNumB = 0;
1261 startClock = clock();
1262 do {
1263 for ( i = minIterations; i; --i ) {
1264 a.low = inputs_floatx80[ inputNumA ].low;
1265 a.high = inputs_floatx80[ inputNumA ].high;
1266 b.low = inputs_floatx80[ inputNumB ].low;
1267 b.high = inputs_floatx80[ inputNumB ].high;
1268 function( a, b );
1269 inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
1270 if ( inputNumA == 0 ) ++inputNumB;
1271 inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
1272 }
1273 count += minIterations;
1274 } while ( clock() - startClock < CLOCKS_PER_SEC );
1275 inputNumA = 0;
1276 inputNumB = 0;
1277 startClock = clock();
1278 for ( i = count; i; --i ) {
1279 a.low = inputs_floatx80[ inputNumA ].low;
1280 a.high = inputs_floatx80[ inputNumA ].high;
1281 b.low = inputs_floatx80[ inputNumB ].low;
1282 b.high = inputs_floatx80[ inputNumB ].high;
1283 function( a, b );
1284 inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
1285 if ( inputNumA == 0 ) ++inputNumB;
1286 inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
1287 }
1288 endClock = clock();
1289 reportTime( count, endClock - startClock );
1290
1291 }
1292
1293 static void time_abz_floatx80( floatx80 function( floatx80, floatx80 ) )
1294 {
1295 clock_t startClock, endClock;
1296 int32 count, i;
1297 int8 inputNumA, inputNumB;
1298 floatx80 a, b;
1299
1300 count = 0;
1301 inputNumA = 0;
1302 inputNumB = 0;
1303 startClock = clock();
1304 do {
1305 for ( i = minIterations; i; --i ) {
1306 a.low = inputs_floatx80[ inputNumA ].low;
1307 a.high = inputs_floatx80[ inputNumA ].high;
1308 b.low = inputs_floatx80[ inputNumB ].low;
1309 b.high = inputs_floatx80[ inputNumB ].high;
1310 function( a, b );
1311 inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
1312 if ( inputNumA == 0 ) ++inputNumB;
1313 inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
1314 }
1315 count += minIterations;
1316 } while ( clock() - startClock < CLOCKS_PER_SEC );
1317 inputNumA = 0;
1318 inputNumB = 0;
1319 startClock = clock();
1320 for ( i = count; i; --i ) {
1321 a.low = inputs_floatx80[ inputNumA ].low;
1322 a.high = inputs_floatx80[ inputNumA ].high;
1323 b.low = inputs_floatx80[ inputNumB ].low;
1324 b.high = inputs_floatx80[ inputNumB ].high;
1325 function( a, b );
1326 inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
1327 if ( inputNumA == 0 ) ++inputNumB;
1328 inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
1329 }
1330 endClock = clock();
1331 reportTime( count, endClock - startClock );
1332
1333 }
1334
1335 static const struct {
1336 bits16 high;
1337 bits64 low;
1338 } inputs_floatx80_pos[ numInputs_floatx80 ] = {
1339 { 0x403F, LIT64( 0xA9BE15A19C1E8B62 ) },
1340 { 0x0000, LIT64( 0x0000000000000000 ) },
1341 { 0x75A8, LIT64( 0xE59591E4788957A5 ) },
1342 { 0x3FFF, LIT64( 0xFFF0000000000040 ) },
1343 { 0x0CD8, LIT64( 0xFC000000000007FE ) },
1344 { 0x43BA, LIT64( 0x99A4000000000000 ) },
1345 { 0x3FFF, LIT64( 0x8000000000000000 ) },
1346 { 0x4081, LIT64( 0x94FBF1BCEB5545F0 ) },
1347 { 0x403E, LIT64( 0xFFF0000000002000 ) },
1348 { 0x3FFE, LIT64( 0xC860E3C75D224F28 ) },
1349 { 0x407E, LIT64( 0xFC00000FFFFFFFFE ) },
1350 { 0x737A, LIT64( 0x800000007FFDFFFE ) },
1351 { 0x4044, LIT64( 0xFFFFFF80000FFFFF ) },
1352 { 0x3BFE, LIT64( 0x8000040000001FFE ) },
1353 { 0x4002, LIT64( 0xFF80000000000020 ) },
1354 { 0x5E8D, LIT64( 0xFFFFFFFFFFE00004 ) },
1355 { 0x4004, LIT64( 0x8000000000003FFB ) },
1356 { 0x407F, LIT64( 0x800000000003FFFE ) },
1357 { 0x4000, LIT64( 0xA459EE6A5C16CA55 ) },
1358 { 0x0003, LIT64( 0xC42CBF7399AEEB94 ) },
1359 { 0x3F7F, LIT64( 0xF800000000000006 ) },
1360 { 0x407F, LIT64( 0xBF56BE8871F28FEA ) },
1361 { 0x407E, LIT64( 0xFFFF77FFFFFFFFFE ) },
1362 { 0x2DC9, LIT64( 0x8000000FFFFFFFDE ) },
1363 { 0x4001, LIT64( 0xEFF7FFFFFFFFFFFF ) },
1364 { 0x4001, LIT64( 0xBE84F30125C497A6 ) },
1365 { 0x406B, LIT64( 0xEFFFFFFFFFFFFFFF ) },
1366 { 0x4080, LIT64( 0xFFFFFFFFBFFFFFFF ) },
1367 { 0x07E9, LIT64( 0x81FFFFFFFFFFFBFF ) },
1368 { 0x263F, LIT64( 0x801FFFFFFEFFFFFE ) },
1369 { 0x403C, LIT64( 0x801FFFFFFFF7FFFF ) },
1370 { 0x4018, LIT64( 0x8000000000080003 ) }
1371 };
1372
1373 static void time_az_floatx80_pos( floatx80 function( floatx80 ) )
1374 {
1375 clock_t startClock, endClock;
1376 int32 count, i;
1377 int8 inputNum;
1378 floatx80 a;
1379
1380 count = 0;
1381 inputNum = 0;
1382 startClock = clock();
1383 do {
1384 for ( i = minIterations; i; --i ) {
1385 a.low = inputs_floatx80_pos[ inputNum ].low;
1386 a.high = inputs_floatx80_pos[ inputNum ].high;
1387 function( a );
1388 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1389 }
1390 count += minIterations;
1391 } while ( clock() - startClock < CLOCKS_PER_SEC );
1392 inputNum = 0;
1393 startClock = clock();
1394 for ( i = count; i; --i ) {
1395 a.low = inputs_floatx80_pos[ inputNum ].low;
1396 a.high = inputs_floatx80_pos[ inputNum ].high;
1397 function( a );
1398 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1399 }
1400 endClock = clock();
1401 reportTime( count, endClock - startClock );
1402
1403 }
1404
1405 #endif
1406
1407 #ifdef FLOAT128
1408
1409 enum {
1410 numInputs_float128 = 32
1411 };
1412
1413 static const struct {
1414 bits64 high, low;
1415 } inputs_float128[ numInputs_float128 ] = {
1416 { LIT64( 0x3FDA200000100000 ), LIT64( 0x0000000000000000 ) },
1417 { LIT64( 0x3FFF000000000000 ), LIT64( 0x0000000000000000 ) },
1418 { LIT64( 0x85F14776190C8306 ), LIT64( 0xD8715F4E3D54BB92 ) },
1419 { LIT64( 0xF2B00000007FFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
1420 { LIT64( 0x8000000000000000 ), LIT64( 0x0000000000000000 ) },
1421 { LIT64( 0xBFFFFFFFFFE00000 ), LIT64( 0x0000008000000000 ) },
1422 { LIT64( 0x407F1719CE722F3E ), LIT64( 0xDA6B3FE5FF29425B ) },
1423 { LIT64( 0x43FFFF8000000000 ), LIT64( 0x0000000000400000 ) },
1424 { LIT64( 0x401E000000000100 ), LIT64( 0x0000000000002000 ) },
1425 { LIT64( 0x3FFED71DACDA8E47 ), LIT64( 0x4860E3C75D224F28 ) },
1426 { LIT64( 0xBF7ECFC1E90647D1 ), LIT64( 0x7A124FE55623EE44 ) },
1427 { LIT64( 0x0DF7007FFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
1428 { LIT64( 0x3FE5FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
1429 { LIT64( 0x403FFFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFE ) },
1430 { LIT64( 0xBFFB2FBF7399AFEB ), LIT64( 0xA459EE6A5C16CA55 ) },
1431 { LIT64( 0xBDB8FFFFFFFFFFFC ), LIT64( 0x0000000000000400 ) },
1432 { LIT64( 0x3FC8FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
1433 { LIT64( 0x3FFBFFFFFFDFFFFF ), LIT64( 0xFFF8000000000000 ) },
1434 { LIT64( 0x407043C11737BE84 ), LIT64( 0xDDD58212ADC937F4 ) },
1435 { LIT64( 0x8001000000000000 ), LIT64( 0x0000001000000001 ) },
1436 { LIT64( 0xC036FFFFFFFFFFFF ), LIT64( 0xFE40000000000000 ) },
1437 { LIT64( 0x4002FFFFFE000002 ), LIT64( 0x0000000000000000 ) },
1438 { LIT64( 0x4000C3FEDE897773 ), LIT64( 0x326AC4FD8EFBE6DC ) },
1439 { LIT64( 0xBFFF0000000FFFFF ), LIT64( 0xFFFFFE0000000000 ) },
1440 { LIT64( 0x62C3E502146E426D ), LIT64( 0x43F3CAA0DC7DF1A0 ) },
1441 { LIT64( 0xB5CBD32E52BB570E ), LIT64( 0xBCC477CB11C6236C ) },
1442 { LIT64( 0xE228FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
1443 { LIT64( 0x3F80000000000000 ), LIT64( 0x0000000080000008 ) },
1444 { LIT64( 0xC1AFFFDFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
1445 { LIT64( 0xC96F000000000000 ), LIT64( 0x00000001FFFBFFFF ) },
1446 { LIT64( 0x3DE09BFE7923A338 ), LIT64( 0xBCC8FBBD7CEC1F4F ) },
1447 { LIT64( 0x401CFFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFF80 ) }
1448 };
1449
1450 static void time_a_float128_z_int32( int32 function( float128 ) )
1451 {
1452 clock_t startClock, endClock;
1453 int32 count, i;
1454 int8 inputNum;
1455 float128 a;
1456
1457 count = 0;
1458 inputNum = 0;
1459 startClock = clock();
1460 do {
1461 for ( i = minIterations; i; --i ) {
1462 a.low = inputs_float128[ inputNum ].low;
1463 a.high = inputs_float128[ inputNum ].high;
1464 function( a );
1465 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1466 }
1467 count += minIterations;
1468 } while ( clock() - startClock < CLOCKS_PER_SEC );
1469 inputNum = 0;
1470 startClock = clock();
1471 for ( i = count; i; --i ) {
1472 a.low = inputs_float128[ inputNum ].low;
1473 a.high = inputs_float128[ inputNum ].high;
1474 function( a );
1475 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1476 }
1477 endClock = clock();
1478 reportTime( count, endClock - startClock );
1479
1480 }
1481
1482 static void time_a_float128_z_int64( int64 function( float128 ) )
1483 {
1484 clock_t startClock, endClock;
1485 int32 count, i;
1486 int8 inputNum;
1487 float128 a;
1488
1489 count = 0;
1490 inputNum = 0;
1491 startClock = clock();
1492 do {
1493 for ( i = minIterations; i; --i ) {
1494 a.low = inputs_float128[ inputNum ].low;
1495 a.high = inputs_float128[ inputNum ].high;
1496 function( a );
1497 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1498 }
1499 count += minIterations;
1500 } while ( clock() - startClock < CLOCKS_PER_SEC );
1501 inputNum = 0;
1502 startClock = clock();
1503 for ( i = count; i; --i ) {
1504 a.low = inputs_float128[ inputNum ].low;
1505 a.high = inputs_float128[ inputNum ].high;
1506 function( a );
1507 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1508 }
1509 endClock = clock();
1510 reportTime( count, endClock - startClock );
1511
1512 }
1513
1514 static void time_a_float128_z_float32( float32 function( float128 ) )
1515 {
1516 clock_t startClock, endClock;
1517 int32 count, i;
1518 int8 inputNum;
1519 float128 a;
1520
1521 count = 0;
1522 inputNum = 0;
1523 startClock = clock();
1524 do {
1525 for ( i = minIterations; i; --i ) {
1526 a.low = inputs_float128[ inputNum ].low;
1527 a.high = inputs_float128[ inputNum ].high;
1528 function( a );
1529 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1530 }
1531 count += minIterations;
1532 } while ( clock() - startClock < CLOCKS_PER_SEC );
1533 inputNum = 0;
1534 startClock = clock();
1535 for ( i = count; i; --i ) {
1536 a.low = inputs_float128[ inputNum ].low;
1537 a.high = inputs_float128[ inputNum ].high;
1538 function( a );
1539 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1540 }
1541 endClock = clock();
1542 reportTime( count, endClock - startClock );
1543
1544 }
1545
1546 static void time_a_float128_z_float64( float64 function( float128 ) )
1547 {
1548 clock_t startClock, endClock;
1549 int32 count, i;
1550 int8 inputNum;
1551 float128 a;
1552
1553 count = 0;
1554 inputNum = 0;
1555 startClock = clock();
1556 do {
1557 for ( i = minIterations; i; --i ) {
1558 a.low = inputs_float128[ inputNum ].low;
1559 a.high = inputs_float128[ inputNum ].high;
1560 function( a );
1561 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1562 }
1563 count += minIterations;
1564 } while ( clock() - startClock < CLOCKS_PER_SEC );
1565 inputNum = 0;
1566 startClock = clock();
1567 for ( i = count; i; --i ) {
1568 a.low = inputs_float128[ inputNum ].low;
1569 a.high = inputs_float128[ inputNum ].high;
1570 function( a );
1571 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1572 }
1573 endClock = clock();
1574 reportTime( count, endClock - startClock );
1575
1576 }
1577
1578 #ifdef FLOATX80
1579
1580 static void time_a_float128_z_floatx80( floatx80 function( float128 ) )
1581 {
1582 clock_t startClock, endClock;
1583 int32 count, i;
1584 int8 inputNum;
1585 float128 a;
1586
1587 count = 0;
1588 inputNum = 0;
1589 startClock = clock();
1590 do {
1591 for ( i = minIterations; i; --i ) {
1592 a.low = inputs_float128[ inputNum ].low;
1593 a.high = inputs_float128[ inputNum ].high;
1594 function( a );
1595 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1596 }
1597 count += minIterations;
1598 } while ( clock() - startClock < CLOCKS_PER_SEC );
1599 inputNum = 0;
1600 startClock = clock();
1601 for ( i = count; i; --i ) {
1602 a.low = inputs_float128[ inputNum ].low;
1603 a.high = inputs_float128[ inputNum ].high;
1604 function( a );
1605 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1606 }
1607 endClock = clock();
1608 reportTime( count, endClock - startClock );
1609
1610 }
1611
1612 #endif
1613
1614 static void time_az_float128( float128 function( float128 ) )
1615 {
1616 clock_t startClock, endClock;
1617 int32 count, i;
1618 int8 inputNum;
1619 float128 a;
1620
1621 count = 0;
1622 inputNum = 0;
1623 startClock = clock();
1624 do {
1625 for ( i = minIterations; i; --i ) {
1626 a.low = inputs_float128[ inputNum ].low;
1627 a.high = inputs_float128[ inputNum ].high;
1628 function( a );
1629 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1630 }
1631 count += minIterations;
1632 } while ( clock() - startClock < CLOCKS_PER_SEC );
1633 inputNum = 0;
1634 startClock = clock();
1635 for ( i = count; i; --i ) {
1636 a.low = inputs_float128[ inputNum ].low;
1637 a.high = inputs_float128[ inputNum ].high;
1638 function( a );
1639 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1640 }
1641 endClock = clock();
1642 reportTime( count, endClock - startClock );
1643
1644 }
1645
1646 static void time_ab_float128_z_flag( flag function( float128, float128 ) )
1647 {
1648 clock_t startClock, endClock;
1649 int32 count, i;
1650 int8 inputNumA, inputNumB;
1651 float128 a, b;
1652
1653 count = 0;
1654 inputNumA = 0;
1655 inputNumB = 0;
1656 startClock = clock();
1657 do {
1658 for ( i = minIterations; i; --i ) {
1659 a.low = inputs_float128[ inputNumA ].low;
1660 a.high = inputs_float128[ inputNumA ].high;
1661 b.low = inputs_float128[ inputNumB ].low;
1662 b.high = inputs_float128[ inputNumB ].high;
1663 function( a, b );
1664 inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
1665 if ( inputNumA == 0 ) ++inputNumB;
1666 inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
1667 }
1668 count += minIterations;
1669 } while ( clock() - startClock < CLOCKS_PER_SEC );
1670 inputNumA = 0;
1671 inputNumB = 0;
1672 startClock = clock();
1673 for ( i = count; i; --i ) {
1674 a.low = inputs_float128[ inputNumA ].low;
1675 a.high = inputs_float128[ inputNumA ].high;
1676 b.low = inputs_float128[ inputNumB ].low;
1677 b.high = inputs_float128[ inputNumB ].high;
1678 function( a, b );
1679 inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
1680 if ( inputNumA == 0 ) ++inputNumB;
1681 inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
1682 }
1683 endClock = clock();
1684 reportTime( count, endClock - startClock );
1685
1686 }
1687
1688 static void time_abz_float128( float128 function( float128, float128 ) )
1689 {
1690 clock_t startClock, endClock;
1691 int32 count, i;
1692 int8 inputNumA, inputNumB;
1693 float128 a, b;
1694
1695 count = 0;
1696 inputNumA = 0;
1697 inputNumB = 0;
1698 startClock = clock();
1699 do {
1700 for ( i = minIterations; i; --i ) {
1701 a.low = inputs_float128[ inputNumA ].low;
1702 a.high = inputs_float128[ inputNumA ].high;
1703 b.low = inputs_float128[ inputNumB ].low;
1704 b.high = inputs_float128[ inputNumB ].high;
1705 function( a, b );
1706 inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
1707 if ( inputNumA == 0 ) ++inputNumB;
1708 inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
1709 }
1710 count += minIterations;
1711 } while ( clock() - startClock < CLOCKS_PER_SEC );
1712 inputNumA = 0;
1713 inputNumB = 0;
1714 startClock = clock();
1715 for ( i = count; i; --i ) {
1716 a.low = inputs_float128[ inputNumA ].low;
1717 a.high = inputs_float128[ inputNumA ].high;
1718 b.low = inputs_float128[ inputNumB ].low;
1719 b.high = inputs_float128[ inputNumB ].high;
1720 function( a, b );
1721 inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
1722 if ( inputNumA == 0 ) ++inputNumB;
1723 inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
1724 }
1725 endClock = clock();
1726 reportTime( count, endClock - startClock );
1727
1728 }
1729
1730 static const struct {
1731 bits64 high, low;
1732 } inputs_float128_pos[ numInputs_float128 ] = {
1733 { LIT64( 0x3FDA200000100000 ), LIT64( 0x0000000000000000 ) },
1734 { LIT64( 0x3FFF000000000000 ), LIT64( 0x0000000000000000 ) },
1735 { LIT64( 0x05F14776190C8306 ), LIT64( 0xD8715F4E3D54BB92 ) },
1736 { LIT64( 0x72B00000007FFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
1737 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000000 ) },
1738 { LIT64( 0x3FFFFFFFFFE00000 ), LIT64( 0x0000008000000000 ) },
1739 { LIT64( 0x407F1719CE722F3E ), LIT64( 0xDA6B3FE5FF29425B ) },
1740 { LIT64( 0x43FFFF8000000000 ), LIT64( 0x0000000000400000 ) },
1741 { LIT64( 0x401E000000000100 ), LIT64( 0x0000000000002000 ) },
1742 { LIT64( 0x3FFED71DACDA8E47 ), LIT64( 0x4860E3C75D224F28 ) },
1743 { LIT64( 0x3F7ECFC1E90647D1 ), LIT64( 0x7A124FE55623EE44 ) },
1744 { LIT64( 0x0DF7007FFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
1745 { LIT64( 0x3FE5FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
1746 { LIT64( 0x403FFFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFE ) },
1747 { LIT64( 0x3FFB2FBF7399AFEB ), LIT64( 0xA459EE6A5C16CA55 ) },
1748 { LIT64( 0x3DB8FFFFFFFFFFFC ), LIT64( 0x0000000000000400 ) },
1749 { LIT64( 0x3FC8FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
1750 { LIT64( 0x3FFBFFFFFFDFFFFF ), LIT64( 0xFFF8000000000000 ) },
1751 { LIT64( 0x407043C11737BE84 ), LIT64( 0xDDD58212ADC937F4 ) },
1752 { LIT64( 0x0001000000000000 ), LIT64( 0x0000001000000001 ) },
1753 { LIT64( 0x4036FFFFFFFFFFFF ), LIT64( 0xFE40000000000000 ) },
1754 { LIT64( 0x4002FFFFFE000002 ), LIT64( 0x0000000000000000 ) },
1755 { LIT64( 0x4000C3FEDE897773 ), LIT64( 0x326AC4FD8EFBE6DC ) },
1756 { LIT64( 0x3FFF0000000FFFFF ), LIT64( 0xFFFFFE0000000000 ) },
1757 { LIT64( 0x62C3E502146E426D ), LIT64( 0x43F3CAA0DC7DF1A0 ) },
1758 { LIT64( 0x35CBD32E52BB570E ), LIT64( 0xBCC477CB11C6236C ) },
1759 { LIT64( 0x6228FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
1760 { LIT64( 0x3F80000000000000 ), LIT64( 0x0000000080000008 ) },
1761 { LIT64( 0x41AFFFDFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
1762 { LIT64( 0x496F000000000000 ), LIT64( 0x00000001FFFBFFFF ) },
1763 { LIT64( 0x3DE09BFE7923A338 ), LIT64( 0xBCC8FBBD7CEC1F4F ) },
1764 { LIT64( 0x401CFFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFF80 ) }
1765 };
1766
1767 static void time_az_float128_pos( float128 function( float128 ) )
1768 {
1769 clock_t startClock, endClock;
1770 int32 count, i;
1771 int8 inputNum;
1772 float128 a;
1773
1774 count = 0;
1775 inputNum = 0;
1776 startClock = clock();
1777 do {
1778 for ( i = minIterations; i; --i ) {
1779 a.low = inputs_float128_pos[ inputNum ].low;
1780 a.high = inputs_float128_pos[ inputNum ].high;
1781 function( a );
1782 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1783 }
1784 count += minIterations;
1785 } while ( clock() - startClock < CLOCKS_PER_SEC );
1786 inputNum = 0;
1787 startClock = clock();
1788 for ( i = count; i; --i ) {
1789 a.low = inputs_float128_pos[ inputNum ].low;
1790 a.high = inputs_float128_pos[ inputNum ].high;
1791 function( a );
1792 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1793 }
1794 endClock = clock();
1795 reportTime( count, endClock - startClock );
1796
1797 }
1798
1799 #endif
1800
1801 enum {
1802 INT32_TO_FLOAT32 = 1,
1803 INT32_TO_FLOAT64,
1804 #ifdef FLOATX80
1805 INT32_TO_FLOATX80,
1806 #endif
1807 #ifdef FLOAT128
1808 INT32_TO_FLOAT128,
1809 #endif
1810 INT64_TO_FLOAT32,
1811 INT64_TO_FLOAT64,
1812 #ifdef FLOATX80
1813 INT64_TO_FLOATX80,
1814 #endif
1815 #ifdef FLOAT128
1816 INT64_TO_FLOAT128,
1817 #endif
1818 FLOAT32_TO_INT32,
1819 FLOAT32_TO_INT32_ROUND_TO_ZERO,
1820 FLOAT32_TO_INT64,
1821 FLOAT32_TO_INT64_ROUND_TO_ZERO,
1822 FLOAT32_TO_FLOAT64,
1823 #ifdef FLOATX80
1824 FLOAT32_TO_FLOATX80,
1825 #endif
1826 #ifdef FLOAT128
1827 FLOAT32_TO_FLOAT128,
1828 #endif
1829 FLOAT32_ROUND_TO_INT,
1830 FLOAT32_ADD,
1831 FLOAT32_SUB,
1832 FLOAT32_MUL,
1833 FLOAT32_DIV,
1834 FLOAT32_REM,
1835 FLOAT32_SQRT,
1836 FLOAT32_EQ,
1837 FLOAT32_LE,
1838 FLOAT32_LT,
1839 FLOAT32_EQ_SIGNALING,
1840 FLOAT32_LE_QUIET,
1841 FLOAT32_LT_QUIET,
1842 FLOAT64_TO_INT32,
1843 FLOAT64_TO_INT32_ROUND_TO_ZERO,
1844 FLOAT64_TO_INT64,
1845 FLOAT64_TO_INT64_ROUND_TO_ZERO,
1846 FLOAT64_TO_FLOAT32,
1847 #ifdef FLOATX80
1848 FLOAT64_TO_FLOATX80,
1849 #endif
1850 #ifdef FLOAT128
1851 FLOAT64_TO_FLOAT128,
1852 #endif
1853 FLOAT64_ROUND_TO_INT,
1854 FLOAT64_ADD,
1855 FLOAT64_SUB,
1856 FLOAT64_MUL,
1857 FLOAT64_DIV,
1858 FLOAT64_REM,
1859 FLOAT64_SQRT,
1860 FLOAT64_EQ,
1861 FLOAT64_LE,
1862 FLOAT64_LT,
1863 FLOAT64_EQ_SIGNALING,
1864 FLOAT64_LE_QUIET,
1865 FLOAT64_LT_QUIET,
1866 #ifdef FLOATX80
1867 FLOATX80_TO_INT32,
1868 FLOATX80_TO_INT32_ROUND_TO_ZERO,
1869 FLOATX80_TO_INT64,
1870 FLOATX80_TO_INT64_ROUND_TO_ZERO,
1871 FLOATX80_TO_FLOAT32,
1872 FLOATX80_TO_FLOAT64,
1873 #ifdef FLOAT128
1874 FLOATX80_TO_FLOAT128,
1875 #endif
1876 FLOATX80_ROUND_TO_INT,
1877 FLOATX80_ADD,
1878 FLOATX80_SUB,
1879 FLOATX80_MUL,
1880 FLOATX80_DIV,
1881 FLOATX80_REM,
1882 FLOATX80_SQRT,
1883 FLOATX80_EQ,
1884 FLOATX80_LE,
1885 FLOATX80_LT,
1886 FLOATX80_EQ_SIGNALING,
1887 FLOATX80_LE_QUIET,
1888 FLOATX80_LT_QUIET,
1889 #endif
1890 #ifdef FLOAT128
1891 FLOAT128_TO_INT32,
1892 FLOAT128_TO_INT32_ROUND_TO_ZERO,
1893 FLOAT128_TO_INT64,
1894 FLOAT128_TO_INT64_ROUND_TO_ZERO,
1895 FLOAT128_TO_FLOAT32,
1896 FLOAT128_TO_FLOAT64,
1897 #ifdef FLOATX80
1898 FLOAT128_TO_FLOATX80,
1899 #endif
1900 FLOAT128_ROUND_TO_INT,
1901 FLOAT128_ADD,
1902 FLOAT128_SUB,
1903 FLOAT128_MUL,
1904 FLOAT128_DIV,
1905 FLOAT128_REM,
1906 FLOAT128_SQRT,
1907 FLOAT128_EQ,
1908 FLOAT128_LE,
1909 FLOAT128_LT,
1910 FLOAT128_EQ_SIGNALING,
1911 FLOAT128_LE_QUIET,
1912 FLOAT128_LT_QUIET,
1913 #endif
1914 NUM_FUNCTIONS
1915 };
1916
1917 static struct {
1918 char *name;
1919 int8 numInputs;
1920 flag roundingPrecision, roundingMode;
1921 flag tininessMode, tininessModeAtReducedPrecision;
1922 } functions[ NUM_FUNCTIONS ] = {
1923 { 0, 0, 0, 0, 0, 0 },
1924 { "int32_to_float32", 1, FALSE, TRUE, FALSE, FALSE },
1925 { "int32_to_float64", 1, FALSE, FALSE, FALSE, FALSE },
1926 #ifdef FLOATX80
1927 { "int32_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
1928 #endif
1929 #ifdef FLOAT128
1930 { "int32_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1931 #endif
1932 { "int64_to_float32", 1, FALSE, TRUE, FALSE, FALSE },
1933 { "int64_to_float64", 1, FALSE, TRUE, FALSE, FALSE },
1934 #ifdef FLOATX80
1935 { "int64_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
1936 #endif
1937 #ifdef FLOAT128
1938 { "int64_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1939 #endif
1940 { "float32_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
1941 { "float32_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1942 { "float32_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
1943 { "float32_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1944 { "float32_to_float64", 1, FALSE, FALSE, FALSE, FALSE },
1945 #ifdef FLOATX80
1946 { "float32_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
1947 #endif
1948 #ifdef FLOAT128
1949 { "float32_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1950 #endif
1951 { "float32_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
1952 { "float32_add", 2, FALSE, TRUE, FALSE, FALSE },
1953 { "float32_sub", 2, FALSE, TRUE, FALSE, FALSE },
1954 { "float32_mul", 2, FALSE, TRUE, TRUE, FALSE },
1955 { "float32_div", 2, FALSE, TRUE, FALSE, FALSE },
1956 { "float32_rem", 2, FALSE, FALSE, FALSE, FALSE },
1957 { "float32_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
1958 { "float32_eq", 2, FALSE, FALSE, FALSE, FALSE },
1959 { "float32_le", 2, FALSE, FALSE, FALSE, FALSE },
1960 { "float32_lt", 2, FALSE, FALSE, FALSE, FALSE },
1961 { "float32_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
1962 { "float32_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
1963 { "float32_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
1964 { "float64_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
1965 { "float64_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1966 { "float64_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
1967 { "float64_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1968 { "float64_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
1969 #ifdef FLOATX80
1970 { "float64_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
1971 #endif
1972 #ifdef FLOAT128
1973 { "float64_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1974 #endif
1975 { "float64_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
1976 { "float64_add", 2, FALSE, TRUE, FALSE, FALSE },
1977 { "float64_sub", 2, FALSE, TRUE, FALSE, FALSE },
1978 { "float64_mul", 2, FALSE, TRUE, TRUE, FALSE },
1979 { "float64_div", 2, FALSE, TRUE, FALSE, FALSE },
1980 { "float64_rem", 2, FALSE, FALSE, FALSE, FALSE },
1981 { "float64_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
1982 { "float64_eq", 2, FALSE, FALSE, FALSE, FALSE },
1983 { "float64_le", 2, FALSE, FALSE, FALSE, FALSE },
1984 { "float64_lt", 2, FALSE, FALSE, FALSE, FALSE },
1985 { "float64_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
1986 { "float64_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
1987 { "float64_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
1988 #ifdef FLOATX80
1989 { "floatx80_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
1990 { "floatx80_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1991 { "floatx80_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
1992 { "floatx80_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1993 { "floatx80_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
1994 { "floatx80_to_float64", 1, FALSE, TRUE, TRUE, FALSE },
1995 #ifdef FLOAT128
1996 { "floatx80_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1997 #endif
1998 { "floatx80_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
1999 { "floatx80_add", 2, TRUE, TRUE, FALSE, TRUE },
2000 { "floatx80_sub", 2, TRUE, TRUE, FALSE, TRUE },
2001 { "floatx80_mul", 2, TRUE, TRUE, TRUE, TRUE },
2002 { "floatx80_div", 2, TRUE, TRUE, FALSE, TRUE },
2003 { "floatx80_rem", 2, FALSE, FALSE, FALSE, FALSE },
2004 { "floatx80_sqrt", 1, TRUE, TRUE, FALSE, FALSE },
2005 { "floatx80_eq", 2, FALSE, FALSE, FALSE, FALSE },
2006 { "floatx80_le", 2, FALSE, FALSE, FALSE, FALSE },
2007 { "floatx80_lt", 2, FALSE, FALSE, FALSE, FALSE },
2008 { "floatx80_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
2009 { "floatx80_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
2010 { "floatx80_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
2011 #endif
2012 #ifdef FLOAT128
2013 { "float128_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
2014 { "float128_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
2015 { "float128_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
2016 { "float128_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
2017 { "float128_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
2018 { "float128_to_float64", 1, FALSE, TRUE, TRUE, FALSE },
2019 #ifdef FLOATX80
2020 { "float128_to_floatx80", 1, FALSE, TRUE, TRUE, FALSE },
2021 #endif
2022 { "float128_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
2023 { "float128_add", 2, FALSE, TRUE, FALSE, FALSE },
2024 { "float128_sub", 2, FALSE, TRUE, FALSE, FALSE },
2025 { "float128_mul", 2, FALSE, TRUE, TRUE, FALSE },
2026 { "float128_div", 2, FALSE, TRUE, FALSE, FALSE },
2027 { "float128_rem", 2, FALSE, FALSE, FALSE, FALSE },
2028 { "float128_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
2029 { "float128_eq", 2, FALSE, FALSE, FALSE, FALSE },
2030 { "float128_le", 2, FALSE, FALSE, FALSE, FALSE },
2031 { "float128_lt", 2, FALSE, FALSE, FALSE, FALSE },
2032 { "float128_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
2033 { "float128_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
2034 { "float128_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
2035 #endif
2036 };
2037
2038 enum {
2039 ROUND_NEAREST_EVEN = 1,
2040 ROUND_TO_ZERO,
2041 ROUND_DOWN,
2042 ROUND_UP,
2043 NUM_ROUNDINGMODES
2044 };
2045 enum {
2046 TININESS_BEFORE_ROUNDING = 1,
2047 TININESS_AFTER_ROUNDING,
2048 NUM_TININESSMODES
2049 };
2050
2051 static void
2052 timeFunctionVariety(
2053 uint8 functionCode,
2054 int8 roundingPrecision,
2055 int8 roundingMode,
2056 int8 tininessMode
2057 )
2058 {
2059 uint8 roundingCode;
2060 int8 tininessCode;
2061
2062 functionName = functions[ functionCode ].name;
2063 if ( roundingPrecision == 32 ) {
2064 roundingPrecisionName = "32";
2065 }
2066 else if ( roundingPrecision == 64 ) {
2067 roundingPrecisionName = "64";
2068 }
2069 else if ( roundingPrecision == 80 ) {
2070 roundingPrecisionName = "80";
2071 }
2072 else {
2073 roundingPrecisionName = 0;
2074 }
2075 #ifdef FLOATX80
2076 floatx80_rounding_precision = roundingPrecision;
2077 #endif
2078 switch ( roundingMode ) {
2079 case 0:
2080 roundingModeName = 0;
2081 roundingCode = float_round_nearest_even;
2082 break;
2083 case ROUND_NEAREST_EVEN:
2084 roundingModeName = "nearest_even";
2085 roundingCode = float_round_nearest_even;
2086 break;
2087 case ROUND_TO_ZERO:
2088 roundingModeName = "to_zero";
2089 roundingCode = float_round_to_zero;
2090 break;
2091 case ROUND_DOWN:
2092 roundingModeName = "down";
2093 roundingCode = float_round_down;
2094 break;
2095 case ROUND_UP:
2096 roundingModeName = "up";
2097 roundingCode = float_round_up;
2098 break;
2099 }
2100 float_rounding_mode = roundingCode;
2101 switch ( tininessMode ) {
2102 case 0:
2103 tininessModeName = 0;
2104 tininessCode = float_tininess_after_rounding;
2105 break;
2106 case TININESS_BEFORE_ROUNDING:
2107 tininessModeName = "before";
2108 tininessCode = float_tininess_before_rounding;
2109 break;
2110 case TININESS_AFTER_ROUNDING:
2111 tininessModeName = "after";
2112 tininessCode = float_tininess_after_rounding;
2113 break;
2114 }
2115 float_detect_tininess = tininessCode;
2116 switch ( functionCode ) {
2117 case INT32_TO_FLOAT32:
2118 time_a_int32_z_float32( int32_to_float32 );
2119 break;
2120 case INT32_TO_FLOAT64:
2121 time_a_int32_z_float64( int32_to_float64 );
2122 break;
2123 #ifdef FLOATX80
2124 case INT32_TO_FLOATX80:
2125 time_a_int32_z_floatx80( int32_to_floatx80 );
2126 break;
2127 #endif
2128 #ifdef FLOAT128
2129 case INT32_TO_FLOAT128:
2130 time_a_int32_z_float128( int32_to_float128 );
2131 break;
2132 #endif
2133 case INT64_TO_FLOAT32:
2134 time_a_int64_z_float32( int64_to_float32 );
2135 break;
2136 case INT64_TO_FLOAT64:
2137 time_a_int64_z_float64( int64_to_float64 );
2138 break;
2139 #ifdef FLOATX80
2140 case INT64_TO_FLOATX80:
2141 time_a_int64_z_floatx80( int64_to_floatx80 );
2142 break;
2143 #endif
2144 #ifdef FLOAT128
2145 case INT64_TO_FLOAT128:
2146 time_a_int64_z_float128( int64_to_float128 );
2147 break;
2148 #endif
2149 case FLOAT32_TO_INT32:
2150 time_a_float32_z_int32( float32_to_int32 );
2151 break;
2152 case FLOAT32_TO_INT32_ROUND_TO_ZERO:
2153 time_a_float32_z_int32( float32_to_int32_round_to_zero );
2154 break;
2155 case FLOAT32_TO_INT64:
2156 time_a_float32_z_int64( float32_to_int64 );
2157 break;
2158 case FLOAT32_TO_INT64_ROUND_TO_ZERO:
2159 time_a_float32_z_int64( float32_to_int64_round_to_zero );
2160 break;
2161 case FLOAT32_TO_FLOAT64:
2162 time_a_float32_z_float64( float32_to_float64 );
2163 break;
2164 #ifdef FLOATX80
2165 case FLOAT32_TO_FLOATX80:
2166 time_a_float32_z_floatx80( float32_to_floatx80 );
2167 break;
2168 #endif
2169 #ifdef FLOAT128
2170 case FLOAT32_TO_FLOAT128:
2171 time_a_float32_z_float128( float32_to_float128 );
2172 break;
2173 #endif
2174 case FLOAT32_ROUND_TO_INT:
2175 time_az_float32( float32_round_to_int );
2176 break;
2177 case FLOAT32_ADD:
2178 time_abz_float32( float32_add );
2179 break;
2180 case FLOAT32_SUB:
2181 time_abz_float32( float32_sub );
2182 break;
2183 case FLOAT32_MUL:
2184 time_abz_float32( float32_mul );
2185 break;
2186 case FLOAT32_DIV:
2187 time_abz_float32( float32_div );
2188 break;
2189 case FLOAT32_REM:
2190 time_abz_float32( float32_rem );
2191 break;
2192 case FLOAT32_SQRT:
2193 time_az_float32_pos( float32_sqrt );
2194 break;
2195 case FLOAT32_EQ:
2196 time_ab_float32_z_flag( float32_eq );
2197 break;
2198 case FLOAT32_LE:
2199 time_ab_float32_z_flag( float32_le );
2200 break;
2201 case FLOAT32_LT:
2202 time_ab_float32_z_flag( float32_lt );
2203 break;
2204 case FLOAT32_EQ_SIGNALING:
2205 time_ab_float32_z_flag( float32_eq_signaling );
2206 break;
2207 case FLOAT32_LE_QUIET:
2208 time_ab_float32_z_flag( float32_le_quiet );
2209 break;
2210 case FLOAT32_LT_QUIET:
2211 time_ab_float32_z_flag( float32_lt_quiet );
2212 break;
2213 case FLOAT64_TO_INT32:
2214 time_a_float64_z_int32( float64_to_int32 );
2215 break;
2216 case FLOAT64_TO_INT32_ROUND_TO_ZERO:
2217 time_a_float64_z_int32( float64_to_int32_round_to_zero );
2218 break;
2219 case FLOAT64_TO_INT64:
2220 time_a_float64_z_int64( float64_to_int64 );
2221 break;
2222 case FLOAT64_TO_INT64_ROUND_TO_ZERO:
2223 time_a_float64_z_int64( float64_to_int64_round_to_zero );
2224 break;
2225 case FLOAT64_TO_FLOAT32:
2226 time_a_float64_z_float32( float64_to_float32 );
2227 break;
2228 #ifdef FLOATX80
2229 case FLOAT64_TO_FLOATX80:
2230 time_a_float64_z_floatx80( float64_to_floatx80 );
2231 break;
2232 #endif
2233 #ifdef FLOAT128
2234 case FLOAT64_TO_FLOAT128:
2235 time_a_float64_z_float128( float64_to_float128 );
2236 break;
2237 #endif
2238 case FLOAT64_ROUND_TO_INT:
2239 time_az_float64( float64_round_to_int );
2240 break;
2241 case FLOAT64_ADD:
2242 time_abz_float64( float64_add );
2243 break;
2244 case FLOAT64_SUB:
2245 time_abz_float64( float64_sub );
2246 break;
2247 case FLOAT64_MUL:
2248 time_abz_float64( float64_mul );
2249 break;
2250 case FLOAT64_DIV:
2251 time_abz_float64( float64_div );
2252 break;
2253 case FLOAT64_REM:
2254 time_abz_float64( float64_rem );
2255 break;
2256 case FLOAT64_SQRT:
2257 time_az_float64_pos( float64_sqrt );
2258 break;
2259 case FLOAT64_EQ:
2260 time_ab_float64_z_flag( float64_eq );
2261 break;
2262 case FLOAT64_LE:
2263 time_ab_float64_z_flag( float64_le );
2264 break;
2265 case FLOAT64_LT:
2266 time_ab_float64_z_flag( float64_lt );
2267 break;
2268 case FLOAT64_EQ_SIGNALING:
2269 time_ab_float64_z_flag( float64_eq_signaling );
2270 break;
2271 case FLOAT64_LE_QUIET:
2272 time_ab_float64_z_flag( float64_le_quiet );
2273 break;
2274 case FLOAT64_LT_QUIET:
2275 time_ab_float64_z_flag( float64_lt_quiet );
2276 break;
2277 #ifdef FLOATX80
2278 case FLOATX80_TO_INT32:
2279 time_a_floatx80_z_int32( floatx80_to_int32 );
2280 break;
2281 case FLOATX80_TO_INT32_ROUND_TO_ZERO:
2282 time_a_floatx80_z_int32( floatx80_to_int32_round_to_zero );
2283 break;
2284 case FLOATX80_TO_INT64:
2285 time_a_floatx80_z_int64( floatx80_to_int64 );
2286 break;
2287 case FLOATX80_TO_INT64_ROUND_TO_ZERO:
2288 time_a_floatx80_z_int64( floatx80_to_int64_round_to_zero );
2289 break;
2290 case FLOATX80_TO_FLOAT32:
2291 time_a_floatx80_z_float32( floatx80_to_float32 );
2292 break;
2293 case FLOATX80_TO_FLOAT64:
2294 time_a_floatx80_z_float64( floatx80_to_float64 );
2295 break;
2296 #ifdef FLOAT128
2297 case FLOATX80_TO_FLOAT128:
2298 time_a_floatx80_z_float128( floatx80_to_float128 );
2299 break;
2300 #endif
2301 case FLOATX80_ROUND_TO_INT:
2302 time_az_floatx80( floatx80_round_to_int );
2303 break;
2304 case FLOATX80_ADD:
2305 time_abz_floatx80( floatx80_add );
2306 break;
2307 case FLOATX80_SUB:
2308 time_abz_floatx80( floatx80_sub );
2309 break;
2310 case FLOATX80_MUL:
2311 time_abz_floatx80( floatx80_mul );
2312 break;
2313 case FLOATX80_DIV:
2314 time_abz_floatx80( floatx80_div );
2315 break;
2316 case FLOATX80_REM:
2317 time_abz_floatx80( floatx80_rem );
2318 break;
2319 case FLOATX80_SQRT:
2320 time_az_floatx80_pos( floatx80_sqrt );
2321 break;
2322 case FLOATX80_EQ:
2323 time_ab_floatx80_z_flag( floatx80_eq );
2324 break;
2325 case FLOATX80_LE:
2326 time_ab_floatx80_z_flag( floatx80_le );
2327 break;
2328 case FLOATX80_LT:
2329 time_ab_floatx80_z_flag( floatx80_lt );
2330 break;
2331 case FLOATX80_EQ_SIGNALING:
2332 time_ab_floatx80_z_flag( floatx80_eq_signaling );
2333 break;
2334 case FLOATX80_LE_QUIET:
2335 time_ab_floatx80_z_flag( floatx80_le_quiet );
2336 break;
2337 case FLOATX80_LT_QUIET:
2338 time_ab_floatx80_z_flag( floatx80_lt_quiet );
2339 break;
2340 #endif
2341 #ifdef FLOAT128
2342 case FLOAT128_TO_INT32:
2343 time_a_float128_z_int32( float128_to_int32 );
2344 break;
2345 case FLOAT128_TO_INT32_ROUND_TO_ZERO:
2346 time_a_float128_z_int32( float128_to_int32_round_to_zero );
2347 break;
2348 case FLOAT128_TO_INT64:
2349 time_a_float128_z_int64( float128_to_int64 );
2350 break;
2351 case FLOAT128_TO_INT64_ROUND_TO_ZERO:
2352 time_a_float128_z_int64( float128_to_int64_round_to_zero );
2353 break;
2354 case FLOAT128_TO_FLOAT32:
2355 time_a_float128_z_float32( float128_to_float32 );
2356 break;
2357 case FLOAT128_TO_FLOAT64:
2358 time_a_float128_z_float64( float128_to_float64 );
2359 break;
2360 #ifdef FLOATX80
2361 case FLOAT128_TO_FLOATX80:
2362 time_a_float128_z_floatx80( float128_to_floatx80 );
2363 break;
2364 #endif
2365 case FLOAT128_ROUND_TO_INT:
2366 time_az_float128( float128_round_to_int );
2367 break;
2368 case FLOAT128_ADD:
2369 time_abz_float128( float128_add );
2370 break;
2371 case FLOAT128_SUB:
2372 time_abz_float128( float128_sub );
2373 break;
2374 case FLOAT128_MUL:
2375 time_abz_float128( float128_mul );
2376 break;
2377 case FLOAT128_DIV:
2378 time_abz_float128( float128_div );
2379 break;
2380 case FLOAT128_REM:
2381 time_abz_float128( float128_rem );
2382 break;
2383 case FLOAT128_SQRT:
2384 time_az_float128_pos( float128_sqrt );
2385 break;
2386 case FLOAT128_EQ:
2387 time_ab_float128_z_flag( float128_eq );
2388 break;
2389 case FLOAT128_LE:
2390 time_ab_float128_z_flag( float128_le );
2391 break;
2392 case FLOAT128_LT:
2393 time_ab_float128_z_flag( float128_lt );
2394 break;
2395 case FLOAT128_EQ_SIGNALING:
2396 time_ab_float128_z_flag( float128_eq_signaling );
2397 break;
2398 case FLOAT128_LE_QUIET:
2399 time_ab_float128_z_flag( float128_le_quiet );
2400 break;
2401 case FLOAT128_LT_QUIET:
2402 time_ab_float128_z_flag( float128_lt_quiet );
2403 break;
2404 #endif
2405 }
2406
2407 }
2408
2409 static void
2410 timeFunction(
2411 uint8 functionCode,
2412 int8 roundingPrecisionIn,
2413 int8 roundingModeIn,
2414 int8 tininessModeIn
2415 )
2416 {
2417 int8 roundingPrecision, roundingMode, tininessMode;
2418
2419 roundingPrecision = 32;
2420 for (;;) {
2421 if ( ! functions[ functionCode ].roundingPrecision ) {
2422 roundingPrecision = 0;
2423 }
2424 else if ( roundingPrecisionIn ) {
2425 roundingPrecision = roundingPrecisionIn;
2426 }
2427 for ( roundingMode = 1;
2428 roundingMode < NUM_ROUNDINGMODES;
2429 ++roundingMode
2430 ) {
2431 if ( ! functions[ functionCode ].roundingMode ) {
2432 roundingMode = 0;
2433 }
2434 else if ( roundingModeIn ) {
2435 roundingMode = roundingModeIn;
2436 }
2437 for ( tininessMode = 1;
2438 tininessMode < NUM_TININESSMODES;
2439 ++tininessMode
2440 ) {
2441 if ( ( roundingPrecision == 32 )
2442 || ( roundingPrecision == 64 ) ) {
2443 if ( ! functions[ functionCode ]
2444 .tininessModeAtReducedPrecision
2445 ) {
2446 tininessMode = 0;
2447 }
2448 else if ( tininessModeIn ) {
2449 tininessMode = tininessModeIn;
2450 }
2451 }
2452 else {
2453 if ( ! functions[ functionCode ].tininessMode ) {
2454 tininessMode = 0;
2455 }
2456 else if ( tininessModeIn ) {
2457 tininessMode = tininessModeIn;
2458 }
2459 }
2460 timeFunctionVariety(
2461 functionCode, roundingPrecision, roundingMode, tininessMode
2462 );
2463 if ( tininessModeIn || ! tininessMode ) break;
2464 }
2465 if ( roundingModeIn || ! roundingMode ) break;
2466 }
2467 if ( roundingPrecisionIn || ! roundingPrecision ) break;
2468 if ( roundingPrecision == 80 ) {
2469 break;
2470 }
2471 else if ( roundingPrecision == 64 ) {
2472 roundingPrecision = 80;
2473 }
2474 else if ( roundingPrecision == 32 ) {
2475 roundingPrecision = 64;
2476 }
2477 }
2478
2479 }
2480
2481 main( int argc, char **argv )
2482 {
2483 char *argPtr;
2484 flag functionArgument;
2485 uint8 functionCode;
2486 int8 operands, roundingPrecision, roundingMode, tininessMode;
2487
2488 if ( argc <= 1 ) goto writeHelpMessage;
2489 functionArgument = FALSE;
2490 functionCode = 0;
2491 operands = 0;
2492 roundingPrecision = 0;
2493 roundingMode = 0;
2494 tininessMode = 0;
2495 --argc;
2496 ++argv;
2497 while ( argc && ( argPtr = argv[ 0 ] ) ) {
2498 if ( argPtr[ 0 ] == '-' ) ++argPtr;
2499 if ( strcmp( argPtr, "help" ) == 0 ) {
2500 writeHelpMessage:
2501 fputs(
2502 "timesoftfloat [<option>...] <function>\n"
2503 " <option>: (* is default)\n"
2504 " -help --Write this message and exit.\n"
2505 #ifdef FLOATX80
2506 " -precision32 --Only time rounding precision equivalent to float32.\n"
2507 " -precision64 --Only time rounding precision equivalent to float64.\n"
2508 " -precision80 --Only time maximum rounding precision.\n"
2509 #endif
2510 " -nearesteven --Only time rounding to nearest/even.\n"
2511 " -tozero --Only time rounding to zero.\n"
2512 " -down --Only time rounding down.\n"
2513 " -up --Only time rounding up.\n"
2514 " -tininessbefore --Only time underflow tininess before rounding.\n"
2515 " -tininessafter --Only time underflow tininess after rounding.\n"
2516 " <function>:\n"
2517 " int32_to_<float> <float>_add <float>_eq\n"
2518 " <float>_to_int32 <float>_sub <float>_le\n"
2519 " <float>_to_int32_round_to_zero <float>_mul <float>_lt\n"
2520 " int64_to_<float> <float>_div <float>_eq_signaling\n"
2521 " <float>_to_int64 <float>_rem <float>_le_quiet\n"
2522 " <float>_to_int64_round_to_zero <float>_lt_quiet\n"
2523 " <float>_to_<float>\n"
2524 " <float>_round_to_int\n"
2525 " <float>_sqrt\n"
2526 " -all1 --All 1-operand functions.\n"
2527 " -all2 --All 2-operand functions.\n"
2528 " -all --All functions.\n"
2529 " <float>:\n"
2530 " float32 --Single precision.\n"
2531 " float64 --Double precision.\n"
2532 #ifdef FLOATX80
2533 " floatx80 --Extended double precision.\n"
2534 #endif
2535 #ifdef FLOAT128
2536 " float128 --Quadruple precision.\n"
2537 #endif
2538 ,
2539 stdout
2540 );
2541 return EXIT_SUCCESS;
2542 }
2543 #ifdef FLOATX80
2544 else if ( strcmp( argPtr, "precision32" ) == 0 ) {
2545 roundingPrecision = 32;
2546 }
2547 else if ( strcmp( argPtr, "precision64" ) == 0 ) {
2548 roundingPrecision = 64;
2549 }
2550 else if ( strcmp( argPtr, "precision80" ) == 0 ) {
2551 roundingPrecision = 80;
2552 }
2553 #endif
2554 else if ( ( strcmp( argPtr, "nearesteven" ) == 0 )
2555 || ( strcmp( argPtr, "nearest_even" ) == 0 ) ) {
2556 roundingMode = ROUND_NEAREST_EVEN;
2557 }
2558 else if ( ( strcmp( argPtr, "tozero" ) == 0 )
2559 || ( strcmp( argPtr, "to_zero" ) == 0 ) ) {
2560 roundingMode = ROUND_TO_ZERO;
2561 }
2562 else if ( strcmp( argPtr, "down" ) == 0 ) {
2563 roundingMode = ROUND_DOWN;
2564 }
2565 else if ( strcmp( argPtr, "up" ) == 0 ) {
2566 roundingMode = ROUND_UP;
2567 }
2568 else if ( strcmp( argPtr, "tininessbefore" ) == 0 ) {
2569 tininessMode = TININESS_BEFORE_ROUNDING;
2570 }
2571 else if ( strcmp( argPtr, "tininessafter" ) == 0 ) {
2572 tininessMode = TININESS_AFTER_ROUNDING;
2573 }
2574 else if ( strcmp( argPtr, "all1" ) == 0 ) {
2575 functionArgument = TRUE;
2576 functionCode = 0;
2577 operands = 1;
2578 }
2579 else if ( strcmp( argPtr, "all2" ) == 0 ) {
2580 functionArgument = TRUE;
2581 functionCode = 0;
2582 operands = 2;
2583 }
2584 else if ( strcmp( argPtr, "all" ) == 0 ) {
2585 functionArgument = TRUE;
2586 functionCode = 0;
2587 operands = 0;
2588 }
2589 else {
2590 for ( functionCode = 1;
2591 functionCode < NUM_FUNCTIONS;
2592 ++functionCode
2593 ) {
2594 if ( strcmp( argPtr, functions[ functionCode ].name ) == 0 ) {
2595 break;
2596 }
2597 }
2598 if ( functionCode == NUM_FUNCTIONS ) {
2599 fail( "Invalid option or function `%s'", argv[ 0 ] );
2600 }
2601 functionArgument = TRUE;
2602 }
2603 --argc;
2604 ++argv;
2605 }
2606 if ( ! functionArgument ) fail( "Function argument required" );
2607 if ( functionCode ) {
2608 timeFunction(
2609 functionCode, roundingPrecision, roundingMode, tininessMode );
2610 }
2611 else if ( operands == 1 ) {
2612 for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
2613 ) {
2614 if ( functions[ functionCode ].numInputs == 1 ) {
2615 timeFunction(
2616 functionCode, roundingPrecision, roundingMode, tininessMode
2617 );
2618 }
2619 }
2620 }
2621 else if ( operands == 2 ) {
2622 for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
2623 ) {
2624 if ( functions[ functionCode ].numInputs == 2 ) {
2625 timeFunction(
2626 functionCode, roundingPrecision, roundingMode, tininessMode
2627 );
2628 }
2629 }
2630 }
2631 else {
2632 for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
2633 ) {
2634 timeFunction(
2635 functionCode, roundingPrecision, roundingMode, tininessMode );
2636 }
2637 }
2638 return EXIT_SUCCESS;
2639
2640 }
2641