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 ===============================================================================
39 #include "softfloat.h"
45 static void fail( const char *message
, ... )
49 fputs( "timesoftfloat: ", stderr
);
50 va_start( varArgs
, message
);
51 vfprintf( stderr
, message
, varArgs
);
53 fputs( ".\n", stderr
);
58 static char *functionName
;
59 static char *roundingPrecisionName
, *roundingModeName
, *tininessModeName
;
61 static void reportTime( int32 count
, long clocks
)
66 ( count
/ ( ( (float) clocks
) / CLOCKS_PER_SEC
) ) / 1000,
69 if ( roundingModeName
) {
70 if ( roundingPrecisionName
) {
71 fputs( ", precision ", stdout
);
72 fputs( roundingPrecisionName
, stdout
);
74 fputs( ", rounding ", stdout
);
75 fputs( roundingModeName
, stdout
);
76 if ( tininessModeName
) {
77 fputs( ", tininess ", stdout
);
78 fputs( tininessModeName
, stdout
);
79 fputs( " rounding", stdout
);
82 fputc( '\n', stdout
);
90 static const int32 inputs_int32
[ numInputs_int32
] = {
91 0xFFFFBB79, 0x405CF80F, 0x00000000, 0xFFFFFD04,
92 0xFFF20002, 0x0C8EF795, 0xF00011FF, 0x000006CA,
93 0x00009BFE, 0xFF4862E3, 0x9FFFEFFE, 0xFFFFFFB7,
94 0x0BFF7FFF, 0x0000F37A, 0x0011DFFE, 0x00000006,
95 0xFFF02006, 0xFFFFF7D1, 0x10200003, 0xDE8DF765,
96 0x00003E02, 0x000019E8, 0x0008FFFE, 0xFFFFFB5C,
97 0xFFDF7FFE, 0x07C42FBF, 0x0FFFE3FF, 0x040B9F13,
98 0xBFFFFFF8, 0x0001BF56, 0x000017F6, 0x000A908A
101 static void time_a_int32_z_float32( float32
function( int32
) )
103 clock_t startClock
, endClock
;
109 startClock
= clock();
111 for ( i
= minIterations
; i
; --i
) {
112 function( inputs_int32
[ inputNum
] );
113 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
115 count
+= minIterations
;
116 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
118 startClock
= clock();
119 for ( i
= count
; i
; --i
) {
120 function( inputs_int32
[ inputNum
] );
121 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
124 reportTime( count
, endClock
- startClock
);
128 static void time_a_int32_z_float64( float64
function( int32
) )
130 clock_t startClock
, endClock
;
136 startClock
= clock();
138 for ( i
= minIterations
; i
; --i
) {
139 function( inputs_int32
[ inputNum
] );
140 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
142 count
+= minIterations
;
143 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
145 startClock
= clock();
146 for ( i
= count
; i
; --i
) {
147 function( inputs_int32
[ inputNum
] );
148 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
151 reportTime( count
, endClock
- startClock
);
157 static void time_a_int32_z_floatx80( floatx80
function( int32
) )
159 clock_t startClock
, endClock
;
165 startClock
= clock();
167 for ( i
= minIterations
; i
; --i
) {
168 function( inputs_int32
[ inputNum
] );
169 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
171 count
+= minIterations
;
172 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
174 startClock
= clock();
175 for ( i
= count
; i
; --i
) {
176 function( inputs_int32
[ inputNum
] );
177 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
180 reportTime( count
, endClock
- startClock
);
188 static void time_a_int32_z_float128( float128
function( int32
) )
190 clock_t startClock
, endClock
;
196 startClock
= clock();
198 for ( i
= minIterations
; i
; --i
) {
199 function( inputs_int32
[ inputNum
] );
200 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
202 count
+= minIterations
;
203 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
205 startClock
= clock();
206 for ( i
= count
; i
; --i
) {
207 function( inputs_int32
[ inputNum
] );
208 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int32
- 1 );
211 reportTime( count
, endClock
- startClock
);
221 static const int64 inputs_int64
[ numInputs_int64
] = {
222 LIT64( 0xFBFFC3FFFFFFFFFF ),
223 LIT64( 0x0000000003C589BC ),
224 LIT64( 0x00000000400013FE ),
225 LIT64( 0x0000000000186171 ),
226 LIT64( 0xFFFFFFFFFFFEFBFA ),
227 LIT64( 0xFFFFFD79E6DFFC73 ),
228 LIT64( 0x0000000010001DFF ),
229 LIT64( 0xDD1A0F0C78513710 ),
230 LIT64( 0xFFFF83FFFFFEFFFE ),
231 LIT64( 0x00756EBD1AD0C1C7 ),
232 LIT64( 0x0003FDFFFFFFFFBE ),
233 LIT64( 0x0007D0FB2C2CA951 ),
234 LIT64( 0x0007FC0007FFFFFE ),
235 LIT64( 0x0000001F942B18BB ),
236 LIT64( 0x0000080101FFFFFE ),
237 LIT64( 0xFFFFFFFFFFFF0978 ),
238 LIT64( 0x000000000008BFFF ),
239 LIT64( 0x0000000006F5AF08 ),
240 LIT64( 0xFFDEFF7FFFFFFFFE ),
241 LIT64( 0x0000000000000003 ),
242 LIT64( 0x3FFFFFFFFF80007D ),
243 LIT64( 0x0000000000000078 ),
244 LIT64( 0xFFF80000007FDFFD ),
245 LIT64( 0x1BBC775B78016AB0 ),
246 LIT64( 0xFFF9001FFFFFFFFE ),
247 LIT64( 0xFFFD4767AB98E43F ),
248 LIT64( 0xFFFFFEFFFE00001E ),
249 LIT64( 0xFFFFFFFFFFF04EFD ),
250 LIT64( 0x07FFFFFFFFFFF7FF ),
251 LIT64( 0xFFFC9EAA38F89050 ),
252 LIT64( 0x00000020FBFFFFFE ),
253 LIT64( 0x0000099AE6455357 )
256 static void time_a_int64_z_float32( float32
function( int64
) )
258 clock_t startClock
, endClock
;
264 startClock
= clock();
266 for ( i
= minIterations
; i
; --i
) {
267 function( inputs_int64
[ inputNum
] );
268 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
270 count
+= minIterations
;
271 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
273 startClock
= clock();
274 for ( i
= count
; i
; --i
) {
275 function( inputs_int64
[ inputNum
] );
276 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
279 reportTime( count
, endClock
- startClock
);
283 static void time_a_int64_z_float64( float64
function( int64
) )
285 clock_t startClock
, endClock
;
291 startClock
= clock();
293 for ( i
= minIterations
; i
; --i
) {
294 function( inputs_int64
[ inputNum
] );
295 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
297 count
+= minIterations
;
298 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
300 startClock
= clock();
301 for ( i
= count
; i
; --i
) {
302 function( inputs_int64
[ inputNum
] );
303 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
306 reportTime( count
, endClock
- startClock
);
312 static void time_a_int64_z_floatx80( floatx80
function( int64
) )
314 clock_t startClock
, endClock
;
320 startClock
= clock();
322 for ( i
= minIterations
; i
; --i
) {
323 function( inputs_int64
[ inputNum
] );
324 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
326 count
+= minIterations
;
327 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
329 startClock
= clock();
330 for ( i
= count
; i
; --i
) {
331 function( inputs_int64
[ inputNum
] );
332 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
335 reportTime( count
, endClock
- startClock
);
343 static void time_a_int64_z_float128( float128
function( int64
) )
345 clock_t startClock
, endClock
;
351 startClock
= clock();
353 for ( i
= minIterations
; i
; --i
) {
354 function( inputs_int64
[ inputNum
] );
355 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
357 count
+= minIterations
;
358 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
360 startClock
= clock();
361 for ( i
= count
; i
; --i
) {
362 function( inputs_int64
[ inputNum
] );
363 inputNum
= ( inputNum
+ 1 ) & ( numInputs_int64
- 1 );
366 reportTime( count
, endClock
- startClock
);
373 numInputs_float32
= 32
376 static const float32 inputs_float32
[ numInputs_float32
] = {
377 0x4EFA0000, 0xC1D0B328, 0x80000000, 0x3E69A31E,
378 0xAF803EFF, 0x3F800000, 0x17BF8000, 0xE74A301A,
379 0x4E010003, 0x7EE3C75D, 0xBD803FE0, 0xBFFEFF00,
380 0x7981F800, 0x431FFFFC, 0xC100C000, 0x3D87EFFF,
381 0x4103FEFE, 0xBC000007, 0xBF01F7FF, 0x4E6C6B5C,
382 0xC187FFFE, 0xC58B9F13, 0x4F88007F, 0xDF004007,
383 0xB7FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
384 0xDB428661, 0x33F89B1F, 0xA3BFEFFF, 0x537BFFBE
387 static void time_a_float32_z_int32( int32
function( float32
) )
389 clock_t startClock
, endClock
;
395 startClock
= clock();
397 for ( i
= minIterations
; i
; --i
) {
398 function( inputs_float32
[ inputNum
] );
399 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
401 count
+= minIterations
;
402 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
404 startClock
= clock();
405 for ( i
= count
; i
; --i
) {
406 function( inputs_float32
[ inputNum
] );
407 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
410 reportTime( count
, endClock
- startClock
);
414 static void time_a_float32_z_int64( int64
function( float32
) )
416 clock_t startClock
, endClock
;
422 startClock
= clock();
424 for ( i
= minIterations
; i
; --i
) {
425 function( inputs_float32
[ inputNum
] );
426 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
428 count
+= minIterations
;
429 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
431 startClock
= clock();
432 for ( i
= count
; i
; --i
) {
433 function( inputs_float32
[ inputNum
] );
434 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
437 reportTime( count
, endClock
- startClock
);
441 static void time_a_float32_z_float64( float64
function( float32
) )
443 clock_t startClock
, endClock
;
449 startClock
= clock();
451 for ( i
= minIterations
; i
; --i
) {
452 function( inputs_float32
[ inputNum
] );
453 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
455 count
+= minIterations
;
456 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
458 startClock
= clock();
459 for ( i
= count
; i
; --i
) {
460 function( inputs_float32
[ inputNum
] );
461 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
464 reportTime( count
, endClock
- startClock
);
470 static void time_a_float32_z_floatx80( floatx80
function( float32
) )
472 clock_t startClock
, endClock
;
478 startClock
= clock();
480 for ( i
= minIterations
; i
; --i
) {
481 function( inputs_float32
[ inputNum
] );
482 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
484 count
+= minIterations
;
485 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
487 startClock
= clock();
488 for ( i
= count
; i
; --i
) {
489 function( inputs_float32
[ inputNum
] );
490 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
493 reportTime( count
, endClock
- startClock
);
501 static void time_a_float32_z_float128( float128
function( float32
) )
503 clock_t startClock
, endClock
;
509 startClock
= clock();
511 for ( i
= minIterations
; i
; --i
) {
512 function( inputs_float32
[ inputNum
] );
513 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
515 count
+= minIterations
;
516 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
518 startClock
= clock();
519 for ( i
= count
; i
; --i
) {
520 function( inputs_float32
[ inputNum
] );
521 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
524 reportTime( count
, endClock
- startClock
);
530 static void time_az_float32( float32
function( float32
) )
532 clock_t startClock
, endClock
;
538 startClock
= clock();
540 for ( i
= minIterations
; i
; --i
) {
541 function( inputs_float32
[ inputNum
] );
542 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
544 count
+= minIterations
;
545 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
547 startClock
= clock();
548 for ( i
= count
; i
; --i
) {
549 function( inputs_float32
[ inputNum
] );
550 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
553 reportTime( count
, endClock
- startClock
);
557 static void time_ab_float32_z_flag( flag
function( float32
, float32
) )
559 clock_t startClock
, endClock
;
561 int8 inputNumA
, inputNumB
;
566 startClock
= clock();
568 for ( i
= minIterations
; i
; --i
) {
570 inputs_float32
[ inputNumA
], inputs_float32
[ inputNumB
] );
571 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float32
- 1 );
572 if ( inputNumA
== 0 ) ++inputNumB
;
573 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float32
- 1 );
575 count
+= minIterations
;
576 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
579 startClock
= clock();
580 for ( i
= count
; i
; --i
) {
582 inputs_float32
[ inputNumA
], inputs_float32
[ inputNumB
] );
583 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float32
- 1 );
584 if ( inputNumA
== 0 ) ++inputNumB
;
585 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float32
- 1 );
588 reportTime( count
, endClock
- startClock
);
592 static void time_abz_float32( float32
function( float32
, float32
) )
594 clock_t startClock
, endClock
;
596 int8 inputNumA
, inputNumB
;
601 startClock
= clock();
603 for ( i
= minIterations
; i
; --i
) {
605 inputs_float32
[ inputNumA
], inputs_float32
[ inputNumB
] );
606 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float32
- 1 );
607 if ( inputNumA
== 0 ) ++inputNumB
;
608 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float32
- 1 );
610 count
+= minIterations
;
611 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
614 startClock
= clock();
615 for ( i
= count
; i
; --i
) {
617 inputs_float32
[ inputNumA
], inputs_float32
[ inputNumB
] );
618 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float32
- 1 );
619 if ( inputNumA
== 0 ) ++inputNumB
;
620 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float32
- 1 );
623 reportTime( count
, endClock
- startClock
);
627 static const float32 inputs_float32_pos
[ numInputs_float32
] = {
628 0x4EFA0000, 0x41D0B328, 0x00000000, 0x3E69A31E,
629 0x2F803EFF, 0x3F800000, 0x17BF8000, 0x674A301A,
630 0x4E010003, 0x7EE3C75D, 0x3D803FE0, 0x3FFEFF00,
631 0x7981F800, 0x431FFFFC, 0x4100C000, 0x3D87EFFF,
632 0x4103FEFE, 0x3C000007, 0x3F01F7FF, 0x4E6C6B5C,
633 0x4187FFFE, 0x458B9F13, 0x4F88007F, 0x5F004007,
634 0x37FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
635 0x5B428661, 0x33F89B1F, 0x23BFEFFF, 0x537BFFBE
638 static void time_az_float32_pos( float32
function( float32
) )
640 clock_t startClock
, endClock
;
646 startClock
= clock();
648 for ( i
= minIterations
; i
; --i
) {
649 function( inputs_float32_pos
[ inputNum
] );
650 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
652 count
+= minIterations
;
653 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
655 startClock
= clock();
656 for ( i
= count
; i
; --i
) {
657 function( inputs_float32_pos
[ inputNum
] );
658 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float32
- 1 );
661 reportTime( count
, endClock
- startClock
);
666 numInputs_float64
= 32
669 static const float64 inputs_float64
[ numInputs_float64
] = {
670 LIT64( 0x422FFFC008000000 ),
671 LIT64( 0xB7E0000480000000 ),
672 LIT64( 0xF3FD2546120B7935 ),
673 LIT64( 0x3FF0000000000000 ),
674 LIT64( 0xCE07F766F09588D6 ),
675 LIT64( 0x8000000000000000 ),
676 LIT64( 0x3FCE000400000000 ),
677 LIT64( 0x8313B60F0032BED8 ),
678 LIT64( 0xC1EFFFFFC0002000 ),
679 LIT64( 0x3FB3C75D224F2B0F ),
680 LIT64( 0x7FD00000004000FF ),
681 LIT64( 0xA12FFF8000001FFF ),
682 LIT64( 0x3EE0000000FE0000 ),
683 LIT64( 0x0010000080000004 ),
684 LIT64( 0x41CFFFFE00000020 ),
685 LIT64( 0x40303FFFFFFFFFFD ),
686 LIT64( 0x3FD000003FEFFFFF ),
687 LIT64( 0xBFD0000010000000 ),
688 LIT64( 0xB7FC6B5C16CA55CF ),
689 LIT64( 0x413EEB940B9D1301 ),
690 LIT64( 0xC7E00200001FFFFF ),
691 LIT64( 0x47F00021FFFFFFFE ),
692 LIT64( 0xBFFFFFFFF80000FF ),
693 LIT64( 0xC07FFFFFE00FFFFF ),
694 LIT64( 0x001497A63740C5E8 ),
695 LIT64( 0xC4BFFFE0001FFFFF ),
696 LIT64( 0x96FFDFFEFFFFFFFF ),
697 LIT64( 0x403FC000000001FE ),
698 LIT64( 0xFFD00000000001F6 ),
699 LIT64( 0x0640400002000000 ),
700 LIT64( 0x479CEE1E4F789FE0 ),
701 LIT64( 0xC237FFFFFFFFFDFE )
704 static void time_a_float64_z_int32( int32
function( float64
) )
706 clock_t startClock
, endClock
;
712 startClock
= clock();
714 for ( i
= minIterations
; i
; --i
) {
715 function( inputs_float64
[ inputNum
] );
716 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
718 count
+= minIterations
;
719 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
721 startClock
= clock();
722 for ( i
= count
; i
; --i
) {
723 function( inputs_float64
[ inputNum
] );
724 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
727 reportTime( count
, endClock
- startClock
);
731 static void time_a_float64_z_int64( int64
function( float64
) )
733 clock_t startClock
, endClock
;
739 startClock
= clock();
741 for ( i
= minIterations
; i
; --i
) {
742 function( inputs_float64
[ inputNum
] );
743 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
745 count
+= minIterations
;
746 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
748 startClock
= clock();
749 for ( i
= count
; i
; --i
) {
750 function( inputs_float64
[ inputNum
] );
751 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
754 reportTime( count
, endClock
- startClock
);
758 static void time_a_float64_z_float32( float32
function( float64
) )
760 clock_t startClock
, endClock
;
766 startClock
= clock();
768 for ( i
= minIterations
; i
; --i
) {
769 function( inputs_float64
[ inputNum
] );
770 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
772 count
+= minIterations
;
773 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
775 startClock
= clock();
776 for ( i
= count
; i
; --i
) {
777 function( inputs_float64
[ inputNum
] );
778 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
781 reportTime( count
, endClock
- startClock
);
787 static void time_a_float64_z_floatx80( floatx80
function( float64
) )
789 clock_t startClock
, endClock
;
795 startClock
= clock();
797 for ( i
= minIterations
; i
; --i
) {
798 function( inputs_float64
[ inputNum
] );
799 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
801 count
+= minIterations
;
802 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
804 startClock
= clock();
805 for ( i
= count
; i
; --i
) {
806 function( inputs_float64
[ inputNum
] );
807 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
810 reportTime( count
, endClock
- startClock
);
818 static void time_a_float64_z_float128( float128
function( float64
) )
820 clock_t startClock
, endClock
;
826 startClock
= clock();
828 for ( i
= minIterations
; i
; --i
) {
829 function( inputs_float64
[ inputNum
] );
830 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
832 count
+= minIterations
;
833 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
835 startClock
= clock();
836 for ( i
= count
; i
; --i
) {
837 function( inputs_float64
[ inputNum
] );
838 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
841 reportTime( count
, endClock
- startClock
);
847 static void time_az_float64( float64
function( float64
) )
849 clock_t startClock
, endClock
;
855 startClock
= clock();
857 for ( i
= minIterations
; i
; --i
) {
858 function( inputs_float64
[ inputNum
] );
859 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
861 count
+= minIterations
;
862 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
864 startClock
= clock();
865 for ( i
= count
; i
; --i
) {
866 function( inputs_float64
[ inputNum
] );
867 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
870 reportTime( count
, endClock
- startClock
);
874 static void time_ab_float64_z_flag( flag
function( float64
, float64
) )
876 clock_t startClock
, endClock
;
878 int8 inputNumA
, inputNumB
;
883 startClock
= clock();
885 for ( i
= minIterations
; i
; --i
) {
887 inputs_float64
[ inputNumA
], inputs_float64
[ inputNumB
] );
888 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float64
- 1 );
889 if ( inputNumA
== 0 ) ++inputNumB
;
890 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float64
- 1 );
892 count
+= minIterations
;
893 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
896 startClock
= clock();
897 for ( i
= count
; i
; --i
) {
899 inputs_float64
[ inputNumA
], inputs_float64
[ inputNumB
] );
900 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float64
- 1 );
901 if ( inputNumA
== 0 ) ++inputNumB
;
902 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float64
- 1 );
905 reportTime( count
, endClock
- startClock
);
909 static void time_abz_float64( float64
function( float64
, float64
) )
911 clock_t startClock
, endClock
;
913 int8 inputNumA
, inputNumB
;
918 startClock
= clock();
920 for ( i
= minIterations
; i
; --i
) {
922 inputs_float64
[ inputNumA
], inputs_float64
[ inputNumB
] );
923 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float64
- 1 );
924 if ( inputNumA
== 0 ) ++inputNumB
;
925 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float64
- 1 );
927 count
+= minIterations
;
928 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
931 startClock
= clock();
932 for ( i
= count
; i
; --i
) {
934 inputs_float64
[ inputNumA
], inputs_float64
[ inputNumB
] );
935 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float64
- 1 );
936 if ( inputNumA
== 0 ) ++inputNumB
;
937 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float64
- 1 );
940 reportTime( count
, endClock
- startClock
);
944 static const float64 inputs_float64_pos
[ numInputs_float64
] = {
945 LIT64( 0x422FFFC008000000 ),
946 LIT64( 0x37E0000480000000 ),
947 LIT64( 0x73FD2546120B7935 ),
948 LIT64( 0x3FF0000000000000 ),
949 LIT64( 0x4E07F766F09588D6 ),
950 LIT64( 0x0000000000000000 ),
951 LIT64( 0x3FCE000400000000 ),
952 LIT64( 0x0313B60F0032BED8 ),
953 LIT64( 0x41EFFFFFC0002000 ),
954 LIT64( 0x3FB3C75D224F2B0F ),
955 LIT64( 0x7FD00000004000FF ),
956 LIT64( 0x212FFF8000001FFF ),
957 LIT64( 0x3EE0000000FE0000 ),
958 LIT64( 0x0010000080000004 ),
959 LIT64( 0x41CFFFFE00000020 ),
960 LIT64( 0x40303FFFFFFFFFFD ),
961 LIT64( 0x3FD000003FEFFFFF ),
962 LIT64( 0x3FD0000010000000 ),
963 LIT64( 0x37FC6B5C16CA55CF ),
964 LIT64( 0x413EEB940B9D1301 ),
965 LIT64( 0x47E00200001FFFFF ),
966 LIT64( 0x47F00021FFFFFFFE ),
967 LIT64( 0x3FFFFFFFF80000FF ),
968 LIT64( 0x407FFFFFE00FFFFF ),
969 LIT64( 0x001497A63740C5E8 ),
970 LIT64( 0x44BFFFE0001FFFFF ),
971 LIT64( 0x16FFDFFEFFFFFFFF ),
972 LIT64( 0x403FC000000001FE ),
973 LIT64( 0x7FD00000000001F6 ),
974 LIT64( 0x0640400002000000 ),
975 LIT64( 0x479CEE1E4F789FE0 ),
976 LIT64( 0x4237FFFFFFFFFDFE )
979 static void time_az_float64_pos( float64
function( float64
) )
981 clock_t startClock
, endClock
;
987 startClock
= clock();
989 for ( i
= minIterations
; i
; --i
) {
990 function( inputs_float64_pos
[ inputNum
] );
991 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
993 count
+= minIterations
;
994 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
996 startClock
= clock();
997 for ( i
= count
; i
; --i
) {
998 function( inputs_float64_pos
[ inputNum
] );
999 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float64
- 1 );
1002 reportTime( count
, endClock
- startClock
);
1009 numInputs_floatx80
= 32
1012 static const struct {
1015 } inputs_floatx80
[ numInputs_floatx80
] = {
1016 { 0xC03F, LIT64( 0xA9BE15A19C1E8B62 ) },
1017 { 0x8000, LIT64( 0x0000000000000000 ) },
1018 { 0x75A8, LIT64( 0xE59591E4788957A5 ) },
1019 { 0xBFFF, LIT64( 0xFFF0000000000040 ) },
1020 { 0x0CD8, LIT64( 0xFC000000000007FE ) },
1021 { 0x43BA, LIT64( 0x99A4000000000000 ) },
1022 { 0x3FFF, LIT64( 0x8000000000000000 ) },
1023 { 0x4081, LIT64( 0x94FBF1BCEB5545F0 ) },
1024 { 0x403E, LIT64( 0xFFF0000000002000 ) },
1025 { 0x3FFE, LIT64( 0xC860E3C75D224F28 ) },
1026 { 0x407E, LIT64( 0xFC00000FFFFFFFFE ) },
1027 { 0x737A, LIT64( 0x800000007FFDFFFE ) },
1028 { 0x4044, LIT64( 0xFFFFFF80000FFFFF ) },
1029 { 0xBBFE, LIT64( 0x8000040000001FFE ) },
1030 { 0xC002, LIT64( 0xFF80000000000020 ) },
1031 { 0xDE8D, LIT64( 0xFFFFFFFFFFE00004 ) },
1032 { 0xC004, LIT64( 0x8000000000003FFB ) },
1033 { 0x407F, LIT64( 0x800000000003FFFE ) },
1034 { 0xC000, LIT64( 0xA459EE6A5C16CA55 ) },
1035 { 0x8003, LIT64( 0xC42CBF7399AEEB94 ) },
1036 { 0xBF7F, LIT64( 0xF800000000000006 ) },
1037 { 0xC07F, LIT64( 0xBF56BE8871F28FEA ) },
1038 { 0xC07E, LIT64( 0xFFFF77FFFFFFFFFE ) },
1039 { 0xADC9, LIT64( 0x8000000FFFFFFFDE ) },
1040 { 0xC001, LIT64( 0xEFF7FFFFFFFFFFFF ) },
1041 { 0x4001, LIT64( 0xBE84F30125C497A6 ) },
1042 { 0xC06B, LIT64( 0xEFFFFFFFFFFFFFFF ) },
1043 { 0x4080, LIT64( 0xFFFFFFFFBFFFFFFF ) },
1044 { 0x87E9, LIT64( 0x81FFFFFFFFFFFBFF ) },
1045 { 0xA63F, LIT64( 0x801FFFFFFEFFFFFE ) },
1046 { 0x403C, LIT64( 0x801FFFFFFFF7FFFF ) },
1047 { 0x4018, LIT64( 0x8000000000080003 ) }
1050 static void time_a_floatx80_z_int32( int32
function( floatx80
) )
1052 clock_t startClock
, endClock
;
1059 startClock
= clock();
1061 for ( i
= minIterations
; i
; --i
) {
1062 a
.low
= inputs_floatx80
[ inputNum
].low
;
1063 a
.high
= inputs_floatx80
[ inputNum
].high
;
1065 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1067 count
+= minIterations
;
1068 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1070 startClock
= clock();
1071 for ( i
= count
; i
; --i
) {
1072 a
.low
= inputs_floatx80
[ inputNum
].low
;
1073 a
.high
= inputs_floatx80
[ inputNum
].high
;
1075 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1078 reportTime( count
, endClock
- startClock
);
1082 static void time_a_floatx80_z_int64( int64
function( floatx80
) )
1084 clock_t startClock
, endClock
;
1091 startClock
= clock();
1093 for ( i
= minIterations
; i
; --i
) {
1094 a
.low
= inputs_floatx80
[ inputNum
].low
;
1095 a
.high
= inputs_floatx80
[ inputNum
].high
;
1097 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1099 count
+= minIterations
;
1100 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1102 startClock
= clock();
1103 for ( i
= count
; i
; --i
) {
1104 a
.low
= inputs_floatx80
[ inputNum
].low
;
1105 a
.high
= inputs_floatx80
[ inputNum
].high
;
1107 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1110 reportTime( count
, endClock
- startClock
);
1114 static void time_a_floatx80_z_float32( float32
function( floatx80
) )
1116 clock_t startClock
, endClock
;
1123 startClock
= clock();
1125 for ( i
= minIterations
; i
; --i
) {
1126 a
.low
= inputs_floatx80
[ inputNum
].low
;
1127 a
.high
= inputs_floatx80
[ inputNum
].high
;
1129 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1131 count
+= minIterations
;
1132 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1134 startClock
= clock();
1135 for ( i
= count
; i
; --i
) {
1136 a
.low
= inputs_floatx80
[ inputNum
].low
;
1137 a
.high
= inputs_floatx80
[ inputNum
].high
;
1139 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1142 reportTime( count
, endClock
- startClock
);
1146 static void time_a_floatx80_z_float64( float64
function( floatx80
) )
1148 clock_t startClock
, endClock
;
1155 startClock
= clock();
1157 for ( i
= minIterations
; i
; --i
) {
1158 a
.low
= inputs_floatx80
[ inputNum
].low
;
1159 a
.high
= inputs_floatx80
[ inputNum
].high
;
1161 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1163 count
+= minIterations
;
1164 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1166 startClock
= clock();
1167 for ( i
= count
; i
; --i
) {
1168 a
.low
= inputs_floatx80
[ inputNum
].low
;
1169 a
.high
= inputs_floatx80
[ inputNum
].high
;
1171 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1174 reportTime( count
, endClock
- startClock
);
1180 static void time_a_floatx80_z_float128( float128
function( floatx80
) )
1182 clock_t startClock
, endClock
;
1189 startClock
= clock();
1191 for ( i
= minIterations
; i
; --i
) {
1192 a
.low
= inputs_floatx80
[ inputNum
].low
;
1193 a
.high
= inputs_floatx80
[ inputNum
].high
;
1195 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1197 count
+= minIterations
;
1198 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1200 startClock
= clock();
1201 for ( i
= count
; i
; --i
) {
1202 a
.low
= inputs_floatx80
[ inputNum
].low
;
1203 a
.high
= inputs_floatx80
[ inputNum
].high
;
1205 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1208 reportTime( count
, endClock
- startClock
);
1214 static void time_az_floatx80( floatx80
function( floatx80
) )
1216 clock_t startClock
, endClock
;
1223 startClock
= clock();
1225 for ( i
= minIterations
; i
; --i
) {
1226 a
.low
= inputs_floatx80
[ inputNum
].low
;
1227 a
.high
= inputs_floatx80
[ inputNum
].high
;
1229 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1231 count
+= minIterations
;
1232 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1234 startClock
= clock();
1235 for ( i
= count
; i
; --i
) {
1236 a
.low
= inputs_floatx80
[ inputNum
].low
;
1237 a
.high
= inputs_floatx80
[ inputNum
].high
;
1239 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1242 reportTime( count
, endClock
- startClock
);
1246 static void time_ab_floatx80_z_flag( flag
function( floatx80
, floatx80
) )
1248 clock_t startClock
, endClock
;
1250 int8 inputNumA
, inputNumB
;
1256 startClock
= clock();
1258 for ( i
= minIterations
; i
; --i
) {
1259 a
.low
= inputs_floatx80
[ inputNumA
].low
;
1260 a
.high
= inputs_floatx80
[ inputNumA
].high
;
1261 b
.low
= inputs_floatx80
[ inputNumB
].low
;
1262 b
.high
= inputs_floatx80
[ inputNumB
].high
;
1264 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_floatx80
- 1 );
1265 if ( inputNumA
== 0 ) ++inputNumB
;
1266 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_floatx80
- 1 );
1268 count
+= minIterations
;
1269 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1272 startClock
= clock();
1273 for ( i
= count
; i
; --i
) {
1274 a
.low
= inputs_floatx80
[ inputNumA
].low
;
1275 a
.high
= inputs_floatx80
[ inputNumA
].high
;
1276 b
.low
= inputs_floatx80
[ inputNumB
].low
;
1277 b
.high
= inputs_floatx80
[ inputNumB
].high
;
1279 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_floatx80
- 1 );
1280 if ( inputNumA
== 0 ) ++inputNumB
;
1281 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_floatx80
- 1 );
1284 reportTime( count
, endClock
- startClock
);
1288 static void time_abz_floatx80( floatx80
function( floatx80
, floatx80
) )
1290 clock_t startClock
, endClock
;
1292 int8 inputNumA
, inputNumB
;
1298 startClock
= clock();
1300 for ( i
= minIterations
; i
; --i
) {
1301 a
.low
= inputs_floatx80
[ inputNumA
].low
;
1302 a
.high
= inputs_floatx80
[ inputNumA
].high
;
1303 b
.low
= inputs_floatx80
[ inputNumB
].low
;
1304 b
.high
= inputs_floatx80
[ inputNumB
].high
;
1306 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_floatx80
- 1 );
1307 if ( inputNumA
== 0 ) ++inputNumB
;
1308 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_floatx80
- 1 );
1310 count
+= minIterations
;
1311 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1314 startClock
= clock();
1315 for ( i
= count
; i
; --i
) {
1316 a
.low
= inputs_floatx80
[ inputNumA
].low
;
1317 a
.high
= inputs_floatx80
[ inputNumA
].high
;
1318 b
.low
= inputs_floatx80
[ inputNumB
].low
;
1319 b
.high
= inputs_floatx80
[ inputNumB
].high
;
1321 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_floatx80
- 1 );
1322 if ( inputNumA
== 0 ) ++inputNumB
;
1323 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_floatx80
- 1 );
1326 reportTime( count
, endClock
- startClock
);
1330 static const struct {
1333 } inputs_floatx80_pos
[ numInputs_floatx80
] = {
1334 { 0x403F, LIT64( 0xA9BE15A19C1E8B62 ) },
1335 { 0x0000, LIT64( 0x0000000000000000 ) },
1336 { 0x75A8, LIT64( 0xE59591E4788957A5 ) },
1337 { 0x3FFF, LIT64( 0xFFF0000000000040 ) },
1338 { 0x0CD8, LIT64( 0xFC000000000007FE ) },
1339 { 0x43BA, LIT64( 0x99A4000000000000 ) },
1340 { 0x3FFF, LIT64( 0x8000000000000000 ) },
1341 { 0x4081, LIT64( 0x94FBF1BCEB5545F0 ) },
1342 { 0x403E, LIT64( 0xFFF0000000002000 ) },
1343 { 0x3FFE, LIT64( 0xC860E3C75D224F28 ) },
1344 { 0x407E, LIT64( 0xFC00000FFFFFFFFE ) },
1345 { 0x737A, LIT64( 0x800000007FFDFFFE ) },
1346 { 0x4044, LIT64( 0xFFFFFF80000FFFFF ) },
1347 { 0x3BFE, LIT64( 0x8000040000001FFE ) },
1348 { 0x4002, LIT64( 0xFF80000000000020 ) },
1349 { 0x5E8D, LIT64( 0xFFFFFFFFFFE00004 ) },
1350 { 0x4004, LIT64( 0x8000000000003FFB ) },
1351 { 0x407F, LIT64( 0x800000000003FFFE ) },
1352 { 0x4000, LIT64( 0xA459EE6A5C16CA55 ) },
1353 { 0x0003, LIT64( 0xC42CBF7399AEEB94 ) },
1354 { 0x3F7F, LIT64( 0xF800000000000006 ) },
1355 { 0x407F, LIT64( 0xBF56BE8871F28FEA ) },
1356 { 0x407E, LIT64( 0xFFFF77FFFFFFFFFE ) },
1357 { 0x2DC9, LIT64( 0x8000000FFFFFFFDE ) },
1358 { 0x4001, LIT64( 0xEFF7FFFFFFFFFFFF ) },
1359 { 0x4001, LIT64( 0xBE84F30125C497A6 ) },
1360 { 0x406B, LIT64( 0xEFFFFFFFFFFFFFFF ) },
1361 { 0x4080, LIT64( 0xFFFFFFFFBFFFFFFF ) },
1362 { 0x07E9, LIT64( 0x81FFFFFFFFFFFBFF ) },
1363 { 0x263F, LIT64( 0x801FFFFFFEFFFFFE ) },
1364 { 0x403C, LIT64( 0x801FFFFFFFF7FFFF ) },
1365 { 0x4018, LIT64( 0x8000000000080003 ) }
1368 static void time_az_floatx80_pos( floatx80
function( floatx80
) )
1370 clock_t startClock
, endClock
;
1377 startClock
= clock();
1379 for ( i
= minIterations
; i
; --i
) {
1380 a
.low
= inputs_floatx80_pos
[ inputNum
].low
;
1381 a
.high
= inputs_floatx80_pos
[ inputNum
].high
;
1383 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1385 count
+= minIterations
;
1386 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1388 startClock
= clock();
1389 for ( i
= count
; i
; --i
) {
1390 a
.low
= inputs_floatx80_pos
[ inputNum
].low
;
1391 a
.high
= inputs_floatx80_pos
[ inputNum
].high
;
1393 inputNum
= ( inputNum
+ 1 ) & ( numInputs_floatx80
- 1 );
1396 reportTime( count
, endClock
- startClock
);
1405 numInputs_float128
= 32
1408 static const struct {
1410 } inputs_float128
[ numInputs_float128
] = {
1411 { LIT64( 0x3FDA200000100000 ), LIT64( 0x0000000000000000 ) },
1412 { LIT64( 0x3FFF000000000000 ), LIT64( 0x0000000000000000 ) },
1413 { LIT64( 0x85F14776190C8306 ), LIT64( 0xD8715F4E3D54BB92 ) },
1414 { LIT64( 0xF2B00000007FFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
1415 { LIT64( 0x8000000000000000 ), LIT64( 0x0000000000000000 ) },
1416 { LIT64( 0xBFFFFFFFFFE00000 ), LIT64( 0x0000008000000000 ) },
1417 { LIT64( 0x407F1719CE722F3E ), LIT64( 0xDA6B3FE5FF29425B ) },
1418 { LIT64( 0x43FFFF8000000000 ), LIT64( 0x0000000000400000 ) },
1419 { LIT64( 0x401E000000000100 ), LIT64( 0x0000000000002000 ) },
1420 { LIT64( 0x3FFED71DACDA8E47 ), LIT64( 0x4860E3C75D224F28 ) },
1421 { LIT64( 0xBF7ECFC1E90647D1 ), LIT64( 0x7A124FE55623EE44 ) },
1422 { LIT64( 0x0DF7007FFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
1423 { LIT64( 0x3FE5FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
1424 { LIT64( 0x403FFFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFE ) },
1425 { LIT64( 0xBFFB2FBF7399AFEB ), LIT64( 0xA459EE6A5C16CA55 ) },
1426 { LIT64( 0xBDB8FFFFFFFFFFFC ), LIT64( 0x0000000000000400 ) },
1427 { LIT64( 0x3FC8FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
1428 { LIT64( 0x3FFBFFFFFFDFFFFF ), LIT64( 0xFFF8000000000000 ) },
1429 { LIT64( 0x407043C11737BE84 ), LIT64( 0xDDD58212ADC937F4 ) },
1430 { LIT64( 0x8001000000000000 ), LIT64( 0x0000001000000001 ) },
1431 { LIT64( 0xC036FFFFFFFFFFFF ), LIT64( 0xFE40000000000000 ) },
1432 { LIT64( 0x4002FFFFFE000002 ), LIT64( 0x0000000000000000 ) },
1433 { LIT64( 0x4000C3FEDE897773 ), LIT64( 0x326AC4FD8EFBE6DC ) },
1434 { LIT64( 0xBFFF0000000FFFFF ), LIT64( 0xFFFFFE0000000000 ) },
1435 { LIT64( 0x62C3E502146E426D ), LIT64( 0x43F3CAA0DC7DF1A0 ) },
1436 { LIT64( 0xB5CBD32E52BB570E ), LIT64( 0xBCC477CB11C6236C ) },
1437 { LIT64( 0xE228FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
1438 { LIT64( 0x3F80000000000000 ), LIT64( 0x0000000080000008 ) },
1439 { LIT64( 0xC1AFFFDFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
1440 { LIT64( 0xC96F000000000000 ), LIT64( 0x00000001FFFBFFFF ) },
1441 { LIT64( 0x3DE09BFE7923A338 ), LIT64( 0xBCC8FBBD7CEC1F4F ) },
1442 { LIT64( 0x401CFFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFF80 ) }
1445 static void time_a_float128_z_int32( int32
function( float128
) )
1447 clock_t startClock
, endClock
;
1454 startClock
= clock();
1456 for ( i
= minIterations
; i
; --i
) {
1457 a
.low
= inputs_float128
[ inputNum
].low
;
1458 a
.high
= inputs_float128
[ inputNum
].high
;
1460 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1462 count
+= minIterations
;
1463 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1465 startClock
= clock();
1466 for ( i
= count
; i
; --i
) {
1467 a
.low
= inputs_float128
[ inputNum
].low
;
1468 a
.high
= inputs_float128
[ inputNum
].high
;
1470 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1473 reportTime( count
, endClock
- startClock
);
1477 static void time_a_float128_z_int64( int64
function( float128
) )
1479 clock_t startClock
, endClock
;
1486 startClock
= clock();
1488 for ( i
= minIterations
; i
; --i
) {
1489 a
.low
= inputs_float128
[ inputNum
].low
;
1490 a
.high
= inputs_float128
[ inputNum
].high
;
1492 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1494 count
+= minIterations
;
1495 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1497 startClock
= clock();
1498 for ( i
= count
; i
; --i
) {
1499 a
.low
= inputs_float128
[ inputNum
].low
;
1500 a
.high
= inputs_float128
[ inputNum
].high
;
1502 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1505 reportTime( count
, endClock
- startClock
);
1509 static void time_a_float128_z_float32( float32
function( float128
) )
1511 clock_t startClock
, endClock
;
1518 startClock
= clock();
1520 for ( i
= minIterations
; i
; --i
) {
1521 a
.low
= inputs_float128
[ inputNum
].low
;
1522 a
.high
= inputs_float128
[ inputNum
].high
;
1524 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1526 count
+= minIterations
;
1527 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1529 startClock
= clock();
1530 for ( i
= count
; i
; --i
) {
1531 a
.low
= inputs_float128
[ inputNum
].low
;
1532 a
.high
= inputs_float128
[ inputNum
].high
;
1534 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1537 reportTime( count
, endClock
- startClock
);
1541 static void time_a_float128_z_float64( float64
function( float128
) )
1543 clock_t startClock
, endClock
;
1550 startClock
= clock();
1552 for ( i
= minIterations
; i
; --i
) {
1553 a
.low
= inputs_float128
[ inputNum
].low
;
1554 a
.high
= inputs_float128
[ inputNum
].high
;
1556 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1558 count
+= minIterations
;
1559 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1561 startClock
= clock();
1562 for ( i
= count
; i
; --i
) {
1563 a
.low
= inputs_float128
[ inputNum
].low
;
1564 a
.high
= inputs_float128
[ inputNum
].high
;
1566 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1569 reportTime( count
, endClock
- startClock
);
1575 static void time_a_float128_z_floatx80( floatx80
function( float128
) )
1577 clock_t startClock
, endClock
;
1584 startClock
= clock();
1586 for ( i
= minIterations
; i
; --i
) {
1587 a
.low
= inputs_float128
[ inputNum
].low
;
1588 a
.high
= inputs_float128
[ inputNum
].high
;
1590 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1592 count
+= minIterations
;
1593 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1595 startClock
= clock();
1596 for ( i
= count
; i
; --i
) {
1597 a
.low
= inputs_float128
[ inputNum
].low
;
1598 a
.high
= inputs_float128
[ inputNum
].high
;
1600 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1603 reportTime( count
, endClock
- startClock
);
1609 static void time_az_float128( float128
function( float128
) )
1611 clock_t startClock
, endClock
;
1618 startClock
= clock();
1620 for ( i
= minIterations
; i
; --i
) {
1621 a
.low
= inputs_float128
[ inputNum
].low
;
1622 a
.high
= inputs_float128
[ inputNum
].high
;
1624 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1626 count
+= minIterations
;
1627 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1629 startClock
= clock();
1630 for ( i
= count
; i
; --i
) {
1631 a
.low
= inputs_float128
[ inputNum
].low
;
1632 a
.high
= inputs_float128
[ inputNum
].high
;
1634 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1637 reportTime( count
, endClock
- startClock
);
1641 static void time_ab_float128_z_flag( flag
function( float128
, float128
) )
1643 clock_t startClock
, endClock
;
1645 int8 inputNumA
, inputNumB
;
1651 startClock
= clock();
1653 for ( i
= minIterations
; i
; --i
) {
1654 a
.low
= inputs_float128
[ inputNumA
].low
;
1655 a
.high
= inputs_float128
[ inputNumA
].high
;
1656 b
.low
= inputs_float128
[ inputNumB
].low
;
1657 b
.high
= inputs_float128
[ inputNumB
].high
;
1659 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float128
- 1 );
1660 if ( inputNumA
== 0 ) ++inputNumB
;
1661 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float128
- 1 );
1663 count
+= minIterations
;
1664 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1667 startClock
= clock();
1668 for ( i
= count
; i
; --i
) {
1669 a
.low
= inputs_float128
[ inputNumA
].low
;
1670 a
.high
= inputs_float128
[ inputNumA
].high
;
1671 b
.low
= inputs_float128
[ inputNumB
].low
;
1672 b
.high
= inputs_float128
[ inputNumB
].high
;
1674 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float128
- 1 );
1675 if ( inputNumA
== 0 ) ++inputNumB
;
1676 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float128
- 1 );
1679 reportTime( count
, endClock
- startClock
);
1683 static void time_abz_float128( float128
function( float128
, float128
) )
1685 clock_t startClock
, endClock
;
1687 int8 inputNumA
, inputNumB
;
1693 startClock
= clock();
1695 for ( i
= minIterations
; i
; --i
) {
1696 a
.low
= inputs_float128
[ inputNumA
].low
;
1697 a
.high
= inputs_float128
[ inputNumA
].high
;
1698 b
.low
= inputs_float128
[ inputNumB
].low
;
1699 b
.high
= inputs_float128
[ inputNumB
].high
;
1701 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float128
- 1 );
1702 if ( inputNumA
== 0 ) ++inputNumB
;
1703 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float128
- 1 );
1705 count
+= minIterations
;
1706 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1709 startClock
= clock();
1710 for ( i
= count
; i
; --i
) {
1711 a
.low
= inputs_float128
[ inputNumA
].low
;
1712 a
.high
= inputs_float128
[ inputNumA
].high
;
1713 b
.low
= inputs_float128
[ inputNumB
].low
;
1714 b
.high
= inputs_float128
[ inputNumB
].high
;
1716 inputNumA
= ( inputNumA
+ 1 ) & ( numInputs_float128
- 1 );
1717 if ( inputNumA
== 0 ) ++inputNumB
;
1718 inputNumB
= ( inputNumB
+ 1 ) & ( numInputs_float128
- 1 );
1721 reportTime( count
, endClock
- startClock
);
1725 static const struct {
1727 } inputs_float128_pos
[ numInputs_float128
] = {
1728 { LIT64( 0x3FDA200000100000 ), LIT64( 0x0000000000000000 ) },
1729 { LIT64( 0x3FFF000000000000 ), LIT64( 0x0000000000000000 ) },
1730 { LIT64( 0x05F14776190C8306 ), LIT64( 0xD8715F4E3D54BB92 ) },
1731 { LIT64( 0x72B00000007FFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
1732 { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000000 ) },
1733 { LIT64( 0x3FFFFFFFFFE00000 ), LIT64( 0x0000008000000000 ) },
1734 { LIT64( 0x407F1719CE722F3E ), LIT64( 0xDA6B3FE5FF29425B ) },
1735 { LIT64( 0x43FFFF8000000000 ), LIT64( 0x0000000000400000 ) },
1736 { LIT64( 0x401E000000000100 ), LIT64( 0x0000000000002000 ) },
1737 { LIT64( 0x3FFED71DACDA8E47 ), LIT64( 0x4860E3C75D224F28 ) },
1738 { LIT64( 0x3F7ECFC1E90647D1 ), LIT64( 0x7A124FE55623EE44 ) },
1739 { LIT64( 0x0DF7007FFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
1740 { LIT64( 0x3FE5FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
1741 { LIT64( 0x403FFFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFE ) },
1742 { LIT64( 0x3FFB2FBF7399AFEB ), LIT64( 0xA459EE6A5C16CA55 ) },
1743 { LIT64( 0x3DB8FFFFFFFFFFFC ), LIT64( 0x0000000000000400 ) },
1744 { LIT64( 0x3FC8FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
1745 { LIT64( 0x3FFBFFFFFFDFFFFF ), LIT64( 0xFFF8000000000000 ) },
1746 { LIT64( 0x407043C11737BE84 ), LIT64( 0xDDD58212ADC937F4 ) },
1747 { LIT64( 0x0001000000000000 ), LIT64( 0x0000001000000001 ) },
1748 { LIT64( 0x4036FFFFFFFFFFFF ), LIT64( 0xFE40000000000000 ) },
1749 { LIT64( 0x4002FFFFFE000002 ), LIT64( 0x0000000000000000 ) },
1750 { LIT64( 0x4000C3FEDE897773 ), LIT64( 0x326AC4FD8EFBE6DC ) },
1751 { LIT64( 0x3FFF0000000FFFFF ), LIT64( 0xFFFFFE0000000000 ) },
1752 { LIT64( 0x62C3E502146E426D ), LIT64( 0x43F3CAA0DC7DF1A0 ) },
1753 { LIT64( 0x35CBD32E52BB570E ), LIT64( 0xBCC477CB11C6236C ) },
1754 { LIT64( 0x6228FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
1755 { LIT64( 0x3F80000000000000 ), LIT64( 0x0000000080000008 ) },
1756 { LIT64( 0x41AFFFDFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
1757 { LIT64( 0x496F000000000000 ), LIT64( 0x00000001FFFBFFFF ) },
1758 { LIT64( 0x3DE09BFE7923A338 ), LIT64( 0xBCC8FBBD7CEC1F4F ) },
1759 { LIT64( 0x401CFFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFF80 ) }
1762 static void time_az_float128_pos( float128
function( float128
) )
1764 clock_t startClock
, endClock
;
1771 startClock
= clock();
1773 for ( i
= minIterations
; i
; --i
) {
1774 a
.low
= inputs_float128_pos
[ inputNum
].low
;
1775 a
.high
= inputs_float128_pos
[ inputNum
].high
;
1777 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1779 count
+= minIterations
;
1780 } while ( clock() - startClock
< CLOCKS_PER_SEC
);
1782 startClock
= clock();
1783 for ( i
= count
; i
; --i
) {
1784 a
.low
= inputs_float128_pos
[ inputNum
].low
;
1785 a
.high
= inputs_float128_pos
[ inputNum
].high
;
1787 inputNum
= ( inputNum
+ 1 ) & ( numInputs_float128
- 1 );
1790 reportTime( count
, endClock
- startClock
);
1797 INT32_TO_FLOAT32
= 1,
1814 FLOAT32_TO_INT32_ROUND_TO_ZERO
,
1816 FLOAT32_TO_INT64_ROUND_TO_ZERO
,
1819 FLOAT32_TO_FLOATX80
,
1822 FLOAT32_TO_FLOAT128
,
1824 FLOAT32_ROUND_TO_INT
,
1834 FLOAT32_EQ_SIGNALING
,
1838 FLOAT64_TO_INT32_ROUND_TO_ZERO
,
1840 FLOAT64_TO_INT64_ROUND_TO_ZERO
,
1843 FLOAT64_TO_FLOATX80
,
1846 FLOAT64_TO_FLOAT128
,
1848 FLOAT64_ROUND_TO_INT
,
1858 FLOAT64_EQ_SIGNALING
,
1863 FLOATX80_TO_INT32_ROUND_TO_ZERO
,
1865 FLOATX80_TO_INT64_ROUND_TO_ZERO
,
1866 FLOATX80_TO_FLOAT32
,
1867 FLOATX80_TO_FLOAT64
,
1869 FLOATX80_TO_FLOAT128
,
1871 FLOATX80_ROUND_TO_INT
,
1881 FLOATX80_EQ_SIGNALING
,
1887 FLOAT128_TO_INT32_ROUND_TO_ZERO
,
1889 FLOAT128_TO_INT64_ROUND_TO_ZERO
,
1890 FLOAT128_TO_FLOAT32
,
1891 FLOAT128_TO_FLOAT64
,
1893 FLOAT128_TO_FLOATX80
,
1895 FLOAT128_ROUND_TO_INT
,
1905 FLOAT128_EQ_SIGNALING
,
1915 flag roundingPrecision
, roundingMode
;
1916 flag tininessMode
, tininessModeAtReducedPrecision
;
1917 } functions
[ NUM_FUNCTIONS
] = {
1918 { 0, 0, 0, 0, 0, 0 },
1919 { "int32_to_float32", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1920 { "int32_to_float64", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1922 { "int32_to_floatx80", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1925 { "int32_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1927 { "int64_to_float32", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1928 { "int64_to_float64", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1930 { "int64_to_floatx80", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1933 { "int64_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1935 { "float32_to_int32", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1936 { "float32_to_int32_round_to_zero", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1937 { "float32_to_int64", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1938 { "float32_to_int64_round_to_zero", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1939 { "float32_to_float64", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1941 { "float32_to_floatx80", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1944 { "float32_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1946 { "float32_round_to_int", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1947 { "float32_add", 2, FALSE
, TRUE
, FALSE
, FALSE
},
1948 { "float32_sub", 2, FALSE
, TRUE
, FALSE
, FALSE
},
1949 { "float32_mul", 2, FALSE
, TRUE
, TRUE
, FALSE
},
1950 { "float32_div", 2, FALSE
, TRUE
, FALSE
, FALSE
},
1951 { "float32_rem", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1952 { "float32_sqrt", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1953 { "float32_eq", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1954 { "float32_le", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1955 { "float32_lt", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1956 { "float32_eq_signaling", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1957 { "float32_le_quiet", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1958 { "float32_lt_quiet", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1959 { "float64_to_int32", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1960 { "float64_to_int32_round_to_zero", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1961 { "float64_to_int64", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1962 { "float64_to_int64_round_to_zero", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1963 { "float64_to_float32", 1, FALSE
, TRUE
, TRUE
, FALSE
},
1965 { "float64_to_floatx80", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1968 { "float64_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1970 { "float64_round_to_int", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1971 { "float64_add", 2, FALSE
, TRUE
, FALSE
, FALSE
},
1972 { "float64_sub", 2, FALSE
, TRUE
, FALSE
, FALSE
},
1973 { "float64_mul", 2, FALSE
, TRUE
, TRUE
, FALSE
},
1974 { "float64_div", 2, FALSE
, TRUE
, FALSE
, FALSE
},
1975 { "float64_rem", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1976 { "float64_sqrt", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1977 { "float64_eq", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1978 { "float64_le", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1979 { "float64_lt", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1980 { "float64_eq_signaling", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1981 { "float64_le_quiet", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1982 { "float64_lt_quiet", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1984 { "floatx80_to_int32", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1985 { "floatx80_to_int32_round_to_zero", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1986 { "floatx80_to_int64", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1987 { "floatx80_to_int64_round_to_zero", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1988 { "floatx80_to_float32", 1, FALSE
, TRUE
, TRUE
, FALSE
},
1989 { "floatx80_to_float64", 1, FALSE
, TRUE
, TRUE
, FALSE
},
1991 { "floatx80_to_float128", 1, FALSE
, FALSE
, FALSE
, FALSE
},
1993 { "floatx80_round_to_int", 1, FALSE
, TRUE
, FALSE
, FALSE
},
1994 { "floatx80_add", 2, TRUE
, TRUE
, FALSE
, TRUE
},
1995 { "floatx80_sub", 2, TRUE
, TRUE
, FALSE
, TRUE
},
1996 { "floatx80_mul", 2, TRUE
, TRUE
, TRUE
, TRUE
},
1997 { "floatx80_div", 2, TRUE
, TRUE
, FALSE
, TRUE
},
1998 { "floatx80_rem", 2, FALSE
, FALSE
, FALSE
, FALSE
},
1999 { "floatx80_sqrt", 1, TRUE
, TRUE
, FALSE
, FALSE
},
2000 { "floatx80_eq", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2001 { "floatx80_le", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2002 { "floatx80_lt", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2003 { "floatx80_eq_signaling", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2004 { "floatx80_le_quiet", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2005 { "floatx80_lt_quiet", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2008 { "float128_to_int32", 1, FALSE
, TRUE
, FALSE
, FALSE
},
2009 { "float128_to_int32_round_to_zero", 1, FALSE
, FALSE
, FALSE
, FALSE
},
2010 { "float128_to_int64", 1, FALSE
, TRUE
, FALSE
, FALSE
},
2011 { "float128_to_int64_round_to_zero", 1, FALSE
, FALSE
, FALSE
, FALSE
},
2012 { "float128_to_float32", 1, FALSE
, TRUE
, TRUE
, FALSE
},
2013 { "float128_to_float64", 1, FALSE
, TRUE
, TRUE
, FALSE
},
2015 { "float128_to_floatx80", 1, FALSE
, TRUE
, TRUE
, FALSE
},
2017 { "float128_round_to_int", 1, FALSE
, TRUE
, FALSE
, FALSE
},
2018 { "float128_add", 2, FALSE
, TRUE
, FALSE
, FALSE
},
2019 { "float128_sub", 2, FALSE
, TRUE
, FALSE
, FALSE
},
2020 { "float128_mul", 2, FALSE
, TRUE
, TRUE
, FALSE
},
2021 { "float128_div", 2, FALSE
, TRUE
, FALSE
, FALSE
},
2022 { "float128_rem", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2023 { "float128_sqrt", 1, FALSE
, TRUE
, FALSE
, FALSE
},
2024 { "float128_eq", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2025 { "float128_le", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2026 { "float128_lt", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2027 { "float128_eq_signaling", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2028 { "float128_le_quiet", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2029 { "float128_lt_quiet", 2, FALSE
, FALSE
, FALSE
, FALSE
},
2034 ROUND_NEAREST_EVEN
= 1,
2041 TININESS_BEFORE_ROUNDING
= 1,
2042 TININESS_AFTER_ROUNDING
,
2047 timeFunctionVariety(
2049 int8 roundingPrecision
,
2057 functionName
= functions
[ functionCode
].name
;
2058 if ( roundingPrecision
== 32 ) {
2059 roundingPrecisionName
= "32";
2061 else if ( roundingPrecision
== 64 ) {
2062 roundingPrecisionName
= "64";
2064 else if ( roundingPrecision
== 80 ) {
2065 roundingPrecisionName
= "80";
2068 roundingPrecisionName
= 0;
2071 floatx80_rounding_precision
= roundingPrecision
;
2073 switch ( roundingMode
) {
2075 roundingModeName
= 0;
2076 roundingCode
= float_round_nearest_even
;
2078 case ROUND_NEAREST_EVEN
:
2079 roundingModeName
= "nearest_even";
2080 roundingCode
= float_round_nearest_even
;
2083 roundingModeName
= "to_zero";
2084 roundingCode
= float_round_to_zero
;
2087 roundingModeName
= "down";
2088 roundingCode
= float_round_down
;
2091 roundingModeName
= "up";
2092 roundingCode
= float_round_up
;
2095 float_rounding_mode
= roundingCode
;
2096 switch ( tininessMode
) {
2098 tininessModeName
= 0;
2099 tininessCode
= float_tininess_after_rounding
;
2101 case TININESS_BEFORE_ROUNDING
:
2102 tininessModeName
= "before";
2103 tininessCode
= float_tininess_before_rounding
;
2105 case TININESS_AFTER_ROUNDING
:
2106 tininessModeName
= "after";
2107 tininessCode
= float_tininess_after_rounding
;
2110 float_detect_tininess
= tininessCode
;
2111 switch ( functionCode
) {
2112 case INT32_TO_FLOAT32
:
2113 time_a_int32_z_float32( int32_to_float32
);
2115 case INT32_TO_FLOAT64
:
2116 time_a_int32_z_float64( int32_to_float64
);
2119 case INT32_TO_FLOATX80
:
2120 time_a_int32_z_floatx80( int32_to_floatx80
);
2124 case INT32_TO_FLOAT128
:
2125 time_a_int32_z_float128( int32_to_float128
);
2128 case INT64_TO_FLOAT32
:
2129 time_a_int64_z_float32( int64_to_float32
);
2131 case INT64_TO_FLOAT64
:
2132 time_a_int64_z_float64( int64_to_float64
);
2135 case INT64_TO_FLOATX80
:
2136 time_a_int64_z_floatx80( int64_to_floatx80
);
2140 case INT64_TO_FLOAT128
:
2141 time_a_int64_z_float128( int64_to_float128
);
2144 case FLOAT32_TO_INT32
:
2145 time_a_float32_z_int32( float32_to_int32
);
2147 case FLOAT32_TO_INT32_ROUND_TO_ZERO
:
2148 time_a_float32_z_int32( float32_to_int32_round_to_zero
);
2150 case FLOAT32_TO_INT64
:
2151 time_a_float32_z_int64( float32_to_int64
);
2153 case FLOAT32_TO_INT64_ROUND_TO_ZERO
:
2154 time_a_float32_z_int64( float32_to_int64_round_to_zero
);
2156 case FLOAT32_TO_FLOAT64
:
2157 time_a_float32_z_float64( float32_to_float64
);
2160 case FLOAT32_TO_FLOATX80
:
2161 time_a_float32_z_floatx80( float32_to_floatx80
);
2165 case FLOAT32_TO_FLOAT128
:
2166 time_a_float32_z_float128( float32_to_float128
);
2169 case FLOAT32_ROUND_TO_INT
:
2170 time_az_float32( float32_round_to_int
);
2173 time_abz_float32( float32_add
);
2176 time_abz_float32( float32_sub
);
2179 time_abz_float32( float32_mul
);
2182 time_abz_float32( float32_div
);
2185 time_abz_float32( float32_rem
);
2188 time_az_float32_pos( float32_sqrt
);
2191 time_ab_float32_z_flag( float32_eq
);
2194 time_ab_float32_z_flag( float32_le
);
2197 time_ab_float32_z_flag( float32_lt
);
2199 case FLOAT32_EQ_SIGNALING
:
2200 time_ab_float32_z_flag( float32_eq_signaling
);
2202 case FLOAT32_LE_QUIET
:
2203 time_ab_float32_z_flag( float32_le_quiet
);
2205 case FLOAT32_LT_QUIET
:
2206 time_ab_float32_z_flag( float32_lt_quiet
);
2208 case FLOAT64_TO_INT32
:
2209 time_a_float64_z_int32( float64_to_int32
);
2211 case FLOAT64_TO_INT32_ROUND_TO_ZERO
:
2212 time_a_float64_z_int32( float64_to_int32_round_to_zero
);
2214 case FLOAT64_TO_INT64
:
2215 time_a_float64_z_int64( float64_to_int64
);
2217 case FLOAT64_TO_INT64_ROUND_TO_ZERO
:
2218 time_a_float64_z_int64( float64_to_int64_round_to_zero
);
2220 case FLOAT64_TO_FLOAT32
:
2221 time_a_float64_z_float32( float64_to_float32
);
2224 case FLOAT64_TO_FLOATX80
:
2225 time_a_float64_z_floatx80( float64_to_floatx80
);
2229 case FLOAT64_TO_FLOAT128
:
2230 time_a_float64_z_float128( float64_to_float128
);
2233 case FLOAT64_ROUND_TO_INT
:
2234 time_az_float64( float64_round_to_int
);
2237 time_abz_float64( float64_add
);
2240 time_abz_float64( float64_sub
);
2243 time_abz_float64( float64_mul
);
2246 time_abz_float64( float64_div
);
2249 time_abz_float64( float64_rem
);
2252 time_az_float64_pos( float64_sqrt
);
2255 time_ab_float64_z_flag( float64_eq
);
2258 time_ab_float64_z_flag( float64_le
);
2261 time_ab_float64_z_flag( float64_lt
);
2263 case FLOAT64_EQ_SIGNALING
:
2264 time_ab_float64_z_flag( float64_eq_signaling
);
2266 case FLOAT64_LE_QUIET
:
2267 time_ab_float64_z_flag( float64_le_quiet
);
2269 case FLOAT64_LT_QUIET
:
2270 time_ab_float64_z_flag( float64_lt_quiet
);
2273 case FLOATX80_TO_INT32
:
2274 time_a_floatx80_z_int32( floatx80_to_int32
);
2276 case FLOATX80_TO_INT32_ROUND_TO_ZERO
:
2277 time_a_floatx80_z_int32( floatx80_to_int32_round_to_zero
);
2279 case FLOATX80_TO_INT64
:
2280 time_a_floatx80_z_int64( floatx80_to_int64
);
2282 case FLOATX80_TO_INT64_ROUND_TO_ZERO
:
2283 time_a_floatx80_z_int64( floatx80_to_int64_round_to_zero
);
2285 case FLOATX80_TO_FLOAT32
:
2286 time_a_floatx80_z_float32( floatx80_to_float32
);
2288 case FLOATX80_TO_FLOAT64
:
2289 time_a_floatx80_z_float64( floatx80_to_float64
);
2292 case FLOATX80_TO_FLOAT128
:
2293 time_a_floatx80_z_float128( floatx80_to_float128
);
2296 case FLOATX80_ROUND_TO_INT
:
2297 time_az_floatx80( floatx80_round_to_int
);
2300 time_abz_floatx80( floatx80_add
);
2303 time_abz_floatx80( floatx80_sub
);
2306 time_abz_floatx80( floatx80_mul
);
2309 time_abz_floatx80( floatx80_div
);
2312 time_abz_floatx80( floatx80_rem
);
2315 time_az_floatx80_pos( floatx80_sqrt
);
2318 time_ab_floatx80_z_flag( floatx80_eq
);
2321 time_ab_floatx80_z_flag( floatx80_le
);
2324 time_ab_floatx80_z_flag( floatx80_lt
);
2326 case FLOATX80_EQ_SIGNALING
:
2327 time_ab_floatx80_z_flag( floatx80_eq_signaling
);
2329 case FLOATX80_LE_QUIET
:
2330 time_ab_floatx80_z_flag( floatx80_le_quiet
);
2332 case FLOATX80_LT_QUIET
:
2333 time_ab_floatx80_z_flag( floatx80_lt_quiet
);
2337 case FLOAT128_TO_INT32
:
2338 time_a_float128_z_int32( float128_to_int32
);
2340 case FLOAT128_TO_INT32_ROUND_TO_ZERO
:
2341 time_a_float128_z_int32( float128_to_int32_round_to_zero
);
2343 case FLOAT128_TO_INT64
:
2344 time_a_float128_z_int64( float128_to_int64
);
2346 case FLOAT128_TO_INT64_ROUND_TO_ZERO
:
2347 time_a_float128_z_int64( float128_to_int64_round_to_zero
);
2349 case FLOAT128_TO_FLOAT32
:
2350 time_a_float128_z_float32( float128_to_float32
);
2352 case FLOAT128_TO_FLOAT64
:
2353 time_a_float128_z_float64( float128_to_float64
);
2356 case FLOAT128_TO_FLOATX80
:
2357 time_a_float128_z_floatx80( float128_to_floatx80
);
2360 case FLOAT128_ROUND_TO_INT
:
2361 time_az_float128( float128_round_to_int
);
2364 time_abz_float128( float128_add
);
2367 time_abz_float128( float128_sub
);
2370 time_abz_float128( float128_mul
);
2373 time_abz_float128( float128_div
);
2376 time_abz_float128( float128_rem
);
2379 time_az_float128_pos( float128_sqrt
);
2382 time_ab_float128_z_flag( float128_eq
);
2385 time_ab_float128_z_flag( float128_le
);
2388 time_ab_float128_z_flag( float128_lt
);
2390 case FLOAT128_EQ_SIGNALING
:
2391 time_ab_float128_z_flag( float128_eq_signaling
);
2393 case FLOAT128_LE_QUIET
:
2394 time_ab_float128_z_flag( float128_le_quiet
);
2396 case FLOAT128_LT_QUIET
:
2397 time_ab_float128_z_flag( float128_lt_quiet
);
2407 int8 roundingPrecisionIn
,
2408 int8 roundingModeIn
,
2412 int8 roundingPrecision
, roundingMode
, tininessMode
;
2414 roundingPrecision
= 32;
2416 if ( ! functions
[ functionCode
].roundingPrecision
) {
2417 roundingPrecision
= 0;
2419 else if ( roundingPrecisionIn
) {
2420 roundingPrecision
= roundingPrecisionIn
;
2422 for ( roundingMode
= 1;
2423 roundingMode
< NUM_ROUNDINGMODES
;
2426 if ( ! functions
[ functionCode
].roundingMode
) {
2429 else if ( roundingModeIn
) {
2430 roundingMode
= roundingModeIn
;
2432 for ( tininessMode
= 1;
2433 tininessMode
< NUM_TININESSMODES
;
2436 if ( ( roundingPrecision
== 32 )
2437 || ( roundingPrecision
== 64 ) ) {
2438 if ( ! functions
[ functionCode
]
2439 .tininessModeAtReducedPrecision
2443 else if ( tininessModeIn
) {
2444 tininessMode
= tininessModeIn
;
2448 if ( ! functions
[ functionCode
].tininessMode
) {
2451 else if ( tininessModeIn
) {
2452 tininessMode
= tininessModeIn
;
2455 timeFunctionVariety(
2456 functionCode
, roundingPrecision
, roundingMode
, tininessMode
2458 if ( tininessModeIn
|| ! tininessMode
) break;
2460 if ( roundingModeIn
|| ! roundingMode
) break;
2462 if ( roundingPrecisionIn
|| ! roundingPrecision
) break;
2463 if ( roundingPrecision
== 80 ) {
2466 else if ( roundingPrecision
== 64 ) {
2467 roundingPrecision
= 80;
2469 else if ( roundingPrecision
== 32 ) {
2470 roundingPrecision
= 64;
2476 main( int argc
, char **argv
)
2479 flag functionArgument
;
2481 int8 operands
, roundingPrecision
, roundingMode
, tininessMode
;
2483 if ( argc
<= 1 ) goto writeHelpMessage
;
2484 functionArgument
= FALSE
;
2487 roundingPrecision
= 0;
2492 while ( argc
&& ( argPtr
= argv
[ 0 ] ) ) {
2493 if ( argPtr
[ 0 ] == '-' ) ++argPtr
;
2494 if ( strcmp( argPtr
, "help" ) == 0 ) {
2497 "timesoftfloat [<option>...] <function>\n"
2498 " <option>: (* is default)\n"
2499 " -help --Write this message and exit.\n"
2501 " -precision32 --Only time rounding precision equivalent to float32.\n"
2502 " -precision64 --Only time rounding precision equivalent to float64.\n"
2503 " -precision80 --Only time maximum rounding precision.\n"
2505 " -nearesteven --Only time rounding to nearest/even.\n"
2506 " -tozero --Only time rounding to zero.\n"
2507 " -down --Only time rounding down.\n"
2508 " -up --Only time rounding up.\n"
2509 " -tininessbefore --Only time underflow tininess before rounding.\n"
2510 " -tininessafter --Only time underflow tininess after rounding.\n"
2512 " int32_to_<float> <float>_add <float>_eq\n"
2513 " <float>_to_int32 <float>_sub <float>_le\n"
2514 " <float>_to_int32_round_to_zero <float>_mul <float>_lt\n"
2515 " int64_to_<float> <float>_div <float>_eq_signaling\n"
2516 " <float>_to_int64 <float>_rem <float>_le_quiet\n"
2517 " <float>_to_int64_round_to_zero <float>_lt_quiet\n"
2518 " <float>_to_<float>\n"
2519 " <float>_round_to_int\n"
2521 " -all1 --All 1-operand functions.\n"
2522 " -all2 --All 2-operand functions.\n"
2523 " -all --All functions.\n"
2525 " float32 --Single precision.\n"
2526 " float64 --Double precision.\n"
2528 " floatx80 --Extended double precision.\n"
2531 " float128 --Quadruple precision.\n"
2536 return EXIT_SUCCESS
;
2539 else if ( strcmp( argPtr
, "precision32" ) == 0 ) {
2540 roundingPrecision
= 32;
2542 else if ( strcmp( argPtr
, "precision64" ) == 0 ) {
2543 roundingPrecision
= 64;
2545 else if ( strcmp( argPtr
, "precision80" ) == 0 ) {
2546 roundingPrecision
= 80;
2549 else if ( ( strcmp( argPtr
, "nearesteven" ) == 0 )
2550 || ( strcmp( argPtr
, "nearest_even" ) == 0 ) ) {
2551 roundingMode
= ROUND_NEAREST_EVEN
;
2553 else if ( ( strcmp( argPtr
, "tozero" ) == 0 )
2554 || ( strcmp( argPtr
, "to_zero" ) == 0 ) ) {
2555 roundingMode
= ROUND_TO_ZERO
;
2557 else if ( strcmp( argPtr
, "down" ) == 0 ) {
2558 roundingMode
= ROUND_DOWN
;
2560 else if ( strcmp( argPtr
, "up" ) == 0 ) {
2561 roundingMode
= ROUND_UP
;
2563 else if ( strcmp( argPtr
, "tininessbefore" ) == 0 ) {
2564 tininessMode
= TININESS_BEFORE_ROUNDING
;
2566 else if ( strcmp( argPtr
, "tininessafter" ) == 0 ) {
2567 tininessMode
= TININESS_AFTER_ROUNDING
;
2569 else if ( strcmp( argPtr
, "all1" ) == 0 ) {
2570 functionArgument
= TRUE
;
2574 else if ( strcmp( argPtr
, "all2" ) == 0 ) {
2575 functionArgument
= TRUE
;
2579 else if ( strcmp( argPtr
, "all" ) == 0 ) {
2580 functionArgument
= TRUE
;
2585 for ( functionCode
= 1;
2586 functionCode
< NUM_FUNCTIONS
;
2589 if ( strcmp( argPtr
, functions
[ functionCode
].name
) == 0 ) {
2593 if ( functionCode
== NUM_FUNCTIONS
) {
2594 fail( "Invalid option or function `%s'", argv
[ 0 ] );
2596 functionArgument
= TRUE
;
2601 if ( ! functionArgument
) fail( "Function argument required" );
2602 if ( functionCode
) {
2604 functionCode
, roundingPrecision
, roundingMode
, tininessMode
);
2606 else if ( operands
== 1 ) {
2607 for ( functionCode
= 1; functionCode
< NUM_FUNCTIONS
; ++functionCode
2609 if ( functions
[ functionCode
].numInputs
== 1 ) {
2611 functionCode
, roundingPrecision
, roundingMode
, tininessMode
2616 else if ( operands
== 2 ) {
2617 for ( functionCode
= 1; functionCode
< NUM_FUNCTIONS
; ++functionCode
2619 if ( functions
[ functionCode
].numInputs
== 2 ) {
2621 functionCode
, roundingPrecision
, roundingMode
, tininessMode
2627 for ( functionCode
= 1; functionCode
< NUM_FUNCTIONS
; ++functionCode
2630 functionCode
, roundingPrecision
, roundingMode
, tininessMode
);
2633 return EXIT_SUCCESS
;