1 /* $NetBSD: timesoftfloat.c,v 1.1 2000/06/06 08:15:11 bjh21 Exp $ */
4 ===============================================================================
6 This C source file is part of the SoftFloat IEC/IEEE Floating-point
7 Arithmetic Package, Release 2a.
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'.
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.
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.
30 ===============================================================================
33 #include <sys/cdefs.h>
34 __FBSDID("$FreeBSD$");
42 #include "softfloat.h"
48 static void fail( const char *message, ... )
52 fputs( "timesoftfloat: ", stderr );
53 va_start( varArgs, message );
54 vfprintf( stderr, message, varArgs );
56 fputs( ".\n", stderr );
61 static char *functionName;
62 static char *roundingPrecisionName, *roundingModeName, *tininessModeName;
64 static void reportTime( int32 count, long clocks )
69 ( count / ( ( (float) clocks ) / CLOCKS_PER_SEC ) ) / 1000,
72 if ( roundingModeName ) {
73 if ( roundingPrecisionName ) {
74 fputs( ", precision ", stdout );
75 fputs( roundingPrecisionName, stdout );
77 fputs( ", rounding ", stdout );
78 fputs( roundingModeName, stdout );
79 if ( tininessModeName ) {
80 fputs( ", tininess ", stdout );
81 fputs( tininessModeName, stdout );
82 fputs( " rounding", stdout );
85 fputc( '\n', stdout );
93 static const int32 inputs_int32[ numInputs_int32 ] = {
94 0xFFFFBB79, 0x405CF80F, 0x00000000, 0xFFFFFD04,
95 0xFFF20002, 0x0C8EF795, 0xF00011FF, 0x000006CA,
96 0x00009BFE, 0xFF4862E3, 0x9FFFEFFE, 0xFFFFFFB7,
97 0x0BFF7FFF, 0x0000F37A, 0x0011DFFE, 0x00000006,
98 0xFFF02006, 0xFFFFF7D1, 0x10200003, 0xDE8DF765,
99 0x00003E02, 0x000019E8, 0x0008FFFE, 0xFFFFFB5C,
100 0xFFDF7FFE, 0x07C42FBF, 0x0FFFE3FF, 0x040B9F13,
101 0xBFFFFFF8, 0x0001BF56, 0x000017F6, 0x000A908A
104 static void time_a_int32_z_float32( float32 function( int32 ) )
106 clock_t startClock, endClock;
112 startClock = clock();
114 for ( i = minIterations; i; --i ) {
115 function( inputs_int32[ inputNum ] );
116 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
118 count += minIterations;
119 } while ( clock() - startClock < CLOCKS_PER_SEC );
121 startClock = clock();
122 for ( i = count; i; --i ) {
123 function( inputs_int32[ inputNum ] );
124 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
127 reportTime( count, endClock - startClock );
131 static void time_a_int32_z_float64( float64 function( int32 ) )
133 clock_t startClock, endClock;
139 startClock = clock();
141 for ( i = minIterations; i; --i ) {
142 function( inputs_int32[ inputNum ] );
143 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
145 count += minIterations;
146 } while ( clock() - startClock < CLOCKS_PER_SEC );
148 startClock = clock();
149 for ( i = count; i; --i ) {
150 function( inputs_int32[ inputNum ] );
151 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
154 reportTime( count, endClock - startClock );
160 static void time_a_int32_z_floatx80( floatx80 function( int32 ) )
162 clock_t startClock, endClock;
168 startClock = clock();
170 for ( i = minIterations; i; --i ) {
171 function( inputs_int32[ inputNum ] );
172 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
174 count += minIterations;
175 } while ( clock() - startClock < CLOCKS_PER_SEC );
177 startClock = clock();
178 for ( i = count; i; --i ) {
179 function( inputs_int32[ inputNum ] );
180 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
183 reportTime( count, endClock - startClock );
191 static void time_a_int32_z_float128( float128 function( int32 ) )
193 clock_t startClock, endClock;
199 startClock = clock();
201 for ( i = minIterations; i; --i ) {
202 function( inputs_int32[ inputNum ] );
203 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
205 count += minIterations;
206 } while ( clock() - startClock < CLOCKS_PER_SEC );
208 startClock = clock();
209 for ( i = count; i; --i ) {
210 function( inputs_int32[ inputNum ] );
211 inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
214 reportTime( count, endClock - startClock );
224 static const int64 inputs_int64[ numInputs_int64 ] = {
225 LIT64( 0xFBFFC3FFFFFFFFFF ),
226 LIT64( 0x0000000003C589BC ),
227 LIT64( 0x00000000400013FE ),
228 LIT64( 0x0000000000186171 ),
229 LIT64( 0xFFFFFFFFFFFEFBFA ),
230 LIT64( 0xFFFFFD79E6DFFC73 ),
231 LIT64( 0x0000000010001DFF ),
232 LIT64( 0xDD1A0F0C78513710 ),
233 LIT64( 0xFFFF83FFFFFEFFFE ),
234 LIT64( 0x00756EBD1AD0C1C7 ),
235 LIT64( 0x0003FDFFFFFFFFBE ),
236 LIT64( 0x0007D0FB2C2CA951 ),
237 LIT64( 0x0007FC0007FFFFFE ),
238 LIT64( 0x0000001F942B18BB ),
239 LIT64( 0x0000080101FFFFFE ),
240 LIT64( 0xFFFFFFFFFFFF0978 ),
241 LIT64( 0x000000000008BFFF ),
242 LIT64( 0x0000000006F5AF08 ),
243 LIT64( 0xFFDEFF7FFFFFFFFE ),
244 LIT64( 0x0000000000000003 ),
245 LIT64( 0x3FFFFFFFFF80007D ),
246 LIT64( 0x0000000000000078 ),
247 LIT64( 0xFFF80000007FDFFD ),
248 LIT64( 0x1BBC775B78016AB0 ),
249 LIT64( 0xFFF9001FFFFFFFFE ),
250 LIT64( 0xFFFD4767AB98E43F ),
251 LIT64( 0xFFFFFEFFFE00001E ),
252 LIT64( 0xFFFFFFFFFFF04EFD ),
253 LIT64( 0x07FFFFFFFFFFF7FF ),
254 LIT64( 0xFFFC9EAA38F89050 ),
255 LIT64( 0x00000020FBFFFFFE ),
256 LIT64( 0x0000099AE6455357 )
259 static void time_a_int64_z_float32( float32 function( int64 ) )
261 clock_t startClock, endClock;
267 startClock = clock();
269 for ( i = minIterations; i; --i ) {
270 function( inputs_int64[ inputNum ] );
271 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
273 count += minIterations;
274 } while ( clock() - startClock < CLOCKS_PER_SEC );
276 startClock = clock();
277 for ( i = count; i; --i ) {
278 function( inputs_int64[ inputNum ] );
279 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
282 reportTime( count, endClock - startClock );
286 static void time_a_int64_z_float64( float64 function( int64 ) )
288 clock_t startClock, endClock;
294 startClock = clock();
296 for ( i = minIterations; i; --i ) {
297 function( inputs_int64[ inputNum ] );
298 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
300 count += minIterations;
301 } while ( clock() - startClock < CLOCKS_PER_SEC );
303 startClock = clock();
304 for ( i = count; i; --i ) {
305 function( inputs_int64[ inputNum ] );
306 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
309 reportTime( count, endClock - startClock );
315 static void time_a_int64_z_floatx80( floatx80 function( int64 ) )
317 clock_t startClock, endClock;
323 startClock = clock();
325 for ( i = minIterations; i; --i ) {
326 function( inputs_int64[ inputNum ] );
327 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
329 count += minIterations;
330 } while ( clock() - startClock < CLOCKS_PER_SEC );
332 startClock = clock();
333 for ( i = count; i; --i ) {
334 function( inputs_int64[ inputNum ] );
335 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
338 reportTime( count, endClock - startClock );
346 static void time_a_int64_z_float128( float128 function( int64 ) )
348 clock_t startClock, endClock;
354 startClock = clock();
356 for ( i = minIterations; i; --i ) {
357 function( inputs_int64[ inputNum ] );
358 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
360 count += minIterations;
361 } while ( clock() - startClock < CLOCKS_PER_SEC );
363 startClock = clock();
364 for ( i = count; i; --i ) {
365 function( inputs_int64[ inputNum ] );
366 inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
369 reportTime( count, endClock - startClock );
376 numInputs_float32 = 32
379 static const float32 inputs_float32[ numInputs_float32 ] = {
380 0x4EFA0000, 0xC1D0B328, 0x80000000, 0x3E69A31E,
381 0xAF803EFF, 0x3F800000, 0x17BF8000, 0xE74A301A,
382 0x4E010003, 0x7EE3C75D, 0xBD803FE0, 0xBFFEFF00,
383 0x7981F800, 0x431FFFFC, 0xC100C000, 0x3D87EFFF,
384 0x4103FEFE, 0xBC000007, 0xBF01F7FF, 0x4E6C6B5C,
385 0xC187FFFE, 0xC58B9F13, 0x4F88007F, 0xDF004007,
386 0xB7FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
387 0xDB428661, 0x33F89B1F, 0xA3BFEFFF, 0x537BFFBE
390 static void time_a_float32_z_int32( int32 function( float32 ) )
392 clock_t startClock, endClock;
398 startClock = clock();
400 for ( i = minIterations; i; --i ) {
401 function( inputs_float32[ inputNum ] );
402 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
404 count += minIterations;
405 } while ( clock() - startClock < CLOCKS_PER_SEC );
407 startClock = clock();
408 for ( i = count; i; --i ) {
409 function( inputs_float32[ inputNum ] );
410 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
413 reportTime( count, endClock - startClock );
417 static void time_a_float32_z_int64( int64 function( float32 ) )
419 clock_t startClock, endClock;
425 startClock = clock();
427 for ( i = minIterations; i; --i ) {
428 function( inputs_float32[ inputNum ] );
429 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
431 count += minIterations;
432 } while ( clock() - startClock < CLOCKS_PER_SEC );
434 startClock = clock();
435 for ( i = count; i; --i ) {
436 function( inputs_float32[ inputNum ] );
437 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
440 reportTime( count, endClock - startClock );
444 static void time_a_float32_z_float64( float64 function( float32 ) )
446 clock_t startClock, endClock;
452 startClock = clock();
454 for ( i = minIterations; i; --i ) {
455 function( inputs_float32[ inputNum ] );
456 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
458 count += minIterations;
459 } while ( clock() - startClock < CLOCKS_PER_SEC );
461 startClock = clock();
462 for ( i = count; i; --i ) {
463 function( inputs_float32[ inputNum ] );
464 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
467 reportTime( count, endClock - startClock );
473 static void time_a_float32_z_floatx80( floatx80 function( float32 ) )
475 clock_t startClock, endClock;
481 startClock = clock();
483 for ( i = minIterations; i; --i ) {
484 function( inputs_float32[ inputNum ] );
485 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
487 count += minIterations;
488 } while ( clock() - startClock < CLOCKS_PER_SEC );
490 startClock = clock();
491 for ( i = count; i; --i ) {
492 function( inputs_float32[ inputNum ] );
493 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
496 reportTime( count, endClock - startClock );
504 static void time_a_float32_z_float128( float128 function( float32 ) )
506 clock_t startClock, endClock;
512 startClock = clock();
514 for ( i = minIterations; i; --i ) {
515 function( inputs_float32[ inputNum ] );
516 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
518 count += minIterations;
519 } while ( clock() - startClock < CLOCKS_PER_SEC );
521 startClock = clock();
522 for ( i = count; i; --i ) {
523 function( inputs_float32[ inputNum ] );
524 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
527 reportTime( count, endClock - startClock );
533 static void time_az_float32( float32 function( float32 ) )
535 clock_t startClock, endClock;
541 startClock = clock();
543 for ( i = minIterations; i; --i ) {
544 function( inputs_float32[ inputNum ] );
545 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
547 count += minIterations;
548 } while ( clock() - startClock < CLOCKS_PER_SEC );
550 startClock = clock();
551 for ( i = count; i; --i ) {
552 function( inputs_float32[ inputNum ] );
553 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
556 reportTime( count, endClock - startClock );
560 static void time_ab_float32_z_flag( flag function( float32, float32 ) )
562 clock_t startClock, endClock;
564 int8 inputNumA, inputNumB;
569 startClock = clock();
571 for ( i = minIterations; i; --i ) {
573 inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
574 inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
575 if ( inputNumA == 0 ) ++inputNumB;
576 inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
578 count += minIterations;
579 } while ( clock() - startClock < CLOCKS_PER_SEC );
582 startClock = clock();
583 for ( i = count; i; --i ) {
585 inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
586 inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
587 if ( inputNumA == 0 ) ++inputNumB;
588 inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
591 reportTime( count, endClock - startClock );
595 static void time_abz_float32( float32 function( float32, float32 ) )
597 clock_t startClock, endClock;
599 int8 inputNumA, inputNumB;
604 startClock = clock();
606 for ( i = minIterations; i; --i ) {
608 inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
609 inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
610 if ( inputNumA == 0 ) ++inputNumB;
611 inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
613 count += minIterations;
614 } while ( clock() - startClock < CLOCKS_PER_SEC );
617 startClock = clock();
618 for ( i = count; i; --i ) {
620 inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
621 inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
622 if ( inputNumA == 0 ) ++inputNumB;
623 inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
626 reportTime( count, endClock - startClock );
630 static const float32 inputs_float32_pos[ numInputs_float32 ] = {
631 0x4EFA0000, 0x41D0B328, 0x00000000, 0x3E69A31E,
632 0x2F803EFF, 0x3F800000, 0x17BF8000, 0x674A301A,
633 0x4E010003, 0x7EE3C75D, 0x3D803FE0, 0x3FFEFF00,
634 0x7981F800, 0x431FFFFC, 0x4100C000, 0x3D87EFFF,
635 0x4103FEFE, 0x3C000007, 0x3F01F7FF, 0x4E6C6B5C,
636 0x4187FFFE, 0x458B9F13, 0x4F88007F, 0x5F004007,
637 0x37FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
638 0x5B428661, 0x33F89B1F, 0x23BFEFFF, 0x537BFFBE
641 static void time_az_float32_pos( float32 function( float32 ) )
643 clock_t startClock, endClock;
649 startClock = clock();
651 for ( i = minIterations; i; --i ) {
652 function( inputs_float32_pos[ inputNum ] );
653 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
655 count += minIterations;
656 } while ( clock() - startClock < CLOCKS_PER_SEC );
658 startClock = clock();
659 for ( i = count; i; --i ) {
660 function( inputs_float32_pos[ inputNum ] );
661 inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
664 reportTime( count, endClock - startClock );
669 numInputs_float64 = 32
672 static const float64 inputs_float64[ numInputs_float64 ] = {
673 LIT64( 0x422FFFC008000000 ),
674 LIT64( 0xB7E0000480000000 ),
675 LIT64( 0xF3FD2546120B7935 ),
676 LIT64( 0x3FF0000000000000 ),
677 LIT64( 0xCE07F766F09588D6 ),
678 LIT64( 0x8000000000000000 ),
679 LIT64( 0x3FCE000400000000 ),
680 LIT64( 0x8313B60F0032BED8 ),
681 LIT64( 0xC1EFFFFFC0002000 ),
682 LIT64( 0x3FB3C75D224F2B0F ),
683 LIT64( 0x7FD00000004000FF ),
684 LIT64( 0xA12FFF8000001FFF ),
685 LIT64( 0x3EE0000000FE0000 ),
686 LIT64( 0x0010000080000004 ),
687 LIT64( 0x41CFFFFE00000020 ),
688 LIT64( 0x40303FFFFFFFFFFD ),
689 LIT64( 0x3FD000003FEFFFFF ),
690 LIT64( 0xBFD0000010000000 ),
691 LIT64( 0xB7FC6B5C16CA55CF ),
692 LIT64( 0x413EEB940B9D1301 ),
693 LIT64( 0xC7E00200001FFFFF ),
694 LIT64( 0x47F00021FFFFFFFE ),
695 LIT64( 0xBFFFFFFFF80000FF ),
696 LIT64( 0xC07FFFFFE00FFFFF ),
697 LIT64( 0x001497A63740C5E8 ),
698 LIT64( 0xC4BFFFE0001FFFFF ),
699 LIT64( 0x96FFDFFEFFFFFFFF ),
700 LIT64( 0x403FC000000001FE ),
701 LIT64( 0xFFD00000000001F6 ),
702 LIT64( 0x0640400002000000 ),
703 LIT64( 0x479CEE1E4F789FE0 ),
704 LIT64( 0xC237FFFFFFFFFDFE )
707 static void time_a_float64_z_int32( int32 function( float64 ) )
709 clock_t startClock, endClock;
715 startClock = clock();
717 for ( i = minIterations; i; --i ) {
718 function( inputs_float64[ inputNum ] );
719 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
721 count += minIterations;
722 } while ( clock() - startClock < CLOCKS_PER_SEC );
724 startClock = clock();
725 for ( i = count; i; --i ) {
726 function( inputs_float64[ inputNum ] );
727 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
730 reportTime( count, endClock - startClock );
734 static void time_a_float64_z_int64( int64 function( float64 ) )
736 clock_t startClock, endClock;
742 startClock = clock();
744 for ( i = minIterations; i; --i ) {
745 function( inputs_float64[ inputNum ] );
746 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
748 count += minIterations;
749 } while ( clock() - startClock < CLOCKS_PER_SEC );
751 startClock = clock();
752 for ( i = count; i; --i ) {
753 function( inputs_float64[ inputNum ] );
754 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
757 reportTime( count, endClock - startClock );
761 static void time_a_float64_z_float32( float32 function( float64 ) )
763 clock_t startClock, endClock;
769 startClock = clock();
771 for ( i = minIterations; i; --i ) {
772 function( inputs_float64[ inputNum ] );
773 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
775 count += minIterations;
776 } while ( clock() - startClock < CLOCKS_PER_SEC );
778 startClock = clock();
779 for ( i = count; i; --i ) {
780 function( inputs_float64[ inputNum ] );
781 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
784 reportTime( count, endClock - startClock );
790 static void time_a_float64_z_floatx80( floatx80 function( float64 ) )
792 clock_t startClock, endClock;
798 startClock = clock();
800 for ( i = minIterations; i; --i ) {
801 function( inputs_float64[ inputNum ] );
802 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
804 count += minIterations;
805 } while ( clock() - startClock < CLOCKS_PER_SEC );
807 startClock = clock();
808 for ( i = count; i; --i ) {
809 function( inputs_float64[ inputNum ] );
810 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
813 reportTime( count, endClock - startClock );
821 static void time_a_float64_z_float128( float128 function( float64 ) )
823 clock_t startClock, endClock;
829 startClock = clock();
831 for ( i = minIterations; i; --i ) {
832 function( inputs_float64[ inputNum ] );
833 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
835 count += minIterations;
836 } while ( clock() - startClock < CLOCKS_PER_SEC );
838 startClock = clock();
839 for ( i = count; i; --i ) {
840 function( inputs_float64[ inputNum ] );
841 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
844 reportTime( count, endClock - startClock );
850 static void time_az_float64( float64 function( float64 ) )
852 clock_t startClock, endClock;
858 startClock = clock();
860 for ( i = minIterations; i; --i ) {
861 function( inputs_float64[ inputNum ] );
862 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
864 count += minIterations;
865 } while ( clock() - startClock < CLOCKS_PER_SEC );
867 startClock = clock();
868 for ( i = count; i; --i ) {
869 function( inputs_float64[ inputNum ] );
870 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
873 reportTime( count, endClock - startClock );
877 static void time_ab_float64_z_flag( flag function( float64, float64 ) )
879 clock_t startClock, endClock;
881 int8 inputNumA, inputNumB;
886 startClock = clock();
888 for ( i = minIterations; i; --i ) {
890 inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
891 inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
892 if ( inputNumA == 0 ) ++inputNumB;
893 inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
895 count += minIterations;
896 } while ( clock() - startClock < CLOCKS_PER_SEC );
899 startClock = clock();
900 for ( i = count; i; --i ) {
902 inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
903 inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
904 if ( inputNumA == 0 ) ++inputNumB;
905 inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
908 reportTime( count, endClock - startClock );
912 static void time_abz_float64( float64 function( float64, float64 ) )
914 clock_t startClock, endClock;
916 int8 inputNumA, inputNumB;
921 startClock = clock();
923 for ( i = minIterations; i; --i ) {
925 inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
926 inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
927 if ( inputNumA == 0 ) ++inputNumB;
928 inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
930 count += minIterations;
931 } while ( clock() - startClock < CLOCKS_PER_SEC );
934 startClock = clock();
935 for ( i = count; i; --i ) {
937 inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
938 inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
939 if ( inputNumA == 0 ) ++inputNumB;
940 inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
943 reportTime( count, endClock - startClock );
947 static const float64 inputs_float64_pos[ numInputs_float64 ] = {
948 LIT64( 0x422FFFC008000000 ),
949 LIT64( 0x37E0000480000000 ),
950 LIT64( 0x73FD2546120B7935 ),
951 LIT64( 0x3FF0000000000000 ),
952 LIT64( 0x4E07F766F09588D6 ),
953 LIT64( 0x0000000000000000 ),
954 LIT64( 0x3FCE000400000000 ),
955 LIT64( 0x0313B60F0032BED8 ),
956 LIT64( 0x41EFFFFFC0002000 ),
957 LIT64( 0x3FB3C75D224F2B0F ),
958 LIT64( 0x7FD00000004000FF ),
959 LIT64( 0x212FFF8000001FFF ),
960 LIT64( 0x3EE0000000FE0000 ),
961 LIT64( 0x0010000080000004 ),
962 LIT64( 0x41CFFFFE00000020 ),
963 LIT64( 0x40303FFFFFFFFFFD ),
964 LIT64( 0x3FD000003FEFFFFF ),
965 LIT64( 0x3FD0000010000000 ),
966 LIT64( 0x37FC6B5C16CA55CF ),
967 LIT64( 0x413EEB940B9D1301 ),
968 LIT64( 0x47E00200001FFFFF ),
969 LIT64( 0x47F00021FFFFFFFE ),
970 LIT64( 0x3FFFFFFFF80000FF ),
971 LIT64( 0x407FFFFFE00FFFFF ),
972 LIT64( 0x001497A63740C5E8 ),
973 LIT64( 0x44BFFFE0001FFFFF ),
974 LIT64( 0x16FFDFFEFFFFFFFF ),
975 LIT64( 0x403FC000000001FE ),
976 LIT64( 0x7FD00000000001F6 ),
977 LIT64( 0x0640400002000000 ),
978 LIT64( 0x479CEE1E4F789FE0 ),
979 LIT64( 0x4237FFFFFFFFFDFE )
982 static void time_az_float64_pos( float64 function( float64 ) )
984 clock_t startClock, endClock;
990 startClock = clock();
992 for ( i = minIterations; i; --i ) {
993 function( inputs_float64_pos[ inputNum ] );
994 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
996 count += minIterations;
997 } while ( clock() - startClock < CLOCKS_PER_SEC );
999 startClock = clock();
1000 for ( i = count; i; --i ) {
1001 function( inputs_float64_pos[ inputNum ] );
1002 inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
1005 reportTime( count, endClock - startClock );
1012 numInputs_floatx80 = 32
1015 static const struct {
1018 } inputs_floatx80[ numInputs_floatx80 ] = {
1019 { 0xC03F, LIT64( 0xA9BE15A19C1E8B62 ) },
1020 { 0x8000, LIT64( 0x0000000000000000 ) },
1021 { 0x75A8, LIT64( 0xE59591E4788957A5 ) },
1022 { 0xBFFF, LIT64( 0xFFF0000000000040 ) },
1023 { 0x0CD8, LIT64( 0xFC000000000007FE ) },
1024 { 0x43BA, LIT64( 0x99A4000000000000 ) },
1025 { 0x3FFF, LIT64( 0x8000000000000000 ) },
1026 { 0x4081, LIT64( 0x94FBF1BCEB5545F0 ) },
1027 { 0x403E, LIT64( 0xFFF0000000002000 ) },
1028 { 0x3FFE, LIT64( 0xC860E3C75D224F28 ) },
1029 { 0x407E, LIT64( 0xFC00000FFFFFFFFE ) },
1030 { 0x737A, LIT64( 0x800000007FFDFFFE ) },
1031 { 0x4044, LIT64( 0xFFFFFF80000FFFFF ) },
1032 { 0xBBFE, LIT64( 0x8000040000001FFE ) },
1033 { 0xC002, LIT64( 0xFF80000000000020 ) },
1034 { 0xDE8D, LIT64( 0xFFFFFFFFFFE00004 ) },
1035 { 0xC004, LIT64( 0x8000000000003FFB ) },
1036 { 0x407F, LIT64( 0x800000000003FFFE ) },
1037 { 0xC000, LIT64( 0xA459EE6A5C16CA55 ) },
1038 { 0x8003, LIT64( 0xC42CBF7399AEEB94 ) },
1039 { 0xBF7F, LIT64( 0xF800000000000006 ) },
1040 { 0xC07F, LIT64( 0xBF56BE8871F28FEA ) },
1041 { 0xC07E, LIT64( 0xFFFF77FFFFFFFFFE ) },
1042 { 0xADC9, LIT64( 0x8000000FFFFFFFDE ) },
1043 { 0xC001, LIT64( 0xEFF7FFFFFFFFFFFF ) },
1044 { 0x4001, LIT64( 0xBE84F30125C497A6 ) },
1045 { 0xC06B, LIT64( 0xEFFFFFFFFFFFFFFF ) },
1046 { 0x4080, LIT64( 0xFFFFFFFFBFFFFFFF ) },
1047 { 0x87E9, LIT64( 0x81FFFFFFFFFFFBFF ) },
1048 { 0xA63F, LIT64( 0x801FFFFFFEFFFFFE ) },
1049 { 0x403C, LIT64( 0x801FFFFFFFF7FFFF ) },
1050 { 0x4018, LIT64( 0x8000000000080003 ) }
1053 static void time_a_floatx80_z_int32( int32 function( floatx80 ) )
1055 clock_t startClock, endClock;
1062 startClock = clock();
1064 for ( i = minIterations; i; --i ) {
1065 a.low = inputs_floatx80[ inputNum ].low;
1066 a.high = inputs_floatx80[ inputNum ].high;
1068 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1070 count += minIterations;
1071 } while ( clock() - startClock < CLOCKS_PER_SEC );
1073 startClock = clock();
1074 for ( i = count; i; --i ) {
1075 a.low = inputs_floatx80[ inputNum ].low;
1076 a.high = inputs_floatx80[ inputNum ].high;
1078 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1081 reportTime( count, endClock - startClock );
1085 static void time_a_floatx80_z_int64( int64 function( floatx80 ) )
1087 clock_t startClock, endClock;
1094 startClock = clock();
1096 for ( i = minIterations; i; --i ) {
1097 a.low = inputs_floatx80[ inputNum ].low;
1098 a.high = inputs_floatx80[ inputNum ].high;
1100 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1102 count += minIterations;
1103 } while ( clock() - startClock < CLOCKS_PER_SEC );
1105 startClock = clock();
1106 for ( i = count; i; --i ) {
1107 a.low = inputs_floatx80[ inputNum ].low;
1108 a.high = inputs_floatx80[ inputNum ].high;
1110 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1113 reportTime( count, endClock - startClock );
1117 static void time_a_floatx80_z_float32( float32 function( floatx80 ) )
1119 clock_t startClock, endClock;
1126 startClock = clock();
1128 for ( i = minIterations; i; --i ) {
1129 a.low = inputs_floatx80[ inputNum ].low;
1130 a.high = inputs_floatx80[ inputNum ].high;
1132 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1134 count += minIterations;
1135 } while ( clock() - startClock < CLOCKS_PER_SEC );
1137 startClock = clock();
1138 for ( i = count; i; --i ) {
1139 a.low = inputs_floatx80[ inputNum ].low;
1140 a.high = inputs_floatx80[ inputNum ].high;
1142 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1145 reportTime( count, endClock - startClock );
1149 static void time_a_floatx80_z_float64( float64 function( floatx80 ) )
1151 clock_t startClock, endClock;
1158 startClock = clock();
1160 for ( i = minIterations; i; --i ) {
1161 a.low = inputs_floatx80[ inputNum ].low;
1162 a.high = inputs_floatx80[ inputNum ].high;
1164 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1166 count += minIterations;
1167 } while ( clock() - startClock < CLOCKS_PER_SEC );
1169 startClock = clock();
1170 for ( i = count; i; --i ) {
1171 a.low = inputs_floatx80[ inputNum ].low;
1172 a.high = inputs_floatx80[ inputNum ].high;
1174 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1177 reportTime( count, endClock - startClock );
1183 static void time_a_floatx80_z_float128( float128 function( floatx80 ) )
1185 clock_t startClock, endClock;
1192 startClock = clock();
1194 for ( i = minIterations; i; --i ) {
1195 a.low = inputs_floatx80[ inputNum ].low;
1196 a.high = inputs_floatx80[ inputNum ].high;
1198 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1200 count += minIterations;
1201 } while ( clock() - startClock < CLOCKS_PER_SEC );
1203 startClock = clock();
1204 for ( i = count; i; --i ) {
1205 a.low = inputs_floatx80[ inputNum ].low;
1206 a.high = inputs_floatx80[ inputNum ].high;
1208 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1211 reportTime( count, endClock - startClock );
1217 static void time_az_floatx80( floatx80 function( floatx80 ) )
1219 clock_t startClock, endClock;
1226 startClock = clock();
1228 for ( i = minIterations; i; --i ) {
1229 a.low = inputs_floatx80[ inputNum ].low;
1230 a.high = inputs_floatx80[ inputNum ].high;
1232 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1234 count += minIterations;
1235 } while ( clock() - startClock < CLOCKS_PER_SEC );
1237 startClock = clock();
1238 for ( i = count; i; --i ) {
1239 a.low = inputs_floatx80[ inputNum ].low;
1240 a.high = inputs_floatx80[ inputNum ].high;
1242 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1245 reportTime( count, endClock - startClock );
1249 static void time_ab_floatx80_z_flag( flag function( floatx80, floatx80 ) )
1251 clock_t startClock, endClock;
1253 int8 inputNumA, inputNumB;
1259 startClock = clock();
1261 for ( i = minIterations; i; --i ) {
1262 a.low = inputs_floatx80[ inputNumA ].low;
1263 a.high = inputs_floatx80[ inputNumA ].high;
1264 b.low = inputs_floatx80[ inputNumB ].low;
1265 b.high = inputs_floatx80[ inputNumB ].high;
1267 inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
1268 if ( inputNumA == 0 ) ++inputNumB;
1269 inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
1271 count += minIterations;
1272 } while ( clock() - startClock < CLOCKS_PER_SEC );
1275 startClock = clock();
1276 for ( i = count; i; --i ) {
1277 a.low = inputs_floatx80[ inputNumA ].low;
1278 a.high = inputs_floatx80[ inputNumA ].high;
1279 b.low = inputs_floatx80[ inputNumB ].low;
1280 b.high = inputs_floatx80[ inputNumB ].high;
1282 inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
1283 if ( inputNumA == 0 ) ++inputNumB;
1284 inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
1287 reportTime( count, endClock - startClock );
1291 static void time_abz_floatx80( floatx80 function( floatx80, floatx80 ) )
1293 clock_t startClock, endClock;
1295 int8 inputNumA, inputNumB;
1301 startClock = clock();
1303 for ( i = minIterations; i; --i ) {
1304 a.low = inputs_floatx80[ inputNumA ].low;
1305 a.high = inputs_floatx80[ inputNumA ].high;
1306 b.low = inputs_floatx80[ inputNumB ].low;
1307 b.high = inputs_floatx80[ inputNumB ].high;
1309 inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
1310 if ( inputNumA == 0 ) ++inputNumB;
1311 inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
1313 count += minIterations;
1314 } while ( clock() - startClock < CLOCKS_PER_SEC );
1317 startClock = clock();
1318 for ( i = count; i; --i ) {
1319 a.low = inputs_floatx80[ inputNumA ].low;
1320 a.high = inputs_floatx80[ inputNumA ].high;
1321 b.low = inputs_floatx80[ inputNumB ].low;
1322 b.high = inputs_floatx80[ inputNumB ].high;
1324 inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
1325 if ( inputNumA == 0 ) ++inputNumB;
1326 inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
1329 reportTime( count, endClock - startClock );
1333 static const struct {
1336 } inputs_floatx80_pos[ numInputs_floatx80 ] = {
1337 { 0x403F, LIT64( 0xA9BE15A19C1E8B62 ) },
1338 { 0x0000, LIT64( 0x0000000000000000 ) },
1339 { 0x75A8, LIT64( 0xE59591E4788957A5 ) },
1340 { 0x3FFF, LIT64( 0xFFF0000000000040 ) },
1341 { 0x0CD8, LIT64( 0xFC000000000007FE ) },
1342 { 0x43BA, LIT64( 0x99A4000000000000 ) },
1343 { 0x3FFF, LIT64( 0x8000000000000000 ) },
1344 { 0x4081, LIT64( 0x94FBF1BCEB5545F0 ) },
1345 { 0x403E, LIT64( 0xFFF0000000002000 ) },
1346 { 0x3FFE, LIT64( 0xC860E3C75D224F28 ) },
1347 { 0x407E, LIT64( 0xFC00000FFFFFFFFE ) },
1348 { 0x737A, LIT64( 0x800000007FFDFFFE ) },
1349 { 0x4044, LIT64( 0xFFFFFF80000FFFFF ) },
1350 { 0x3BFE, LIT64( 0x8000040000001FFE ) },
1351 { 0x4002, LIT64( 0xFF80000000000020 ) },
1352 { 0x5E8D, LIT64( 0xFFFFFFFFFFE00004 ) },
1353 { 0x4004, LIT64( 0x8000000000003FFB ) },
1354 { 0x407F, LIT64( 0x800000000003FFFE ) },
1355 { 0x4000, LIT64( 0xA459EE6A5C16CA55 ) },
1356 { 0x0003, LIT64( 0xC42CBF7399AEEB94 ) },
1357 { 0x3F7F, LIT64( 0xF800000000000006 ) },
1358 { 0x407F, LIT64( 0xBF56BE8871F28FEA ) },
1359 { 0x407E, LIT64( 0xFFFF77FFFFFFFFFE ) },
1360 { 0x2DC9, LIT64( 0x8000000FFFFFFFDE ) },
1361 { 0x4001, LIT64( 0xEFF7FFFFFFFFFFFF ) },
1362 { 0x4001, LIT64( 0xBE84F30125C497A6 ) },
1363 { 0x406B, LIT64( 0xEFFFFFFFFFFFFFFF ) },
1364 { 0x4080, LIT64( 0xFFFFFFFFBFFFFFFF ) },
1365 { 0x07E9, LIT64( 0x81FFFFFFFFFFFBFF ) },
1366 { 0x263F, LIT64( 0x801FFFFFFEFFFFFE ) },
1367 { 0x403C, LIT64( 0x801FFFFFFFF7FFFF ) },
1368 { 0x4018, LIT64( 0x8000000000080003 ) }
1371 static void time_az_floatx80_pos( floatx80 function( floatx80 ) )
1373 clock_t startClock, endClock;
1380 startClock = clock();
1382 for ( i = minIterations; i; --i ) {
1383 a.low = inputs_floatx80_pos[ inputNum ].low;
1384 a.high = inputs_floatx80_pos[ inputNum ].high;
1386 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1388 count += minIterations;
1389 } while ( clock() - startClock < CLOCKS_PER_SEC );
1391 startClock = clock();
1392 for ( i = count; i; --i ) {
1393 a.low = inputs_floatx80_pos[ inputNum ].low;
1394 a.high = inputs_floatx80_pos[ inputNum ].high;
1396 inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
1399 reportTime( count, endClock - startClock );
1408 numInputs_float128 = 32
1411 static const struct {
1413 } inputs_float128[ numInputs_float128 ] = {
1414 { LIT64( 0x3FDA200000100000 ), LIT64( 0x0000000000000000 ) },
1415 { LIT64( 0x3FFF000000000000 ), LIT64( 0x0000000000000000 ) },
1416 { LIT64( 0x85F14776190C8306 ), LIT64( 0xD8715F4E3D54BB92 ) },
1417 { LIT64( 0xF2B00000007FFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
1418 { LIT64( 0x8000000000000000 ), LIT64( 0x0000000000000000 ) },
1419 { LIT64( 0xBFFFFFFFFFE00000 ), LIT64( 0x0000008000000000 ) },
1420 { LIT64( 0x407F1719CE722F3E ), LIT64( 0xDA6B3FE5FF29425B ) },
1421 { LIT64( 0x43FFFF8000000000 ), LIT64( 0x0000000000400000 ) },
1422 { LIT64( 0x401E000000000100 ), LIT64( 0x0000000000002000 ) },
1423 { LIT64( 0x3FFED71DACDA8E47 ), LIT64( 0x4860E3C75D224F28 ) },
1424 { LIT64( 0xBF7ECFC1E90647D1 ), LIT64( 0x7A124FE55623EE44 ) },
1425 { LIT64( 0x0DF7007FFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
1426 { LIT64( 0x3FE5FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
1427 { LIT64( 0x403FFFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFE ) },
1428 { LIT64( 0xBFFB2FBF7399AFEB ), LIT64( 0xA459EE6A5C16CA55 ) },
1429 { LIT64( 0xBDB8FFFFFFFFFFFC ), LIT64( 0x0000000000000400 ) },
1430 { LIT64( 0x3FC8FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
1431 { LIT64( 0x3FFBFFFFFFDFFFFF ), LIT64( 0xFFF8000000000000 ) },
1432 { LIT64( 0x407043C11737BE84 ), LIT64( 0xDDD58212ADC937F4 ) },
1433 { LIT64( 0x8001000000000000 ), LIT64( 0x0000001000000001 ) },
1434 { LIT64( 0xC036FFFFFFFFFFFF ), LIT64( 0xFE40000000000000 ) },
1435 { LIT64( 0x4002FFFFFE000002 ), LIT64( 0x0000000000000000 ) },
1436 { LIT64( 0x4000C3FEDE897773 ), LIT64( 0x326AC4FD8EFBE6DC ) },
1437 { LIT64( 0xBFFF0000000FFFFF ), LIT64( 0xFFFFFE0000000000 ) },
1438 { LIT64( 0x62C3E502146E426D ), LIT64( 0x43F3CAA0DC7DF1A0 ) },
1439 { LIT64( 0xB5CBD32E52BB570E ), LIT64( 0xBCC477CB11C6236C ) },
1440 { LIT64( 0xE228FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
1441 { LIT64( 0x3F80000000000000 ), LIT64( 0x0000000080000008 ) },
1442 { LIT64( 0xC1AFFFDFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
1443 { LIT64( 0xC96F000000000000 ), LIT64( 0x00000001FFFBFFFF ) },
1444 { LIT64( 0x3DE09BFE7923A338 ), LIT64( 0xBCC8FBBD7CEC1F4F ) },
1445 { LIT64( 0x401CFFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFF80 ) }
1448 static void time_a_float128_z_int32( int32 function( float128 ) )
1450 clock_t startClock, endClock;
1457 startClock = clock();
1459 for ( i = minIterations; i; --i ) {
1460 a.low = inputs_float128[ inputNum ].low;
1461 a.high = inputs_float128[ inputNum ].high;
1463 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1465 count += minIterations;
1466 } while ( clock() - startClock < CLOCKS_PER_SEC );
1468 startClock = clock();
1469 for ( i = count; i; --i ) {
1470 a.low = inputs_float128[ inputNum ].low;
1471 a.high = inputs_float128[ inputNum ].high;
1473 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1476 reportTime( count, endClock - startClock );
1480 static void time_a_float128_z_int64( int64 function( float128 ) )
1482 clock_t startClock, endClock;
1489 startClock = clock();
1491 for ( i = minIterations; i; --i ) {
1492 a.low = inputs_float128[ inputNum ].low;
1493 a.high = inputs_float128[ inputNum ].high;
1495 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1497 count += minIterations;
1498 } while ( clock() - startClock < CLOCKS_PER_SEC );
1500 startClock = clock();
1501 for ( i = count; i; --i ) {
1502 a.low = inputs_float128[ inputNum ].low;
1503 a.high = inputs_float128[ inputNum ].high;
1505 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1508 reportTime( count, endClock - startClock );
1512 static void time_a_float128_z_float32( float32 function( float128 ) )
1514 clock_t startClock, endClock;
1521 startClock = clock();
1523 for ( i = minIterations; i; --i ) {
1524 a.low = inputs_float128[ inputNum ].low;
1525 a.high = inputs_float128[ inputNum ].high;
1527 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1529 count += minIterations;
1530 } while ( clock() - startClock < CLOCKS_PER_SEC );
1532 startClock = clock();
1533 for ( i = count; i; --i ) {
1534 a.low = inputs_float128[ inputNum ].low;
1535 a.high = inputs_float128[ inputNum ].high;
1537 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1540 reportTime( count, endClock - startClock );
1544 static void time_a_float128_z_float64( float64 function( float128 ) )
1546 clock_t startClock, endClock;
1553 startClock = clock();
1555 for ( i = minIterations; i; --i ) {
1556 a.low = inputs_float128[ inputNum ].low;
1557 a.high = inputs_float128[ inputNum ].high;
1559 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1561 count += minIterations;
1562 } while ( clock() - startClock < CLOCKS_PER_SEC );
1564 startClock = clock();
1565 for ( i = count; i; --i ) {
1566 a.low = inputs_float128[ inputNum ].low;
1567 a.high = inputs_float128[ inputNum ].high;
1569 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1572 reportTime( count, endClock - startClock );
1578 static void time_a_float128_z_floatx80( floatx80 function( float128 ) )
1580 clock_t startClock, endClock;
1587 startClock = clock();
1589 for ( i = minIterations; i; --i ) {
1590 a.low = inputs_float128[ inputNum ].low;
1591 a.high = inputs_float128[ inputNum ].high;
1593 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1595 count += minIterations;
1596 } while ( clock() - startClock < CLOCKS_PER_SEC );
1598 startClock = clock();
1599 for ( i = count; i; --i ) {
1600 a.low = inputs_float128[ inputNum ].low;
1601 a.high = inputs_float128[ inputNum ].high;
1603 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1606 reportTime( count, endClock - startClock );
1612 static void time_az_float128( float128 function( float128 ) )
1614 clock_t startClock, endClock;
1621 startClock = clock();
1623 for ( i = minIterations; i; --i ) {
1624 a.low = inputs_float128[ inputNum ].low;
1625 a.high = inputs_float128[ inputNum ].high;
1627 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1629 count += minIterations;
1630 } while ( clock() - startClock < CLOCKS_PER_SEC );
1632 startClock = clock();
1633 for ( i = count; i; --i ) {
1634 a.low = inputs_float128[ inputNum ].low;
1635 a.high = inputs_float128[ inputNum ].high;
1637 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1640 reportTime( count, endClock - startClock );
1644 static void time_ab_float128_z_flag( flag function( float128, float128 ) )
1646 clock_t startClock, endClock;
1648 int8 inputNumA, inputNumB;
1654 startClock = clock();
1656 for ( i = minIterations; i; --i ) {
1657 a.low = inputs_float128[ inputNumA ].low;
1658 a.high = inputs_float128[ inputNumA ].high;
1659 b.low = inputs_float128[ inputNumB ].low;
1660 b.high = inputs_float128[ inputNumB ].high;
1662 inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
1663 if ( inputNumA == 0 ) ++inputNumB;
1664 inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
1666 count += minIterations;
1667 } while ( clock() - startClock < CLOCKS_PER_SEC );
1670 startClock = clock();
1671 for ( i = count; i; --i ) {
1672 a.low = inputs_float128[ inputNumA ].low;
1673 a.high = inputs_float128[ inputNumA ].high;
1674 b.low = inputs_float128[ inputNumB ].low;
1675 b.high = inputs_float128[ inputNumB ].high;
1677 inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
1678 if ( inputNumA == 0 ) ++inputNumB;
1679 inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
1682 reportTime( count, endClock - startClock );
1686 static void time_abz_float128( float128 function( float128, float128 ) )
1688 clock_t startClock, endClock;
1690 int8 inputNumA, inputNumB;
1696 startClock = clock();
1698 for ( i = minIterations; i; --i ) {
1699 a.low = inputs_float128[ inputNumA ].low;
1700 a.high = inputs_float128[ inputNumA ].high;
1701 b.low = inputs_float128[ inputNumB ].low;
1702 b.high = inputs_float128[ inputNumB ].high;
1704 inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
1705 if ( inputNumA == 0 ) ++inputNumB;
1706 inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
1708 count += minIterations;
1709 } while ( clock() - startClock < CLOCKS_PER_SEC );
1712 startClock = clock();
1713 for ( i = count; i; --i ) {
1714 a.low = inputs_float128[ inputNumA ].low;
1715 a.high = inputs_float128[ inputNumA ].high;
1716 b.low = inputs_float128[ inputNumB ].low;
1717 b.high = inputs_float128[ inputNumB ].high;
1719 inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
1720 if ( inputNumA == 0 ) ++inputNumB;
1721 inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
1724 reportTime( count, endClock - startClock );
1728 static const struct {
1730 } inputs_float128_pos[ numInputs_float128 ] = {
1731 { LIT64( 0x3FDA200000100000 ), LIT64( 0x0000000000000000 ) },
1732 { LIT64( 0x3FFF000000000000 ), LIT64( 0x0000000000000000 ) },
1733 { LIT64( 0x05F14776190C8306 ), LIT64( 0xD8715F4E3D54BB92 ) },
1734 { LIT64( 0x72B00000007FFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
1735 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000000 ) },
1736 { LIT64( 0x3FFFFFFFFFE00000 ), LIT64( 0x0000008000000000 ) },
1737 { LIT64( 0x407F1719CE722F3E ), LIT64( 0xDA6B3FE5FF29425B ) },
1738 { LIT64( 0x43FFFF8000000000 ), LIT64( 0x0000000000400000 ) },
1739 { LIT64( 0x401E000000000100 ), LIT64( 0x0000000000002000 ) },
1740 { LIT64( 0x3FFED71DACDA8E47 ), LIT64( 0x4860E3C75D224F28 ) },
1741 { LIT64( 0x3F7ECFC1E90647D1 ), LIT64( 0x7A124FE55623EE44 ) },
1742 { LIT64( 0x0DF7007FFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
1743 { LIT64( 0x3FE5FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
1744 { LIT64( 0x403FFFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFE ) },
1745 { LIT64( 0x3FFB2FBF7399AFEB ), LIT64( 0xA459EE6A5C16CA55 ) },
1746 { LIT64( 0x3DB8FFFFFFFFFFFC ), LIT64( 0x0000000000000400 ) },
1747 { LIT64( 0x3FC8FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
1748 { LIT64( 0x3FFBFFFFFFDFFFFF ), LIT64( 0xFFF8000000000000 ) },
1749 { LIT64( 0x407043C11737BE84 ), LIT64( 0xDDD58212ADC937F4 ) },
1750 { LIT64( 0x0001000000000000 ), LIT64( 0x0000001000000001 ) },
1751 { LIT64( 0x4036FFFFFFFFFFFF ), LIT64( 0xFE40000000000000 ) },
1752 { LIT64( 0x4002FFFFFE000002 ), LIT64( 0x0000000000000000 ) },
1753 { LIT64( 0x4000C3FEDE897773 ), LIT64( 0x326AC4FD8EFBE6DC ) },
1754 { LIT64( 0x3FFF0000000FFFFF ), LIT64( 0xFFFFFE0000000000 ) },
1755 { LIT64( 0x62C3E502146E426D ), LIT64( 0x43F3CAA0DC7DF1A0 ) },
1756 { LIT64( 0x35CBD32E52BB570E ), LIT64( 0xBCC477CB11C6236C ) },
1757 { LIT64( 0x6228FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
1758 { LIT64( 0x3F80000000000000 ), LIT64( 0x0000000080000008 ) },
1759 { LIT64( 0x41AFFFDFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
1760 { LIT64( 0x496F000000000000 ), LIT64( 0x00000001FFFBFFFF ) },
1761 { LIT64( 0x3DE09BFE7923A338 ), LIT64( 0xBCC8FBBD7CEC1F4F ) },
1762 { LIT64( 0x401CFFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFF80 ) }
1765 static void time_az_float128_pos( float128 function( float128 ) )
1767 clock_t startClock, endClock;
1774 startClock = clock();
1776 for ( i = minIterations; i; --i ) {
1777 a.low = inputs_float128_pos[ inputNum ].low;
1778 a.high = inputs_float128_pos[ inputNum ].high;
1780 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1782 count += minIterations;
1783 } while ( clock() - startClock < CLOCKS_PER_SEC );
1785 startClock = clock();
1786 for ( i = count; i; --i ) {
1787 a.low = inputs_float128_pos[ inputNum ].low;
1788 a.high = inputs_float128_pos[ inputNum ].high;
1790 inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
1793 reportTime( count, endClock - startClock );
1800 INT32_TO_FLOAT32 = 1,
1817 FLOAT32_TO_INT32_ROUND_TO_ZERO,
1819 FLOAT32_TO_INT64_ROUND_TO_ZERO,
1822 FLOAT32_TO_FLOATX80,
1825 FLOAT32_TO_FLOAT128,
1827 FLOAT32_ROUND_TO_INT,
1837 FLOAT32_EQ_SIGNALING,
1841 FLOAT64_TO_INT32_ROUND_TO_ZERO,
1843 FLOAT64_TO_INT64_ROUND_TO_ZERO,
1846 FLOAT64_TO_FLOATX80,
1849 FLOAT64_TO_FLOAT128,
1851 FLOAT64_ROUND_TO_INT,
1861 FLOAT64_EQ_SIGNALING,
1866 FLOATX80_TO_INT32_ROUND_TO_ZERO,
1868 FLOATX80_TO_INT64_ROUND_TO_ZERO,
1869 FLOATX80_TO_FLOAT32,
1870 FLOATX80_TO_FLOAT64,
1872 FLOATX80_TO_FLOAT128,
1874 FLOATX80_ROUND_TO_INT,
1884 FLOATX80_EQ_SIGNALING,
1890 FLOAT128_TO_INT32_ROUND_TO_ZERO,
1892 FLOAT128_TO_INT64_ROUND_TO_ZERO,
1893 FLOAT128_TO_FLOAT32,
1894 FLOAT128_TO_FLOAT64,
1896 FLOAT128_TO_FLOATX80,
1898 FLOAT128_ROUND_TO_INT,
1908 FLOAT128_EQ_SIGNALING,
1918 flag roundingPrecision, roundingMode;
1919 flag tininessMode, tininessModeAtReducedPrecision;
1920 } functions[ NUM_FUNCTIONS ] = {
1921 { 0, 0, 0, 0, 0, 0 },
1922 { "int32_to_float32", 1, FALSE, TRUE, FALSE, FALSE },
1923 { "int32_to_float64", 1, FALSE, FALSE, FALSE, FALSE },
1925 { "int32_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
1928 { "int32_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1930 { "int64_to_float32", 1, FALSE, TRUE, FALSE, FALSE },
1931 { "int64_to_float64", 1, FALSE, TRUE, FALSE, FALSE },
1933 { "int64_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
1936 { "int64_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1938 { "float32_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
1939 { "float32_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1940 { "float32_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
1941 { "float32_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1942 { "float32_to_float64", 1, FALSE, FALSE, FALSE, FALSE },
1944 { "float32_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
1947 { "float32_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1949 { "float32_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
1950 { "float32_add", 2, FALSE, TRUE, FALSE, FALSE },
1951 { "float32_sub", 2, FALSE, TRUE, FALSE, FALSE },
1952 { "float32_mul", 2, FALSE, TRUE, TRUE, FALSE },
1953 { "float32_div", 2, FALSE, TRUE, FALSE, FALSE },
1954 { "float32_rem", 2, FALSE, FALSE, FALSE, FALSE },
1955 { "float32_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
1956 { "float32_eq", 2, FALSE, FALSE, FALSE, FALSE },
1957 { "float32_le", 2, FALSE, FALSE, FALSE, FALSE },
1958 { "float32_lt", 2, FALSE, FALSE, FALSE, FALSE },
1959 { "float32_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
1960 { "float32_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
1961 { "float32_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
1962 { "float64_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
1963 { "float64_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1964 { "float64_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
1965 { "float64_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1966 { "float64_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
1968 { "float64_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
1971 { "float64_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1973 { "float64_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
1974 { "float64_add", 2, FALSE, TRUE, FALSE, FALSE },
1975 { "float64_sub", 2, FALSE, TRUE, FALSE, FALSE },
1976 { "float64_mul", 2, FALSE, TRUE, TRUE, FALSE },
1977 { "float64_div", 2, FALSE, TRUE, FALSE, FALSE },
1978 { "float64_rem", 2, FALSE, FALSE, FALSE, FALSE },
1979 { "float64_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
1980 { "float64_eq", 2, FALSE, FALSE, FALSE, FALSE },
1981 { "float64_le", 2, FALSE, FALSE, FALSE, FALSE },
1982 { "float64_lt", 2, FALSE, FALSE, FALSE, FALSE },
1983 { "float64_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
1984 { "float64_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
1985 { "float64_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
1987 { "floatx80_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
1988 { "floatx80_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1989 { "floatx80_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
1990 { "floatx80_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
1991 { "floatx80_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
1992 { "floatx80_to_float64", 1, FALSE, TRUE, TRUE, FALSE },
1994 { "floatx80_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
1996 { "floatx80_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
1997 { "floatx80_add", 2, TRUE, TRUE, FALSE, TRUE },
1998 { "floatx80_sub", 2, TRUE, TRUE, FALSE, TRUE },
1999 { "floatx80_mul", 2, TRUE, TRUE, TRUE, TRUE },
2000 { "floatx80_div", 2, TRUE, TRUE, FALSE, TRUE },
2001 { "floatx80_rem", 2, FALSE, FALSE, FALSE, FALSE },
2002 { "floatx80_sqrt", 1, TRUE, TRUE, FALSE, FALSE },
2003 { "floatx80_eq", 2, FALSE, FALSE, FALSE, FALSE },
2004 { "floatx80_le", 2, FALSE, FALSE, FALSE, FALSE },
2005 { "floatx80_lt", 2, FALSE, FALSE, FALSE, FALSE },
2006 { "floatx80_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
2007 { "floatx80_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
2008 { "floatx80_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
2011 { "float128_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
2012 { "float128_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
2013 { "float128_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
2014 { "float128_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
2015 { "float128_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
2016 { "float128_to_float64", 1, FALSE, TRUE, TRUE, FALSE },
2018 { "float128_to_floatx80", 1, FALSE, TRUE, TRUE, FALSE },
2020 { "float128_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
2021 { "float128_add", 2, FALSE, TRUE, FALSE, FALSE },
2022 { "float128_sub", 2, FALSE, TRUE, FALSE, FALSE },
2023 { "float128_mul", 2, FALSE, TRUE, TRUE, FALSE },
2024 { "float128_div", 2, FALSE, TRUE, FALSE, FALSE },
2025 { "float128_rem", 2, FALSE, FALSE, FALSE, FALSE },
2026 { "float128_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
2027 { "float128_eq", 2, FALSE, FALSE, FALSE, FALSE },
2028 { "float128_le", 2, FALSE, FALSE, FALSE, FALSE },
2029 { "float128_lt", 2, FALSE, FALSE, FALSE, FALSE },
2030 { "float128_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
2031 { "float128_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
2032 { "float128_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
2037 ROUND_NEAREST_EVEN = 1,
2044 TININESS_BEFORE_ROUNDING = 1,
2045 TININESS_AFTER_ROUNDING,
2050 timeFunctionVariety(
2052 int8 roundingPrecision,
2060 functionName = functions[ functionCode ].name;
2061 if ( roundingPrecision == 32 ) {
2062 roundingPrecisionName = "32";
2064 else if ( roundingPrecision == 64 ) {
2065 roundingPrecisionName = "64";
2067 else if ( roundingPrecision == 80 ) {
2068 roundingPrecisionName = "80";
2071 roundingPrecisionName = 0;
2074 floatx80_rounding_precision = roundingPrecision;
2076 switch ( roundingMode ) {
2078 roundingModeName = 0;
2079 roundingCode = float_round_nearest_even;
2081 case ROUND_NEAREST_EVEN:
2082 roundingModeName = "nearest_even";
2083 roundingCode = float_round_nearest_even;
2086 roundingModeName = "to_zero";
2087 roundingCode = float_round_to_zero;
2090 roundingModeName = "down";
2091 roundingCode = float_round_down;
2094 roundingModeName = "up";
2095 roundingCode = float_round_up;
2098 float_rounding_mode = roundingCode;
2099 switch ( tininessMode ) {
2101 tininessModeName = 0;
2102 tininessCode = float_tininess_after_rounding;
2104 case TININESS_BEFORE_ROUNDING:
2105 tininessModeName = "before";
2106 tininessCode = float_tininess_before_rounding;
2108 case TININESS_AFTER_ROUNDING:
2109 tininessModeName = "after";
2110 tininessCode = float_tininess_after_rounding;
2113 float_detect_tininess = tininessCode;
2114 switch ( functionCode ) {
2115 case INT32_TO_FLOAT32:
2116 time_a_int32_z_float32( int32_to_float32 );
2118 case INT32_TO_FLOAT64:
2119 time_a_int32_z_float64( int32_to_float64 );
2122 case INT32_TO_FLOATX80:
2123 time_a_int32_z_floatx80( int32_to_floatx80 );
2127 case INT32_TO_FLOAT128:
2128 time_a_int32_z_float128( int32_to_float128 );
2131 case INT64_TO_FLOAT32:
2132 time_a_int64_z_float32( int64_to_float32 );
2134 case INT64_TO_FLOAT64:
2135 time_a_int64_z_float64( int64_to_float64 );
2138 case INT64_TO_FLOATX80:
2139 time_a_int64_z_floatx80( int64_to_floatx80 );
2143 case INT64_TO_FLOAT128:
2144 time_a_int64_z_float128( int64_to_float128 );
2147 case FLOAT32_TO_INT32:
2148 time_a_float32_z_int32( float32_to_int32 );
2150 case FLOAT32_TO_INT32_ROUND_TO_ZERO:
2151 time_a_float32_z_int32( float32_to_int32_round_to_zero );
2153 case FLOAT32_TO_INT64:
2154 time_a_float32_z_int64( float32_to_int64 );
2156 case FLOAT32_TO_INT64_ROUND_TO_ZERO:
2157 time_a_float32_z_int64( float32_to_int64_round_to_zero );
2159 case FLOAT32_TO_FLOAT64:
2160 time_a_float32_z_float64( float32_to_float64 );
2163 case FLOAT32_TO_FLOATX80:
2164 time_a_float32_z_floatx80( float32_to_floatx80 );
2168 case FLOAT32_TO_FLOAT128:
2169 time_a_float32_z_float128( float32_to_float128 );
2172 case FLOAT32_ROUND_TO_INT:
2173 time_az_float32( float32_round_to_int );
2176 time_abz_float32( float32_add );
2179 time_abz_float32( float32_sub );
2182 time_abz_float32( float32_mul );
2185 time_abz_float32( float32_div );
2188 time_abz_float32( float32_rem );
2191 time_az_float32_pos( float32_sqrt );
2194 time_ab_float32_z_flag( float32_eq );
2197 time_ab_float32_z_flag( float32_le );
2200 time_ab_float32_z_flag( float32_lt );
2202 case FLOAT32_EQ_SIGNALING:
2203 time_ab_float32_z_flag( float32_eq_signaling );
2205 case FLOAT32_LE_QUIET:
2206 time_ab_float32_z_flag( float32_le_quiet );
2208 case FLOAT32_LT_QUIET:
2209 time_ab_float32_z_flag( float32_lt_quiet );
2211 case FLOAT64_TO_INT32:
2212 time_a_float64_z_int32( float64_to_int32 );
2214 case FLOAT64_TO_INT32_ROUND_TO_ZERO:
2215 time_a_float64_z_int32( float64_to_int32_round_to_zero );
2217 case FLOAT64_TO_INT64:
2218 time_a_float64_z_int64( float64_to_int64 );
2220 case FLOAT64_TO_INT64_ROUND_TO_ZERO:
2221 time_a_float64_z_int64( float64_to_int64_round_to_zero );
2223 case FLOAT64_TO_FLOAT32:
2224 time_a_float64_z_float32( float64_to_float32 );
2227 case FLOAT64_TO_FLOATX80:
2228 time_a_float64_z_floatx80( float64_to_floatx80 );
2232 case FLOAT64_TO_FLOAT128:
2233 time_a_float64_z_float128( float64_to_float128 );
2236 case FLOAT64_ROUND_TO_INT:
2237 time_az_float64( float64_round_to_int );
2240 time_abz_float64( float64_add );
2243 time_abz_float64( float64_sub );
2246 time_abz_float64( float64_mul );
2249 time_abz_float64( float64_div );
2252 time_abz_float64( float64_rem );
2255 time_az_float64_pos( float64_sqrt );
2258 time_ab_float64_z_flag( float64_eq );
2261 time_ab_float64_z_flag( float64_le );
2264 time_ab_float64_z_flag( float64_lt );
2266 case FLOAT64_EQ_SIGNALING:
2267 time_ab_float64_z_flag( float64_eq_signaling );
2269 case FLOAT64_LE_QUIET:
2270 time_ab_float64_z_flag( float64_le_quiet );
2272 case FLOAT64_LT_QUIET:
2273 time_ab_float64_z_flag( float64_lt_quiet );
2276 case FLOATX80_TO_INT32:
2277 time_a_floatx80_z_int32( floatx80_to_int32 );
2279 case FLOATX80_TO_INT32_ROUND_TO_ZERO:
2280 time_a_floatx80_z_int32( floatx80_to_int32_round_to_zero );
2282 case FLOATX80_TO_INT64:
2283 time_a_floatx80_z_int64( floatx80_to_int64 );
2285 case FLOATX80_TO_INT64_ROUND_TO_ZERO:
2286 time_a_floatx80_z_int64( floatx80_to_int64_round_to_zero );
2288 case FLOATX80_TO_FLOAT32:
2289 time_a_floatx80_z_float32( floatx80_to_float32 );
2291 case FLOATX80_TO_FLOAT64:
2292 time_a_floatx80_z_float64( floatx80_to_float64 );
2295 case FLOATX80_TO_FLOAT128:
2296 time_a_floatx80_z_float128( floatx80_to_float128 );
2299 case FLOATX80_ROUND_TO_INT:
2300 time_az_floatx80( floatx80_round_to_int );
2303 time_abz_floatx80( floatx80_add );
2306 time_abz_floatx80( floatx80_sub );
2309 time_abz_floatx80( floatx80_mul );
2312 time_abz_floatx80( floatx80_div );
2315 time_abz_floatx80( floatx80_rem );
2318 time_az_floatx80_pos( floatx80_sqrt );
2321 time_ab_floatx80_z_flag( floatx80_eq );
2324 time_ab_floatx80_z_flag( floatx80_le );
2327 time_ab_floatx80_z_flag( floatx80_lt );
2329 case FLOATX80_EQ_SIGNALING:
2330 time_ab_floatx80_z_flag( floatx80_eq_signaling );
2332 case FLOATX80_LE_QUIET:
2333 time_ab_floatx80_z_flag( floatx80_le_quiet );
2335 case FLOATX80_LT_QUIET:
2336 time_ab_floatx80_z_flag( floatx80_lt_quiet );
2340 case FLOAT128_TO_INT32:
2341 time_a_float128_z_int32( float128_to_int32 );
2343 case FLOAT128_TO_INT32_ROUND_TO_ZERO:
2344 time_a_float128_z_int32( float128_to_int32_round_to_zero );
2346 case FLOAT128_TO_INT64:
2347 time_a_float128_z_int64( float128_to_int64 );
2349 case FLOAT128_TO_INT64_ROUND_TO_ZERO:
2350 time_a_float128_z_int64( float128_to_int64_round_to_zero );
2352 case FLOAT128_TO_FLOAT32:
2353 time_a_float128_z_float32( float128_to_float32 );
2355 case FLOAT128_TO_FLOAT64:
2356 time_a_float128_z_float64( float128_to_float64 );
2359 case FLOAT128_TO_FLOATX80:
2360 time_a_float128_z_floatx80( float128_to_floatx80 );
2363 case FLOAT128_ROUND_TO_INT:
2364 time_az_float128( float128_round_to_int );
2367 time_abz_float128( float128_add );
2370 time_abz_float128( float128_sub );
2373 time_abz_float128( float128_mul );
2376 time_abz_float128( float128_div );
2379 time_abz_float128( float128_rem );
2382 time_az_float128_pos( float128_sqrt );
2385 time_ab_float128_z_flag( float128_eq );
2388 time_ab_float128_z_flag( float128_le );
2391 time_ab_float128_z_flag( float128_lt );
2393 case FLOAT128_EQ_SIGNALING:
2394 time_ab_float128_z_flag( float128_eq_signaling );
2396 case FLOAT128_LE_QUIET:
2397 time_ab_float128_z_flag( float128_le_quiet );
2399 case FLOAT128_LT_QUIET:
2400 time_ab_float128_z_flag( float128_lt_quiet );
2410 int8 roundingPrecisionIn,
2411 int8 roundingModeIn,
2415 int8 roundingPrecision, roundingMode, tininessMode;
2417 roundingPrecision = 32;
2419 if ( ! functions[ functionCode ].roundingPrecision ) {
2420 roundingPrecision = 0;
2422 else if ( roundingPrecisionIn ) {
2423 roundingPrecision = roundingPrecisionIn;
2425 for ( roundingMode = 1;
2426 roundingMode < NUM_ROUNDINGMODES;
2429 if ( ! functions[ functionCode ].roundingMode ) {
2432 else if ( roundingModeIn ) {
2433 roundingMode = roundingModeIn;
2435 for ( tininessMode = 1;
2436 tininessMode < NUM_TININESSMODES;
2439 if ( ( roundingPrecision == 32 )
2440 || ( roundingPrecision == 64 ) ) {
2441 if ( ! functions[ functionCode ]
2442 .tininessModeAtReducedPrecision
2446 else if ( tininessModeIn ) {
2447 tininessMode = tininessModeIn;
2451 if ( ! functions[ functionCode ].tininessMode ) {
2454 else if ( tininessModeIn ) {
2455 tininessMode = tininessModeIn;
2458 timeFunctionVariety(
2459 functionCode, roundingPrecision, roundingMode, tininessMode
2461 if ( tininessModeIn || ! tininessMode ) break;
2463 if ( roundingModeIn || ! roundingMode ) break;
2465 if ( roundingPrecisionIn || ! roundingPrecision ) break;
2466 if ( roundingPrecision == 80 ) {
2469 else if ( roundingPrecision == 64 ) {
2470 roundingPrecision = 80;
2472 else if ( roundingPrecision == 32 ) {
2473 roundingPrecision = 64;
2479 main( int argc, char **argv )
2482 flag functionArgument;
2484 int8 operands, roundingPrecision, roundingMode, tininessMode;
2486 if ( argc <= 1 ) goto writeHelpMessage;
2487 functionArgument = FALSE;
2490 roundingPrecision = 0;
2495 while ( argc && ( argPtr = argv[ 0 ] ) ) {
2496 if ( argPtr[ 0 ] == '-' ) ++argPtr;
2497 if ( strcmp( argPtr, "help" ) == 0 ) {
2500 "timesoftfloat [<option>...] <function>\n"
2501 " <option>: (* is default)\n"
2502 " -help --Write this message and exit.\n"
2504 " -precision32 --Only time rounding precision equivalent to float32.\n"
2505 " -precision64 --Only time rounding precision equivalent to float64.\n"
2506 " -precision80 --Only time maximum rounding precision.\n"
2508 " -nearesteven --Only time rounding to nearest/even.\n"
2509 " -tozero --Only time rounding to zero.\n"
2510 " -down --Only time rounding down.\n"
2511 " -up --Only time rounding up.\n"
2512 " -tininessbefore --Only time underflow tininess before rounding.\n"
2513 " -tininessafter --Only time underflow tininess after rounding.\n"
2515 " int32_to_<float> <float>_add <float>_eq\n"
2516 " <float>_to_int32 <float>_sub <float>_le\n"
2517 " <float>_to_int32_round_to_zero <float>_mul <float>_lt\n"
2518 " int64_to_<float> <float>_div <float>_eq_signaling\n"
2519 " <float>_to_int64 <float>_rem <float>_le_quiet\n"
2520 " <float>_to_int64_round_to_zero <float>_lt_quiet\n"
2521 " <float>_to_<float>\n"
2522 " <float>_round_to_int\n"
2524 " -all1 --All 1-operand functions.\n"
2525 " -all2 --All 2-operand functions.\n"
2526 " -all --All functions.\n"
2528 " float32 --Single precision.\n"
2529 " float64 --Double precision.\n"
2531 " floatx80 --Extended double precision.\n"
2534 " float128 --Quadruple precision.\n"
2539 return EXIT_SUCCESS;
2542 else if ( strcmp( argPtr, "precision32" ) == 0 ) {
2543 roundingPrecision = 32;
2545 else if ( strcmp( argPtr, "precision64" ) == 0 ) {
2546 roundingPrecision = 64;
2548 else if ( strcmp( argPtr, "precision80" ) == 0 ) {
2549 roundingPrecision = 80;
2552 else if ( ( strcmp( argPtr, "nearesteven" ) == 0 )
2553 || ( strcmp( argPtr, "nearest_even" ) == 0 ) ) {
2554 roundingMode = ROUND_NEAREST_EVEN;
2556 else if ( ( strcmp( argPtr, "tozero" ) == 0 )
2557 || ( strcmp( argPtr, "to_zero" ) == 0 ) ) {
2558 roundingMode = ROUND_TO_ZERO;
2560 else if ( strcmp( argPtr, "down" ) == 0 ) {
2561 roundingMode = ROUND_DOWN;
2563 else if ( strcmp( argPtr, "up" ) == 0 ) {
2564 roundingMode = ROUND_UP;
2566 else if ( strcmp( argPtr, "tininessbefore" ) == 0 ) {
2567 tininessMode = TININESS_BEFORE_ROUNDING;
2569 else if ( strcmp( argPtr, "tininessafter" ) == 0 ) {
2570 tininessMode = TININESS_AFTER_ROUNDING;
2572 else if ( strcmp( argPtr, "all1" ) == 0 ) {
2573 functionArgument = TRUE;
2577 else if ( strcmp( argPtr, "all2" ) == 0 ) {
2578 functionArgument = TRUE;
2582 else if ( strcmp( argPtr, "all" ) == 0 ) {
2583 functionArgument = TRUE;
2588 for ( functionCode = 1;
2589 functionCode < NUM_FUNCTIONS;
2592 if ( strcmp( argPtr, functions[ functionCode ].name ) == 0 ) {
2596 if ( functionCode == NUM_FUNCTIONS ) {
2597 fail( "Invalid option or function `%s'", argv[ 0 ] );
2599 functionArgument = TRUE;
2604 if ( ! functionArgument ) fail( "Function argument required" );
2605 if ( functionCode ) {
2607 functionCode, roundingPrecision, roundingMode, tininessMode );
2609 else if ( operands == 1 ) {
2610 for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
2612 if ( functions[ functionCode ].numInputs == 1 ) {
2614 functionCode, roundingPrecision, roundingMode, tininessMode
2619 else if ( operands == 2 ) {
2620 for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
2622 if ( functions[ functionCode ].numInputs == 2 ) {
2624 functionCode, roundingPrecision, roundingMode, tininessMode
2630 for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
2633 functionCode, roundingPrecision, roundingMode, tininessMode );
2636 return EXIT_SUCCESS;