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 #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 */
44 #include "softfloat.h"
50 static void fail( const char *message
, ... )
54 fputs( "timesoftfloat: ", stderr
);
55 va_start( varArgs
, message
);
56 vfprintf( stderr
, message
, varArgs
);
58 fputs( ".\n", stderr
);
63 static char *functionName
;
64 static char *roundingPrecisionName
, *roundingModeName
, *tininessModeName
;
66 static void reportTime( int32 count
, long clocks
)
71 ( count
/ ( ( (float) clocks
) / CLOCKS_PER_SEC
) ) / 1000,
74 if ( roundingModeName
) {
75 if ( roundingPrecisionName
) {
76 fputs( ", precision ", stdout
);
77 fputs( roundingPrecisionName
, stdout
);
79 fputs( ", rounding ", stdout
);
80 fputs( roundingModeName
, stdout
);
81 if ( tininessModeName
) {
82 fputs( ", tininess ", stdout
);
83 fputs( tininessModeName
, stdout
);
84 fputs( " rounding", stdout
);
87 fputc( '\n', stdout
);
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
106 static void time_a_int32_z_float32( float32
function( int32
) )
108 clock_t startClock
, endClock
;
114 startClock
= clock();
116 for ( i
= minIterations
; i
; --i
) {
117 function( inputs_int32
[ inputNum
] );
118 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
120 count
+= minIterations
;
121 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
123 startClock
= clock();
124 for ( i
= count
; i
; --i
) {
125 function( inputs_int32
[ inputNum
] );
126 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
129 reportTime( count
, endClock
- startClock
);
133 static void time_a_int32_z_float64( float64
function( int32
) )
135 clock_t startClock
, endClock
;
141 startClock
= clock();
143 for ( i
= minIterations
; i
; --i
) {
144 function( inputs_int32
[ inputNum
] );
145 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
147 count
+= minIterations
;
148 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
150 startClock
= clock();
151 for ( i
= count
; i
; --i
) {
152 function( inputs_int32
[ inputNum
] );
153 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
156 reportTime( count
, endClock
- startClock
);
162 static void time_a_int32_z_floatx80( floatx80
function( int32
) )
164 clock_t startClock
, endClock
;
170 startClock
= clock();
172 for ( i
= minIterations
; i
; --i
) {
173 function( inputs_int32
[ inputNum
] );
174 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
176 count
+= minIterations
;
177 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
179 startClock
= clock();
180 for ( i
= count
; i
; --i
) {
181 function( inputs_int32
[ inputNum
] );
182 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
185 reportTime( count
, endClock
- startClock
);
193 static void time_a_int32_z_float128( float128
function( int32
) )
195 clock_t startClock
, endClock
;
201 startClock
= clock();
203 for ( i
= minIterations
; i
; --i
) {
204 function( inputs_int32
[ inputNum
] );
205 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
207 count
+= minIterations
;
208 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
210 startClock
= clock();
211 for ( i
= count
; i
; --i
) {
212 function( inputs_int32
[ inputNum
] );
213 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
216 reportTime( count
, endClock
- startClock
);
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 )
261 static void time_a_int64_z_float32( float32
function( int64
) )
263 clock_t startClock
, endClock
;
269 startClock
= clock();
271 for ( i
= minIterations
; i
; --i
) {
272 function( inputs_int64
[ inputNum
] );
273 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
275 count
+= minIterations
;
276 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
278 startClock
= clock();
279 for ( i
= count
; i
; --i
) {
280 function( inputs_int64
[ inputNum
] );
281 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
284 reportTime( count
, endClock
- startClock
);
288 static void time_a_int64_z_float64( float64
function( int64
) )
290 clock_t startClock
, endClock
;
296 startClock
= clock();
298 for ( i
= minIterations
; i
; --i
) {
299 function( inputs_int64
[ inputNum
] );
300 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
302 count
+= minIterations
;
303 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
305 startClock
= clock();
306 for ( i
= count
; i
; --i
) {
307 function( inputs_int64
[ inputNum
] );
308 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
311 reportTime( count
, endClock
- startClock
);
317 static void time_a_int64_z_floatx80( floatx80
function( int64
) )
319 clock_t startClock
, endClock
;
325 startClock
= clock();
327 for ( i
= minIterations
; i
; --i
) {
328 function( inputs_int64
[ inputNum
] );
329 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
331 count
+= minIterations
;
332 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
334 startClock
= clock();
335 for ( i
= count
; i
; --i
) {
336 function( inputs_int64
[ inputNum
] );
337 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
340 reportTime( count
, endClock
- startClock
);
348 static void time_a_int64_z_float128( float128
function( int64
) )
350 clock_t startClock
, endClock
;
356 startClock
= clock();
358 for ( i
= minIterations
; i
; --i
) {
359 function( inputs_int64
[ inputNum
] );
360 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
362 count
+= minIterations
;
363 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
365 startClock
= clock();
366 for ( i
= count
; i
; --i
) {
367 function( inputs_int64
[ inputNum
] );
368 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
371 reportTime( count
, endClock
- startClock
);
378 numInputs_float32
= 32
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
392 static void time_a_float32_z_int32( int32
function( float32
) )
394 clock_t startClock
, endClock
;
400 startClock
= clock();
402 for ( i
= minIterations
; i
; --i
) {
403 function( inputs_float32
[ inputNum
] );
404 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
406 count
+= minIterations
;
407 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
409 startClock
= clock();
410 for ( i
= count
; i
; --i
) {
411 function( inputs_float32
[ inputNum
] );
412 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
415 reportTime( count
, endClock
- startClock
);
419 static void time_a_float32_z_int64( int64
function( float32
) )
421 clock_t startClock
, endClock
;
427 startClock
= clock();
429 for ( i
= minIterations
; i
; --i
) {
430 function( inputs_float32
[ inputNum
] );
431 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
433 count
+= minIterations
;
434 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
436 startClock
= clock();
437 for ( i
= count
; i
; --i
) {
438 function( inputs_float32
[ inputNum
] );
439 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
442 reportTime( count
, endClock
- startClock
);
446 static void time_a_float32_z_float64( float64
function( float32
) )
448 clock_t startClock
, endClock
;
454 startClock
= clock();
456 for ( i
= minIterations
; i
; --i
) {
457 function( inputs_float32
[ inputNum
] );
458 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
460 count
+= minIterations
;
461 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
463 startClock
= clock();
464 for ( i
= count
; i
; --i
) {
465 function( inputs_float32
[ inputNum
] );
466 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
469 reportTime( count
, endClock
- startClock
);
475 static void time_a_float32_z_floatx80( floatx80
function( float32
) )
477 clock_t startClock
, endClock
;
483 startClock
= clock();
485 for ( i
= minIterations
; i
; --i
) {
486 function( inputs_float32
[ inputNum
] );
487 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
489 count
+= minIterations
;
490 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
492 startClock
= clock();
493 for ( i
= count
; i
; --i
) {
494 function( inputs_float32
[ inputNum
] );
495 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
498 reportTime( count
, endClock
- startClock
);
506 static void time_a_float32_z_float128( float128
function( float32
) )
508 clock_t startClock
, endClock
;
514 startClock
= clock();
516 for ( i
= minIterations
; i
; --i
) {
517 function( inputs_float32
[ inputNum
] );
518 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
520 count
+= minIterations
;
521 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
523 startClock
= clock();
524 for ( i
= count
; i
; --i
) {
525 function( inputs_float32
[ inputNum
] );
526 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
529 reportTime( count
, endClock
- startClock
);
535 static void time_az_float32( float32
function( float32
) )
537 clock_t startClock
, endClock
;
543 startClock
= clock();
545 for ( i
= minIterations
; i
; --i
) {
546 function( inputs_float32
[ inputNum
] );
547 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
549 count
+= minIterations
;
550 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
552 startClock
= clock();
553 for ( i
= count
; i
; --i
) {
554 function( inputs_float32
[ inputNum
] );
555 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
558 reportTime( count
, endClock
- startClock
);
562 static void time_ab_float32_z_flag( flag
function( float32
, float32
) )
564 clock_t startClock
, endClock
;
566 int8 inputNumA
, inputNumB
;
571 startClock
= clock();
573 for ( i
= minIterations
; i
; --i
) {
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 );
580 count
+= minIterations
;
581 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
584 startClock
= clock();
585 for ( i
= count
; i
; --i
) {
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 );
593 reportTime( count
, endClock
- startClock
);
597 static void time_abz_float32( float32
function( float32
, float32
) )
599 clock_t startClock
, endClock
;
601 int8 inputNumA
, inputNumB
;
606 startClock
= clock();
608 for ( i
= minIterations
; i
; --i
) {
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 );
615 count
+= minIterations
;
616 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
619 startClock
= clock();
620 for ( i
= count
; i
; --i
) {
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 );
628 reportTime( count
, endClock
- startClock
);
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
643 static void time_az_float32_pos( float32
function( float32
) )
645 clock_t startClock
, endClock
;
651 startClock
= clock();
653 for ( i
= minIterations
; i
; --i
) {
654 function( inputs_float32_pos
[ inputNum
] );
655 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
657 count
+= minIterations
;
658 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
660 startClock
= clock();
661 for ( i
= count
; i
; --i
) {
662 function( inputs_float32_pos
[ inputNum
] );
663 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
666 reportTime( count
, endClock
- startClock
);
671 numInputs_float64
= 32
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 )
709 static void time_a_float64_z_int32( int32
function( float64
) )
711 clock_t startClock
, endClock
;
717 startClock
= clock();
719 for ( i
= minIterations
; i
; --i
) {
720 function( inputs_float64
[ inputNum
] );
721 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
723 count
+= minIterations
;
724 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
726 startClock
= clock();
727 for ( i
= count
; i
; --i
) {
728 function( inputs_float64
[ inputNum
] );
729 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
732 reportTime( count
, endClock
- startClock
);
736 static void time_a_float64_z_int64( int64
function( float64
) )
738 clock_t startClock
, endClock
;
744 startClock
= clock();
746 for ( i
= minIterations
; i
; --i
) {
747 function( inputs_float64
[ inputNum
] );
748 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
750 count
+= minIterations
;
751 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
753 startClock
= clock();
754 for ( i
= count
; i
; --i
) {
755 function( inputs_float64
[ inputNum
] );
756 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
759 reportTime( count
, endClock
- startClock
);
763 static void time_a_float64_z_float32( float32
function( float64
) )
765 clock_t startClock
, endClock
;
771 startClock
= clock();
773 for ( i
= minIterations
; i
; --i
) {
774 function( inputs_float64
[ inputNum
] );
775 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
777 count
+= minIterations
;
778 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
780 startClock
= clock();
781 for ( i
= count
; i
; --i
) {
782 function( inputs_float64
[ inputNum
] );
783 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
786 reportTime( count
, endClock
- startClock
);
792 static void time_a_float64_z_floatx80( floatx80
function( float64
) )
794 clock_t startClock
, endClock
;
800 startClock
= clock();
802 for ( i
= minIterations
; i
; --i
) {
803 function( inputs_float64
[ inputNum
] );
804 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
806 count
+= minIterations
;
807 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
809 startClock
= clock();
810 for ( i
= count
; i
; --i
) {
811 function( inputs_float64
[ inputNum
] );
812 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
815 reportTime( count
, endClock
- startClock
);
823 static void time_a_float64_z_float128( float128
function( float64
) )
825 clock_t startClock
, endClock
;
831 startClock
= clock();
833 for ( i
= minIterations
; i
; --i
) {
834 function( inputs_float64
[ inputNum
] );
835 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
837 count
+= minIterations
;
838 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
840 startClock
= clock();
841 for ( i
= count
; i
; --i
) {
842 function( inputs_float64
[ inputNum
] );
843 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
846 reportTime( count
, endClock
- startClock
);
852 static void time_az_float64( float64
function( float64
) )
854 clock_t startClock
, endClock
;
860 startClock
= clock();
862 for ( i
= minIterations
; i
; --i
) {
863 function( inputs_float64
[ inputNum
] );
864 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
866 count
+= minIterations
;
867 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
869 startClock
= clock();
870 for ( i
= count
; i
; --i
) {
871 function( inputs_float64
[ inputNum
] );
872 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
875 reportTime( count
, endClock
- startClock
);
879 static void time_ab_float64_z_flag( flag
function( float64
, float64
) )
881 clock_t startClock
, endClock
;
883 int8 inputNumA
, inputNumB
;
888 startClock
= clock();
890 for ( i
= minIterations
; i
; --i
) {
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 );
897 count
+= minIterations
;
898 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
901 startClock
= clock();
902 for ( i
= count
; i
; --i
) {
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 );
910 reportTime( count
, endClock
- startClock
);
914 static void time_abz_float64( float64
function( float64
, float64
) )
916 clock_t startClock
, endClock
;
918 int8 inputNumA
, inputNumB
;
923 startClock
= clock();
925 for ( i
= minIterations
; i
; --i
) {
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 );
932 count
+= minIterations
;
933 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
936 startClock
= clock();
937 for ( i
= count
; i
; --i
) {
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 );
945 reportTime( count
, endClock
- startClock
);
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 )
984 static void time_az_float64_pos( float64
function( float64
) )
986 clock_t startClock
, endClock
;
992 startClock
= clock();
994 for ( i
= minIterations
; i
; --i
) {
995 function( inputs_float64_pos
[ inputNum
] );
996 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
998 count
+= minIterations
;
999 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1001 startClock
= clock();
1002 for ( i
= count
; i
; --i
) {
1003 function( inputs_float64_pos
[ inputNum
] );
1004 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
1007 reportTime( count
, endClock
- startClock
);
1014 numInputs_floatx80
= 32
1017 static const struct {
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 ) }
1055 static void time_a_floatx80_z_int32( int32
function( floatx80
) )
1057 clock_t startClock
, endClock
;
1064 startClock
= clock();
1066 for ( i
= minIterations
; i
; --i
) {
1067 a
.low
= inputs_floatx80
[ inputNum
].low
;
1068 a
.high
= inputs_floatx80
[ inputNum
].high
;
1070 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1072 count
+= minIterations
;
1073 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1075 startClock
= clock();
1076 for ( i
= count
; i
; --i
) {
1077 a
.low
= inputs_floatx80
[ inputNum
].low
;
1078 a
.high
= inputs_floatx80
[ inputNum
].high
;
1080 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1083 reportTime( count
, endClock
- startClock
);
1087 static void time_a_floatx80_z_int64( int64
function( floatx80
) )
1089 clock_t startClock
, endClock
;
1096 startClock
= clock();
1098 for ( i
= minIterations
; i
; --i
) {
1099 a
.low
= inputs_floatx80
[ inputNum
].low
;
1100 a
.high
= inputs_floatx80
[ inputNum
].high
;
1102 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1104 count
+= minIterations
;
1105 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1107 startClock
= clock();
1108 for ( i
= count
; i
; --i
) {
1109 a
.low
= inputs_floatx80
[ inputNum
].low
;
1110 a
.high
= inputs_floatx80
[ inputNum
].high
;
1112 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1115 reportTime( count
, endClock
- startClock
);
1119 static void time_a_floatx80_z_float32( float32
function( floatx80
) )
1121 clock_t startClock
, endClock
;
1128 startClock
= clock();
1130 for ( i
= minIterations
; i
; --i
) {
1131 a
.low
= inputs_floatx80
[ inputNum
].low
;
1132 a
.high
= inputs_floatx80
[ inputNum
].high
;
1134 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1136 count
+= minIterations
;
1137 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1139 startClock
= clock();
1140 for ( i
= count
; i
; --i
) {
1141 a
.low
= inputs_floatx80
[ inputNum
].low
;
1142 a
.high
= inputs_floatx80
[ inputNum
].high
;
1144 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1147 reportTime( count
, endClock
- startClock
);
1151 static void time_a_floatx80_z_float64( float64
function( floatx80
) )
1153 clock_t startClock
, endClock
;
1160 startClock
= clock();
1162 for ( i
= minIterations
; i
; --i
) {
1163 a
.low
= inputs_floatx80
[ inputNum
].low
;
1164 a
.high
= inputs_floatx80
[ inputNum
].high
;
1166 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1168 count
+= minIterations
;
1169 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1171 startClock
= clock();
1172 for ( i
= count
; i
; --i
) {
1173 a
.low
= inputs_floatx80
[ inputNum
].low
;
1174 a
.high
= inputs_floatx80
[ inputNum
].high
;
1176 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1179 reportTime( count
, endClock
- startClock
);
1185 static void time_a_floatx80_z_float128( float128
function( floatx80
) )
1187 clock_t startClock
, endClock
;
1194 startClock
= clock();
1196 for ( i
= minIterations
; i
; --i
) {
1197 a
.low
= inputs_floatx80
[ inputNum
].low
;
1198 a
.high
= inputs_floatx80
[ inputNum
].high
;
1200 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1202 count
+= minIterations
;
1203 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1205 startClock
= clock();
1206 for ( i
= count
; i
; --i
) {
1207 a
.low
= inputs_floatx80
[ inputNum
].low
;
1208 a
.high
= inputs_floatx80
[ inputNum
].high
;
1210 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1213 reportTime( count
, endClock
- startClock
);
1219 static void time_az_floatx80( floatx80
function( floatx80
) )
1221 clock_t startClock
, endClock
;
1228 startClock
= clock();
1230 for ( i
= minIterations
; i
; --i
) {
1231 a
.low
= inputs_floatx80
[ inputNum
].low
;
1232 a
.high
= inputs_floatx80
[ inputNum
].high
;
1234 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1236 count
+= minIterations
;
1237 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1239 startClock
= clock();
1240 for ( i
= count
; i
; --i
) {
1241 a
.low
= inputs_floatx80
[ inputNum
].low
;
1242 a
.high
= inputs_floatx80
[ inputNum
].high
;
1244 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1247 reportTime( count
, endClock
- startClock
);
1251 static void time_ab_floatx80_z_flag( flag
function( floatx80
, floatx80
) )
1253 clock_t startClock
, endClock
;
1255 int8 inputNumA
, inputNumB
;
1261 startClock
= clock();
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
;
1269 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_floatx80
- 1 );
1270 if ( inputNumA
== 0 ) ++inputNumB
;
1271 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_floatx80
- 1 );
1273 count
+= minIterations
;
1274 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
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
;
1284 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_floatx80
- 1 );
1285 if ( inputNumA
== 0 ) ++inputNumB
;
1286 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_floatx80
- 1 );
1289 reportTime( count
, endClock
- startClock
);
1293 static void time_abz_floatx80( floatx80
function( floatx80
, floatx80
) )
1295 clock_t startClock
, endClock
;
1297 int8 inputNumA
, inputNumB
;
1303 startClock
= clock();
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
;
1311 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_floatx80
- 1 );
1312 if ( inputNumA
== 0 ) ++inputNumB
;
1313 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_floatx80
- 1 );
1315 count
+= minIterations
;
1316 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
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
;
1326 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_floatx80
- 1 );
1327 if ( inputNumA
== 0 ) ++inputNumB
;
1328 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_floatx80
- 1 );
1331 reportTime( count
, endClock
- startClock
);
1335 static const struct {
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 ) }
1373 static void time_az_floatx80_pos( floatx80
function( floatx80
) )
1375 clock_t startClock
, endClock
;
1382 startClock
= clock();
1384 for ( i
= minIterations
; i
; --i
) {
1385 a
.low
= inputs_floatx80_pos
[ inputNum
].low
;
1386 a
.high
= inputs_floatx80_pos
[ inputNum
].high
;
1388 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1390 count
+= minIterations
;
1391 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
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
;
1398 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1401 reportTime( count
, endClock
- startClock
);
1410 numInputs_float128
= 32
1413 static const struct {
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 ) }
1450 static void time_a_float128_z_int32( int32
function( float128
) )
1452 clock_t startClock
, endClock
;
1459 startClock
= clock();
1461 for ( i
= minIterations
; i
; --i
) {
1462 a
.low
= inputs_float128
[ inputNum
].low
;
1463 a
.high
= inputs_float128
[ inputNum
].high
;
1465 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1467 count
+= minIterations
;
1468 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1470 startClock
= clock();
1471 for ( i
= count
; i
; --i
) {
1472 a
.low
= inputs_float128
[ inputNum
].low
;
1473 a
.high
= inputs_float128
[ inputNum
].high
;
1475 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1478 reportTime( count
, endClock
- startClock
);
1482 static void time_a_float128_z_int64( int64
function( float128
) )
1484 clock_t startClock
, endClock
;
1491 startClock
= clock();
1493 for ( i
= minIterations
; i
; --i
) {
1494 a
.low
= inputs_float128
[ inputNum
].low
;
1495 a
.high
= inputs_float128
[ inputNum
].high
;
1497 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1499 count
+= minIterations
;
1500 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1502 startClock
= clock();
1503 for ( i
= count
; i
; --i
) {
1504 a
.low
= inputs_float128
[ inputNum
].low
;
1505 a
.high
= inputs_float128
[ inputNum
].high
;
1507 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1510 reportTime( count
, endClock
- startClock
);
1514 static void time_a_float128_z_float32( float32
function( float128
) )
1516 clock_t startClock
, endClock
;
1523 startClock
= clock();
1525 for ( i
= minIterations
; i
; --i
) {
1526 a
.low
= inputs_float128
[ inputNum
].low
;
1527 a
.high
= inputs_float128
[ inputNum
].high
;
1529 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1531 count
+= minIterations
;
1532 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1534 startClock
= clock();
1535 for ( i
= count
; i
; --i
) {
1536 a
.low
= inputs_float128
[ inputNum
].low
;
1537 a
.high
= inputs_float128
[ inputNum
].high
;
1539 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1542 reportTime( count
, endClock
- startClock
);
1546 static void time_a_float128_z_float64( float64
function( float128
) )
1548 clock_t startClock
, endClock
;
1555 startClock
= clock();
1557 for ( i
= minIterations
; i
; --i
) {
1558 a
.low
= inputs_float128
[ inputNum
].low
;
1559 a
.high
= inputs_float128
[ inputNum
].high
;
1561 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1563 count
+= minIterations
;
1564 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1566 startClock
= clock();
1567 for ( i
= count
; i
; --i
) {
1568 a
.low
= inputs_float128
[ inputNum
].low
;
1569 a
.high
= inputs_float128
[ inputNum
].high
;
1571 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1574 reportTime( count
, endClock
- startClock
);
1580 static void time_a_float128_z_floatx80( floatx80
function( float128
) )
1582 clock_t startClock
, endClock
;
1589 startClock
= clock();
1591 for ( i
= minIterations
; i
; --i
) {
1592 a
.low
= inputs_float128
[ inputNum
].low
;
1593 a
.high
= inputs_float128
[ inputNum
].high
;
1595 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1597 count
+= minIterations
;
1598 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1600 startClock
= clock();
1601 for ( i
= count
; i
; --i
) {
1602 a
.low
= inputs_float128
[ inputNum
].low
;
1603 a
.high
= inputs_float128
[ inputNum
].high
;
1605 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1608 reportTime( count
, endClock
- startClock
);
1614 static void time_az_float128( float128
function( float128
) )
1616 clock_t startClock
, endClock
;
1623 startClock
= clock();
1625 for ( i
= minIterations
; i
; --i
) {
1626 a
.low
= inputs_float128
[ inputNum
].low
;
1627 a
.high
= inputs_float128
[ inputNum
].high
;
1629 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1631 count
+= minIterations
;
1632 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1634 startClock
= clock();
1635 for ( i
= count
; i
; --i
) {
1636 a
.low
= inputs_float128
[ inputNum
].low
;
1637 a
.high
= inputs_float128
[ inputNum
].high
;
1639 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1642 reportTime( count
, endClock
- startClock
);
1646 static void time_ab_float128_z_flag( flag
function( float128
, float128
) )
1648 clock_t startClock
, endClock
;
1650 int8 inputNumA
, inputNumB
;
1656 startClock
= clock();
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
;
1664 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float128
- 1 );
1665 if ( inputNumA
== 0 ) ++inputNumB
;
1666 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float128
- 1 );
1668 count
+= minIterations
;
1669 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
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
;
1679 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float128
- 1 );
1680 if ( inputNumA
== 0 ) ++inputNumB
;
1681 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float128
- 1 );
1684 reportTime( count
, endClock
- startClock
);
1688 static void time_abz_float128( float128
function( float128
, float128
) )
1690 clock_t startClock
, endClock
;
1692 int8 inputNumA
, inputNumB
;
1698 startClock
= clock();
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
;
1706 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float128
- 1 );
1707 if ( inputNumA
== 0 ) ++inputNumB
;
1708 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float128
- 1 );
1710 count
+= minIterations
;
1711 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
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
;
1721 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float128
- 1 );
1722 if ( inputNumA
== 0 ) ++inputNumB
;
1723 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float128
- 1 );
1726 reportTime( count
, endClock
- startClock
);
1730 static const struct {
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 ) }
1767 static void time_az_float128_pos( float128
function( float128
) )
1769 clock_t startClock
, endClock
;
1776 startClock
= clock();
1778 for ( i
= minIterations
; i
; --i
) {
1779 a
.low
= inputs_float128_pos
[ inputNum
].low
;
1780 a
.high
= inputs_float128_pos
[ inputNum
].high
;
1782 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1784 count
+= minIterations
;
1785 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
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
;
1792 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1795 reportTime( count
, endClock
- startClock
);
1802 INT32_TO_FLOAT32
= 1,
1819 FLOAT32_TO_INT32_ROUND_TO_ZERO
,
1821 FLOAT32_TO_INT64_ROUND_TO_ZERO
,
1824 FLOAT32_TO_FLOATX80
,
1827 FLOAT32_TO_FLOAT128
,
1829 FLOAT32_ROUND_TO_INT
,
1839 FLOAT32_EQ_SIGNALING
,
1843 FLOAT64_TO_INT32_ROUND_TO_ZERO
,
1845 FLOAT64_TO_INT64_ROUND_TO_ZERO
,
1848 FLOAT64_TO_FLOATX80
,
1851 FLOAT64_TO_FLOAT128
,
1853 FLOAT64_ROUND_TO_INT
,
1863 FLOAT64_EQ_SIGNALING
,
1868 FLOATX80_TO_INT32_ROUND_TO_ZERO
,
1870 FLOATX80_TO_INT64_ROUND_TO_ZERO
,
1871 FLOATX80_TO_FLOAT32
,
1872 FLOATX80_TO_FLOAT64
,
1874 FLOATX80_TO_FLOAT128
,
1876 FLOATX80_ROUND_TO_INT
,
1886 FLOATX80_EQ_SIGNALING
,
1892 FLOAT128_TO_INT32_ROUND_TO_ZERO
,
1894 FLOAT128_TO_INT64_ROUND_TO_ZERO
,
1895 FLOAT128_TO_FLOAT32
,
1896 FLOAT128_TO_FLOAT64
,
1898 FLOAT128_TO_FLOATX80
,
1900 FLOAT128_ROUND_TO_INT
,
1910 FLOAT128_EQ_SIGNALING
,
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
},
1927 { "int32_to_floatx80", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1930 { "int32_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1932 { "int64_to_float32", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1933 { "int64_to_float64", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1935 { "int64_to_floatx80", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1938 { "int64_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
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
},
1946 { "float32_to_floatx80", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1949 { "float32_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
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
},
1970 { "float64_to_floatx80", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1973 { "float64_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
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
},
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
},
1996 { "floatx80_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
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
},
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
},
2020 { "float128_to_floatx80", 1, FALSE
, TRUE
, TRUE
, FALSE
},
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
},
2039 ROUND_NEAREST_EVEN
= 1,
2046 TININESS_BEFORE_ROUNDING
= 1,
2047 TININESS_AFTER_ROUNDING
,
2052 timeFunctionVariety(
2054 int8 roundingPrecision
,
2062 functionName
= functions
[ functionCode
].name
;
2063 if ( roundingPrecision
== 32 ) {
2064 roundingPrecisionName
= "32";
2066 else if ( roundingPrecision
== 64 ) {
2067 roundingPrecisionName
= "64";
2069 else if ( roundingPrecision
== 80 ) {
2070 roundingPrecisionName
= "80";
2073 roundingPrecisionName
= 0;
2076 floatx80_rounding_precision
= roundingPrecision
;
2078 switch ( roundingMode
) {
2080 roundingModeName
= 0;
2081 roundingCode
= float_round_nearest_even
;
2083 case ROUND_NEAREST_EVEN
:
2084 roundingModeName
= "nearest_even";
2085 roundingCode
= float_round_nearest_even
;
2088 roundingModeName
= "to_zero";
2089 roundingCode
= float_round_to_zero
;
2092 roundingModeName
= "down";
2093 roundingCode
= float_round_down
;
2096 roundingModeName
= "up";
2097 roundingCode
= float_round_up
;
2100 float_rounding_mode
= roundingCode
;
2101 switch ( tininessMode
) {
2103 tininessModeName
= 0;
2104 tininessCode
= float_tininess_after_rounding
;
2106 case TININESS_BEFORE_ROUNDING
:
2107 tininessModeName
= "before";
2108 tininessCode
= float_tininess_before_rounding
;
2110 case TININESS_AFTER_ROUNDING
:
2111 tininessModeName
= "after";
2112 tininessCode
= float_tininess_after_rounding
;
2115 float_detect_tininess
= tininessCode
;
2116 switch ( functionCode
) {
2117 case INT32_TO_FLOAT32
:
2118 time_a_int32_z_float32( int32_to_float32
);
2120 case INT32_TO_FLOAT64
:
2121 time_a_int32_z_float64( int32_to_float64
);
2124 case INT32_TO_FLOATX80
:
2125 time_a_int32_z_floatx80( int32_to_floatx80
);
2129 case INT32_TO_FLOAT128
:
2130 time_a_int32_z_float128( int32_to_float128
);
2133 case INT64_TO_FLOAT32
:
2134 time_a_int64_z_float32( int64_to_float32
);
2136 case INT64_TO_FLOAT64
:
2137 time_a_int64_z_float64( int64_to_float64
);
2140 case INT64_TO_FLOATX80
:
2141 time_a_int64_z_floatx80( int64_to_floatx80
);
2145 case INT64_TO_FLOAT128
:
2146 time_a_int64_z_float128( int64_to_float128
);
2149 case FLOAT32_TO_INT32
:
2150 time_a_float32_z_int32( float32_to_int32
);
2152 case FLOAT32_TO_INT32_ROUND_TO_ZERO
:
2153 time_a_float32_z_int32( float32_to_int32_round_to_zero
);
2155 case FLOAT32_TO_INT64
:
2156 time_a_float32_z_int64( float32_to_int64
);
2158 case FLOAT32_TO_INT64_ROUND_TO_ZERO
:
2159 time_a_float32_z_int64( float32_to_int64_round_to_zero
);
2161 case FLOAT32_TO_FLOAT64
:
2162 time_a_float32_z_float64( float32_to_float64
);
2165 case FLOAT32_TO_FLOATX80
:
2166 time_a_float32_z_floatx80( float32_to_floatx80
);
2170 case FLOAT32_TO_FLOAT128
:
2171 time_a_float32_z_float128( float32_to_float128
);
2174 case FLOAT32_ROUND_TO_INT
:
2175 time_az_float32( float32_round_to_int
);
2178 time_abz_float32( float32_add
);
2181 time_abz_float32( float32_sub
);
2184 time_abz_float32( float32_mul
);
2187 time_abz_float32( float32_div
);
2190 time_abz_float32( float32_rem
);
2193 time_az_float32_pos( float32_sqrt
);
2196 time_ab_float32_z_flag( float32_eq
);
2199 time_ab_float32_z_flag( float32_le
);
2202 time_ab_float32_z_flag( float32_lt
);
2204 case FLOAT32_EQ_SIGNALING
:
2205 time_ab_float32_z_flag( float32_eq_signaling
);
2207 case FLOAT32_LE_QUIET
:
2208 time_ab_float32_z_flag( float32_le_quiet
);
2210 case FLOAT32_LT_QUIET
:
2211 time_ab_float32_z_flag( float32_lt_quiet
);
2213 case FLOAT64_TO_INT32
:
2214 time_a_float64_z_int32( float64_to_int32
);
2216 case FLOAT64_TO_INT32_ROUND_TO_ZERO
:
2217 time_a_float64_z_int32( float64_to_int32_round_to_zero
);
2219 case FLOAT64_TO_INT64
:
2220 time_a_float64_z_int64( float64_to_int64
);
2222 case FLOAT64_TO_INT64_ROUND_TO_ZERO
:
2223 time_a_float64_z_int64( float64_to_int64_round_to_zero
);
2225 case FLOAT64_TO_FLOAT32
:
2226 time_a_float64_z_float32( float64_to_float32
);
2229 case FLOAT64_TO_FLOATX80
:
2230 time_a_float64_z_floatx80( float64_to_floatx80
);
2234 case FLOAT64_TO_FLOAT128
:
2235 time_a_float64_z_float128( float64_to_float128
);
2238 case FLOAT64_ROUND_TO_INT
:
2239 time_az_float64( float64_round_to_int
);
2242 time_abz_float64( float64_add
);
2245 time_abz_float64( float64_sub
);
2248 time_abz_float64( float64_mul
);
2251 time_abz_float64( float64_div
);
2254 time_abz_float64( float64_rem
);
2257 time_az_float64_pos( float64_sqrt
);
2260 time_ab_float64_z_flag( float64_eq
);
2263 time_ab_float64_z_flag( float64_le
);
2266 time_ab_float64_z_flag( float64_lt
);
2268 case FLOAT64_EQ_SIGNALING
:
2269 time_ab_float64_z_flag( float64_eq_signaling
);
2271 case FLOAT64_LE_QUIET
:
2272 time_ab_float64_z_flag( float64_le_quiet
);
2274 case FLOAT64_LT_QUIET
:
2275 time_ab_float64_z_flag( float64_lt_quiet
);
2278 case FLOATX80_TO_INT32
:
2279 time_a_floatx80_z_int32( floatx80_to_int32
);
2281 case FLOATX80_TO_INT32_ROUND_TO_ZERO
:
2282 time_a_floatx80_z_int32( floatx80_to_int32_round_to_zero
);
2284 case FLOATX80_TO_INT64
:
2285 time_a_floatx80_z_int64( floatx80_to_int64
);
2287 case FLOATX80_TO_INT64_ROUND_TO_ZERO
:
2288 time_a_floatx80_z_int64( floatx80_to_int64_round_to_zero
);
2290 case FLOATX80_TO_FLOAT32
:
2291 time_a_floatx80_z_float32( floatx80_to_float32
);
2293 case FLOATX80_TO_FLOAT64
:
2294 time_a_floatx80_z_float64( floatx80_to_float64
);
2297 case FLOATX80_TO_FLOAT128
:
2298 time_a_floatx80_z_float128( floatx80_to_float128
);
2301 case FLOATX80_ROUND_TO_INT
:
2302 time_az_floatx80( floatx80_round_to_int
);
2305 time_abz_floatx80( floatx80_add
);
2308 time_abz_floatx80( floatx80_sub
);
2311 time_abz_floatx80( floatx80_mul
);
2314 time_abz_floatx80( floatx80_div
);
2317 time_abz_floatx80( floatx80_rem
);
2320 time_az_floatx80_pos( floatx80_sqrt
);
2323 time_ab_floatx80_z_flag( floatx80_eq
);
2326 time_ab_floatx80_z_flag( floatx80_le
);
2329 time_ab_floatx80_z_flag( floatx80_lt
);
2331 case FLOATX80_EQ_SIGNALING
:
2332 time_ab_floatx80_z_flag( floatx80_eq_signaling
);
2334 case FLOATX80_LE_QUIET
:
2335 time_ab_floatx80_z_flag( floatx80_le_quiet
);
2337 case FLOATX80_LT_QUIET
:
2338 time_ab_floatx80_z_flag( floatx80_lt_quiet
);
2342 case FLOAT128_TO_INT32
:
2343 time_a_float128_z_int32( float128_to_int32
);
2345 case FLOAT128_TO_INT32_ROUND_TO_ZERO
:
2346 time_a_float128_z_int32( float128_to_int32_round_to_zero
);
2348 case FLOAT128_TO_INT64
:
2349 time_a_float128_z_int64( float128_to_int64
);
2351 case FLOAT128_TO_INT64_ROUND_TO_ZERO
:
2352 time_a_float128_z_int64( float128_to_int64_round_to_zero
);
2354 case FLOAT128_TO_FLOAT32
:
2355 time_a_float128_z_float32( float128_to_float32
);
2357 case FLOAT128_TO_FLOAT64
:
2358 time_a_float128_z_float64( float128_to_float64
);
2361 case FLOAT128_TO_FLOATX80
:
2362 time_a_float128_z_floatx80( float128_to_floatx80
);
2365 case FLOAT128_ROUND_TO_INT
:
2366 time_az_float128( float128_round_to_int
);
2369 time_abz_float128( float128_add
);
2372 time_abz_float128( float128_sub
);
2375 time_abz_float128( float128_mul
);
2378 time_abz_float128( float128_div
);
2381 time_abz_float128( float128_rem
);
2384 time_az_float128_pos( float128_sqrt
);
2387 time_ab_float128_z_flag( float128_eq
);
2390 time_ab_float128_z_flag( float128_le
);
2393 time_ab_float128_z_flag( float128_lt
);
2395 case FLOAT128_EQ_SIGNALING
:
2396 time_ab_float128_z_flag( float128_eq_signaling
);
2398 case FLOAT128_LE_QUIET
:
2399 time_ab_float128_z_flag( float128_le_quiet
);
2401 case FLOAT128_LT_QUIET
:
2402 time_ab_float128_z_flag( float128_lt_quiet
);
2412 int8 roundingPrecisionIn
,
2413 int8 roundingModeIn
,
2417 int8 roundingPrecision
, roundingMode
, tininessMode
;
2419 roundingPrecision
= 32;
2421 if ( ! functions
[ functionCode
].roundingPrecision
) {
2422 roundingPrecision
= 0;
2424 else if ( roundingPrecisionIn
) {
2425 roundingPrecision
= roundingPrecisionIn
;
2427 for ( roundingMode
= 1;
2428 roundingMode
< NUM_ROUNDINGMODES
;
2431 if ( ! functions
[ functionCode
].roundingMode
) {
2434 else if ( roundingModeIn
) {
2435 roundingMode
= roundingModeIn
;
2437 for ( tininessMode
= 1;
2438 tininessMode
< NUM_TININESSMODES
;
2441 if ( ( roundingPrecision
== 32 )
2442 || ( roundingPrecision
== 64 ) ) {
2443 if ( ! functions
[ functionCode
]
2444 .tininessModeAtReducedPrecision
2448 else if ( tininessModeIn
) {
2449 tininessMode
= tininessModeIn
;
2453 if ( ! functions
[ functionCode
].tininessMode
) {
2456 else if ( tininessModeIn
) {
2457 tininessMode
= tininessModeIn
;
2460 timeFunctionVariety(
2461 functionCode
, roundingPrecision
, roundingMode
, tininessMode
2463 if ( tininessModeIn
|| ! tininessMode
) break;
2465 if ( roundingModeIn
|| ! roundingMode
) break;
2467 if ( roundingPrecisionIn
|| ! roundingPrecision
) break;
2468 if ( roundingPrecision
== 80 ) {
2471 else if ( roundingPrecision
== 64 ) {
2472 roundingPrecision
= 80;
2474 else if ( roundingPrecision
== 32 ) {
2475 roundingPrecision
= 64;
2481 main( int argc
, char **argv
)
2484 flag functionArgument
;
2486 int8 operands
, roundingPrecision
, roundingMode
, tininessMode
;
2488 if ( argc
<= 1 ) goto writeHelpMessage
;
2489 functionArgument
= FALSE
;
2492 roundingPrecision
= 0;
2497 while ( argc
&& ( argPtr
= argv
[ 0 ] ) ) {
2498 if ( argPtr
[ 0 ] == '-' ) ++argPtr
;
2499 if ( strcmp( argPtr
, "help" ) == 0 ) {
2502 "timesoftfloat [<option>...] <function>\n"
2503 " <option>: (* is default)\n"
2504 " -help --Write this message and exit.\n"
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"
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"
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"
2526 " -all1 --All 1-operand functions.\n"
2527 " -all2 --All 2-operand functions.\n"
2528 " -all --All functions.\n"
2530 " float32 --Single precision.\n"
2531 " float64 --Double precision.\n"
2533 " floatx80 --Extended double precision.\n"
2536 " float128 --Quadruple precision.\n"
2541 return EXIT_SUCCESS
;
2544 else if ( strcmp( argPtr
, "precision32" ) == 0 ) {
2545 roundingPrecision
= 32;
2547 else if ( strcmp( argPtr
, "precision64" ) == 0 ) {
2548 roundingPrecision
= 64;
2550 else if ( strcmp( argPtr
, "precision80" ) == 0 ) {
2551 roundingPrecision
= 80;
2554 else if ( ( strcmp( argPtr
, "nearesteven" ) == 0 )
2555 || ( strcmp( argPtr
, "nearest_even" ) == 0 ) ) {
2556 roundingMode
= ROUND_NEAREST_EVEN
;
2558 else if ( ( strcmp( argPtr
, "tozero" ) == 0 )
2559 || ( strcmp( argPtr
, "to_zero" ) == 0 ) ) {
2560 roundingMode
= ROUND_TO_ZERO
;
2562 else if ( strcmp( argPtr
, "down" ) == 0 ) {
2563 roundingMode
= ROUND_DOWN
;
2565 else if ( strcmp( argPtr
, "up" ) == 0 ) {
2566 roundingMode
= ROUND_UP
;
2568 else if ( strcmp( argPtr
, "tininessbefore" ) == 0 ) {
2569 tininessMode
= TININESS_BEFORE_ROUNDING
;
2571 else if ( strcmp( argPtr
, "tininessafter" ) == 0 ) {
2572 tininessMode
= TININESS_AFTER_ROUNDING
;
2574 else if ( strcmp( argPtr
, "all1" ) == 0 ) {
2575 functionArgument
= TRUE
;
2579 else if ( strcmp( argPtr
, "all2" ) == 0 ) {
2580 functionArgument
= TRUE
;
2584 else if ( strcmp( argPtr
, "all" ) == 0 ) {
2585 functionArgument
= TRUE
;
2590 for ( functionCode
= 1;
2591 functionCode
< NUM_FUNCTIONS
;
2594 if ( strcmp( argPtr
, functions
[ functionCode
].name
) == 0 ) {
2598 if ( functionCode
== NUM_FUNCTIONS
) {
2599 fail( "Invalid option or function `%s'", argv
[ 0 ] );
2601 functionArgument
= TRUE
;
2606 if ( ! functionArgument
) fail( "Function argument required" );
2607 if ( functionCode
) {
2609 functionCode
, roundingPrecision
, roundingMode
, tininessMode
);
2611 else if ( operands
== 1 ) {
2612 for ( functionCode
= 1; functionCode
< NUM_FUNCTIONS
; ++functionCode
2614 if ( functions
[ functionCode
].numInputs
== 1 ) {
2616 functionCode
, roundingPrecision
, roundingMode
, tininessMode
2621 else if ( operands
== 2 ) {
2622 for ( functionCode
= 1; functionCode
< NUM_FUNCTIONS
; ++functionCode
2624 if ( functions
[ functionCode
].numInputs
== 2 ) {
2626 functionCode
, roundingPrecision
, roundingMode
, tininessMode
2632 for ( functionCode
= 1; functionCode
< NUM_FUNCTIONS
; ++functionCode
2635 functionCode
, roundingPrecision
, roundingMode
, tininessMode
);
2638 return EXIT_SUCCESS
;