115144b0fSOlivier Houchard /* $NetBSD: timesoftfloat.c,v 1.1 2000/06/06 08:15:11 bjh21 Exp $ */
215144b0fSOlivier Houchard
315144b0fSOlivier Houchard /*
415144b0fSOlivier Houchard ===============================================================================
515144b0fSOlivier Houchard
615144b0fSOlivier Houchard This C source file is part of the SoftFloat IEC/IEEE Floating-point
715144b0fSOlivier Houchard Arithmetic Package, Release 2a.
815144b0fSOlivier Houchard
915144b0fSOlivier Houchard Written by John R. Hauser. This work was made possible in part by the
1015144b0fSOlivier Houchard International Computer Science Institute, located at Suite 600, 1947 Center
1115144b0fSOlivier Houchard Street, Berkeley, California 94704. Funding was partially provided by the
1215144b0fSOlivier Houchard National Science Foundation under grant MIP-9311980. The original version
1315144b0fSOlivier Houchard of this code was written as part of a project to build a fixed-point vector
1415144b0fSOlivier Houchard processor in collaboration with the University of California at Berkeley,
1515144b0fSOlivier Houchard overseen by Profs. Nelson Morgan and John Wawrzynek. More information
1615144b0fSOlivier Houchard is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
1715144b0fSOlivier Houchard arithmetic/SoftFloat.html'.
1815144b0fSOlivier Houchard
1915144b0fSOlivier Houchard THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
2015144b0fSOlivier Houchard has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
2115144b0fSOlivier Houchard TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
2215144b0fSOlivier Houchard PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
2315144b0fSOlivier Houchard AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
2415144b0fSOlivier Houchard
2515144b0fSOlivier Houchard Derivative works are acceptable, even for commercial purposes, so long as
2615144b0fSOlivier Houchard (1) they include prominent notice that the work is derivative, and (2) they
2715144b0fSOlivier Houchard include prominent notice akin to these four paragraphs for those parts of
2815144b0fSOlivier Houchard this code that are retained.
2915144b0fSOlivier Houchard
3015144b0fSOlivier Houchard ===============================================================================
3115144b0fSOlivier Houchard */
3215144b0fSOlivier Houchard
3315144b0fSOlivier Houchard #include <stdlib.h>
3415144b0fSOlivier Houchard #include <stdarg.h>
3515144b0fSOlivier Houchard #include <string.h>
3615144b0fSOlivier Houchard #include <stdio.h>
3715144b0fSOlivier Houchard #include <time.h>
3815144b0fSOlivier Houchard #include "milieu.h"
3915144b0fSOlivier Houchard #include "softfloat.h"
4015144b0fSOlivier Houchard
4115144b0fSOlivier Houchard enum {
4215144b0fSOlivier Houchard minIterations = 1000
4315144b0fSOlivier Houchard };
4415144b0fSOlivier Houchard
fail(const char * message,...)4515144b0fSOlivier Houchard static void fail( const char *message, ... )
4615144b0fSOlivier Houchard {
4715144b0fSOlivier Houchard va_list varArgs;
4815144b0fSOlivier Houchard
4915144b0fSOlivier Houchard fputs( "timesoftfloat: ", stderr );
5015144b0fSOlivier Houchard va_start( varArgs, message );
5115144b0fSOlivier Houchard vfprintf( stderr, message, varArgs );
5215144b0fSOlivier Houchard va_end( varArgs );
5315144b0fSOlivier Houchard fputs( ".\n", stderr );
5415144b0fSOlivier Houchard exit( EXIT_FAILURE );
5515144b0fSOlivier Houchard
5615144b0fSOlivier Houchard }
5715144b0fSOlivier Houchard
5815144b0fSOlivier Houchard static char *functionName;
5915144b0fSOlivier Houchard static char *roundingPrecisionName, *roundingModeName, *tininessModeName;
6015144b0fSOlivier Houchard
reportTime(int32 count,long clocks)6115144b0fSOlivier Houchard static void reportTime( int32 count, long clocks )
6215144b0fSOlivier Houchard {
6315144b0fSOlivier Houchard
6415144b0fSOlivier Houchard printf(
6515144b0fSOlivier Houchard "%8.1f kops/s: %s",
6615144b0fSOlivier Houchard ( count / ( ( (float) clocks ) / CLOCKS_PER_SEC ) ) / 1000,
6715144b0fSOlivier Houchard functionName
6815144b0fSOlivier Houchard );
6915144b0fSOlivier Houchard if ( roundingModeName ) {
7015144b0fSOlivier Houchard if ( roundingPrecisionName ) {
7115144b0fSOlivier Houchard fputs( ", precision ", stdout );
7215144b0fSOlivier Houchard fputs( roundingPrecisionName, stdout );
7315144b0fSOlivier Houchard }
7415144b0fSOlivier Houchard fputs( ", rounding ", stdout );
7515144b0fSOlivier Houchard fputs( roundingModeName, stdout );
7615144b0fSOlivier Houchard if ( tininessModeName ) {
7715144b0fSOlivier Houchard fputs( ", tininess ", stdout );
7815144b0fSOlivier Houchard fputs( tininessModeName, stdout );
7915144b0fSOlivier Houchard fputs( " rounding", stdout );
8015144b0fSOlivier Houchard }
8115144b0fSOlivier Houchard }
8215144b0fSOlivier Houchard fputc( '\n', stdout );
8315144b0fSOlivier Houchard
8415144b0fSOlivier Houchard }
8515144b0fSOlivier Houchard
8615144b0fSOlivier Houchard enum {
8715144b0fSOlivier Houchard numInputs_int32 = 32
8815144b0fSOlivier Houchard };
8915144b0fSOlivier Houchard
9015144b0fSOlivier Houchard static const int32 inputs_int32[ numInputs_int32 ] = {
9115144b0fSOlivier Houchard 0xFFFFBB79, 0x405CF80F, 0x00000000, 0xFFFFFD04,
9215144b0fSOlivier Houchard 0xFFF20002, 0x0C8EF795, 0xF00011FF, 0x000006CA,
9315144b0fSOlivier Houchard 0x00009BFE, 0xFF4862E3, 0x9FFFEFFE, 0xFFFFFFB7,
9415144b0fSOlivier Houchard 0x0BFF7FFF, 0x0000F37A, 0x0011DFFE, 0x00000006,
9515144b0fSOlivier Houchard 0xFFF02006, 0xFFFFF7D1, 0x10200003, 0xDE8DF765,
9615144b0fSOlivier Houchard 0x00003E02, 0x000019E8, 0x0008FFFE, 0xFFFFFB5C,
9715144b0fSOlivier Houchard 0xFFDF7FFE, 0x07C42FBF, 0x0FFFE3FF, 0x040B9F13,
9815144b0fSOlivier Houchard 0xBFFFFFF8, 0x0001BF56, 0x000017F6, 0x000A908A
9915144b0fSOlivier Houchard };
10015144b0fSOlivier Houchard
time_a_int32_z_float32(float32 function (int32))10115144b0fSOlivier Houchard static void time_a_int32_z_float32( float32 function( int32 ) )
10215144b0fSOlivier Houchard {
10315144b0fSOlivier Houchard clock_t startClock, endClock;
10415144b0fSOlivier Houchard int32 count, i;
10515144b0fSOlivier Houchard int8 inputNum;
10615144b0fSOlivier Houchard
10715144b0fSOlivier Houchard count = 0;
10815144b0fSOlivier Houchard inputNum = 0;
10915144b0fSOlivier Houchard startClock = clock();
11015144b0fSOlivier Houchard do {
11115144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
11215144b0fSOlivier Houchard function( inputs_int32[ inputNum ] );
11315144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
11415144b0fSOlivier Houchard }
11515144b0fSOlivier Houchard count += minIterations;
11615144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
11715144b0fSOlivier Houchard inputNum = 0;
11815144b0fSOlivier Houchard startClock = clock();
11915144b0fSOlivier Houchard for ( i = count; i; --i ) {
12015144b0fSOlivier Houchard function( inputs_int32[ inputNum ] );
12115144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
12215144b0fSOlivier Houchard }
12315144b0fSOlivier Houchard endClock = clock();
12415144b0fSOlivier Houchard reportTime( count, endClock - startClock );
12515144b0fSOlivier Houchard
12615144b0fSOlivier Houchard }
12715144b0fSOlivier Houchard
time_a_int32_z_float64(float64 function (int32))12815144b0fSOlivier Houchard static void time_a_int32_z_float64( float64 function( int32 ) )
12915144b0fSOlivier Houchard {
13015144b0fSOlivier Houchard clock_t startClock, endClock;
13115144b0fSOlivier Houchard int32 count, i;
13215144b0fSOlivier Houchard int8 inputNum;
13315144b0fSOlivier Houchard
13415144b0fSOlivier Houchard count = 0;
13515144b0fSOlivier Houchard inputNum = 0;
13615144b0fSOlivier Houchard startClock = clock();
13715144b0fSOlivier Houchard do {
13815144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
13915144b0fSOlivier Houchard function( inputs_int32[ inputNum ] );
14015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
14115144b0fSOlivier Houchard }
14215144b0fSOlivier Houchard count += minIterations;
14315144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
14415144b0fSOlivier Houchard inputNum = 0;
14515144b0fSOlivier Houchard startClock = clock();
14615144b0fSOlivier Houchard for ( i = count; i; --i ) {
14715144b0fSOlivier Houchard function( inputs_int32[ inputNum ] );
14815144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
14915144b0fSOlivier Houchard }
15015144b0fSOlivier Houchard endClock = clock();
15115144b0fSOlivier Houchard reportTime( count, endClock - startClock );
15215144b0fSOlivier Houchard
15315144b0fSOlivier Houchard }
15415144b0fSOlivier Houchard
15515144b0fSOlivier Houchard #ifdef FLOATX80
15615144b0fSOlivier Houchard
time_a_int32_z_floatx80(floatx80 function (int32))15715144b0fSOlivier Houchard static void time_a_int32_z_floatx80( floatx80 function( int32 ) )
15815144b0fSOlivier Houchard {
15915144b0fSOlivier Houchard clock_t startClock, endClock;
16015144b0fSOlivier Houchard int32 count, i;
16115144b0fSOlivier Houchard int8 inputNum;
16215144b0fSOlivier Houchard
16315144b0fSOlivier Houchard count = 0;
16415144b0fSOlivier Houchard inputNum = 0;
16515144b0fSOlivier Houchard startClock = clock();
16615144b0fSOlivier Houchard do {
16715144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
16815144b0fSOlivier Houchard function( inputs_int32[ inputNum ] );
16915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
17015144b0fSOlivier Houchard }
17115144b0fSOlivier Houchard count += minIterations;
17215144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
17315144b0fSOlivier Houchard inputNum = 0;
17415144b0fSOlivier Houchard startClock = clock();
17515144b0fSOlivier Houchard for ( i = count; i; --i ) {
17615144b0fSOlivier Houchard function( inputs_int32[ inputNum ] );
17715144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
17815144b0fSOlivier Houchard }
17915144b0fSOlivier Houchard endClock = clock();
18015144b0fSOlivier Houchard reportTime( count, endClock - startClock );
18115144b0fSOlivier Houchard
18215144b0fSOlivier Houchard }
18315144b0fSOlivier Houchard
18415144b0fSOlivier Houchard #endif
18515144b0fSOlivier Houchard
18615144b0fSOlivier Houchard #ifdef FLOAT128
18715144b0fSOlivier Houchard
time_a_int32_z_float128(float128 function (int32))18815144b0fSOlivier Houchard static void time_a_int32_z_float128( float128 function( int32 ) )
18915144b0fSOlivier Houchard {
19015144b0fSOlivier Houchard clock_t startClock, endClock;
19115144b0fSOlivier Houchard int32 count, i;
19215144b0fSOlivier Houchard int8 inputNum;
19315144b0fSOlivier Houchard
19415144b0fSOlivier Houchard count = 0;
19515144b0fSOlivier Houchard inputNum = 0;
19615144b0fSOlivier Houchard startClock = clock();
19715144b0fSOlivier Houchard do {
19815144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
19915144b0fSOlivier Houchard function( inputs_int32[ inputNum ] );
20015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
20115144b0fSOlivier Houchard }
20215144b0fSOlivier Houchard count += minIterations;
20315144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
20415144b0fSOlivier Houchard inputNum = 0;
20515144b0fSOlivier Houchard startClock = clock();
20615144b0fSOlivier Houchard for ( i = count; i; --i ) {
20715144b0fSOlivier Houchard function( inputs_int32[ inputNum ] );
20815144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int32 - 1 );
20915144b0fSOlivier Houchard }
21015144b0fSOlivier Houchard endClock = clock();
21115144b0fSOlivier Houchard reportTime( count, endClock - startClock );
21215144b0fSOlivier Houchard
21315144b0fSOlivier Houchard }
21415144b0fSOlivier Houchard
21515144b0fSOlivier Houchard #endif
21615144b0fSOlivier Houchard
21715144b0fSOlivier Houchard enum {
21815144b0fSOlivier Houchard numInputs_int64 = 32
21915144b0fSOlivier Houchard };
22015144b0fSOlivier Houchard
22115144b0fSOlivier Houchard static const int64 inputs_int64[ numInputs_int64 ] = {
22215144b0fSOlivier Houchard LIT64( 0xFBFFC3FFFFFFFFFF ),
22315144b0fSOlivier Houchard LIT64( 0x0000000003C589BC ),
22415144b0fSOlivier Houchard LIT64( 0x00000000400013FE ),
22515144b0fSOlivier Houchard LIT64( 0x0000000000186171 ),
22615144b0fSOlivier Houchard LIT64( 0xFFFFFFFFFFFEFBFA ),
22715144b0fSOlivier Houchard LIT64( 0xFFFFFD79E6DFFC73 ),
22815144b0fSOlivier Houchard LIT64( 0x0000000010001DFF ),
22915144b0fSOlivier Houchard LIT64( 0xDD1A0F0C78513710 ),
23015144b0fSOlivier Houchard LIT64( 0xFFFF83FFFFFEFFFE ),
23115144b0fSOlivier Houchard LIT64( 0x00756EBD1AD0C1C7 ),
23215144b0fSOlivier Houchard LIT64( 0x0003FDFFFFFFFFBE ),
23315144b0fSOlivier Houchard LIT64( 0x0007D0FB2C2CA951 ),
23415144b0fSOlivier Houchard LIT64( 0x0007FC0007FFFFFE ),
23515144b0fSOlivier Houchard LIT64( 0x0000001F942B18BB ),
23615144b0fSOlivier Houchard LIT64( 0x0000080101FFFFFE ),
23715144b0fSOlivier Houchard LIT64( 0xFFFFFFFFFFFF0978 ),
23815144b0fSOlivier Houchard LIT64( 0x000000000008BFFF ),
23915144b0fSOlivier Houchard LIT64( 0x0000000006F5AF08 ),
24015144b0fSOlivier Houchard LIT64( 0xFFDEFF7FFFFFFFFE ),
24115144b0fSOlivier Houchard LIT64( 0x0000000000000003 ),
24215144b0fSOlivier Houchard LIT64( 0x3FFFFFFFFF80007D ),
24315144b0fSOlivier Houchard LIT64( 0x0000000000000078 ),
24415144b0fSOlivier Houchard LIT64( 0xFFF80000007FDFFD ),
24515144b0fSOlivier Houchard LIT64( 0x1BBC775B78016AB0 ),
24615144b0fSOlivier Houchard LIT64( 0xFFF9001FFFFFFFFE ),
24715144b0fSOlivier Houchard LIT64( 0xFFFD4767AB98E43F ),
24815144b0fSOlivier Houchard LIT64( 0xFFFFFEFFFE00001E ),
24915144b0fSOlivier Houchard LIT64( 0xFFFFFFFFFFF04EFD ),
25015144b0fSOlivier Houchard LIT64( 0x07FFFFFFFFFFF7FF ),
25115144b0fSOlivier Houchard LIT64( 0xFFFC9EAA38F89050 ),
25215144b0fSOlivier Houchard LIT64( 0x00000020FBFFFFFE ),
25315144b0fSOlivier Houchard LIT64( 0x0000099AE6455357 )
25415144b0fSOlivier Houchard };
25515144b0fSOlivier Houchard
time_a_int64_z_float32(float32 function (int64))25615144b0fSOlivier Houchard static void time_a_int64_z_float32( float32 function( int64 ) )
25715144b0fSOlivier Houchard {
25815144b0fSOlivier Houchard clock_t startClock, endClock;
25915144b0fSOlivier Houchard int32 count, i;
26015144b0fSOlivier Houchard int8 inputNum;
26115144b0fSOlivier Houchard
26215144b0fSOlivier Houchard count = 0;
26315144b0fSOlivier Houchard inputNum = 0;
26415144b0fSOlivier Houchard startClock = clock();
26515144b0fSOlivier Houchard do {
26615144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
26715144b0fSOlivier Houchard function( inputs_int64[ inputNum ] );
26815144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
26915144b0fSOlivier Houchard }
27015144b0fSOlivier Houchard count += minIterations;
27115144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
27215144b0fSOlivier Houchard inputNum = 0;
27315144b0fSOlivier Houchard startClock = clock();
27415144b0fSOlivier Houchard for ( i = count; i; --i ) {
27515144b0fSOlivier Houchard function( inputs_int64[ inputNum ] );
27615144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
27715144b0fSOlivier Houchard }
27815144b0fSOlivier Houchard endClock = clock();
27915144b0fSOlivier Houchard reportTime( count, endClock - startClock );
28015144b0fSOlivier Houchard
28115144b0fSOlivier Houchard }
28215144b0fSOlivier Houchard
time_a_int64_z_float64(float64 function (int64))28315144b0fSOlivier Houchard static void time_a_int64_z_float64( float64 function( int64 ) )
28415144b0fSOlivier Houchard {
28515144b0fSOlivier Houchard clock_t startClock, endClock;
28615144b0fSOlivier Houchard int32 count, i;
28715144b0fSOlivier Houchard int8 inputNum;
28815144b0fSOlivier Houchard
28915144b0fSOlivier Houchard count = 0;
29015144b0fSOlivier Houchard inputNum = 0;
29115144b0fSOlivier Houchard startClock = clock();
29215144b0fSOlivier Houchard do {
29315144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
29415144b0fSOlivier Houchard function( inputs_int64[ inputNum ] );
29515144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
29615144b0fSOlivier Houchard }
29715144b0fSOlivier Houchard count += minIterations;
29815144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
29915144b0fSOlivier Houchard inputNum = 0;
30015144b0fSOlivier Houchard startClock = clock();
30115144b0fSOlivier Houchard for ( i = count; i; --i ) {
30215144b0fSOlivier Houchard function( inputs_int64[ inputNum ] );
30315144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
30415144b0fSOlivier Houchard }
30515144b0fSOlivier Houchard endClock = clock();
30615144b0fSOlivier Houchard reportTime( count, endClock - startClock );
30715144b0fSOlivier Houchard
30815144b0fSOlivier Houchard }
30915144b0fSOlivier Houchard
31015144b0fSOlivier Houchard #ifdef FLOATX80
31115144b0fSOlivier Houchard
time_a_int64_z_floatx80(floatx80 function (int64))31215144b0fSOlivier Houchard static void time_a_int64_z_floatx80( floatx80 function( int64 ) )
31315144b0fSOlivier Houchard {
31415144b0fSOlivier Houchard clock_t startClock, endClock;
31515144b0fSOlivier Houchard int32 count, i;
31615144b0fSOlivier Houchard int8 inputNum;
31715144b0fSOlivier Houchard
31815144b0fSOlivier Houchard count = 0;
31915144b0fSOlivier Houchard inputNum = 0;
32015144b0fSOlivier Houchard startClock = clock();
32115144b0fSOlivier Houchard do {
32215144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
32315144b0fSOlivier Houchard function( inputs_int64[ inputNum ] );
32415144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
32515144b0fSOlivier Houchard }
32615144b0fSOlivier Houchard count += minIterations;
32715144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
32815144b0fSOlivier Houchard inputNum = 0;
32915144b0fSOlivier Houchard startClock = clock();
33015144b0fSOlivier Houchard for ( i = count; i; --i ) {
33115144b0fSOlivier Houchard function( inputs_int64[ inputNum ] );
33215144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
33315144b0fSOlivier Houchard }
33415144b0fSOlivier Houchard endClock = clock();
33515144b0fSOlivier Houchard reportTime( count, endClock - startClock );
33615144b0fSOlivier Houchard
33715144b0fSOlivier Houchard }
33815144b0fSOlivier Houchard
33915144b0fSOlivier Houchard #endif
34015144b0fSOlivier Houchard
34115144b0fSOlivier Houchard #ifdef FLOAT128
34215144b0fSOlivier Houchard
time_a_int64_z_float128(float128 function (int64))34315144b0fSOlivier Houchard static void time_a_int64_z_float128( float128 function( int64 ) )
34415144b0fSOlivier Houchard {
34515144b0fSOlivier Houchard clock_t startClock, endClock;
34615144b0fSOlivier Houchard int32 count, i;
34715144b0fSOlivier Houchard int8 inputNum;
34815144b0fSOlivier Houchard
34915144b0fSOlivier Houchard count = 0;
35015144b0fSOlivier Houchard inputNum = 0;
35115144b0fSOlivier Houchard startClock = clock();
35215144b0fSOlivier Houchard do {
35315144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
35415144b0fSOlivier Houchard function( inputs_int64[ inputNum ] );
35515144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
35615144b0fSOlivier Houchard }
35715144b0fSOlivier Houchard count += minIterations;
35815144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
35915144b0fSOlivier Houchard inputNum = 0;
36015144b0fSOlivier Houchard startClock = clock();
36115144b0fSOlivier Houchard for ( i = count; i; --i ) {
36215144b0fSOlivier Houchard function( inputs_int64[ inputNum ] );
36315144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_int64 - 1 );
36415144b0fSOlivier Houchard }
36515144b0fSOlivier Houchard endClock = clock();
36615144b0fSOlivier Houchard reportTime( count, endClock - startClock );
36715144b0fSOlivier Houchard
36815144b0fSOlivier Houchard }
36915144b0fSOlivier Houchard
37015144b0fSOlivier Houchard #endif
37115144b0fSOlivier Houchard
37215144b0fSOlivier Houchard enum {
37315144b0fSOlivier Houchard numInputs_float32 = 32
37415144b0fSOlivier Houchard };
37515144b0fSOlivier Houchard
37615144b0fSOlivier Houchard static const float32 inputs_float32[ numInputs_float32 ] = {
37715144b0fSOlivier Houchard 0x4EFA0000, 0xC1D0B328, 0x80000000, 0x3E69A31E,
37815144b0fSOlivier Houchard 0xAF803EFF, 0x3F800000, 0x17BF8000, 0xE74A301A,
37915144b0fSOlivier Houchard 0x4E010003, 0x7EE3C75D, 0xBD803FE0, 0xBFFEFF00,
38015144b0fSOlivier Houchard 0x7981F800, 0x431FFFFC, 0xC100C000, 0x3D87EFFF,
38115144b0fSOlivier Houchard 0x4103FEFE, 0xBC000007, 0xBF01F7FF, 0x4E6C6B5C,
38215144b0fSOlivier Houchard 0xC187FFFE, 0xC58B9F13, 0x4F88007F, 0xDF004007,
38315144b0fSOlivier Houchard 0xB7FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
38415144b0fSOlivier Houchard 0xDB428661, 0x33F89B1F, 0xA3BFEFFF, 0x537BFFBE
38515144b0fSOlivier Houchard };
38615144b0fSOlivier Houchard
time_a_float32_z_int32(int32 function (float32))38715144b0fSOlivier Houchard static void time_a_float32_z_int32( int32 function( float32 ) )
38815144b0fSOlivier Houchard {
38915144b0fSOlivier Houchard clock_t startClock, endClock;
39015144b0fSOlivier Houchard int32 count, i;
39115144b0fSOlivier Houchard int8 inputNum;
39215144b0fSOlivier Houchard
39315144b0fSOlivier Houchard count = 0;
39415144b0fSOlivier Houchard inputNum = 0;
39515144b0fSOlivier Houchard startClock = clock();
39615144b0fSOlivier Houchard do {
39715144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
39815144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
39915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
40015144b0fSOlivier Houchard }
40115144b0fSOlivier Houchard count += minIterations;
40215144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
40315144b0fSOlivier Houchard inputNum = 0;
40415144b0fSOlivier Houchard startClock = clock();
40515144b0fSOlivier Houchard for ( i = count; i; --i ) {
40615144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
40715144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
40815144b0fSOlivier Houchard }
40915144b0fSOlivier Houchard endClock = clock();
41015144b0fSOlivier Houchard reportTime( count, endClock - startClock );
41115144b0fSOlivier Houchard
41215144b0fSOlivier Houchard }
41315144b0fSOlivier Houchard
time_a_float32_z_int64(int64 function (float32))41415144b0fSOlivier Houchard static void time_a_float32_z_int64( int64 function( float32 ) )
41515144b0fSOlivier Houchard {
41615144b0fSOlivier Houchard clock_t startClock, endClock;
41715144b0fSOlivier Houchard int32 count, i;
41815144b0fSOlivier Houchard int8 inputNum;
41915144b0fSOlivier Houchard
42015144b0fSOlivier Houchard count = 0;
42115144b0fSOlivier Houchard inputNum = 0;
42215144b0fSOlivier Houchard startClock = clock();
42315144b0fSOlivier Houchard do {
42415144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
42515144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
42615144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
42715144b0fSOlivier Houchard }
42815144b0fSOlivier Houchard count += minIterations;
42915144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
43015144b0fSOlivier Houchard inputNum = 0;
43115144b0fSOlivier Houchard startClock = clock();
43215144b0fSOlivier Houchard for ( i = count; i; --i ) {
43315144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
43415144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
43515144b0fSOlivier Houchard }
43615144b0fSOlivier Houchard endClock = clock();
43715144b0fSOlivier Houchard reportTime( count, endClock - startClock );
43815144b0fSOlivier Houchard
43915144b0fSOlivier Houchard }
44015144b0fSOlivier Houchard
time_a_float32_z_float64(float64 function (float32))44115144b0fSOlivier Houchard static void time_a_float32_z_float64( float64 function( float32 ) )
44215144b0fSOlivier Houchard {
44315144b0fSOlivier Houchard clock_t startClock, endClock;
44415144b0fSOlivier Houchard int32 count, i;
44515144b0fSOlivier Houchard int8 inputNum;
44615144b0fSOlivier Houchard
44715144b0fSOlivier Houchard count = 0;
44815144b0fSOlivier Houchard inputNum = 0;
44915144b0fSOlivier Houchard startClock = clock();
45015144b0fSOlivier Houchard do {
45115144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
45215144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
45315144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
45415144b0fSOlivier Houchard }
45515144b0fSOlivier Houchard count += minIterations;
45615144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
45715144b0fSOlivier Houchard inputNum = 0;
45815144b0fSOlivier Houchard startClock = clock();
45915144b0fSOlivier Houchard for ( i = count; i; --i ) {
46015144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
46115144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
46215144b0fSOlivier Houchard }
46315144b0fSOlivier Houchard endClock = clock();
46415144b0fSOlivier Houchard reportTime( count, endClock - startClock );
46515144b0fSOlivier Houchard
46615144b0fSOlivier Houchard }
46715144b0fSOlivier Houchard
46815144b0fSOlivier Houchard #ifdef FLOATX80
46915144b0fSOlivier Houchard
time_a_float32_z_floatx80(floatx80 function (float32))47015144b0fSOlivier Houchard static void time_a_float32_z_floatx80( floatx80 function( float32 ) )
47115144b0fSOlivier Houchard {
47215144b0fSOlivier Houchard clock_t startClock, endClock;
47315144b0fSOlivier Houchard int32 count, i;
47415144b0fSOlivier Houchard int8 inputNum;
47515144b0fSOlivier Houchard
47615144b0fSOlivier Houchard count = 0;
47715144b0fSOlivier Houchard inputNum = 0;
47815144b0fSOlivier Houchard startClock = clock();
47915144b0fSOlivier Houchard do {
48015144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
48115144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
48215144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
48315144b0fSOlivier Houchard }
48415144b0fSOlivier Houchard count += minIterations;
48515144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
48615144b0fSOlivier Houchard inputNum = 0;
48715144b0fSOlivier Houchard startClock = clock();
48815144b0fSOlivier Houchard for ( i = count; i; --i ) {
48915144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
49015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
49115144b0fSOlivier Houchard }
49215144b0fSOlivier Houchard endClock = clock();
49315144b0fSOlivier Houchard reportTime( count, endClock - startClock );
49415144b0fSOlivier Houchard
49515144b0fSOlivier Houchard }
49615144b0fSOlivier Houchard
49715144b0fSOlivier Houchard #endif
49815144b0fSOlivier Houchard
49915144b0fSOlivier Houchard #ifdef FLOAT128
50015144b0fSOlivier Houchard
time_a_float32_z_float128(float128 function (float32))50115144b0fSOlivier Houchard static void time_a_float32_z_float128( float128 function( float32 ) )
50215144b0fSOlivier Houchard {
50315144b0fSOlivier Houchard clock_t startClock, endClock;
50415144b0fSOlivier Houchard int32 count, i;
50515144b0fSOlivier Houchard int8 inputNum;
50615144b0fSOlivier Houchard
50715144b0fSOlivier Houchard count = 0;
50815144b0fSOlivier Houchard inputNum = 0;
50915144b0fSOlivier Houchard startClock = clock();
51015144b0fSOlivier Houchard do {
51115144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
51215144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
51315144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
51415144b0fSOlivier Houchard }
51515144b0fSOlivier Houchard count += minIterations;
51615144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
51715144b0fSOlivier Houchard inputNum = 0;
51815144b0fSOlivier Houchard startClock = clock();
51915144b0fSOlivier Houchard for ( i = count; i; --i ) {
52015144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
52115144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
52215144b0fSOlivier Houchard }
52315144b0fSOlivier Houchard endClock = clock();
52415144b0fSOlivier Houchard reportTime( count, endClock - startClock );
52515144b0fSOlivier Houchard
52615144b0fSOlivier Houchard }
52715144b0fSOlivier Houchard
52815144b0fSOlivier Houchard #endif
52915144b0fSOlivier Houchard
time_az_float32(float32 function (float32))53015144b0fSOlivier Houchard static void time_az_float32( float32 function( float32 ) )
53115144b0fSOlivier Houchard {
53215144b0fSOlivier Houchard clock_t startClock, endClock;
53315144b0fSOlivier Houchard int32 count, i;
53415144b0fSOlivier Houchard int8 inputNum;
53515144b0fSOlivier Houchard
53615144b0fSOlivier Houchard count = 0;
53715144b0fSOlivier Houchard inputNum = 0;
53815144b0fSOlivier Houchard startClock = clock();
53915144b0fSOlivier Houchard do {
54015144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
54115144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
54215144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
54315144b0fSOlivier Houchard }
54415144b0fSOlivier Houchard count += minIterations;
54515144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
54615144b0fSOlivier Houchard inputNum = 0;
54715144b0fSOlivier Houchard startClock = clock();
54815144b0fSOlivier Houchard for ( i = count; i; --i ) {
54915144b0fSOlivier Houchard function( inputs_float32[ inputNum ] );
55015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
55115144b0fSOlivier Houchard }
55215144b0fSOlivier Houchard endClock = clock();
55315144b0fSOlivier Houchard reportTime( count, endClock - startClock );
55415144b0fSOlivier Houchard
55515144b0fSOlivier Houchard }
55615144b0fSOlivier Houchard
time_ab_float32_z_flag(flag function (float32,float32))55715144b0fSOlivier Houchard static void time_ab_float32_z_flag( flag function( float32, float32 ) )
55815144b0fSOlivier Houchard {
55915144b0fSOlivier Houchard clock_t startClock, endClock;
56015144b0fSOlivier Houchard int32 count, i;
56115144b0fSOlivier Houchard int8 inputNumA, inputNumB;
56215144b0fSOlivier Houchard
56315144b0fSOlivier Houchard count = 0;
56415144b0fSOlivier Houchard inputNumA = 0;
56515144b0fSOlivier Houchard inputNumB = 0;
56615144b0fSOlivier Houchard startClock = clock();
56715144b0fSOlivier Houchard do {
56815144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
56915144b0fSOlivier Houchard function(
57015144b0fSOlivier Houchard inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
57115144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
57215144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
57315144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
57415144b0fSOlivier Houchard }
57515144b0fSOlivier Houchard count += minIterations;
57615144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
57715144b0fSOlivier Houchard inputNumA = 0;
57815144b0fSOlivier Houchard inputNumB = 0;
57915144b0fSOlivier Houchard startClock = clock();
58015144b0fSOlivier Houchard for ( i = count; i; --i ) {
58115144b0fSOlivier Houchard function(
58215144b0fSOlivier Houchard inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
58315144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
58415144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
58515144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
58615144b0fSOlivier Houchard }
58715144b0fSOlivier Houchard endClock = clock();
58815144b0fSOlivier Houchard reportTime( count, endClock - startClock );
58915144b0fSOlivier Houchard
59015144b0fSOlivier Houchard }
59115144b0fSOlivier Houchard
time_abz_float32(float32 function (float32,float32))59215144b0fSOlivier Houchard static void time_abz_float32( float32 function( float32, float32 ) )
59315144b0fSOlivier Houchard {
59415144b0fSOlivier Houchard clock_t startClock, endClock;
59515144b0fSOlivier Houchard int32 count, i;
59615144b0fSOlivier Houchard int8 inputNumA, inputNumB;
59715144b0fSOlivier Houchard
59815144b0fSOlivier Houchard count = 0;
59915144b0fSOlivier Houchard inputNumA = 0;
60015144b0fSOlivier Houchard inputNumB = 0;
60115144b0fSOlivier Houchard startClock = clock();
60215144b0fSOlivier Houchard do {
60315144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
60415144b0fSOlivier Houchard function(
60515144b0fSOlivier Houchard inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
60615144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
60715144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
60815144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
60915144b0fSOlivier Houchard }
61015144b0fSOlivier Houchard count += minIterations;
61115144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
61215144b0fSOlivier Houchard inputNumA = 0;
61315144b0fSOlivier Houchard inputNumB = 0;
61415144b0fSOlivier Houchard startClock = clock();
61515144b0fSOlivier Houchard for ( i = count; i; --i ) {
61615144b0fSOlivier Houchard function(
61715144b0fSOlivier Houchard inputs_float32[ inputNumA ], inputs_float32[ inputNumB ] );
61815144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float32 - 1 );
61915144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
62015144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float32 - 1 );
62115144b0fSOlivier Houchard }
62215144b0fSOlivier Houchard endClock = clock();
62315144b0fSOlivier Houchard reportTime( count, endClock - startClock );
62415144b0fSOlivier Houchard
62515144b0fSOlivier Houchard }
62615144b0fSOlivier Houchard
62715144b0fSOlivier Houchard static const float32 inputs_float32_pos[ numInputs_float32 ] = {
62815144b0fSOlivier Houchard 0x4EFA0000, 0x41D0B328, 0x00000000, 0x3E69A31E,
62915144b0fSOlivier Houchard 0x2F803EFF, 0x3F800000, 0x17BF8000, 0x674A301A,
63015144b0fSOlivier Houchard 0x4E010003, 0x7EE3C75D, 0x3D803FE0, 0x3FFEFF00,
63115144b0fSOlivier Houchard 0x7981F800, 0x431FFFFC, 0x4100C000, 0x3D87EFFF,
63215144b0fSOlivier Houchard 0x4103FEFE, 0x3C000007, 0x3F01F7FF, 0x4E6C6B5C,
63315144b0fSOlivier Houchard 0x4187FFFE, 0x458B9F13, 0x4F88007F, 0x5F004007,
63415144b0fSOlivier Houchard 0x37FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
63515144b0fSOlivier Houchard 0x5B428661, 0x33F89B1F, 0x23BFEFFF, 0x537BFFBE
63615144b0fSOlivier Houchard };
63715144b0fSOlivier Houchard
time_az_float32_pos(float32 function (float32))63815144b0fSOlivier Houchard static void time_az_float32_pos( float32 function( float32 ) )
63915144b0fSOlivier Houchard {
64015144b0fSOlivier Houchard clock_t startClock, endClock;
64115144b0fSOlivier Houchard int32 count, i;
64215144b0fSOlivier Houchard int8 inputNum;
64315144b0fSOlivier Houchard
64415144b0fSOlivier Houchard count = 0;
64515144b0fSOlivier Houchard inputNum = 0;
64615144b0fSOlivier Houchard startClock = clock();
64715144b0fSOlivier Houchard do {
64815144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
64915144b0fSOlivier Houchard function( inputs_float32_pos[ inputNum ] );
65015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
65115144b0fSOlivier Houchard }
65215144b0fSOlivier Houchard count += minIterations;
65315144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
65415144b0fSOlivier Houchard inputNum = 0;
65515144b0fSOlivier Houchard startClock = clock();
65615144b0fSOlivier Houchard for ( i = count; i; --i ) {
65715144b0fSOlivier Houchard function( inputs_float32_pos[ inputNum ] );
65815144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float32 - 1 );
65915144b0fSOlivier Houchard }
66015144b0fSOlivier Houchard endClock = clock();
66115144b0fSOlivier Houchard reportTime( count, endClock - startClock );
66215144b0fSOlivier Houchard
66315144b0fSOlivier Houchard }
66415144b0fSOlivier Houchard
66515144b0fSOlivier Houchard enum {
66615144b0fSOlivier Houchard numInputs_float64 = 32
66715144b0fSOlivier Houchard };
66815144b0fSOlivier Houchard
66915144b0fSOlivier Houchard static const float64 inputs_float64[ numInputs_float64 ] = {
67015144b0fSOlivier Houchard LIT64( 0x422FFFC008000000 ),
67115144b0fSOlivier Houchard LIT64( 0xB7E0000480000000 ),
67215144b0fSOlivier Houchard LIT64( 0xF3FD2546120B7935 ),
67315144b0fSOlivier Houchard LIT64( 0x3FF0000000000000 ),
67415144b0fSOlivier Houchard LIT64( 0xCE07F766F09588D6 ),
67515144b0fSOlivier Houchard LIT64( 0x8000000000000000 ),
67615144b0fSOlivier Houchard LIT64( 0x3FCE000400000000 ),
67715144b0fSOlivier Houchard LIT64( 0x8313B60F0032BED8 ),
67815144b0fSOlivier Houchard LIT64( 0xC1EFFFFFC0002000 ),
67915144b0fSOlivier Houchard LIT64( 0x3FB3C75D224F2B0F ),
68015144b0fSOlivier Houchard LIT64( 0x7FD00000004000FF ),
68115144b0fSOlivier Houchard LIT64( 0xA12FFF8000001FFF ),
68215144b0fSOlivier Houchard LIT64( 0x3EE0000000FE0000 ),
68315144b0fSOlivier Houchard LIT64( 0x0010000080000004 ),
68415144b0fSOlivier Houchard LIT64( 0x41CFFFFE00000020 ),
68515144b0fSOlivier Houchard LIT64( 0x40303FFFFFFFFFFD ),
68615144b0fSOlivier Houchard LIT64( 0x3FD000003FEFFFFF ),
68715144b0fSOlivier Houchard LIT64( 0xBFD0000010000000 ),
68815144b0fSOlivier Houchard LIT64( 0xB7FC6B5C16CA55CF ),
68915144b0fSOlivier Houchard LIT64( 0x413EEB940B9D1301 ),
69015144b0fSOlivier Houchard LIT64( 0xC7E00200001FFFFF ),
69115144b0fSOlivier Houchard LIT64( 0x47F00021FFFFFFFE ),
69215144b0fSOlivier Houchard LIT64( 0xBFFFFFFFF80000FF ),
69315144b0fSOlivier Houchard LIT64( 0xC07FFFFFE00FFFFF ),
69415144b0fSOlivier Houchard LIT64( 0x001497A63740C5E8 ),
69515144b0fSOlivier Houchard LIT64( 0xC4BFFFE0001FFFFF ),
69615144b0fSOlivier Houchard LIT64( 0x96FFDFFEFFFFFFFF ),
69715144b0fSOlivier Houchard LIT64( 0x403FC000000001FE ),
69815144b0fSOlivier Houchard LIT64( 0xFFD00000000001F6 ),
69915144b0fSOlivier Houchard LIT64( 0x0640400002000000 ),
70015144b0fSOlivier Houchard LIT64( 0x479CEE1E4F789FE0 ),
70115144b0fSOlivier Houchard LIT64( 0xC237FFFFFFFFFDFE )
70215144b0fSOlivier Houchard };
70315144b0fSOlivier Houchard
time_a_float64_z_int32(int32 function (float64))70415144b0fSOlivier Houchard static void time_a_float64_z_int32( int32 function( float64 ) )
70515144b0fSOlivier Houchard {
70615144b0fSOlivier Houchard clock_t startClock, endClock;
70715144b0fSOlivier Houchard int32 count, i;
70815144b0fSOlivier Houchard int8 inputNum;
70915144b0fSOlivier Houchard
71015144b0fSOlivier Houchard count = 0;
71115144b0fSOlivier Houchard inputNum = 0;
71215144b0fSOlivier Houchard startClock = clock();
71315144b0fSOlivier Houchard do {
71415144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
71515144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
71615144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
71715144b0fSOlivier Houchard }
71815144b0fSOlivier Houchard count += minIterations;
71915144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
72015144b0fSOlivier Houchard inputNum = 0;
72115144b0fSOlivier Houchard startClock = clock();
72215144b0fSOlivier Houchard for ( i = count; i; --i ) {
72315144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
72415144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
72515144b0fSOlivier Houchard }
72615144b0fSOlivier Houchard endClock = clock();
72715144b0fSOlivier Houchard reportTime( count, endClock - startClock );
72815144b0fSOlivier Houchard
72915144b0fSOlivier Houchard }
73015144b0fSOlivier Houchard
time_a_float64_z_int64(int64 function (float64))73115144b0fSOlivier Houchard static void time_a_float64_z_int64( int64 function( float64 ) )
73215144b0fSOlivier Houchard {
73315144b0fSOlivier Houchard clock_t startClock, endClock;
73415144b0fSOlivier Houchard int32 count, i;
73515144b0fSOlivier Houchard int8 inputNum;
73615144b0fSOlivier Houchard
73715144b0fSOlivier Houchard count = 0;
73815144b0fSOlivier Houchard inputNum = 0;
73915144b0fSOlivier Houchard startClock = clock();
74015144b0fSOlivier Houchard do {
74115144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
74215144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
74315144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
74415144b0fSOlivier Houchard }
74515144b0fSOlivier Houchard count += minIterations;
74615144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
74715144b0fSOlivier Houchard inputNum = 0;
74815144b0fSOlivier Houchard startClock = clock();
74915144b0fSOlivier Houchard for ( i = count; i; --i ) {
75015144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
75115144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
75215144b0fSOlivier Houchard }
75315144b0fSOlivier Houchard endClock = clock();
75415144b0fSOlivier Houchard reportTime( count, endClock - startClock );
75515144b0fSOlivier Houchard
75615144b0fSOlivier Houchard }
75715144b0fSOlivier Houchard
time_a_float64_z_float32(float32 function (float64))75815144b0fSOlivier Houchard static void time_a_float64_z_float32( float32 function( float64 ) )
75915144b0fSOlivier Houchard {
76015144b0fSOlivier Houchard clock_t startClock, endClock;
76115144b0fSOlivier Houchard int32 count, i;
76215144b0fSOlivier Houchard int8 inputNum;
76315144b0fSOlivier Houchard
76415144b0fSOlivier Houchard count = 0;
76515144b0fSOlivier Houchard inputNum = 0;
76615144b0fSOlivier Houchard startClock = clock();
76715144b0fSOlivier Houchard do {
76815144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
76915144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
77015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
77115144b0fSOlivier Houchard }
77215144b0fSOlivier Houchard count += minIterations;
77315144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
77415144b0fSOlivier Houchard inputNum = 0;
77515144b0fSOlivier Houchard startClock = clock();
77615144b0fSOlivier Houchard for ( i = count; i; --i ) {
77715144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
77815144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
77915144b0fSOlivier Houchard }
78015144b0fSOlivier Houchard endClock = clock();
78115144b0fSOlivier Houchard reportTime( count, endClock - startClock );
78215144b0fSOlivier Houchard
78315144b0fSOlivier Houchard }
78415144b0fSOlivier Houchard
78515144b0fSOlivier Houchard #ifdef FLOATX80
78615144b0fSOlivier Houchard
time_a_float64_z_floatx80(floatx80 function (float64))78715144b0fSOlivier Houchard static void time_a_float64_z_floatx80( floatx80 function( float64 ) )
78815144b0fSOlivier Houchard {
78915144b0fSOlivier Houchard clock_t startClock, endClock;
79015144b0fSOlivier Houchard int32 count, i;
79115144b0fSOlivier Houchard int8 inputNum;
79215144b0fSOlivier Houchard
79315144b0fSOlivier Houchard count = 0;
79415144b0fSOlivier Houchard inputNum = 0;
79515144b0fSOlivier Houchard startClock = clock();
79615144b0fSOlivier Houchard do {
79715144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
79815144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
79915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
80015144b0fSOlivier Houchard }
80115144b0fSOlivier Houchard count += minIterations;
80215144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
80315144b0fSOlivier Houchard inputNum = 0;
80415144b0fSOlivier Houchard startClock = clock();
80515144b0fSOlivier Houchard for ( i = count; i; --i ) {
80615144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
80715144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
80815144b0fSOlivier Houchard }
80915144b0fSOlivier Houchard endClock = clock();
81015144b0fSOlivier Houchard reportTime( count, endClock - startClock );
81115144b0fSOlivier Houchard
81215144b0fSOlivier Houchard }
81315144b0fSOlivier Houchard
81415144b0fSOlivier Houchard #endif
81515144b0fSOlivier Houchard
81615144b0fSOlivier Houchard #ifdef FLOAT128
81715144b0fSOlivier Houchard
time_a_float64_z_float128(float128 function (float64))81815144b0fSOlivier Houchard static void time_a_float64_z_float128( float128 function( float64 ) )
81915144b0fSOlivier Houchard {
82015144b0fSOlivier Houchard clock_t startClock, endClock;
82115144b0fSOlivier Houchard int32 count, i;
82215144b0fSOlivier Houchard int8 inputNum;
82315144b0fSOlivier Houchard
82415144b0fSOlivier Houchard count = 0;
82515144b0fSOlivier Houchard inputNum = 0;
82615144b0fSOlivier Houchard startClock = clock();
82715144b0fSOlivier Houchard do {
82815144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
82915144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
83015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
83115144b0fSOlivier Houchard }
83215144b0fSOlivier Houchard count += minIterations;
83315144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
83415144b0fSOlivier Houchard inputNum = 0;
83515144b0fSOlivier Houchard startClock = clock();
83615144b0fSOlivier Houchard for ( i = count; i; --i ) {
83715144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
83815144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
83915144b0fSOlivier Houchard }
84015144b0fSOlivier Houchard endClock = clock();
84115144b0fSOlivier Houchard reportTime( count, endClock - startClock );
84215144b0fSOlivier Houchard
84315144b0fSOlivier Houchard }
84415144b0fSOlivier Houchard
84515144b0fSOlivier Houchard #endif
84615144b0fSOlivier Houchard
time_az_float64(float64 function (float64))84715144b0fSOlivier Houchard static void time_az_float64( float64 function( float64 ) )
84815144b0fSOlivier Houchard {
84915144b0fSOlivier Houchard clock_t startClock, endClock;
85015144b0fSOlivier Houchard int32 count, i;
85115144b0fSOlivier Houchard int8 inputNum;
85215144b0fSOlivier Houchard
85315144b0fSOlivier Houchard count = 0;
85415144b0fSOlivier Houchard inputNum = 0;
85515144b0fSOlivier Houchard startClock = clock();
85615144b0fSOlivier Houchard do {
85715144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
85815144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
85915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
86015144b0fSOlivier Houchard }
86115144b0fSOlivier Houchard count += minIterations;
86215144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
86315144b0fSOlivier Houchard inputNum = 0;
86415144b0fSOlivier Houchard startClock = clock();
86515144b0fSOlivier Houchard for ( i = count; i; --i ) {
86615144b0fSOlivier Houchard function( inputs_float64[ inputNum ] );
86715144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
86815144b0fSOlivier Houchard }
86915144b0fSOlivier Houchard endClock = clock();
87015144b0fSOlivier Houchard reportTime( count, endClock - startClock );
87115144b0fSOlivier Houchard
87215144b0fSOlivier Houchard }
87315144b0fSOlivier Houchard
time_ab_float64_z_flag(flag function (float64,float64))87415144b0fSOlivier Houchard static void time_ab_float64_z_flag( flag function( float64, float64 ) )
87515144b0fSOlivier Houchard {
87615144b0fSOlivier Houchard clock_t startClock, endClock;
87715144b0fSOlivier Houchard int32 count, i;
87815144b0fSOlivier Houchard int8 inputNumA, inputNumB;
87915144b0fSOlivier Houchard
88015144b0fSOlivier Houchard count = 0;
88115144b0fSOlivier Houchard inputNumA = 0;
88215144b0fSOlivier Houchard inputNumB = 0;
88315144b0fSOlivier Houchard startClock = clock();
88415144b0fSOlivier Houchard do {
88515144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
88615144b0fSOlivier Houchard function(
88715144b0fSOlivier Houchard inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
88815144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
88915144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
89015144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
89115144b0fSOlivier Houchard }
89215144b0fSOlivier Houchard count += minIterations;
89315144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
89415144b0fSOlivier Houchard inputNumA = 0;
89515144b0fSOlivier Houchard inputNumB = 0;
89615144b0fSOlivier Houchard startClock = clock();
89715144b0fSOlivier Houchard for ( i = count; i; --i ) {
89815144b0fSOlivier Houchard function(
89915144b0fSOlivier Houchard inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
90015144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
90115144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
90215144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
90315144b0fSOlivier Houchard }
90415144b0fSOlivier Houchard endClock = clock();
90515144b0fSOlivier Houchard reportTime( count, endClock - startClock );
90615144b0fSOlivier Houchard
90715144b0fSOlivier Houchard }
90815144b0fSOlivier Houchard
time_abz_float64(float64 function (float64,float64))90915144b0fSOlivier Houchard static void time_abz_float64( float64 function( float64, float64 ) )
91015144b0fSOlivier Houchard {
91115144b0fSOlivier Houchard clock_t startClock, endClock;
91215144b0fSOlivier Houchard int32 count, i;
91315144b0fSOlivier Houchard int8 inputNumA, inputNumB;
91415144b0fSOlivier Houchard
91515144b0fSOlivier Houchard count = 0;
91615144b0fSOlivier Houchard inputNumA = 0;
91715144b0fSOlivier Houchard inputNumB = 0;
91815144b0fSOlivier Houchard startClock = clock();
91915144b0fSOlivier Houchard do {
92015144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
92115144b0fSOlivier Houchard function(
92215144b0fSOlivier Houchard inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
92315144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
92415144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
92515144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
92615144b0fSOlivier Houchard }
92715144b0fSOlivier Houchard count += minIterations;
92815144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
92915144b0fSOlivier Houchard inputNumA = 0;
93015144b0fSOlivier Houchard inputNumB = 0;
93115144b0fSOlivier Houchard startClock = clock();
93215144b0fSOlivier Houchard for ( i = count; i; --i ) {
93315144b0fSOlivier Houchard function(
93415144b0fSOlivier Houchard inputs_float64[ inputNumA ], inputs_float64[ inputNumB ] );
93515144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float64 - 1 );
93615144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
93715144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float64 - 1 );
93815144b0fSOlivier Houchard }
93915144b0fSOlivier Houchard endClock = clock();
94015144b0fSOlivier Houchard reportTime( count, endClock - startClock );
94115144b0fSOlivier Houchard
94215144b0fSOlivier Houchard }
94315144b0fSOlivier Houchard
94415144b0fSOlivier Houchard static const float64 inputs_float64_pos[ numInputs_float64 ] = {
94515144b0fSOlivier Houchard LIT64( 0x422FFFC008000000 ),
94615144b0fSOlivier Houchard LIT64( 0x37E0000480000000 ),
94715144b0fSOlivier Houchard LIT64( 0x73FD2546120B7935 ),
94815144b0fSOlivier Houchard LIT64( 0x3FF0000000000000 ),
94915144b0fSOlivier Houchard LIT64( 0x4E07F766F09588D6 ),
95015144b0fSOlivier Houchard LIT64( 0x0000000000000000 ),
95115144b0fSOlivier Houchard LIT64( 0x3FCE000400000000 ),
95215144b0fSOlivier Houchard LIT64( 0x0313B60F0032BED8 ),
95315144b0fSOlivier Houchard LIT64( 0x41EFFFFFC0002000 ),
95415144b0fSOlivier Houchard LIT64( 0x3FB3C75D224F2B0F ),
95515144b0fSOlivier Houchard LIT64( 0x7FD00000004000FF ),
95615144b0fSOlivier Houchard LIT64( 0x212FFF8000001FFF ),
95715144b0fSOlivier Houchard LIT64( 0x3EE0000000FE0000 ),
95815144b0fSOlivier Houchard LIT64( 0x0010000080000004 ),
95915144b0fSOlivier Houchard LIT64( 0x41CFFFFE00000020 ),
96015144b0fSOlivier Houchard LIT64( 0x40303FFFFFFFFFFD ),
96115144b0fSOlivier Houchard LIT64( 0x3FD000003FEFFFFF ),
96215144b0fSOlivier Houchard LIT64( 0x3FD0000010000000 ),
96315144b0fSOlivier Houchard LIT64( 0x37FC6B5C16CA55CF ),
96415144b0fSOlivier Houchard LIT64( 0x413EEB940B9D1301 ),
96515144b0fSOlivier Houchard LIT64( 0x47E00200001FFFFF ),
96615144b0fSOlivier Houchard LIT64( 0x47F00021FFFFFFFE ),
96715144b0fSOlivier Houchard LIT64( 0x3FFFFFFFF80000FF ),
96815144b0fSOlivier Houchard LIT64( 0x407FFFFFE00FFFFF ),
96915144b0fSOlivier Houchard LIT64( 0x001497A63740C5E8 ),
97015144b0fSOlivier Houchard LIT64( 0x44BFFFE0001FFFFF ),
97115144b0fSOlivier Houchard LIT64( 0x16FFDFFEFFFFFFFF ),
97215144b0fSOlivier Houchard LIT64( 0x403FC000000001FE ),
97315144b0fSOlivier Houchard LIT64( 0x7FD00000000001F6 ),
97415144b0fSOlivier Houchard LIT64( 0x0640400002000000 ),
97515144b0fSOlivier Houchard LIT64( 0x479CEE1E4F789FE0 ),
97615144b0fSOlivier Houchard LIT64( 0x4237FFFFFFFFFDFE )
97715144b0fSOlivier Houchard };
97815144b0fSOlivier Houchard
time_az_float64_pos(float64 function (float64))97915144b0fSOlivier Houchard static void time_az_float64_pos( float64 function( float64 ) )
98015144b0fSOlivier Houchard {
98115144b0fSOlivier Houchard clock_t startClock, endClock;
98215144b0fSOlivier Houchard int32 count, i;
98315144b0fSOlivier Houchard int8 inputNum;
98415144b0fSOlivier Houchard
98515144b0fSOlivier Houchard count = 0;
98615144b0fSOlivier Houchard inputNum = 0;
98715144b0fSOlivier Houchard startClock = clock();
98815144b0fSOlivier Houchard do {
98915144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
99015144b0fSOlivier Houchard function( inputs_float64_pos[ inputNum ] );
99115144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
99215144b0fSOlivier Houchard }
99315144b0fSOlivier Houchard count += minIterations;
99415144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
99515144b0fSOlivier Houchard inputNum = 0;
99615144b0fSOlivier Houchard startClock = clock();
99715144b0fSOlivier Houchard for ( i = count; i; --i ) {
99815144b0fSOlivier Houchard function( inputs_float64_pos[ inputNum ] );
99915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float64 - 1 );
100015144b0fSOlivier Houchard }
100115144b0fSOlivier Houchard endClock = clock();
100215144b0fSOlivier Houchard reportTime( count, endClock - startClock );
100315144b0fSOlivier Houchard
100415144b0fSOlivier Houchard }
100515144b0fSOlivier Houchard
100615144b0fSOlivier Houchard #ifdef FLOATX80
100715144b0fSOlivier Houchard
100815144b0fSOlivier Houchard enum {
100915144b0fSOlivier Houchard numInputs_floatx80 = 32
101015144b0fSOlivier Houchard };
101115144b0fSOlivier Houchard
101215144b0fSOlivier Houchard static const struct {
101315144b0fSOlivier Houchard bits16 high;
101415144b0fSOlivier Houchard bits64 low;
101515144b0fSOlivier Houchard } inputs_floatx80[ numInputs_floatx80 ] = {
101615144b0fSOlivier Houchard { 0xC03F, LIT64( 0xA9BE15A19C1E8B62 ) },
101715144b0fSOlivier Houchard { 0x8000, LIT64( 0x0000000000000000 ) },
101815144b0fSOlivier Houchard { 0x75A8, LIT64( 0xE59591E4788957A5 ) },
101915144b0fSOlivier Houchard { 0xBFFF, LIT64( 0xFFF0000000000040 ) },
102015144b0fSOlivier Houchard { 0x0CD8, LIT64( 0xFC000000000007FE ) },
102115144b0fSOlivier Houchard { 0x43BA, LIT64( 0x99A4000000000000 ) },
102215144b0fSOlivier Houchard { 0x3FFF, LIT64( 0x8000000000000000 ) },
102315144b0fSOlivier Houchard { 0x4081, LIT64( 0x94FBF1BCEB5545F0 ) },
102415144b0fSOlivier Houchard { 0x403E, LIT64( 0xFFF0000000002000 ) },
102515144b0fSOlivier Houchard { 0x3FFE, LIT64( 0xC860E3C75D224F28 ) },
102615144b0fSOlivier Houchard { 0x407E, LIT64( 0xFC00000FFFFFFFFE ) },
102715144b0fSOlivier Houchard { 0x737A, LIT64( 0x800000007FFDFFFE ) },
102815144b0fSOlivier Houchard { 0x4044, LIT64( 0xFFFFFF80000FFFFF ) },
102915144b0fSOlivier Houchard { 0xBBFE, LIT64( 0x8000040000001FFE ) },
103015144b0fSOlivier Houchard { 0xC002, LIT64( 0xFF80000000000020 ) },
103115144b0fSOlivier Houchard { 0xDE8D, LIT64( 0xFFFFFFFFFFE00004 ) },
103215144b0fSOlivier Houchard { 0xC004, LIT64( 0x8000000000003FFB ) },
103315144b0fSOlivier Houchard { 0x407F, LIT64( 0x800000000003FFFE ) },
103415144b0fSOlivier Houchard { 0xC000, LIT64( 0xA459EE6A5C16CA55 ) },
103515144b0fSOlivier Houchard { 0x8003, LIT64( 0xC42CBF7399AEEB94 ) },
103615144b0fSOlivier Houchard { 0xBF7F, LIT64( 0xF800000000000006 ) },
103715144b0fSOlivier Houchard { 0xC07F, LIT64( 0xBF56BE8871F28FEA ) },
103815144b0fSOlivier Houchard { 0xC07E, LIT64( 0xFFFF77FFFFFFFFFE ) },
103915144b0fSOlivier Houchard { 0xADC9, LIT64( 0x8000000FFFFFFFDE ) },
104015144b0fSOlivier Houchard { 0xC001, LIT64( 0xEFF7FFFFFFFFFFFF ) },
104115144b0fSOlivier Houchard { 0x4001, LIT64( 0xBE84F30125C497A6 ) },
104215144b0fSOlivier Houchard { 0xC06B, LIT64( 0xEFFFFFFFFFFFFFFF ) },
104315144b0fSOlivier Houchard { 0x4080, LIT64( 0xFFFFFFFFBFFFFFFF ) },
104415144b0fSOlivier Houchard { 0x87E9, LIT64( 0x81FFFFFFFFFFFBFF ) },
104515144b0fSOlivier Houchard { 0xA63F, LIT64( 0x801FFFFFFEFFFFFE ) },
104615144b0fSOlivier Houchard { 0x403C, LIT64( 0x801FFFFFFFF7FFFF ) },
104715144b0fSOlivier Houchard { 0x4018, LIT64( 0x8000000000080003 ) }
104815144b0fSOlivier Houchard };
104915144b0fSOlivier Houchard
time_a_floatx80_z_int32(int32 function (floatx80))105015144b0fSOlivier Houchard static void time_a_floatx80_z_int32( int32 function( floatx80 ) )
105115144b0fSOlivier Houchard {
105215144b0fSOlivier Houchard clock_t startClock, endClock;
105315144b0fSOlivier Houchard int32 count, i;
105415144b0fSOlivier Houchard int8 inputNum;
105515144b0fSOlivier Houchard floatx80 a;
105615144b0fSOlivier Houchard
105715144b0fSOlivier Houchard count = 0;
105815144b0fSOlivier Houchard inputNum = 0;
105915144b0fSOlivier Houchard startClock = clock();
106015144b0fSOlivier Houchard do {
106115144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
106215144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
106315144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
106415144b0fSOlivier Houchard function( a );
106515144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
106615144b0fSOlivier Houchard }
106715144b0fSOlivier Houchard count += minIterations;
106815144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
106915144b0fSOlivier Houchard inputNum = 0;
107015144b0fSOlivier Houchard startClock = clock();
107115144b0fSOlivier Houchard for ( i = count; i; --i ) {
107215144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
107315144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
107415144b0fSOlivier Houchard function( a );
107515144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
107615144b0fSOlivier Houchard }
107715144b0fSOlivier Houchard endClock = clock();
107815144b0fSOlivier Houchard reportTime( count, endClock - startClock );
107915144b0fSOlivier Houchard
108015144b0fSOlivier Houchard }
108115144b0fSOlivier Houchard
time_a_floatx80_z_int64(int64 function (floatx80))108215144b0fSOlivier Houchard static void time_a_floatx80_z_int64( int64 function( floatx80 ) )
108315144b0fSOlivier Houchard {
108415144b0fSOlivier Houchard clock_t startClock, endClock;
108515144b0fSOlivier Houchard int32 count, i;
108615144b0fSOlivier Houchard int8 inputNum;
108715144b0fSOlivier Houchard floatx80 a;
108815144b0fSOlivier Houchard
108915144b0fSOlivier Houchard count = 0;
109015144b0fSOlivier Houchard inputNum = 0;
109115144b0fSOlivier Houchard startClock = clock();
109215144b0fSOlivier Houchard do {
109315144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
109415144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
109515144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
109615144b0fSOlivier Houchard function( a );
109715144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
109815144b0fSOlivier Houchard }
109915144b0fSOlivier Houchard count += minIterations;
110015144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
110115144b0fSOlivier Houchard inputNum = 0;
110215144b0fSOlivier Houchard startClock = clock();
110315144b0fSOlivier Houchard for ( i = count; i; --i ) {
110415144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
110515144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
110615144b0fSOlivier Houchard function( a );
110715144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
110815144b0fSOlivier Houchard }
110915144b0fSOlivier Houchard endClock = clock();
111015144b0fSOlivier Houchard reportTime( count, endClock - startClock );
111115144b0fSOlivier Houchard
111215144b0fSOlivier Houchard }
111315144b0fSOlivier Houchard
time_a_floatx80_z_float32(float32 function (floatx80))111415144b0fSOlivier Houchard static void time_a_floatx80_z_float32( float32 function( floatx80 ) )
111515144b0fSOlivier Houchard {
111615144b0fSOlivier Houchard clock_t startClock, endClock;
111715144b0fSOlivier Houchard int32 count, i;
111815144b0fSOlivier Houchard int8 inputNum;
111915144b0fSOlivier Houchard floatx80 a;
112015144b0fSOlivier Houchard
112115144b0fSOlivier Houchard count = 0;
112215144b0fSOlivier Houchard inputNum = 0;
112315144b0fSOlivier Houchard startClock = clock();
112415144b0fSOlivier Houchard do {
112515144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
112615144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
112715144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
112815144b0fSOlivier Houchard function( a );
112915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
113015144b0fSOlivier Houchard }
113115144b0fSOlivier Houchard count += minIterations;
113215144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
113315144b0fSOlivier Houchard inputNum = 0;
113415144b0fSOlivier Houchard startClock = clock();
113515144b0fSOlivier Houchard for ( i = count; i; --i ) {
113615144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
113715144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
113815144b0fSOlivier Houchard function( a );
113915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
114015144b0fSOlivier Houchard }
114115144b0fSOlivier Houchard endClock = clock();
114215144b0fSOlivier Houchard reportTime( count, endClock - startClock );
114315144b0fSOlivier Houchard
114415144b0fSOlivier Houchard }
114515144b0fSOlivier Houchard
time_a_floatx80_z_float64(float64 function (floatx80))114615144b0fSOlivier Houchard static void time_a_floatx80_z_float64( float64 function( floatx80 ) )
114715144b0fSOlivier Houchard {
114815144b0fSOlivier Houchard clock_t startClock, endClock;
114915144b0fSOlivier Houchard int32 count, i;
115015144b0fSOlivier Houchard int8 inputNum;
115115144b0fSOlivier Houchard floatx80 a;
115215144b0fSOlivier Houchard
115315144b0fSOlivier Houchard count = 0;
115415144b0fSOlivier Houchard inputNum = 0;
115515144b0fSOlivier Houchard startClock = clock();
115615144b0fSOlivier Houchard do {
115715144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
115815144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
115915144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
116015144b0fSOlivier Houchard function( a );
116115144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
116215144b0fSOlivier Houchard }
116315144b0fSOlivier Houchard count += minIterations;
116415144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
116515144b0fSOlivier Houchard inputNum = 0;
116615144b0fSOlivier Houchard startClock = clock();
116715144b0fSOlivier Houchard for ( i = count; i; --i ) {
116815144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
116915144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
117015144b0fSOlivier Houchard function( a );
117115144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
117215144b0fSOlivier Houchard }
117315144b0fSOlivier Houchard endClock = clock();
117415144b0fSOlivier Houchard reportTime( count, endClock - startClock );
117515144b0fSOlivier Houchard
117615144b0fSOlivier Houchard }
117715144b0fSOlivier Houchard
117815144b0fSOlivier Houchard #ifdef FLOAT128
117915144b0fSOlivier Houchard
time_a_floatx80_z_float128(float128 function (floatx80))118015144b0fSOlivier Houchard static void time_a_floatx80_z_float128( float128 function( floatx80 ) )
118115144b0fSOlivier Houchard {
118215144b0fSOlivier Houchard clock_t startClock, endClock;
118315144b0fSOlivier Houchard int32 count, i;
118415144b0fSOlivier Houchard int8 inputNum;
118515144b0fSOlivier Houchard floatx80 a;
118615144b0fSOlivier Houchard
118715144b0fSOlivier Houchard count = 0;
118815144b0fSOlivier Houchard inputNum = 0;
118915144b0fSOlivier Houchard startClock = clock();
119015144b0fSOlivier Houchard do {
119115144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
119215144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
119315144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
119415144b0fSOlivier Houchard function( a );
119515144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
119615144b0fSOlivier Houchard }
119715144b0fSOlivier Houchard count += minIterations;
119815144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
119915144b0fSOlivier Houchard inputNum = 0;
120015144b0fSOlivier Houchard startClock = clock();
120115144b0fSOlivier Houchard for ( i = count; i; --i ) {
120215144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
120315144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
120415144b0fSOlivier Houchard function( a );
120515144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
120615144b0fSOlivier Houchard }
120715144b0fSOlivier Houchard endClock = clock();
120815144b0fSOlivier Houchard reportTime( count, endClock - startClock );
120915144b0fSOlivier Houchard
121015144b0fSOlivier Houchard }
121115144b0fSOlivier Houchard
121215144b0fSOlivier Houchard #endif
121315144b0fSOlivier Houchard
time_az_floatx80(floatx80 function (floatx80))121415144b0fSOlivier Houchard static void time_az_floatx80( floatx80 function( floatx80 ) )
121515144b0fSOlivier Houchard {
121615144b0fSOlivier Houchard clock_t startClock, endClock;
121715144b0fSOlivier Houchard int32 count, i;
121815144b0fSOlivier Houchard int8 inputNum;
121915144b0fSOlivier Houchard floatx80 a;
122015144b0fSOlivier Houchard
122115144b0fSOlivier Houchard count = 0;
122215144b0fSOlivier Houchard inputNum = 0;
122315144b0fSOlivier Houchard startClock = clock();
122415144b0fSOlivier Houchard do {
122515144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
122615144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
122715144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
122815144b0fSOlivier Houchard function( a );
122915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
123015144b0fSOlivier Houchard }
123115144b0fSOlivier Houchard count += minIterations;
123215144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
123315144b0fSOlivier Houchard inputNum = 0;
123415144b0fSOlivier Houchard startClock = clock();
123515144b0fSOlivier Houchard for ( i = count; i; --i ) {
123615144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNum ].low;
123715144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNum ].high;
123815144b0fSOlivier Houchard function( a );
123915144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
124015144b0fSOlivier Houchard }
124115144b0fSOlivier Houchard endClock = clock();
124215144b0fSOlivier Houchard reportTime( count, endClock - startClock );
124315144b0fSOlivier Houchard
124415144b0fSOlivier Houchard }
124515144b0fSOlivier Houchard
time_ab_floatx80_z_flag(flag function (floatx80,floatx80))124615144b0fSOlivier Houchard static void time_ab_floatx80_z_flag( flag function( floatx80, floatx80 ) )
124715144b0fSOlivier Houchard {
124815144b0fSOlivier Houchard clock_t startClock, endClock;
124915144b0fSOlivier Houchard int32 count, i;
125015144b0fSOlivier Houchard int8 inputNumA, inputNumB;
125115144b0fSOlivier Houchard floatx80 a, b;
125215144b0fSOlivier Houchard
125315144b0fSOlivier Houchard count = 0;
125415144b0fSOlivier Houchard inputNumA = 0;
125515144b0fSOlivier Houchard inputNumB = 0;
125615144b0fSOlivier Houchard startClock = clock();
125715144b0fSOlivier Houchard do {
125815144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
125915144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNumA ].low;
126015144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNumA ].high;
126115144b0fSOlivier Houchard b.low = inputs_floatx80[ inputNumB ].low;
126215144b0fSOlivier Houchard b.high = inputs_floatx80[ inputNumB ].high;
126315144b0fSOlivier Houchard function( a, b );
126415144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
126515144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
126615144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
126715144b0fSOlivier Houchard }
126815144b0fSOlivier Houchard count += minIterations;
126915144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
127015144b0fSOlivier Houchard inputNumA = 0;
127115144b0fSOlivier Houchard inputNumB = 0;
127215144b0fSOlivier Houchard startClock = clock();
127315144b0fSOlivier Houchard for ( i = count; i; --i ) {
127415144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNumA ].low;
127515144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNumA ].high;
127615144b0fSOlivier Houchard b.low = inputs_floatx80[ inputNumB ].low;
127715144b0fSOlivier Houchard b.high = inputs_floatx80[ inputNumB ].high;
127815144b0fSOlivier Houchard function( a, b );
127915144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
128015144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
128115144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
128215144b0fSOlivier Houchard }
128315144b0fSOlivier Houchard endClock = clock();
128415144b0fSOlivier Houchard reportTime( count, endClock - startClock );
128515144b0fSOlivier Houchard
128615144b0fSOlivier Houchard }
128715144b0fSOlivier Houchard
time_abz_floatx80(floatx80 function (floatx80,floatx80))128815144b0fSOlivier Houchard static void time_abz_floatx80( floatx80 function( floatx80, floatx80 ) )
128915144b0fSOlivier Houchard {
129015144b0fSOlivier Houchard clock_t startClock, endClock;
129115144b0fSOlivier Houchard int32 count, i;
129215144b0fSOlivier Houchard int8 inputNumA, inputNumB;
129315144b0fSOlivier Houchard floatx80 a, b;
129415144b0fSOlivier Houchard
129515144b0fSOlivier Houchard count = 0;
129615144b0fSOlivier Houchard inputNumA = 0;
129715144b0fSOlivier Houchard inputNumB = 0;
129815144b0fSOlivier Houchard startClock = clock();
129915144b0fSOlivier Houchard do {
130015144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
130115144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNumA ].low;
130215144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNumA ].high;
130315144b0fSOlivier Houchard b.low = inputs_floatx80[ inputNumB ].low;
130415144b0fSOlivier Houchard b.high = inputs_floatx80[ inputNumB ].high;
130515144b0fSOlivier Houchard function( a, b );
130615144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
130715144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
130815144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
130915144b0fSOlivier Houchard }
131015144b0fSOlivier Houchard count += minIterations;
131115144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
131215144b0fSOlivier Houchard inputNumA = 0;
131315144b0fSOlivier Houchard inputNumB = 0;
131415144b0fSOlivier Houchard startClock = clock();
131515144b0fSOlivier Houchard for ( i = count; i; --i ) {
131615144b0fSOlivier Houchard a.low = inputs_floatx80[ inputNumA ].low;
131715144b0fSOlivier Houchard a.high = inputs_floatx80[ inputNumA ].high;
131815144b0fSOlivier Houchard b.low = inputs_floatx80[ inputNumB ].low;
131915144b0fSOlivier Houchard b.high = inputs_floatx80[ inputNumB ].high;
132015144b0fSOlivier Houchard function( a, b );
132115144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_floatx80 - 1 );
132215144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
132315144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_floatx80 - 1 );
132415144b0fSOlivier Houchard }
132515144b0fSOlivier Houchard endClock = clock();
132615144b0fSOlivier Houchard reportTime( count, endClock - startClock );
132715144b0fSOlivier Houchard
132815144b0fSOlivier Houchard }
132915144b0fSOlivier Houchard
133015144b0fSOlivier Houchard static const struct {
133115144b0fSOlivier Houchard bits16 high;
133215144b0fSOlivier Houchard bits64 low;
133315144b0fSOlivier Houchard } inputs_floatx80_pos[ numInputs_floatx80 ] = {
133415144b0fSOlivier Houchard { 0x403F, LIT64( 0xA9BE15A19C1E8B62 ) },
133515144b0fSOlivier Houchard { 0x0000, LIT64( 0x0000000000000000 ) },
133615144b0fSOlivier Houchard { 0x75A8, LIT64( 0xE59591E4788957A5 ) },
133715144b0fSOlivier Houchard { 0x3FFF, LIT64( 0xFFF0000000000040 ) },
133815144b0fSOlivier Houchard { 0x0CD8, LIT64( 0xFC000000000007FE ) },
133915144b0fSOlivier Houchard { 0x43BA, LIT64( 0x99A4000000000000 ) },
134015144b0fSOlivier Houchard { 0x3FFF, LIT64( 0x8000000000000000 ) },
134115144b0fSOlivier Houchard { 0x4081, LIT64( 0x94FBF1BCEB5545F0 ) },
134215144b0fSOlivier Houchard { 0x403E, LIT64( 0xFFF0000000002000 ) },
134315144b0fSOlivier Houchard { 0x3FFE, LIT64( 0xC860E3C75D224F28 ) },
134415144b0fSOlivier Houchard { 0x407E, LIT64( 0xFC00000FFFFFFFFE ) },
134515144b0fSOlivier Houchard { 0x737A, LIT64( 0x800000007FFDFFFE ) },
134615144b0fSOlivier Houchard { 0x4044, LIT64( 0xFFFFFF80000FFFFF ) },
134715144b0fSOlivier Houchard { 0x3BFE, LIT64( 0x8000040000001FFE ) },
134815144b0fSOlivier Houchard { 0x4002, LIT64( 0xFF80000000000020 ) },
134915144b0fSOlivier Houchard { 0x5E8D, LIT64( 0xFFFFFFFFFFE00004 ) },
135015144b0fSOlivier Houchard { 0x4004, LIT64( 0x8000000000003FFB ) },
135115144b0fSOlivier Houchard { 0x407F, LIT64( 0x800000000003FFFE ) },
135215144b0fSOlivier Houchard { 0x4000, LIT64( 0xA459EE6A5C16CA55 ) },
135315144b0fSOlivier Houchard { 0x0003, LIT64( 0xC42CBF7399AEEB94 ) },
135415144b0fSOlivier Houchard { 0x3F7F, LIT64( 0xF800000000000006 ) },
135515144b0fSOlivier Houchard { 0x407F, LIT64( 0xBF56BE8871F28FEA ) },
135615144b0fSOlivier Houchard { 0x407E, LIT64( 0xFFFF77FFFFFFFFFE ) },
135715144b0fSOlivier Houchard { 0x2DC9, LIT64( 0x8000000FFFFFFFDE ) },
135815144b0fSOlivier Houchard { 0x4001, LIT64( 0xEFF7FFFFFFFFFFFF ) },
135915144b0fSOlivier Houchard { 0x4001, LIT64( 0xBE84F30125C497A6 ) },
136015144b0fSOlivier Houchard { 0x406B, LIT64( 0xEFFFFFFFFFFFFFFF ) },
136115144b0fSOlivier Houchard { 0x4080, LIT64( 0xFFFFFFFFBFFFFFFF ) },
136215144b0fSOlivier Houchard { 0x07E9, LIT64( 0x81FFFFFFFFFFFBFF ) },
136315144b0fSOlivier Houchard { 0x263F, LIT64( 0x801FFFFFFEFFFFFE ) },
136415144b0fSOlivier Houchard { 0x403C, LIT64( 0x801FFFFFFFF7FFFF ) },
136515144b0fSOlivier Houchard { 0x4018, LIT64( 0x8000000000080003 ) }
136615144b0fSOlivier Houchard };
136715144b0fSOlivier Houchard
time_az_floatx80_pos(floatx80 function (floatx80))136815144b0fSOlivier Houchard static void time_az_floatx80_pos( floatx80 function( floatx80 ) )
136915144b0fSOlivier Houchard {
137015144b0fSOlivier Houchard clock_t startClock, endClock;
137115144b0fSOlivier Houchard int32 count, i;
137215144b0fSOlivier Houchard int8 inputNum;
137315144b0fSOlivier Houchard floatx80 a;
137415144b0fSOlivier Houchard
137515144b0fSOlivier Houchard count = 0;
137615144b0fSOlivier Houchard inputNum = 0;
137715144b0fSOlivier Houchard startClock = clock();
137815144b0fSOlivier Houchard do {
137915144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
138015144b0fSOlivier Houchard a.low = inputs_floatx80_pos[ inputNum ].low;
138115144b0fSOlivier Houchard a.high = inputs_floatx80_pos[ inputNum ].high;
138215144b0fSOlivier Houchard function( a );
138315144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
138415144b0fSOlivier Houchard }
138515144b0fSOlivier Houchard count += minIterations;
138615144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
138715144b0fSOlivier Houchard inputNum = 0;
138815144b0fSOlivier Houchard startClock = clock();
138915144b0fSOlivier Houchard for ( i = count; i; --i ) {
139015144b0fSOlivier Houchard a.low = inputs_floatx80_pos[ inputNum ].low;
139115144b0fSOlivier Houchard a.high = inputs_floatx80_pos[ inputNum ].high;
139215144b0fSOlivier Houchard function( a );
139315144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_floatx80 - 1 );
139415144b0fSOlivier Houchard }
139515144b0fSOlivier Houchard endClock = clock();
139615144b0fSOlivier Houchard reportTime( count, endClock - startClock );
139715144b0fSOlivier Houchard
139815144b0fSOlivier Houchard }
139915144b0fSOlivier Houchard
140015144b0fSOlivier Houchard #endif
140115144b0fSOlivier Houchard
140215144b0fSOlivier Houchard #ifdef FLOAT128
140315144b0fSOlivier Houchard
140415144b0fSOlivier Houchard enum {
140515144b0fSOlivier Houchard numInputs_float128 = 32
140615144b0fSOlivier Houchard };
140715144b0fSOlivier Houchard
140815144b0fSOlivier Houchard static const struct {
140915144b0fSOlivier Houchard bits64 high, low;
141015144b0fSOlivier Houchard } inputs_float128[ numInputs_float128 ] = {
141115144b0fSOlivier Houchard { LIT64( 0x3FDA200000100000 ), LIT64( 0x0000000000000000 ) },
141215144b0fSOlivier Houchard { LIT64( 0x3FFF000000000000 ), LIT64( 0x0000000000000000 ) },
141315144b0fSOlivier Houchard { LIT64( 0x85F14776190C8306 ), LIT64( 0xD8715F4E3D54BB92 ) },
141415144b0fSOlivier Houchard { LIT64( 0xF2B00000007FFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
141515144b0fSOlivier Houchard { LIT64( 0x8000000000000000 ), LIT64( 0x0000000000000000 ) },
141615144b0fSOlivier Houchard { LIT64( 0xBFFFFFFFFFE00000 ), LIT64( 0x0000008000000000 ) },
141715144b0fSOlivier Houchard { LIT64( 0x407F1719CE722F3E ), LIT64( 0xDA6B3FE5FF29425B ) },
141815144b0fSOlivier Houchard { LIT64( 0x43FFFF8000000000 ), LIT64( 0x0000000000400000 ) },
141915144b0fSOlivier Houchard { LIT64( 0x401E000000000100 ), LIT64( 0x0000000000002000 ) },
142015144b0fSOlivier Houchard { LIT64( 0x3FFED71DACDA8E47 ), LIT64( 0x4860E3C75D224F28 ) },
142115144b0fSOlivier Houchard { LIT64( 0xBF7ECFC1E90647D1 ), LIT64( 0x7A124FE55623EE44 ) },
142215144b0fSOlivier Houchard { LIT64( 0x0DF7007FFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
142315144b0fSOlivier Houchard { LIT64( 0x3FE5FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
142415144b0fSOlivier Houchard { LIT64( 0x403FFFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFE ) },
142515144b0fSOlivier Houchard { LIT64( 0xBFFB2FBF7399AFEB ), LIT64( 0xA459EE6A5C16CA55 ) },
142615144b0fSOlivier Houchard { LIT64( 0xBDB8FFFFFFFFFFFC ), LIT64( 0x0000000000000400 ) },
142715144b0fSOlivier Houchard { LIT64( 0x3FC8FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
142815144b0fSOlivier Houchard { LIT64( 0x3FFBFFFFFFDFFFFF ), LIT64( 0xFFF8000000000000 ) },
142915144b0fSOlivier Houchard { LIT64( 0x407043C11737BE84 ), LIT64( 0xDDD58212ADC937F4 ) },
143015144b0fSOlivier Houchard { LIT64( 0x8001000000000000 ), LIT64( 0x0000001000000001 ) },
143115144b0fSOlivier Houchard { LIT64( 0xC036FFFFFFFFFFFF ), LIT64( 0xFE40000000000000 ) },
143215144b0fSOlivier Houchard { LIT64( 0x4002FFFFFE000002 ), LIT64( 0x0000000000000000 ) },
143315144b0fSOlivier Houchard { LIT64( 0x4000C3FEDE897773 ), LIT64( 0x326AC4FD8EFBE6DC ) },
143415144b0fSOlivier Houchard { LIT64( 0xBFFF0000000FFFFF ), LIT64( 0xFFFFFE0000000000 ) },
143515144b0fSOlivier Houchard { LIT64( 0x62C3E502146E426D ), LIT64( 0x43F3CAA0DC7DF1A0 ) },
143615144b0fSOlivier Houchard { LIT64( 0xB5CBD32E52BB570E ), LIT64( 0xBCC477CB11C6236C ) },
143715144b0fSOlivier Houchard { LIT64( 0xE228FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
143815144b0fSOlivier Houchard { LIT64( 0x3F80000000000000 ), LIT64( 0x0000000080000008 ) },
143915144b0fSOlivier Houchard { LIT64( 0xC1AFFFDFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
144015144b0fSOlivier Houchard { LIT64( 0xC96F000000000000 ), LIT64( 0x00000001FFFBFFFF ) },
144115144b0fSOlivier Houchard { LIT64( 0x3DE09BFE7923A338 ), LIT64( 0xBCC8FBBD7CEC1F4F ) },
144215144b0fSOlivier Houchard { LIT64( 0x401CFFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFF80 ) }
144315144b0fSOlivier Houchard };
144415144b0fSOlivier Houchard
time_a_float128_z_int32(int32 function (float128))144515144b0fSOlivier Houchard static void time_a_float128_z_int32( int32 function( float128 ) )
144615144b0fSOlivier Houchard {
144715144b0fSOlivier Houchard clock_t startClock, endClock;
144815144b0fSOlivier Houchard int32 count, i;
144915144b0fSOlivier Houchard int8 inputNum;
145015144b0fSOlivier Houchard float128 a;
145115144b0fSOlivier Houchard
145215144b0fSOlivier Houchard count = 0;
145315144b0fSOlivier Houchard inputNum = 0;
145415144b0fSOlivier Houchard startClock = clock();
145515144b0fSOlivier Houchard do {
145615144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
145715144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
145815144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
145915144b0fSOlivier Houchard function( a );
146015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
146115144b0fSOlivier Houchard }
146215144b0fSOlivier Houchard count += minIterations;
146315144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
146415144b0fSOlivier Houchard inputNum = 0;
146515144b0fSOlivier Houchard startClock = clock();
146615144b0fSOlivier Houchard for ( i = count; i; --i ) {
146715144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
146815144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
146915144b0fSOlivier Houchard function( a );
147015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
147115144b0fSOlivier Houchard }
147215144b0fSOlivier Houchard endClock = clock();
147315144b0fSOlivier Houchard reportTime( count, endClock - startClock );
147415144b0fSOlivier Houchard
147515144b0fSOlivier Houchard }
147615144b0fSOlivier Houchard
time_a_float128_z_int64(int64 function (float128))147715144b0fSOlivier Houchard static void time_a_float128_z_int64( int64 function( float128 ) )
147815144b0fSOlivier Houchard {
147915144b0fSOlivier Houchard clock_t startClock, endClock;
148015144b0fSOlivier Houchard int32 count, i;
148115144b0fSOlivier Houchard int8 inputNum;
148215144b0fSOlivier Houchard float128 a;
148315144b0fSOlivier Houchard
148415144b0fSOlivier Houchard count = 0;
148515144b0fSOlivier Houchard inputNum = 0;
148615144b0fSOlivier Houchard startClock = clock();
148715144b0fSOlivier Houchard do {
148815144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
148915144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
149015144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
149115144b0fSOlivier Houchard function( a );
149215144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
149315144b0fSOlivier Houchard }
149415144b0fSOlivier Houchard count += minIterations;
149515144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
149615144b0fSOlivier Houchard inputNum = 0;
149715144b0fSOlivier Houchard startClock = clock();
149815144b0fSOlivier Houchard for ( i = count; i; --i ) {
149915144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
150015144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
150115144b0fSOlivier Houchard function( a );
150215144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
150315144b0fSOlivier Houchard }
150415144b0fSOlivier Houchard endClock = clock();
150515144b0fSOlivier Houchard reportTime( count, endClock - startClock );
150615144b0fSOlivier Houchard
150715144b0fSOlivier Houchard }
150815144b0fSOlivier Houchard
time_a_float128_z_float32(float32 function (float128))150915144b0fSOlivier Houchard static void time_a_float128_z_float32( float32 function( float128 ) )
151015144b0fSOlivier Houchard {
151115144b0fSOlivier Houchard clock_t startClock, endClock;
151215144b0fSOlivier Houchard int32 count, i;
151315144b0fSOlivier Houchard int8 inputNum;
151415144b0fSOlivier Houchard float128 a;
151515144b0fSOlivier Houchard
151615144b0fSOlivier Houchard count = 0;
151715144b0fSOlivier Houchard inputNum = 0;
151815144b0fSOlivier Houchard startClock = clock();
151915144b0fSOlivier Houchard do {
152015144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
152115144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
152215144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
152315144b0fSOlivier Houchard function( a );
152415144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
152515144b0fSOlivier Houchard }
152615144b0fSOlivier Houchard count += minIterations;
152715144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
152815144b0fSOlivier Houchard inputNum = 0;
152915144b0fSOlivier Houchard startClock = clock();
153015144b0fSOlivier Houchard for ( i = count; i; --i ) {
153115144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
153215144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
153315144b0fSOlivier Houchard function( a );
153415144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
153515144b0fSOlivier Houchard }
153615144b0fSOlivier Houchard endClock = clock();
153715144b0fSOlivier Houchard reportTime( count, endClock - startClock );
153815144b0fSOlivier Houchard
153915144b0fSOlivier Houchard }
154015144b0fSOlivier Houchard
time_a_float128_z_float64(float64 function (float128))154115144b0fSOlivier Houchard static void time_a_float128_z_float64( float64 function( float128 ) )
154215144b0fSOlivier Houchard {
154315144b0fSOlivier Houchard clock_t startClock, endClock;
154415144b0fSOlivier Houchard int32 count, i;
154515144b0fSOlivier Houchard int8 inputNum;
154615144b0fSOlivier Houchard float128 a;
154715144b0fSOlivier Houchard
154815144b0fSOlivier Houchard count = 0;
154915144b0fSOlivier Houchard inputNum = 0;
155015144b0fSOlivier Houchard startClock = clock();
155115144b0fSOlivier Houchard do {
155215144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
155315144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
155415144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
155515144b0fSOlivier Houchard function( a );
155615144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
155715144b0fSOlivier Houchard }
155815144b0fSOlivier Houchard count += minIterations;
155915144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
156015144b0fSOlivier Houchard inputNum = 0;
156115144b0fSOlivier Houchard startClock = clock();
156215144b0fSOlivier Houchard for ( i = count; i; --i ) {
156315144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
156415144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
156515144b0fSOlivier Houchard function( a );
156615144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
156715144b0fSOlivier Houchard }
156815144b0fSOlivier Houchard endClock = clock();
156915144b0fSOlivier Houchard reportTime( count, endClock - startClock );
157015144b0fSOlivier Houchard
157115144b0fSOlivier Houchard }
157215144b0fSOlivier Houchard
157315144b0fSOlivier Houchard #ifdef FLOATX80
157415144b0fSOlivier Houchard
time_a_float128_z_floatx80(floatx80 function (float128))157515144b0fSOlivier Houchard static void time_a_float128_z_floatx80( floatx80 function( float128 ) )
157615144b0fSOlivier Houchard {
157715144b0fSOlivier Houchard clock_t startClock, endClock;
157815144b0fSOlivier Houchard int32 count, i;
157915144b0fSOlivier Houchard int8 inputNum;
158015144b0fSOlivier Houchard float128 a;
158115144b0fSOlivier Houchard
158215144b0fSOlivier Houchard count = 0;
158315144b0fSOlivier Houchard inputNum = 0;
158415144b0fSOlivier Houchard startClock = clock();
158515144b0fSOlivier Houchard do {
158615144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
158715144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
158815144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
158915144b0fSOlivier Houchard function( a );
159015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
159115144b0fSOlivier Houchard }
159215144b0fSOlivier Houchard count += minIterations;
159315144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
159415144b0fSOlivier Houchard inputNum = 0;
159515144b0fSOlivier Houchard startClock = clock();
159615144b0fSOlivier Houchard for ( i = count; i; --i ) {
159715144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
159815144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
159915144b0fSOlivier Houchard function( a );
160015144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
160115144b0fSOlivier Houchard }
160215144b0fSOlivier Houchard endClock = clock();
160315144b0fSOlivier Houchard reportTime( count, endClock - startClock );
160415144b0fSOlivier Houchard
160515144b0fSOlivier Houchard }
160615144b0fSOlivier Houchard
160715144b0fSOlivier Houchard #endif
160815144b0fSOlivier Houchard
time_az_float128(float128 function (float128))160915144b0fSOlivier Houchard static void time_az_float128( float128 function( float128 ) )
161015144b0fSOlivier Houchard {
161115144b0fSOlivier Houchard clock_t startClock, endClock;
161215144b0fSOlivier Houchard int32 count, i;
161315144b0fSOlivier Houchard int8 inputNum;
161415144b0fSOlivier Houchard float128 a;
161515144b0fSOlivier Houchard
161615144b0fSOlivier Houchard count = 0;
161715144b0fSOlivier Houchard inputNum = 0;
161815144b0fSOlivier Houchard startClock = clock();
161915144b0fSOlivier Houchard do {
162015144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
162115144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
162215144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
162315144b0fSOlivier Houchard function( a );
162415144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
162515144b0fSOlivier Houchard }
162615144b0fSOlivier Houchard count += minIterations;
162715144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
162815144b0fSOlivier Houchard inputNum = 0;
162915144b0fSOlivier Houchard startClock = clock();
163015144b0fSOlivier Houchard for ( i = count; i; --i ) {
163115144b0fSOlivier Houchard a.low = inputs_float128[ inputNum ].low;
163215144b0fSOlivier Houchard a.high = inputs_float128[ inputNum ].high;
163315144b0fSOlivier Houchard function( a );
163415144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
163515144b0fSOlivier Houchard }
163615144b0fSOlivier Houchard endClock = clock();
163715144b0fSOlivier Houchard reportTime( count, endClock - startClock );
163815144b0fSOlivier Houchard
163915144b0fSOlivier Houchard }
164015144b0fSOlivier Houchard
time_ab_float128_z_flag(flag function (float128,float128))164115144b0fSOlivier Houchard static void time_ab_float128_z_flag( flag function( float128, float128 ) )
164215144b0fSOlivier Houchard {
164315144b0fSOlivier Houchard clock_t startClock, endClock;
164415144b0fSOlivier Houchard int32 count, i;
164515144b0fSOlivier Houchard int8 inputNumA, inputNumB;
164615144b0fSOlivier Houchard float128 a, b;
164715144b0fSOlivier Houchard
164815144b0fSOlivier Houchard count = 0;
164915144b0fSOlivier Houchard inputNumA = 0;
165015144b0fSOlivier Houchard inputNumB = 0;
165115144b0fSOlivier Houchard startClock = clock();
165215144b0fSOlivier Houchard do {
165315144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
165415144b0fSOlivier Houchard a.low = inputs_float128[ inputNumA ].low;
165515144b0fSOlivier Houchard a.high = inputs_float128[ inputNumA ].high;
165615144b0fSOlivier Houchard b.low = inputs_float128[ inputNumB ].low;
165715144b0fSOlivier Houchard b.high = inputs_float128[ inputNumB ].high;
165815144b0fSOlivier Houchard function( a, b );
165915144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
166015144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
166115144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
166215144b0fSOlivier Houchard }
166315144b0fSOlivier Houchard count += minIterations;
166415144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
166515144b0fSOlivier Houchard inputNumA = 0;
166615144b0fSOlivier Houchard inputNumB = 0;
166715144b0fSOlivier Houchard startClock = clock();
166815144b0fSOlivier Houchard for ( i = count; i; --i ) {
166915144b0fSOlivier Houchard a.low = inputs_float128[ inputNumA ].low;
167015144b0fSOlivier Houchard a.high = inputs_float128[ inputNumA ].high;
167115144b0fSOlivier Houchard b.low = inputs_float128[ inputNumB ].low;
167215144b0fSOlivier Houchard b.high = inputs_float128[ inputNumB ].high;
167315144b0fSOlivier Houchard function( a, b );
167415144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
167515144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
167615144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
167715144b0fSOlivier Houchard }
167815144b0fSOlivier Houchard endClock = clock();
167915144b0fSOlivier Houchard reportTime( count, endClock - startClock );
168015144b0fSOlivier Houchard
168115144b0fSOlivier Houchard }
168215144b0fSOlivier Houchard
time_abz_float128(float128 function (float128,float128))168315144b0fSOlivier Houchard static void time_abz_float128( float128 function( float128, float128 ) )
168415144b0fSOlivier Houchard {
168515144b0fSOlivier Houchard clock_t startClock, endClock;
168615144b0fSOlivier Houchard int32 count, i;
168715144b0fSOlivier Houchard int8 inputNumA, inputNumB;
168815144b0fSOlivier Houchard float128 a, b;
168915144b0fSOlivier Houchard
169015144b0fSOlivier Houchard count = 0;
169115144b0fSOlivier Houchard inputNumA = 0;
169215144b0fSOlivier Houchard inputNumB = 0;
169315144b0fSOlivier Houchard startClock = clock();
169415144b0fSOlivier Houchard do {
169515144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
169615144b0fSOlivier Houchard a.low = inputs_float128[ inputNumA ].low;
169715144b0fSOlivier Houchard a.high = inputs_float128[ inputNumA ].high;
169815144b0fSOlivier Houchard b.low = inputs_float128[ inputNumB ].low;
169915144b0fSOlivier Houchard b.high = inputs_float128[ inputNumB ].high;
170015144b0fSOlivier Houchard function( a, b );
170115144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
170215144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
170315144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
170415144b0fSOlivier Houchard }
170515144b0fSOlivier Houchard count += minIterations;
170615144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
170715144b0fSOlivier Houchard inputNumA = 0;
170815144b0fSOlivier Houchard inputNumB = 0;
170915144b0fSOlivier Houchard startClock = clock();
171015144b0fSOlivier Houchard for ( i = count; i; --i ) {
171115144b0fSOlivier Houchard a.low = inputs_float128[ inputNumA ].low;
171215144b0fSOlivier Houchard a.high = inputs_float128[ inputNumA ].high;
171315144b0fSOlivier Houchard b.low = inputs_float128[ inputNumB ].low;
171415144b0fSOlivier Houchard b.high = inputs_float128[ inputNumB ].high;
171515144b0fSOlivier Houchard function( a, b );
171615144b0fSOlivier Houchard inputNumA = ( inputNumA + 1 ) & ( numInputs_float128 - 1 );
171715144b0fSOlivier Houchard if ( inputNumA == 0 ) ++inputNumB;
171815144b0fSOlivier Houchard inputNumB = ( inputNumB + 1 ) & ( numInputs_float128 - 1 );
171915144b0fSOlivier Houchard }
172015144b0fSOlivier Houchard endClock = clock();
172115144b0fSOlivier Houchard reportTime( count, endClock - startClock );
172215144b0fSOlivier Houchard
172315144b0fSOlivier Houchard }
172415144b0fSOlivier Houchard
172515144b0fSOlivier Houchard static const struct {
172615144b0fSOlivier Houchard bits64 high, low;
172715144b0fSOlivier Houchard } inputs_float128_pos[ numInputs_float128 ] = {
172815144b0fSOlivier Houchard { LIT64( 0x3FDA200000100000 ), LIT64( 0x0000000000000000 ) },
172915144b0fSOlivier Houchard { LIT64( 0x3FFF000000000000 ), LIT64( 0x0000000000000000 ) },
173015144b0fSOlivier Houchard { LIT64( 0x05F14776190C8306 ), LIT64( 0xD8715F4E3D54BB92 ) },
173115144b0fSOlivier Houchard { LIT64( 0x72B00000007FFFFF ), LIT64( 0xFFFFFFFFFFF7FFFF ) },
173215144b0fSOlivier Houchard { LIT64( 0x0000000000000000 ), LIT64( 0x0000000000000000 ) },
173315144b0fSOlivier Houchard { LIT64( 0x3FFFFFFFFFE00000 ), LIT64( 0x0000008000000000 ) },
173415144b0fSOlivier Houchard { LIT64( 0x407F1719CE722F3E ), LIT64( 0xDA6B3FE5FF29425B ) },
173515144b0fSOlivier Houchard { LIT64( 0x43FFFF8000000000 ), LIT64( 0x0000000000400000 ) },
173615144b0fSOlivier Houchard { LIT64( 0x401E000000000100 ), LIT64( 0x0000000000002000 ) },
173715144b0fSOlivier Houchard { LIT64( 0x3FFED71DACDA8E47 ), LIT64( 0x4860E3C75D224F28 ) },
173815144b0fSOlivier Houchard { LIT64( 0x3F7ECFC1E90647D1 ), LIT64( 0x7A124FE55623EE44 ) },
173915144b0fSOlivier Houchard { LIT64( 0x0DF7007FFFFFFFFF ), LIT64( 0xFFFFFFFFEFFFFFFF ) },
174015144b0fSOlivier Houchard { LIT64( 0x3FE5FFEFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFEFFF ) },
174115144b0fSOlivier Houchard { LIT64( 0x403FFFFFFFFFFFFF ), LIT64( 0xFFFFFFFFFFFFFBFE ) },
174215144b0fSOlivier Houchard { LIT64( 0x3FFB2FBF7399AFEB ), LIT64( 0xA459EE6A5C16CA55 ) },
174315144b0fSOlivier Houchard { LIT64( 0x3DB8FFFFFFFFFFFC ), LIT64( 0x0000000000000400 ) },
174415144b0fSOlivier Houchard { LIT64( 0x3FC8FFDFFFFFFFFF ), LIT64( 0xFFFFFFFFF0000000 ) },
174515144b0fSOlivier Houchard { LIT64( 0x3FFBFFFFFFDFFFFF ), LIT64( 0xFFF8000000000000 ) },
174615144b0fSOlivier Houchard { LIT64( 0x407043C11737BE84 ), LIT64( 0xDDD58212ADC937F4 ) },
174715144b0fSOlivier Houchard { LIT64( 0x0001000000000000 ), LIT64( 0x0000001000000001 ) },
174815144b0fSOlivier Houchard { LIT64( 0x4036FFFFFFFFFFFF ), LIT64( 0xFE40000000000000 ) },
174915144b0fSOlivier Houchard { LIT64( 0x4002FFFFFE000002 ), LIT64( 0x0000000000000000 ) },
175015144b0fSOlivier Houchard { LIT64( 0x4000C3FEDE897773 ), LIT64( 0x326AC4FD8EFBE6DC ) },
175115144b0fSOlivier Houchard { LIT64( 0x3FFF0000000FFFFF ), LIT64( 0xFFFFFE0000000000 ) },
175215144b0fSOlivier Houchard { LIT64( 0x62C3E502146E426D ), LIT64( 0x43F3CAA0DC7DF1A0 ) },
175315144b0fSOlivier Houchard { LIT64( 0x35CBD32E52BB570E ), LIT64( 0xBCC477CB11C6236C ) },
175415144b0fSOlivier Houchard { LIT64( 0x6228FFFFFFC00000 ), LIT64( 0x0000000000000000 ) },
175515144b0fSOlivier Houchard { LIT64( 0x3F80000000000000 ), LIT64( 0x0000000080000008 ) },
175615144b0fSOlivier Houchard { LIT64( 0x41AFFFDFFFFFFFFF ), LIT64( 0xFFFC000000000000 ) },
175715144b0fSOlivier Houchard { LIT64( 0x496F000000000000 ), LIT64( 0x00000001FFFBFFFF ) },
175815144b0fSOlivier Houchard { LIT64( 0x3DE09BFE7923A338 ), LIT64( 0xBCC8FBBD7CEC1F4F ) },
175915144b0fSOlivier Houchard { LIT64( 0x401CFFFFFFFFFFFF ), LIT64( 0xFFFFFFFEFFFFFF80 ) }
176015144b0fSOlivier Houchard };
176115144b0fSOlivier Houchard
time_az_float128_pos(float128 function (float128))176215144b0fSOlivier Houchard static void time_az_float128_pos( float128 function( float128 ) )
176315144b0fSOlivier Houchard {
176415144b0fSOlivier Houchard clock_t startClock, endClock;
176515144b0fSOlivier Houchard int32 count, i;
176615144b0fSOlivier Houchard int8 inputNum;
176715144b0fSOlivier Houchard float128 a;
176815144b0fSOlivier Houchard
176915144b0fSOlivier Houchard count = 0;
177015144b0fSOlivier Houchard inputNum = 0;
177115144b0fSOlivier Houchard startClock = clock();
177215144b0fSOlivier Houchard do {
177315144b0fSOlivier Houchard for ( i = minIterations; i; --i ) {
177415144b0fSOlivier Houchard a.low = inputs_float128_pos[ inputNum ].low;
177515144b0fSOlivier Houchard a.high = inputs_float128_pos[ inputNum ].high;
177615144b0fSOlivier Houchard function( a );
177715144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
177815144b0fSOlivier Houchard }
177915144b0fSOlivier Houchard count += minIterations;
178015144b0fSOlivier Houchard } while ( clock() - startClock < CLOCKS_PER_SEC );
178115144b0fSOlivier Houchard inputNum = 0;
178215144b0fSOlivier Houchard startClock = clock();
178315144b0fSOlivier Houchard for ( i = count; i; --i ) {
178415144b0fSOlivier Houchard a.low = inputs_float128_pos[ inputNum ].low;
178515144b0fSOlivier Houchard a.high = inputs_float128_pos[ inputNum ].high;
178615144b0fSOlivier Houchard function( a );
178715144b0fSOlivier Houchard inputNum = ( inputNum + 1 ) & ( numInputs_float128 - 1 );
178815144b0fSOlivier Houchard }
178915144b0fSOlivier Houchard endClock = clock();
179015144b0fSOlivier Houchard reportTime( count, endClock - startClock );
179115144b0fSOlivier Houchard
179215144b0fSOlivier Houchard }
179315144b0fSOlivier Houchard
179415144b0fSOlivier Houchard #endif
179515144b0fSOlivier Houchard
179615144b0fSOlivier Houchard enum {
179715144b0fSOlivier Houchard INT32_TO_FLOAT32 = 1,
179815144b0fSOlivier Houchard INT32_TO_FLOAT64,
179915144b0fSOlivier Houchard #ifdef FLOATX80
180015144b0fSOlivier Houchard INT32_TO_FLOATX80,
180115144b0fSOlivier Houchard #endif
180215144b0fSOlivier Houchard #ifdef FLOAT128
180315144b0fSOlivier Houchard INT32_TO_FLOAT128,
180415144b0fSOlivier Houchard #endif
180515144b0fSOlivier Houchard INT64_TO_FLOAT32,
180615144b0fSOlivier Houchard INT64_TO_FLOAT64,
180715144b0fSOlivier Houchard #ifdef FLOATX80
180815144b0fSOlivier Houchard INT64_TO_FLOATX80,
180915144b0fSOlivier Houchard #endif
181015144b0fSOlivier Houchard #ifdef FLOAT128
181115144b0fSOlivier Houchard INT64_TO_FLOAT128,
181215144b0fSOlivier Houchard #endif
181315144b0fSOlivier Houchard FLOAT32_TO_INT32,
181415144b0fSOlivier Houchard FLOAT32_TO_INT32_ROUND_TO_ZERO,
181515144b0fSOlivier Houchard FLOAT32_TO_INT64,
181615144b0fSOlivier Houchard FLOAT32_TO_INT64_ROUND_TO_ZERO,
181715144b0fSOlivier Houchard FLOAT32_TO_FLOAT64,
181815144b0fSOlivier Houchard #ifdef FLOATX80
181915144b0fSOlivier Houchard FLOAT32_TO_FLOATX80,
182015144b0fSOlivier Houchard #endif
182115144b0fSOlivier Houchard #ifdef FLOAT128
182215144b0fSOlivier Houchard FLOAT32_TO_FLOAT128,
182315144b0fSOlivier Houchard #endif
182415144b0fSOlivier Houchard FLOAT32_ROUND_TO_INT,
182515144b0fSOlivier Houchard FLOAT32_ADD,
182615144b0fSOlivier Houchard FLOAT32_SUB,
182715144b0fSOlivier Houchard FLOAT32_MUL,
182815144b0fSOlivier Houchard FLOAT32_DIV,
182915144b0fSOlivier Houchard FLOAT32_REM,
183015144b0fSOlivier Houchard FLOAT32_SQRT,
183115144b0fSOlivier Houchard FLOAT32_EQ,
183215144b0fSOlivier Houchard FLOAT32_LE,
183315144b0fSOlivier Houchard FLOAT32_LT,
183415144b0fSOlivier Houchard FLOAT32_EQ_SIGNALING,
183515144b0fSOlivier Houchard FLOAT32_LE_QUIET,
183615144b0fSOlivier Houchard FLOAT32_LT_QUIET,
183715144b0fSOlivier Houchard FLOAT64_TO_INT32,
183815144b0fSOlivier Houchard FLOAT64_TO_INT32_ROUND_TO_ZERO,
183915144b0fSOlivier Houchard FLOAT64_TO_INT64,
184015144b0fSOlivier Houchard FLOAT64_TO_INT64_ROUND_TO_ZERO,
184115144b0fSOlivier Houchard FLOAT64_TO_FLOAT32,
184215144b0fSOlivier Houchard #ifdef FLOATX80
184315144b0fSOlivier Houchard FLOAT64_TO_FLOATX80,
184415144b0fSOlivier Houchard #endif
184515144b0fSOlivier Houchard #ifdef FLOAT128
184615144b0fSOlivier Houchard FLOAT64_TO_FLOAT128,
184715144b0fSOlivier Houchard #endif
184815144b0fSOlivier Houchard FLOAT64_ROUND_TO_INT,
184915144b0fSOlivier Houchard FLOAT64_ADD,
185015144b0fSOlivier Houchard FLOAT64_SUB,
185115144b0fSOlivier Houchard FLOAT64_MUL,
185215144b0fSOlivier Houchard FLOAT64_DIV,
185315144b0fSOlivier Houchard FLOAT64_REM,
185415144b0fSOlivier Houchard FLOAT64_SQRT,
185515144b0fSOlivier Houchard FLOAT64_EQ,
185615144b0fSOlivier Houchard FLOAT64_LE,
185715144b0fSOlivier Houchard FLOAT64_LT,
185815144b0fSOlivier Houchard FLOAT64_EQ_SIGNALING,
185915144b0fSOlivier Houchard FLOAT64_LE_QUIET,
186015144b0fSOlivier Houchard FLOAT64_LT_QUIET,
186115144b0fSOlivier Houchard #ifdef FLOATX80
186215144b0fSOlivier Houchard FLOATX80_TO_INT32,
186315144b0fSOlivier Houchard FLOATX80_TO_INT32_ROUND_TO_ZERO,
186415144b0fSOlivier Houchard FLOATX80_TO_INT64,
186515144b0fSOlivier Houchard FLOATX80_TO_INT64_ROUND_TO_ZERO,
186615144b0fSOlivier Houchard FLOATX80_TO_FLOAT32,
186715144b0fSOlivier Houchard FLOATX80_TO_FLOAT64,
186815144b0fSOlivier Houchard #ifdef FLOAT128
186915144b0fSOlivier Houchard FLOATX80_TO_FLOAT128,
187015144b0fSOlivier Houchard #endif
187115144b0fSOlivier Houchard FLOATX80_ROUND_TO_INT,
187215144b0fSOlivier Houchard FLOATX80_ADD,
187315144b0fSOlivier Houchard FLOATX80_SUB,
187415144b0fSOlivier Houchard FLOATX80_MUL,
187515144b0fSOlivier Houchard FLOATX80_DIV,
187615144b0fSOlivier Houchard FLOATX80_REM,
187715144b0fSOlivier Houchard FLOATX80_SQRT,
187815144b0fSOlivier Houchard FLOATX80_EQ,
187915144b0fSOlivier Houchard FLOATX80_LE,
188015144b0fSOlivier Houchard FLOATX80_LT,
188115144b0fSOlivier Houchard FLOATX80_EQ_SIGNALING,
188215144b0fSOlivier Houchard FLOATX80_LE_QUIET,
188315144b0fSOlivier Houchard FLOATX80_LT_QUIET,
188415144b0fSOlivier Houchard #endif
188515144b0fSOlivier Houchard #ifdef FLOAT128
188615144b0fSOlivier Houchard FLOAT128_TO_INT32,
188715144b0fSOlivier Houchard FLOAT128_TO_INT32_ROUND_TO_ZERO,
188815144b0fSOlivier Houchard FLOAT128_TO_INT64,
188915144b0fSOlivier Houchard FLOAT128_TO_INT64_ROUND_TO_ZERO,
189015144b0fSOlivier Houchard FLOAT128_TO_FLOAT32,
189115144b0fSOlivier Houchard FLOAT128_TO_FLOAT64,
189215144b0fSOlivier Houchard #ifdef FLOATX80
189315144b0fSOlivier Houchard FLOAT128_TO_FLOATX80,
189415144b0fSOlivier Houchard #endif
189515144b0fSOlivier Houchard FLOAT128_ROUND_TO_INT,
189615144b0fSOlivier Houchard FLOAT128_ADD,
189715144b0fSOlivier Houchard FLOAT128_SUB,
189815144b0fSOlivier Houchard FLOAT128_MUL,
189915144b0fSOlivier Houchard FLOAT128_DIV,
190015144b0fSOlivier Houchard FLOAT128_REM,
190115144b0fSOlivier Houchard FLOAT128_SQRT,
190215144b0fSOlivier Houchard FLOAT128_EQ,
190315144b0fSOlivier Houchard FLOAT128_LE,
190415144b0fSOlivier Houchard FLOAT128_LT,
190515144b0fSOlivier Houchard FLOAT128_EQ_SIGNALING,
190615144b0fSOlivier Houchard FLOAT128_LE_QUIET,
190715144b0fSOlivier Houchard FLOAT128_LT_QUIET,
190815144b0fSOlivier Houchard #endif
190915144b0fSOlivier Houchard NUM_FUNCTIONS
191015144b0fSOlivier Houchard };
191115144b0fSOlivier Houchard
191215144b0fSOlivier Houchard static struct {
191315144b0fSOlivier Houchard char *name;
191415144b0fSOlivier Houchard int8 numInputs;
191515144b0fSOlivier Houchard flag roundingPrecision, roundingMode;
191615144b0fSOlivier Houchard flag tininessMode, tininessModeAtReducedPrecision;
191715144b0fSOlivier Houchard } functions[ NUM_FUNCTIONS ] = {
191815144b0fSOlivier Houchard { 0, 0, 0, 0, 0, 0 },
191915144b0fSOlivier Houchard { "int32_to_float32", 1, FALSE, TRUE, FALSE, FALSE },
192015144b0fSOlivier Houchard { "int32_to_float64", 1, FALSE, FALSE, FALSE, FALSE },
192115144b0fSOlivier Houchard #ifdef FLOATX80
192215144b0fSOlivier Houchard { "int32_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
192315144b0fSOlivier Houchard #endif
192415144b0fSOlivier Houchard #ifdef FLOAT128
192515144b0fSOlivier Houchard { "int32_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
192615144b0fSOlivier Houchard #endif
192715144b0fSOlivier Houchard { "int64_to_float32", 1, FALSE, TRUE, FALSE, FALSE },
192815144b0fSOlivier Houchard { "int64_to_float64", 1, FALSE, TRUE, FALSE, FALSE },
192915144b0fSOlivier Houchard #ifdef FLOATX80
193015144b0fSOlivier Houchard { "int64_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
193115144b0fSOlivier Houchard #endif
193215144b0fSOlivier Houchard #ifdef FLOAT128
193315144b0fSOlivier Houchard { "int64_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
193415144b0fSOlivier Houchard #endif
193515144b0fSOlivier Houchard { "float32_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
193615144b0fSOlivier Houchard { "float32_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
193715144b0fSOlivier Houchard { "float32_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
193815144b0fSOlivier Houchard { "float32_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
193915144b0fSOlivier Houchard { "float32_to_float64", 1, FALSE, FALSE, FALSE, FALSE },
194015144b0fSOlivier Houchard #ifdef FLOATX80
194115144b0fSOlivier Houchard { "float32_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
194215144b0fSOlivier Houchard #endif
194315144b0fSOlivier Houchard #ifdef FLOAT128
194415144b0fSOlivier Houchard { "float32_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
194515144b0fSOlivier Houchard #endif
194615144b0fSOlivier Houchard { "float32_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
194715144b0fSOlivier Houchard { "float32_add", 2, FALSE, TRUE, FALSE, FALSE },
194815144b0fSOlivier Houchard { "float32_sub", 2, FALSE, TRUE, FALSE, FALSE },
194915144b0fSOlivier Houchard { "float32_mul", 2, FALSE, TRUE, TRUE, FALSE },
195015144b0fSOlivier Houchard { "float32_div", 2, FALSE, TRUE, FALSE, FALSE },
195115144b0fSOlivier Houchard { "float32_rem", 2, FALSE, FALSE, FALSE, FALSE },
195215144b0fSOlivier Houchard { "float32_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
195315144b0fSOlivier Houchard { "float32_eq", 2, FALSE, FALSE, FALSE, FALSE },
195415144b0fSOlivier Houchard { "float32_le", 2, FALSE, FALSE, FALSE, FALSE },
195515144b0fSOlivier Houchard { "float32_lt", 2, FALSE, FALSE, FALSE, FALSE },
195615144b0fSOlivier Houchard { "float32_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
195715144b0fSOlivier Houchard { "float32_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
195815144b0fSOlivier Houchard { "float32_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
195915144b0fSOlivier Houchard { "float64_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
196015144b0fSOlivier Houchard { "float64_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
196115144b0fSOlivier Houchard { "float64_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
196215144b0fSOlivier Houchard { "float64_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
196315144b0fSOlivier Houchard { "float64_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
196415144b0fSOlivier Houchard #ifdef FLOATX80
196515144b0fSOlivier Houchard { "float64_to_floatx80", 1, FALSE, FALSE, FALSE, FALSE },
196615144b0fSOlivier Houchard #endif
196715144b0fSOlivier Houchard #ifdef FLOAT128
196815144b0fSOlivier Houchard { "float64_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
196915144b0fSOlivier Houchard #endif
197015144b0fSOlivier Houchard { "float64_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
197115144b0fSOlivier Houchard { "float64_add", 2, FALSE, TRUE, FALSE, FALSE },
197215144b0fSOlivier Houchard { "float64_sub", 2, FALSE, TRUE, FALSE, FALSE },
197315144b0fSOlivier Houchard { "float64_mul", 2, FALSE, TRUE, TRUE, FALSE },
197415144b0fSOlivier Houchard { "float64_div", 2, FALSE, TRUE, FALSE, FALSE },
197515144b0fSOlivier Houchard { "float64_rem", 2, FALSE, FALSE, FALSE, FALSE },
197615144b0fSOlivier Houchard { "float64_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
197715144b0fSOlivier Houchard { "float64_eq", 2, FALSE, FALSE, FALSE, FALSE },
197815144b0fSOlivier Houchard { "float64_le", 2, FALSE, FALSE, FALSE, FALSE },
197915144b0fSOlivier Houchard { "float64_lt", 2, FALSE, FALSE, FALSE, FALSE },
198015144b0fSOlivier Houchard { "float64_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
198115144b0fSOlivier Houchard { "float64_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
198215144b0fSOlivier Houchard { "float64_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
198315144b0fSOlivier Houchard #ifdef FLOATX80
198415144b0fSOlivier Houchard { "floatx80_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
198515144b0fSOlivier Houchard { "floatx80_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
198615144b0fSOlivier Houchard { "floatx80_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
198715144b0fSOlivier Houchard { "floatx80_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
198815144b0fSOlivier Houchard { "floatx80_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
198915144b0fSOlivier Houchard { "floatx80_to_float64", 1, FALSE, TRUE, TRUE, FALSE },
199015144b0fSOlivier Houchard #ifdef FLOAT128
199115144b0fSOlivier Houchard { "floatx80_to_float128", 1, FALSE, FALSE, FALSE, FALSE },
199215144b0fSOlivier Houchard #endif
199315144b0fSOlivier Houchard { "floatx80_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
199415144b0fSOlivier Houchard { "floatx80_add", 2, TRUE, TRUE, FALSE, TRUE },
199515144b0fSOlivier Houchard { "floatx80_sub", 2, TRUE, TRUE, FALSE, TRUE },
199615144b0fSOlivier Houchard { "floatx80_mul", 2, TRUE, TRUE, TRUE, TRUE },
199715144b0fSOlivier Houchard { "floatx80_div", 2, TRUE, TRUE, FALSE, TRUE },
199815144b0fSOlivier Houchard { "floatx80_rem", 2, FALSE, FALSE, FALSE, FALSE },
199915144b0fSOlivier Houchard { "floatx80_sqrt", 1, TRUE, TRUE, FALSE, FALSE },
200015144b0fSOlivier Houchard { "floatx80_eq", 2, FALSE, FALSE, FALSE, FALSE },
200115144b0fSOlivier Houchard { "floatx80_le", 2, FALSE, FALSE, FALSE, FALSE },
200215144b0fSOlivier Houchard { "floatx80_lt", 2, FALSE, FALSE, FALSE, FALSE },
200315144b0fSOlivier Houchard { "floatx80_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
200415144b0fSOlivier Houchard { "floatx80_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
200515144b0fSOlivier Houchard { "floatx80_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
200615144b0fSOlivier Houchard #endif
200715144b0fSOlivier Houchard #ifdef FLOAT128
200815144b0fSOlivier Houchard { "float128_to_int32", 1, FALSE, TRUE, FALSE, FALSE },
200915144b0fSOlivier Houchard { "float128_to_int32_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
201015144b0fSOlivier Houchard { "float128_to_int64", 1, FALSE, TRUE, FALSE, FALSE },
201115144b0fSOlivier Houchard { "float128_to_int64_round_to_zero", 1, FALSE, FALSE, FALSE, FALSE },
201215144b0fSOlivier Houchard { "float128_to_float32", 1, FALSE, TRUE, TRUE, FALSE },
201315144b0fSOlivier Houchard { "float128_to_float64", 1, FALSE, TRUE, TRUE, FALSE },
201415144b0fSOlivier Houchard #ifdef FLOATX80
201515144b0fSOlivier Houchard { "float128_to_floatx80", 1, FALSE, TRUE, TRUE, FALSE },
201615144b0fSOlivier Houchard #endif
201715144b0fSOlivier Houchard { "float128_round_to_int", 1, FALSE, TRUE, FALSE, FALSE },
201815144b0fSOlivier Houchard { "float128_add", 2, FALSE, TRUE, FALSE, FALSE },
201915144b0fSOlivier Houchard { "float128_sub", 2, FALSE, TRUE, FALSE, FALSE },
202015144b0fSOlivier Houchard { "float128_mul", 2, FALSE, TRUE, TRUE, FALSE },
202115144b0fSOlivier Houchard { "float128_div", 2, FALSE, TRUE, FALSE, FALSE },
202215144b0fSOlivier Houchard { "float128_rem", 2, FALSE, FALSE, FALSE, FALSE },
202315144b0fSOlivier Houchard { "float128_sqrt", 1, FALSE, TRUE, FALSE, FALSE },
202415144b0fSOlivier Houchard { "float128_eq", 2, FALSE, FALSE, FALSE, FALSE },
202515144b0fSOlivier Houchard { "float128_le", 2, FALSE, FALSE, FALSE, FALSE },
202615144b0fSOlivier Houchard { "float128_lt", 2, FALSE, FALSE, FALSE, FALSE },
202715144b0fSOlivier Houchard { "float128_eq_signaling", 2, FALSE, FALSE, FALSE, FALSE },
202815144b0fSOlivier Houchard { "float128_le_quiet", 2, FALSE, FALSE, FALSE, FALSE },
202915144b0fSOlivier Houchard { "float128_lt_quiet", 2, FALSE, FALSE, FALSE, FALSE },
203015144b0fSOlivier Houchard #endif
203115144b0fSOlivier Houchard };
203215144b0fSOlivier Houchard
203315144b0fSOlivier Houchard enum {
203415144b0fSOlivier Houchard ROUND_NEAREST_EVEN = 1,
203515144b0fSOlivier Houchard ROUND_TO_ZERO,
203615144b0fSOlivier Houchard ROUND_DOWN,
203715144b0fSOlivier Houchard ROUND_UP,
203815144b0fSOlivier Houchard NUM_ROUNDINGMODES
203915144b0fSOlivier Houchard };
204015144b0fSOlivier Houchard enum {
204115144b0fSOlivier Houchard TININESS_BEFORE_ROUNDING = 1,
204215144b0fSOlivier Houchard TININESS_AFTER_ROUNDING,
204315144b0fSOlivier Houchard NUM_TININESSMODES
204415144b0fSOlivier Houchard };
204515144b0fSOlivier Houchard
204615144b0fSOlivier Houchard static void
timeFunctionVariety(uint8 functionCode,int8 roundingPrecision,int8 roundingMode,int8 tininessMode)204715144b0fSOlivier Houchard timeFunctionVariety(
204815144b0fSOlivier Houchard uint8 functionCode,
204915144b0fSOlivier Houchard int8 roundingPrecision,
205015144b0fSOlivier Houchard int8 roundingMode,
205115144b0fSOlivier Houchard int8 tininessMode
205215144b0fSOlivier Houchard )
205315144b0fSOlivier Houchard {
205415144b0fSOlivier Houchard uint8 roundingCode;
205515144b0fSOlivier Houchard int8 tininessCode;
205615144b0fSOlivier Houchard
205715144b0fSOlivier Houchard functionName = functions[ functionCode ].name;
205815144b0fSOlivier Houchard if ( roundingPrecision == 32 ) {
205915144b0fSOlivier Houchard roundingPrecisionName = "32";
206015144b0fSOlivier Houchard }
206115144b0fSOlivier Houchard else if ( roundingPrecision == 64 ) {
206215144b0fSOlivier Houchard roundingPrecisionName = "64";
206315144b0fSOlivier Houchard }
206415144b0fSOlivier Houchard else if ( roundingPrecision == 80 ) {
206515144b0fSOlivier Houchard roundingPrecisionName = "80";
206615144b0fSOlivier Houchard }
206715144b0fSOlivier Houchard else {
2068*513004a2SPedro F. Giffuni roundingPrecisionName = NULL;
206915144b0fSOlivier Houchard }
207015144b0fSOlivier Houchard #ifdef FLOATX80
207115144b0fSOlivier Houchard floatx80_rounding_precision = roundingPrecision;
207215144b0fSOlivier Houchard #endif
207315144b0fSOlivier Houchard switch ( roundingMode ) {
207415144b0fSOlivier Houchard case 0:
2075*513004a2SPedro F. Giffuni roundingModeName = NULL;
207615144b0fSOlivier Houchard roundingCode = float_round_nearest_even;
207715144b0fSOlivier Houchard break;
207815144b0fSOlivier Houchard case ROUND_NEAREST_EVEN:
207915144b0fSOlivier Houchard roundingModeName = "nearest_even";
208015144b0fSOlivier Houchard roundingCode = float_round_nearest_even;
208115144b0fSOlivier Houchard break;
208215144b0fSOlivier Houchard case ROUND_TO_ZERO:
208315144b0fSOlivier Houchard roundingModeName = "to_zero";
208415144b0fSOlivier Houchard roundingCode = float_round_to_zero;
208515144b0fSOlivier Houchard break;
208615144b0fSOlivier Houchard case ROUND_DOWN:
208715144b0fSOlivier Houchard roundingModeName = "down";
208815144b0fSOlivier Houchard roundingCode = float_round_down;
208915144b0fSOlivier Houchard break;
209015144b0fSOlivier Houchard case ROUND_UP:
209115144b0fSOlivier Houchard roundingModeName = "up";
209215144b0fSOlivier Houchard roundingCode = float_round_up;
209315144b0fSOlivier Houchard break;
209415144b0fSOlivier Houchard }
209515144b0fSOlivier Houchard float_rounding_mode = roundingCode;
209615144b0fSOlivier Houchard switch ( tininessMode ) {
209715144b0fSOlivier Houchard case 0:
2098*513004a2SPedro F. Giffuni tininessModeName = NULL;
209915144b0fSOlivier Houchard tininessCode = float_tininess_after_rounding;
210015144b0fSOlivier Houchard break;
210115144b0fSOlivier Houchard case TININESS_BEFORE_ROUNDING:
210215144b0fSOlivier Houchard tininessModeName = "before";
210315144b0fSOlivier Houchard tininessCode = float_tininess_before_rounding;
210415144b0fSOlivier Houchard break;
210515144b0fSOlivier Houchard case TININESS_AFTER_ROUNDING:
210615144b0fSOlivier Houchard tininessModeName = "after";
210715144b0fSOlivier Houchard tininessCode = float_tininess_after_rounding;
210815144b0fSOlivier Houchard break;
210915144b0fSOlivier Houchard }
211015144b0fSOlivier Houchard float_detect_tininess = tininessCode;
211115144b0fSOlivier Houchard switch ( functionCode ) {
211215144b0fSOlivier Houchard case INT32_TO_FLOAT32:
211315144b0fSOlivier Houchard time_a_int32_z_float32( int32_to_float32 );
211415144b0fSOlivier Houchard break;
211515144b0fSOlivier Houchard case INT32_TO_FLOAT64:
211615144b0fSOlivier Houchard time_a_int32_z_float64( int32_to_float64 );
211715144b0fSOlivier Houchard break;
211815144b0fSOlivier Houchard #ifdef FLOATX80
211915144b0fSOlivier Houchard case INT32_TO_FLOATX80:
212015144b0fSOlivier Houchard time_a_int32_z_floatx80( int32_to_floatx80 );
212115144b0fSOlivier Houchard break;
212215144b0fSOlivier Houchard #endif
212315144b0fSOlivier Houchard #ifdef FLOAT128
212415144b0fSOlivier Houchard case INT32_TO_FLOAT128:
212515144b0fSOlivier Houchard time_a_int32_z_float128( int32_to_float128 );
212615144b0fSOlivier Houchard break;
212715144b0fSOlivier Houchard #endif
212815144b0fSOlivier Houchard case INT64_TO_FLOAT32:
212915144b0fSOlivier Houchard time_a_int64_z_float32( int64_to_float32 );
213015144b0fSOlivier Houchard break;
213115144b0fSOlivier Houchard case INT64_TO_FLOAT64:
213215144b0fSOlivier Houchard time_a_int64_z_float64( int64_to_float64 );
213315144b0fSOlivier Houchard break;
213415144b0fSOlivier Houchard #ifdef FLOATX80
213515144b0fSOlivier Houchard case INT64_TO_FLOATX80:
213615144b0fSOlivier Houchard time_a_int64_z_floatx80( int64_to_floatx80 );
213715144b0fSOlivier Houchard break;
213815144b0fSOlivier Houchard #endif
213915144b0fSOlivier Houchard #ifdef FLOAT128
214015144b0fSOlivier Houchard case INT64_TO_FLOAT128:
214115144b0fSOlivier Houchard time_a_int64_z_float128( int64_to_float128 );
214215144b0fSOlivier Houchard break;
214315144b0fSOlivier Houchard #endif
214415144b0fSOlivier Houchard case FLOAT32_TO_INT32:
214515144b0fSOlivier Houchard time_a_float32_z_int32( float32_to_int32 );
214615144b0fSOlivier Houchard break;
214715144b0fSOlivier Houchard case FLOAT32_TO_INT32_ROUND_TO_ZERO:
214815144b0fSOlivier Houchard time_a_float32_z_int32( float32_to_int32_round_to_zero );
214915144b0fSOlivier Houchard break;
215015144b0fSOlivier Houchard case FLOAT32_TO_INT64:
215115144b0fSOlivier Houchard time_a_float32_z_int64( float32_to_int64 );
215215144b0fSOlivier Houchard break;
215315144b0fSOlivier Houchard case FLOAT32_TO_INT64_ROUND_TO_ZERO:
215415144b0fSOlivier Houchard time_a_float32_z_int64( float32_to_int64_round_to_zero );
215515144b0fSOlivier Houchard break;
215615144b0fSOlivier Houchard case FLOAT32_TO_FLOAT64:
215715144b0fSOlivier Houchard time_a_float32_z_float64( float32_to_float64 );
215815144b0fSOlivier Houchard break;
215915144b0fSOlivier Houchard #ifdef FLOATX80
216015144b0fSOlivier Houchard case FLOAT32_TO_FLOATX80:
216115144b0fSOlivier Houchard time_a_float32_z_floatx80( float32_to_floatx80 );
216215144b0fSOlivier Houchard break;
216315144b0fSOlivier Houchard #endif
216415144b0fSOlivier Houchard #ifdef FLOAT128
216515144b0fSOlivier Houchard case FLOAT32_TO_FLOAT128:
216615144b0fSOlivier Houchard time_a_float32_z_float128( float32_to_float128 );
216715144b0fSOlivier Houchard break;
216815144b0fSOlivier Houchard #endif
216915144b0fSOlivier Houchard case FLOAT32_ROUND_TO_INT:
217015144b0fSOlivier Houchard time_az_float32( float32_round_to_int );
217115144b0fSOlivier Houchard break;
217215144b0fSOlivier Houchard case FLOAT32_ADD:
217315144b0fSOlivier Houchard time_abz_float32( float32_add );
217415144b0fSOlivier Houchard break;
217515144b0fSOlivier Houchard case FLOAT32_SUB:
217615144b0fSOlivier Houchard time_abz_float32( float32_sub );
217715144b0fSOlivier Houchard break;
217815144b0fSOlivier Houchard case FLOAT32_MUL:
217915144b0fSOlivier Houchard time_abz_float32( float32_mul );
218015144b0fSOlivier Houchard break;
218115144b0fSOlivier Houchard case FLOAT32_DIV:
218215144b0fSOlivier Houchard time_abz_float32( float32_div );
218315144b0fSOlivier Houchard break;
218415144b0fSOlivier Houchard case FLOAT32_REM:
218515144b0fSOlivier Houchard time_abz_float32( float32_rem );
218615144b0fSOlivier Houchard break;
218715144b0fSOlivier Houchard case FLOAT32_SQRT:
218815144b0fSOlivier Houchard time_az_float32_pos( float32_sqrt );
218915144b0fSOlivier Houchard break;
219015144b0fSOlivier Houchard case FLOAT32_EQ:
219115144b0fSOlivier Houchard time_ab_float32_z_flag( float32_eq );
219215144b0fSOlivier Houchard break;
219315144b0fSOlivier Houchard case FLOAT32_LE:
219415144b0fSOlivier Houchard time_ab_float32_z_flag( float32_le );
219515144b0fSOlivier Houchard break;
219615144b0fSOlivier Houchard case FLOAT32_LT:
219715144b0fSOlivier Houchard time_ab_float32_z_flag( float32_lt );
219815144b0fSOlivier Houchard break;
219915144b0fSOlivier Houchard case FLOAT32_EQ_SIGNALING:
220015144b0fSOlivier Houchard time_ab_float32_z_flag( float32_eq_signaling );
220115144b0fSOlivier Houchard break;
220215144b0fSOlivier Houchard case FLOAT32_LE_QUIET:
220315144b0fSOlivier Houchard time_ab_float32_z_flag( float32_le_quiet );
220415144b0fSOlivier Houchard break;
220515144b0fSOlivier Houchard case FLOAT32_LT_QUIET:
220615144b0fSOlivier Houchard time_ab_float32_z_flag( float32_lt_quiet );
220715144b0fSOlivier Houchard break;
220815144b0fSOlivier Houchard case FLOAT64_TO_INT32:
220915144b0fSOlivier Houchard time_a_float64_z_int32( float64_to_int32 );
221015144b0fSOlivier Houchard break;
221115144b0fSOlivier Houchard case FLOAT64_TO_INT32_ROUND_TO_ZERO:
221215144b0fSOlivier Houchard time_a_float64_z_int32( float64_to_int32_round_to_zero );
221315144b0fSOlivier Houchard break;
221415144b0fSOlivier Houchard case FLOAT64_TO_INT64:
221515144b0fSOlivier Houchard time_a_float64_z_int64( float64_to_int64 );
221615144b0fSOlivier Houchard break;
221715144b0fSOlivier Houchard case FLOAT64_TO_INT64_ROUND_TO_ZERO:
221815144b0fSOlivier Houchard time_a_float64_z_int64( float64_to_int64_round_to_zero );
221915144b0fSOlivier Houchard break;
222015144b0fSOlivier Houchard case FLOAT64_TO_FLOAT32:
222115144b0fSOlivier Houchard time_a_float64_z_float32( float64_to_float32 );
222215144b0fSOlivier Houchard break;
222315144b0fSOlivier Houchard #ifdef FLOATX80
222415144b0fSOlivier Houchard case FLOAT64_TO_FLOATX80:
222515144b0fSOlivier Houchard time_a_float64_z_floatx80( float64_to_floatx80 );
222615144b0fSOlivier Houchard break;
222715144b0fSOlivier Houchard #endif
222815144b0fSOlivier Houchard #ifdef FLOAT128
222915144b0fSOlivier Houchard case FLOAT64_TO_FLOAT128:
223015144b0fSOlivier Houchard time_a_float64_z_float128( float64_to_float128 );
223115144b0fSOlivier Houchard break;
223215144b0fSOlivier Houchard #endif
223315144b0fSOlivier Houchard case FLOAT64_ROUND_TO_INT:
223415144b0fSOlivier Houchard time_az_float64( float64_round_to_int );
223515144b0fSOlivier Houchard break;
223615144b0fSOlivier Houchard case FLOAT64_ADD:
223715144b0fSOlivier Houchard time_abz_float64( float64_add );
223815144b0fSOlivier Houchard break;
223915144b0fSOlivier Houchard case FLOAT64_SUB:
224015144b0fSOlivier Houchard time_abz_float64( float64_sub );
224115144b0fSOlivier Houchard break;
224215144b0fSOlivier Houchard case FLOAT64_MUL:
224315144b0fSOlivier Houchard time_abz_float64( float64_mul );
224415144b0fSOlivier Houchard break;
224515144b0fSOlivier Houchard case FLOAT64_DIV:
224615144b0fSOlivier Houchard time_abz_float64( float64_div );
224715144b0fSOlivier Houchard break;
224815144b0fSOlivier Houchard case FLOAT64_REM:
224915144b0fSOlivier Houchard time_abz_float64( float64_rem );
225015144b0fSOlivier Houchard break;
225115144b0fSOlivier Houchard case FLOAT64_SQRT:
225215144b0fSOlivier Houchard time_az_float64_pos( float64_sqrt );
225315144b0fSOlivier Houchard break;
225415144b0fSOlivier Houchard case FLOAT64_EQ:
225515144b0fSOlivier Houchard time_ab_float64_z_flag( float64_eq );
225615144b0fSOlivier Houchard break;
225715144b0fSOlivier Houchard case FLOAT64_LE:
225815144b0fSOlivier Houchard time_ab_float64_z_flag( float64_le );
225915144b0fSOlivier Houchard break;
226015144b0fSOlivier Houchard case FLOAT64_LT:
226115144b0fSOlivier Houchard time_ab_float64_z_flag( float64_lt );
226215144b0fSOlivier Houchard break;
226315144b0fSOlivier Houchard case FLOAT64_EQ_SIGNALING:
226415144b0fSOlivier Houchard time_ab_float64_z_flag( float64_eq_signaling );
226515144b0fSOlivier Houchard break;
226615144b0fSOlivier Houchard case FLOAT64_LE_QUIET:
226715144b0fSOlivier Houchard time_ab_float64_z_flag( float64_le_quiet );
226815144b0fSOlivier Houchard break;
226915144b0fSOlivier Houchard case FLOAT64_LT_QUIET:
227015144b0fSOlivier Houchard time_ab_float64_z_flag( float64_lt_quiet );
227115144b0fSOlivier Houchard break;
227215144b0fSOlivier Houchard #ifdef FLOATX80
227315144b0fSOlivier Houchard case FLOATX80_TO_INT32:
227415144b0fSOlivier Houchard time_a_floatx80_z_int32( floatx80_to_int32 );
227515144b0fSOlivier Houchard break;
227615144b0fSOlivier Houchard case FLOATX80_TO_INT32_ROUND_TO_ZERO:
227715144b0fSOlivier Houchard time_a_floatx80_z_int32( floatx80_to_int32_round_to_zero );
227815144b0fSOlivier Houchard break;
227915144b0fSOlivier Houchard case FLOATX80_TO_INT64:
228015144b0fSOlivier Houchard time_a_floatx80_z_int64( floatx80_to_int64 );
228115144b0fSOlivier Houchard break;
228215144b0fSOlivier Houchard case FLOATX80_TO_INT64_ROUND_TO_ZERO:
228315144b0fSOlivier Houchard time_a_floatx80_z_int64( floatx80_to_int64_round_to_zero );
228415144b0fSOlivier Houchard break;
228515144b0fSOlivier Houchard case FLOATX80_TO_FLOAT32:
228615144b0fSOlivier Houchard time_a_floatx80_z_float32( floatx80_to_float32 );
228715144b0fSOlivier Houchard break;
228815144b0fSOlivier Houchard case FLOATX80_TO_FLOAT64:
228915144b0fSOlivier Houchard time_a_floatx80_z_float64( floatx80_to_float64 );
229015144b0fSOlivier Houchard break;
229115144b0fSOlivier Houchard #ifdef FLOAT128
229215144b0fSOlivier Houchard case FLOATX80_TO_FLOAT128:
229315144b0fSOlivier Houchard time_a_floatx80_z_float128( floatx80_to_float128 );
229415144b0fSOlivier Houchard break;
229515144b0fSOlivier Houchard #endif
229615144b0fSOlivier Houchard case FLOATX80_ROUND_TO_INT:
229715144b0fSOlivier Houchard time_az_floatx80( floatx80_round_to_int );
229815144b0fSOlivier Houchard break;
229915144b0fSOlivier Houchard case FLOATX80_ADD:
230015144b0fSOlivier Houchard time_abz_floatx80( floatx80_add );
230115144b0fSOlivier Houchard break;
230215144b0fSOlivier Houchard case FLOATX80_SUB:
230315144b0fSOlivier Houchard time_abz_floatx80( floatx80_sub );
230415144b0fSOlivier Houchard break;
230515144b0fSOlivier Houchard case FLOATX80_MUL:
230615144b0fSOlivier Houchard time_abz_floatx80( floatx80_mul );
230715144b0fSOlivier Houchard break;
230815144b0fSOlivier Houchard case FLOATX80_DIV:
230915144b0fSOlivier Houchard time_abz_floatx80( floatx80_div );
231015144b0fSOlivier Houchard break;
231115144b0fSOlivier Houchard case FLOATX80_REM:
231215144b0fSOlivier Houchard time_abz_floatx80( floatx80_rem );
231315144b0fSOlivier Houchard break;
231415144b0fSOlivier Houchard case FLOATX80_SQRT:
231515144b0fSOlivier Houchard time_az_floatx80_pos( floatx80_sqrt );
231615144b0fSOlivier Houchard break;
231715144b0fSOlivier Houchard case FLOATX80_EQ:
231815144b0fSOlivier Houchard time_ab_floatx80_z_flag( floatx80_eq );
231915144b0fSOlivier Houchard break;
232015144b0fSOlivier Houchard case FLOATX80_LE:
232115144b0fSOlivier Houchard time_ab_floatx80_z_flag( floatx80_le );
232215144b0fSOlivier Houchard break;
232315144b0fSOlivier Houchard case FLOATX80_LT:
232415144b0fSOlivier Houchard time_ab_floatx80_z_flag( floatx80_lt );
232515144b0fSOlivier Houchard break;
232615144b0fSOlivier Houchard case FLOATX80_EQ_SIGNALING:
232715144b0fSOlivier Houchard time_ab_floatx80_z_flag( floatx80_eq_signaling );
232815144b0fSOlivier Houchard break;
232915144b0fSOlivier Houchard case FLOATX80_LE_QUIET:
233015144b0fSOlivier Houchard time_ab_floatx80_z_flag( floatx80_le_quiet );
233115144b0fSOlivier Houchard break;
233215144b0fSOlivier Houchard case FLOATX80_LT_QUIET:
233315144b0fSOlivier Houchard time_ab_floatx80_z_flag( floatx80_lt_quiet );
233415144b0fSOlivier Houchard break;
233515144b0fSOlivier Houchard #endif
233615144b0fSOlivier Houchard #ifdef FLOAT128
233715144b0fSOlivier Houchard case FLOAT128_TO_INT32:
233815144b0fSOlivier Houchard time_a_float128_z_int32( float128_to_int32 );
233915144b0fSOlivier Houchard break;
234015144b0fSOlivier Houchard case FLOAT128_TO_INT32_ROUND_TO_ZERO:
234115144b0fSOlivier Houchard time_a_float128_z_int32( float128_to_int32_round_to_zero );
234215144b0fSOlivier Houchard break;
234315144b0fSOlivier Houchard case FLOAT128_TO_INT64:
234415144b0fSOlivier Houchard time_a_float128_z_int64( float128_to_int64 );
234515144b0fSOlivier Houchard break;
234615144b0fSOlivier Houchard case FLOAT128_TO_INT64_ROUND_TO_ZERO:
234715144b0fSOlivier Houchard time_a_float128_z_int64( float128_to_int64_round_to_zero );
234815144b0fSOlivier Houchard break;
234915144b0fSOlivier Houchard case FLOAT128_TO_FLOAT32:
235015144b0fSOlivier Houchard time_a_float128_z_float32( float128_to_float32 );
235115144b0fSOlivier Houchard break;
235215144b0fSOlivier Houchard case FLOAT128_TO_FLOAT64:
235315144b0fSOlivier Houchard time_a_float128_z_float64( float128_to_float64 );
235415144b0fSOlivier Houchard break;
235515144b0fSOlivier Houchard #ifdef FLOATX80
235615144b0fSOlivier Houchard case FLOAT128_TO_FLOATX80:
235715144b0fSOlivier Houchard time_a_float128_z_floatx80( float128_to_floatx80 );
235815144b0fSOlivier Houchard break;
235915144b0fSOlivier Houchard #endif
236015144b0fSOlivier Houchard case FLOAT128_ROUND_TO_INT:
236115144b0fSOlivier Houchard time_az_float128( float128_round_to_int );
236215144b0fSOlivier Houchard break;
236315144b0fSOlivier Houchard case FLOAT128_ADD:
236415144b0fSOlivier Houchard time_abz_float128( float128_add );
236515144b0fSOlivier Houchard break;
236615144b0fSOlivier Houchard case FLOAT128_SUB:
236715144b0fSOlivier Houchard time_abz_float128( float128_sub );
236815144b0fSOlivier Houchard break;
236915144b0fSOlivier Houchard case FLOAT128_MUL:
237015144b0fSOlivier Houchard time_abz_float128( float128_mul );
237115144b0fSOlivier Houchard break;
237215144b0fSOlivier Houchard case FLOAT128_DIV:
237315144b0fSOlivier Houchard time_abz_float128( float128_div );
237415144b0fSOlivier Houchard break;
237515144b0fSOlivier Houchard case FLOAT128_REM:
237615144b0fSOlivier Houchard time_abz_float128( float128_rem );
237715144b0fSOlivier Houchard break;
237815144b0fSOlivier Houchard case FLOAT128_SQRT:
237915144b0fSOlivier Houchard time_az_float128_pos( float128_sqrt );
238015144b0fSOlivier Houchard break;
238115144b0fSOlivier Houchard case FLOAT128_EQ:
238215144b0fSOlivier Houchard time_ab_float128_z_flag( float128_eq );
238315144b0fSOlivier Houchard break;
238415144b0fSOlivier Houchard case FLOAT128_LE:
238515144b0fSOlivier Houchard time_ab_float128_z_flag( float128_le );
238615144b0fSOlivier Houchard break;
238715144b0fSOlivier Houchard case FLOAT128_LT:
238815144b0fSOlivier Houchard time_ab_float128_z_flag( float128_lt );
238915144b0fSOlivier Houchard break;
239015144b0fSOlivier Houchard case FLOAT128_EQ_SIGNALING:
239115144b0fSOlivier Houchard time_ab_float128_z_flag( float128_eq_signaling );
239215144b0fSOlivier Houchard break;
239315144b0fSOlivier Houchard case FLOAT128_LE_QUIET:
239415144b0fSOlivier Houchard time_ab_float128_z_flag( float128_le_quiet );
239515144b0fSOlivier Houchard break;
239615144b0fSOlivier Houchard case FLOAT128_LT_QUIET:
239715144b0fSOlivier Houchard time_ab_float128_z_flag( float128_lt_quiet );
239815144b0fSOlivier Houchard break;
239915144b0fSOlivier Houchard #endif
240015144b0fSOlivier Houchard }
240115144b0fSOlivier Houchard
240215144b0fSOlivier Houchard }
240315144b0fSOlivier Houchard
240415144b0fSOlivier Houchard static void
timeFunction(uint8 functionCode,int8 roundingPrecisionIn,int8 roundingModeIn,int8 tininessModeIn)240515144b0fSOlivier Houchard timeFunction(
240615144b0fSOlivier Houchard uint8 functionCode,
240715144b0fSOlivier Houchard int8 roundingPrecisionIn,
240815144b0fSOlivier Houchard int8 roundingModeIn,
240915144b0fSOlivier Houchard int8 tininessModeIn
241015144b0fSOlivier Houchard )
241115144b0fSOlivier Houchard {
241215144b0fSOlivier Houchard int8 roundingPrecision, roundingMode, tininessMode;
241315144b0fSOlivier Houchard
241415144b0fSOlivier Houchard roundingPrecision = 32;
241515144b0fSOlivier Houchard for (;;) {
241615144b0fSOlivier Houchard if ( ! functions[ functionCode ].roundingPrecision ) {
241715144b0fSOlivier Houchard roundingPrecision = 0;
241815144b0fSOlivier Houchard }
241915144b0fSOlivier Houchard else if ( roundingPrecisionIn ) {
242015144b0fSOlivier Houchard roundingPrecision = roundingPrecisionIn;
242115144b0fSOlivier Houchard }
242215144b0fSOlivier Houchard for ( roundingMode = 1;
242315144b0fSOlivier Houchard roundingMode < NUM_ROUNDINGMODES;
242415144b0fSOlivier Houchard ++roundingMode
242515144b0fSOlivier Houchard ) {
242615144b0fSOlivier Houchard if ( ! functions[ functionCode ].roundingMode ) {
242715144b0fSOlivier Houchard roundingMode = 0;
242815144b0fSOlivier Houchard }
242915144b0fSOlivier Houchard else if ( roundingModeIn ) {
243015144b0fSOlivier Houchard roundingMode = roundingModeIn;
243115144b0fSOlivier Houchard }
243215144b0fSOlivier Houchard for ( tininessMode = 1;
243315144b0fSOlivier Houchard tininessMode < NUM_TININESSMODES;
243415144b0fSOlivier Houchard ++tininessMode
243515144b0fSOlivier Houchard ) {
243615144b0fSOlivier Houchard if ( ( roundingPrecision == 32 )
243715144b0fSOlivier Houchard || ( roundingPrecision == 64 ) ) {
243815144b0fSOlivier Houchard if ( ! functions[ functionCode ]
243915144b0fSOlivier Houchard .tininessModeAtReducedPrecision
244015144b0fSOlivier Houchard ) {
244115144b0fSOlivier Houchard tininessMode = 0;
244215144b0fSOlivier Houchard }
244315144b0fSOlivier Houchard else if ( tininessModeIn ) {
244415144b0fSOlivier Houchard tininessMode = tininessModeIn;
244515144b0fSOlivier Houchard }
244615144b0fSOlivier Houchard }
244715144b0fSOlivier Houchard else {
244815144b0fSOlivier Houchard if ( ! functions[ functionCode ].tininessMode ) {
244915144b0fSOlivier Houchard tininessMode = 0;
245015144b0fSOlivier Houchard }
245115144b0fSOlivier Houchard else if ( tininessModeIn ) {
245215144b0fSOlivier Houchard tininessMode = tininessModeIn;
245315144b0fSOlivier Houchard }
245415144b0fSOlivier Houchard }
245515144b0fSOlivier Houchard timeFunctionVariety(
245615144b0fSOlivier Houchard functionCode, roundingPrecision, roundingMode, tininessMode
245715144b0fSOlivier Houchard );
245815144b0fSOlivier Houchard if ( tininessModeIn || ! tininessMode ) break;
245915144b0fSOlivier Houchard }
246015144b0fSOlivier Houchard if ( roundingModeIn || ! roundingMode ) break;
246115144b0fSOlivier Houchard }
246215144b0fSOlivier Houchard if ( roundingPrecisionIn || ! roundingPrecision ) break;
246315144b0fSOlivier Houchard if ( roundingPrecision == 80 ) {
246415144b0fSOlivier Houchard break;
246515144b0fSOlivier Houchard }
246615144b0fSOlivier Houchard else if ( roundingPrecision == 64 ) {
246715144b0fSOlivier Houchard roundingPrecision = 80;
246815144b0fSOlivier Houchard }
246915144b0fSOlivier Houchard else if ( roundingPrecision == 32 ) {
247015144b0fSOlivier Houchard roundingPrecision = 64;
247115144b0fSOlivier Houchard }
247215144b0fSOlivier Houchard }
247315144b0fSOlivier Houchard
247415144b0fSOlivier Houchard }
247515144b0fSOlivier Houchard
main(int argc,char ** argv)247615144b0fSOlivier Houchard main( int argc, char **argv )
247715144b0fSOlivier Houchard {
247815144b0fSOlivier Houchard char *argPtr;
247915144b0fSOlivier Houchard flag functionArgument;
248015144b0fSOlivier Houchard uint8 functionCode;
248115144b0fSOlivier Houchard int8 operands, roundingPrecision, roundingMode, tininessMode;
248215144b0fSOlivier Houchard
248315144b0fSOlivier Houchard if ( argc <= 1 ) goto writeHelpMessage;
248415144b0fSOlivier Houchard functionArgument = FALSE;
248515144b0fSOlivier Houchard functionCode = 0;
248615144b0fSOlivier Houchard operands = 0;
248715144b0fSOlivier Houchard roundingPrecision = 0;
248815144b0fSOlivier Houchard roundingMode = 0;
248915144b0fSOlivier Houchard tininessMode = 0;
249015144b0fSOlivier Houchard --argc;
249115144b0fSOlivier Houchard ++argv;
249215144b0fSOlivier Houchard while ( argc && ( argPtr = argv[ 0 ] ) ) {
249315144b0fSOlivier Houchard if ( argPtr[ 0 ] == '-' ) ++argPtr;
249415144b0fSOlivier Houchard if ( strcmp( argPtr, "help" ) == 0 ) {
249515144b0fSOlivier Houchard writeHelpMessage:
249615144b0fSOlivier Houchard fputs(
249715144b0fSOlivier Houchard "timesoftfloat [<option>...] <function>\n"
249815144b0fSOlivier Houchard " <option>: (* is default)\n"
249915144b0fSOlivier Houchard " -help --Write this message and exit.\n"
250015144b0fSOlivier Houchard #ifdef FLOATX80
250115144b0fSOlivier Houchard " -precision32 --Only time rounding precision equivalent to float32.\n"
250215144b0fSOlivier Houchard " -precision64 --Only time rounding precision equivalent to float64.\n"
250315144b0fSOlivier Houchard " -precision80 --Only time maximum rounding precision.\n"
250415144b0fSOlivier Houchard #endif
250515144b0fSOlivier Houchard " -nearesteven --Only time rounding to nearest/even.\n"
250615144b0fSOlivier Houchard " -tozero --Only time rounding to zero.\n"
250715144b0fSOlivier Houchard " -down --Only time rounding down.\n"
250815144b0fSOlivier Houchard " -up --Only time rounding up.\n"
250915144b0fSOlivier Houchard " -tininessbefore --Only time underflow tininess before rounding.\n"
251015144b0fSOlivier Houchard " -tininessafter --Only time underflow tininess after rounding.\n"
251115144b0fSOlivier Houchard " <function>:\n"
251215144b0fSOlivier Houchard " int32_to_<float> <float>_add <float>_eq\n"
251315144b0fSOlivier Houchard " <float>_to_int32 <float>_sub <float>_le\n"
251415144b0fSOlivier Houchard " <float>_to_int32_round_to_zero <float>_mul <float>_lt\n"
251515144b0fSOlivier Houchard " int64_to_<float> <float>_div <float>_eq_signaling\n"
251615144b0fSOlivier Houchard " <float>_to_int64 <float>_rem <float>_le_quiet\n"
251715144b0fSOlivier Houchard " <float>_to_int64_round_to_zero <float>_lt_quiet\n"
251815144b0fSOlivier Houchard " <float>_to_<float>\n"
251915144b0fSOlivier Houchard " <float>_round_to_int\n"
252015144b0fSOlivier Houchard " <float>_sqrt\n"
252115144b0fSOlivier Houchard " -all1 --All 1-operand functions.\n"
252215144b0fSOlivier Houchard " -all2 --All 2-operand functions.\n"
252315144b0fSOlivier Houchard " -all --All functions.\n"
252415144b0fSOlivier Houchard " <float>:\n"
252515144b0fSOlivier Houchard " float32 --Single precision.\n"
252615144b0fSOlivier Houchard " float64 --Double precision.\n"
252715144b0fSOlivier Houchard #ifdef FLOATX80
252815144b0fSOlivier Houchard " floatx80 --Extended double precision.\n"
252915144b0fSOlivier Houchard #endif
253015144b0fSOlivier Houchard #ifdef FLOAT128
253115144b0fSOlivier Houchard " float128 --Quadruple precision.\n"
253215144b0fSOlivier Houchard #endif
253315144b0fSOlivier Houchard ,
253415144b0fSOlivier Houchard stdout
253515144b0fSOlivier Houchard );
253615144b0fSOlivier Houchard return EXIT_SUCCESS;
253715144b0fSOlivier Houchard }
253815144b0fSOlivier Houchard #ifdef FLOATX80
253915144b0fSOlivier Houchard else if ( strcmp( argPtr, "precision32" ) == 0 ) {
254015144b0fSOlivier Houchard roundingPrecision = 32;
254115144b0fSOlivier Houchard }
254215144b0fSOlivier Houchard else if ( strcmp( argPtr, "precision64" ) == 0 ) {
254315144b0fSOlivier Houchard roundingPrecision = 64;
254415144b0fSOlivier Houchard }
254515144b0fSOlivier Houchard else if ( strcmp( argPtr, "precision80" ) == 0 ) {
254615144b0fSOlivier Houchard roundingPrecision = 80;
254715144b0fSOlivier Houchard }
254815144b0fSOlivier Houchard #endif
254915144b0fSOlivier Houchard else if ( ( strcmp( argPtr, "nearesteven" ) == 0 )
255015144b0fSOlivier Houchard || ( strcmp( argPtr, "nearest_even" ) == 0 ) ) {
255115144b0fSOlivier Houchard roundingMode = ROUND_NEAREST_EVEN;
255215144b0fSOlivier Houchard }
255315144b0fSOlivier Houchard else if ( ( strcmp( argPtr, "tozero" ) == 0 )
255415144b0fSOlivier Houchard || ( strcmp( argPtr, "to_zero" ) == 0 ) ) {
255515144b0fSOlivier Houchard roundingMode = ROUND_TO_ZERO;
255615144b0fSOlivier Houchard }
255715144b0fSOlivier Houchard else if ( strcmp( argPtr, "down" ) == 0 ) {
255815144b0fSOlivier Houchard roundingMode = ROUND_DOWN;
255915144b0fSOlivier Houchard }
256015144b0fSOlivier Houchard else if ( strcmp( argPtr, "up" ) == 0 ) {
256115144b0fSOlivier Houchard roundingMode = ROUND_UP;
256215144b0fSOlivier Houchard }
256315144b0fSOlivier Houchard else if ( strcmp( argPtr, "tininessbefore" ) == 0 ) {
256415144b0fSOlivier Houchard tininessMode = TININESS_BEFORE_ROUNDING;
256515144b0fSOlivier Houchard }
256615144b0fSOlivier Houchard else if ( strcmp( argPtr, "tininessafter" ) == 0 ) {
256715144b0fSOlivier Houchard tininessMode = TININESS_AFTER_ROUNDING;
256815144b0fSOlivier Houchard }
256915144b0fSOlivier Houchard else if ( strcmp( argPtr, "all1" ) == 0 ) {
257015144b0fSOlivier Houchard functionArgument = TRUE;
257115144b0fSOlivier Houchard functionCode = 0;
257215144b0fSOlivier Houchard operands = 1;
257315144b0fSOlivier Houchard }
257415144b0fSOlivier Houchard else if ( strcmp( argPtr, "all2" ) == 0 ) {
257515144b0fSOlivier Houchard functionArgument = TRUE;
257615144b0fSOlivier Houchard functionCode = 0;
257715144b0fSOlivier Houchard operands = 2;
257815144b0fSOlivier Houchard }
257915144b0fSOlivier Houchard else if ( strcmp( argPtr, "all" ) == 0 ) {
258015144b0fSOlivier Houchard functionArgument = TRUE;
258115144b0fSOlivier Houchard functionCode = 0;
258215144b0fSOlivier Houchard operands = 0;
258315144b0fSOlivier Houchard }
258415144b0fSOlivier Houchard else {
258515144b0fSOlivier Houchard for ( functionCode = 1;
258615144b0fSOlivier Houchard functionCode < NUM_FUNCTIONS;
258715144b0fSOlivier Houchard ++functionCode
258815144b0fSOlivier Houchard ) {
258915144b0fSOlivier Houchard if ( strcmp( argPtr, functions[ functionCode ].name ) == 0 ) {
259015144b0fSOlivier Houchard break;
259115144b0fSOlivier Houchard }
259215144b0fSOlivier Houchard }
259315144b0fSOlivier Houchard if ( functionCode == NUM_FUNCTIONS ) {
259415144b0fSOlivier Houchard fail( "Invalid option or function `%s'", argv[ 0 ] );
259515144b0fSOlivier Houchard }
259615144b0fSOlivier Houchard functionArgument = TRUE;
259715144b0fSOlivier Houchard }
259815144b0fSOlivier Houchard --argc;
259915144b0fSOlivier Houchard ++argv;
260015144b0fSOlivier Houchard }
260115144b0fSOlivier Houchard if ( ! functionArgument ) fail( "Function argument required" );
260215144b0fSOlivier Houchard if ( functionCode ) {
260315144b0fSOlivier Houchard timeFunction(
260415144b0fSOlivier Houchard functionCode, roundingPrecision, roundingMode, tininessMode );
260515144b0fSOlivier Houchard }
260615144b0fSOlivier Houchard else if ( operands == 1 ) {
260715144b0fSOlivier Houchard for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
260815144b0fSOlivier Houchard ) {
260915144b0fSOlivier Houchard if ( functions[ functionCode ].numInputs == 1 ) {
261015144b0fSOlivier Houchard timeFunction(
261115144b0fSOlivier Houchard functionCode, roundingPrecision, roundingMode, tininessMode
261215144b0fSOlivier Houchard );
261315144b0fSOlivier Houchard }
261415144b0fSOlivier Houchard }
261515144b0fSOlivier Houchard }
261615144b0fSOlivier Houchard else if ( operands == 2 ) {
261715144b0fSOlivier Houchard for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
261815144b0fSOlivier Houchard ) {
261915144b0fSOlivier Houchard if ( functions[ functionCode ].numInputs == 2 ) {
262015144b0fSOlivier Houchard timeFunction(
262115144b0fSOlivier Houchard functionCode, roundingPrecision, roundingMode, tininessMode
262215144b0fSOlivier Houchard );
262315144b0fSOlivier Houchard }
262415144b0fSOlivier Houchard }
262515144b0fSOlivier Houchard }
262615144b0fSOlivier Houchard else {
262715144b0fSOlivier Houchard for ( functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
262815144b0fSOlivier Houchard ) {
262915144b0fSOlivier Houchard timeFunction(
263015144b0fSOlivier Houchard functionCode, roundingPrecision, roundingMode, tininessMode );
263115144b0fSOlivier Houchard }
263215144b0fSOlivier Houchard }
263315144b0fSOlivier Houchard return EXIT_SUCCESS;
263415144b0fSOlivier Houchard
263515144b0fSOlivier Houchard }
263615144b0fSOlivier Houchard
2637