1 |
|
---|
2 | /*============================================================================
|
---|
3 |
|
---|
4 | This C source file is part of TestFloat, Release 3e, a package of programs for
|
---|
5 | testing the correctness of floating-point arithmetic complying with the IEEE
|
---|
6 | Standard for Floating-Point, by John R. Hauser.
|
---|
7 |
|
---|
8 | Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the
|
---|
9 | University of California. All rights reserved.
|
---|
10 |
|
---|
11 | Redistribution and use in source and binary forms, with or without
|
---|
12 | modification, are permitted provided that the following conditions are met:
|
---|
13 |
|
---|
14 | 1. Redistributions of source code must retain the above copyright notice,
|
---|
15 | this list of conditions, and the following disclaimer.
|
---|
16 |
|
---|
17 | 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
18 | this list of conditions, and the following disclaimer in the documentation
|
---|
19 | and/or other materials provided with the distribution.
|
---|
20 |
|
---|
21 | 3. Neither the name of the University nor the names of its contributors may
|
---|
22 | be used to endorse or promote products derived from this software without
|
---|
23 | specific prior written permission.
|
---|
24 |
|
---|
25 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
|
---|
26 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
---|
27 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
|
---|
28 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
---|
29 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
---|
30 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
---|
31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
32 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
---|
34 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
35 |
|
---|
36 | =============================================================================*/
|
---|
37 |
|
---|
38 | #include <stdbool.h>
|
---|
39 | #include <stdint.h>
|
---|
40 | #include <string.h>
|
---|
41 | #include <stdlib.h>
|
---|
42 | #include <stdio.h>
|
---|
43 | #include <time.h>
|
---|
44 | #include "platform.h"
|
---|
45 | #include "uint128.h"
|
---|
46 | #include "fail.h"
|
---|
47 | #include "softfloat.h"
|
---|
48 | #include "functions.h"
|
---|
49 |
|
---|
50 | enum { minIterations = 1000 };
|
---|
51 |
|
---|
52 | /*----------------------------------------------------------------------------
|
---|
53 | *----------------------------------------------------------------------------*/
|
---|
54 |
|
---|
55 | static const char *functionNamePtr;
|
---|
56 | static uint_fast8_t roundingPrecision;
|
---|
57 | static int roundingCode;
|
---|
58 | static int tininessCode;
|
---|
59 | static bool usesExact;
|
---|
60 | static bool exact;
|
---|
61 |
|
---|
62 | /*----------------------------------------------------------------------------
|
---|
63 | *----------------------------------------------------------------------------*/
|
---|
64 |
|
---|
65 | static void reportTime( int_fast64_t count, clock_t clockTicks )
|
---|
66 | {
|
---|
67 | static const char *roundingModeNames[NUM_ROUNDINGMODES] = {
|
---|
68 | 0,
|
---|
69 | ", rounding near_even",
|
---|
70 | ", rounding minMag",
|
---|
71 | ", rounding min",
|
---|
72 | ", rounding max",
|
---|
73 | ", rounding near_maxMag",
|
---|
74 | #ifdef FLOAT_ROUND_ODD
|
---|
75 | ", rounding odd"
|
---|
76 | #endif
|
---|
77 | };
|
---|
78 |
|
---|
79 | printf(
|
---|
80 | "%9.4f Mop/s: %s",
|
---|
81 | count / ((float) clockTicks / CLOCKS_PER_SEC) / 1000000,
|
---|
82 | functionNamePtr
|
---|
83 | );
|
---|
84 | if ( roundingCode ) {
|
---|
85 | #ifdef EXTFLOAT80
|
---|
86 | if ( roundingPrecision ) {
|
---|
87 | printf( ", precision %d", (int) roundingPrecision );
|
---|
88 | }
|
---|
89 | #endif
|
---|
90 | fputs( roundingModeNames[roundingCode], stdout );
|
---|
91 | if ( tininessCode ) {
|
---|
92 | fputs(
|
---|
93 | (tininessCode == TININESS_BEFORE_ROUNDING)
|
---|
94 | ? ", tininess before rounding"
|
---|
95 | : ", tininess after rounding",
|
---|
96 | stdout
|
---|
97 | );
|
---|
98 | }
|
---|
99 | }
|
---|
100 | if ( usesExact ) fputs( exact ? ", exact" : ", not exact", stdout );
|
---|
101 | fputc( '\n', stdout );
|
---|
102 | fflush( stdout );
|
---|
103 |
|
---|
104 | }
|
---|
105 |
|
---|
106 | /*----------------------------------------------------------------------------
|
---|
107 | *----------------------------------------------------------------------------*/
|
---|
108 |
|
---|
109 | #ifdef FLOAT16
|
---|
110 | union ui16_f16 { uint16_t ui; float16_t f; };
|
---|
111 | #endif
|
---|
112 | union ui32_f32 { uint32_t ui; float32_t f; };
|
---|
113 | #ifdef FLOAT64
|
---|
114 | union ui64_f64 { uint64_t ui; float64_t f; };
|
---|
115 | #endif
|
---|
116 |
|
---|
117 | /*----------------------------------------------------------------------------
|
---|
118 | *----------------------------------------------------------------------------*/
|
---|
119 |
|
---|
120 | enum { numInputs_ui32 = 32 };
|
---|
121 |
|
---|
122 | static const uint32_t inputs_ui32[numInputs_ui32] = {
|
---|
123 | 0x00004487, 0x405CF80F, 0x00000000, 0x000002FC,
|
---|
124 | 0x000DFFFE, 0x0C8EF795, 0x0FFFEE01, 0x000006CA,
|
---|
125 | 0x00009BFE, 0x00B79D1D, 0x60001002, 0x00000049,
|
---|
126 | 0x0BFF7FFF, 0x0000F37A, 0x0011DFFE, 0x00000006,
|
---|
127 | 0x000FDFFA, 0x0000082F, 0x10200003, 0x2172089B,
|
---|
128 | 0x00003E02, 0x000019E8, 0x0008FFFE, 0x000004A4,
|
---|
129 | 0x00208002, 0x07C42FBF, 0x0FFFE3FF, 0x040B9F13,
|
---|
130 | 0x40000008, 0x0001BF56, 0x000017F6, 0x000A908A
|
---|
131 | };
|
---|
132 |
|
---|
133 | #ifdef FLOAT16
|
---|
134 |
|
---|
135 | static void time_a_ui32_z_f16( float16_t function( uint32_t ) )
|
---|
136 | {
|
---|
137 | int_fast64_t count;
|
---|
138 | int inputNum;
|
---|
139 | clock_t startClock;
|
---|
140 | int_fast64_t i;
|
---|
141 | clock_t endClock;
|
---|
142 |
|
---|
143 | count = 0;
|
---|
144 | inputNum = 0;
|
---|
145 | startClock = clock();
|
---|
146 | do {
|
---|
147 | for ( i = minIterations; i; --i ) {
|
---|
148 | function( inputs_ui32[inputNum] );
|
---|
149 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
150 | }
|
---|
151 | count += minIterations;
|
---|
152 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
153 | inputNum = 0;
|
---|
154 | startClock = clock();
|
---|
155 | for ( i = count; i; --i ) {
|
---|
156 | function( inputs_ui32[inputNum] );
|
---|
157 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
158 | }
|
---|
159 | endClock = clock();
|
---|
160 | reportTime( count, endClock - startClock );
|
---|
161 |
|
---|
162 | }
|
---|
163 |
|
---|
164 | #endif
|
---|
165 |
|
---|
166 | static void time_a_ui32_z_f32( float32_t function( uint32_t ) )
|
---|
167 | {
|
---|
168 | int_fast64_t count;
|
---|
169 | int inputNum;
|
---|
170 | clock_t startClock;
|
---|
171 | int_fast64_t i;
|
---|
172 | clock_t endClock;
|
---|
173 |
|
---|
174 | count = 0;
|
---|
175 | inputNum = 0;
|
---|
176 | startClock = clock();
|
---|
177 | do {
|
---|
178 | for ( i = minIterations; i; --i ) {
|
---|
179 | function( inputs_ui32[inputNum] );
|
---|
180 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
181 | }
|
---|
182 | count += minIterations;
|
---|
183 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
184 | inputNum = 0;
|
---|
185 | startClock = clock();
|
---|
186 | for ( i = count; i; --i ) {
|
---|
187 | function( inputs_ui32[inputNum] );
|
---|
188 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
189 | }
|
---|
190 | endClock = clock();
|
---|
191 | reportTime( count, endClock - startClock );
|
---|
192 |
|
---|
193 | }
|
---|
194 |
|
---|
195 | #ifdef FLOAT64
|
---|
196 |
|
---|
197 | static void time_a_ui32_z_f64( float64_t function( uint32_t ) )
|
---|
198 | {
|
---|
199 | int_fast64_t count;
|
---|
200 | int inputNum;
|
---|
201 | clock_t startClock;
|
---|
202 | int_fast64_t i;
|
---|
203 | clock_t endClock;
|
---|
204 |
|
---|
205 | count = 0;
|
---|
206 | inputNum = 0;
|
---|
207 | startClock = clock();
|
---|
208 | do {
|
---|
209 | for ( i = minIterations; i; --i ) {
|
---|
210 | function( inputs_ui32[inputNum] );
|
---|
211 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
212 | }
|
---|
213 | count += minIterations;
|
---|
214 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
215 | inputNum = 0;
|
---|
216 | startClock = clock();
|
---|
217 | for ( i = count; i; --i ) {
|
---|
218 | function( inputs_ui32[inputNum] );
|
---|
219 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
220 | }
|
---|
221 | endClock = clock();
|
---|
222 | reportTime( count, endClock - startClock );
|
---|
223 |
|
---|
224 | }
|
---|
225 |
|
---|
226 | #endif
|
---|
227 |
|
---|
228 | #ifdef EXTFLOAT80
|
---|
229 |
|
---|
230 | static void time_a_ui32_z_extF80( void function( uint32_t, extFloat80_t * ) )
|
---|
231 | {
|
---|
232 | int_fast64_t count;
|
---|
233 | int inputNum;
|
---|
234 | clock_t startClock;
|
---|
235 | int_fast64_t i;
|
---|
236 | extFloat80_t z;
|
---|
237 | clock_t endClock;
|
---|
238 |
|
---|
239 | count = 0;
|
---|
240 | inputNum = 0;
|
---|
241 | startClock = clock();
|
---|
242 | do {
|
---|
243 | for ( i = minIterations; i; --i ) {
|
---|
244 | function( inputs_ui32[inputNum], &z );
|
---|
245 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
246 | }
|
---|
247 | count += minIterations;
|
---|
248 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
249 | inputNum = 0;
|
---|
250 | startClock = clock();
|
---|
251 | for ( i = count; i; --i ) {
|
---|
252 | function( inputs_ui32[inputNum], &z );
|
---|
253 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
254 | }
|
---|
255 | endClock = clock();
|
---|
256 | reportTime( count, endClock - startClock );
|
---|
257 |
|
---|
258 | }
|
---|
259 |
|
---|
260 | #endif
|
---|
261 |
|
---|
262 | #ifdef FLOAT128
|
---|
263 |
|
---|
264 | static void time_a_ui32_z_f128( void function( uint32_t, float128_t * ) )
|
---|
265 | {
|
---|
266 | int_fast64_t count;
|
---|
267 | int inputNum;
|
---|
268 | clock_t startClock;
|
---|
269 | int_fast64_t i;
|
---|
270 | float128_t z;
|
---|
271 | clock_t endClock;
|
---|
272 |
|
---|
273 | count = 0;
|
---|
274 | inputNum = 0;
|
---|
275 | startClock = clock();
|
---|
276 | do {
|
---|
277 | for ( i = minIterations; i; --i ) {
|
---|
278 | function( inputs_ui32[inputNum], &z );
|
---|
279 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
280 | }
|
---|
281 | count += minIterations;
|
---|
282 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
283 | inputNum = 0;
|
---|
284 | startClock = clock();
|
---|
285 | for ( i = count; i; --i ) {
|
---|
286 | function( inputs_ui32[inputNum], &z );
|
---|
287 | inputNum = (inputNum + 1) & (numInputs_ui32 - 1);
|
---|
288 | }
|
---|
289 | endClock = clock();
|
---|
290 | reportTime( count, endClock - startClock );
|
---|
291 |
|
---|
292 | }
|
---|
293 |
|
---|
294 | #endif
|
---|
295 |
|
---|
296 | /*----------------------------------------------------------------------------
|
---|
297 | *----------------------------------------------------------------------------*/
|
---|
298 |
|
---|
299 | enum { numInputs_ui64 = 32 };
|
---|
300 |
|
---|
301 | static const int64_t inputs_ui64[numInputs_ui64] = {
|
---|
302 | UINT64_C( 0x04003C0000000001 ), UINT64_C( 0x0000000003C589BC ),
|
---|
303 | UINT64_C( 0x00000000400013FE ), UINT64_C( 0x0000000000186171 ),
|
---|
304 | UINT64_C( 0x0000000000010406 ), UINT64_C( 0x000002861920038D ),
|
---|
305 | UINT64_C( 0x0000000010001DFF ), UINT64_C( 0x22E5F0F387AEC8F0 ),
|
---|
306 | UINT64_C( 0x00007C0000010002 ), UINT64_C( 0x00756EBD1AD0C1C7 ),
|
---|
307 | UINT64_C( 0x0003FDFFFFFFFFBE ), UINT64_C( 0x0007D0FB2C2CA951 ),
|
---|
308 | UINT64_C( 0x0007FC0007FFFFFE ), UINT64_C( 0x0000001F942B18BB ),
|
---|
309 | UINT64_C( 0x0000080101FFFFFE ), UINT64_C( 0x000000000000F688 ),
|
---|
310 | UINT64_C( 0x000000000008BFFF ), UINT64_C( 0x0000000006F5AF08 ),
|
---|
311 | UINT64_C( 0x0021008000000002 ), UINT64_C( 0x0000000000000003 ),
|
---|
312 | UINT64_C( 0x3FFFFFFFFF80007D ), UINT64_C( 0x0000000000000078 ),
|
---|
313 | UINT64_C( 0x0007FFFFFF802003 ), UINT64_C( 0x1BBC775B78016AB0 ),
|
---|
314 | UINT64_C( 0x0006FFE000000002 ), UINT64_C( 0x0002B89854671BC1 ),
|
---|
315 | UINT64_C( 0x0000010001FFFFE2 ), UINT64_C( 0x00000000000FB103 ),
|
---|
316 | UINT64_C( 0x07FFFFFFFFFFF7FF ), UINT64_C( 0x00036155C7076FB0 ),
|
---|
317 | UINT64_C( 0x00000020FBFFFFFE ), UINT64_C( 0x0000099AE6455357 )
|
---|
318 | };
|
---|
319 |
|
---|
320 | #ifdef FLOAT16
|
---|
321 |
|
---|
322 | static void time_a_ui64_z_f16( float16_t function( uint64_t ) )
|
---|
323 | {
|
---|
324 | int_fast64_t count;
|
---|
325 | int inputNum;
|
---|
326 | clock_t startClock;
|
---|
327 | int_fast64_t i;
|
---|
328 | clock_t endClock;
|
---|
329 |
|
---|
330 | count = 0;
|
---|
331 | inputNum = 0;
|
---|
332 | startClock = clock();
|
---|
333 | do {
|
---|
334 | for ( i = minIterations; i; --i ) {
|
---|
335 | function( inputs_ui64[inputNum] );
|
---|
336 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
337 | }
|
---|
338 | count += minIterations;
|
---|
339 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
340 | inputNum = 0;
|
---|
341 | startClock = clock();
|
---|
342 | for ( i = count; i; --i ) {
|
---|
343 | function( inputs_ui64[inputNum] );
|
---|
344 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
345 | }
|
---|
346 | endClock = clock();
|
---|
347 | reportTime( count, endClock - startClock );
|
---|
348 |
|
---|
349 | }
|
---|
350 |
|
---|
351 | #endif
|
---|
352 |
|
---|
353 | static void time_a_ui64_z_f32( float32_t function( uint64_t ) )
|
---|
354 | {
|
---|
355 | int_fast64_t count;
|
---|
356 | int inputNum;
|
---|
357 | clock_t startClock;
|
---|
358 | int_fast64_t i;
|
---|
359 | clock_t endClock;
|
---|
360 |
|
---|
361 | count = 0;
|
---|
362 | inputNum = 0;
|
---|
363 | startClock = clock();
|
---|
364 | do {
|
---|
365 | for ( i = minIterations; i; --i ) {
|
---|
366 | function( inputs_ui64[inputNum] );
|
---|
367 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
368 | }
|
---|
369 | count += minIterations;
|
---|
370 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
371 | inputNum = 0;
|
---|
372 | startClock = clock();
|
---|
373 | for ( i = count; i; --i ) {
|
---|
374 | function( inputs_ui64[inputNum] );
|
---|
375 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
376 | }
|
---|
377 | endClock = clock();
|
---|
378 | reportTime( count, endClock - startClock );
|
---|
379 |
|
---|
380 | }
|
---|
381 |
|
---|
382 | #ifdef FLOAT64
|
---|
383 |
|
---|
384 | static void time_a_ui64_z_f64( float64_t function( uint64_t ) )
|
---|
385 | {
|
---|
386 | int_fast64_t count;
|
---|
387 | int inputNum;
|
---|
388 | clock_t startClock;
|
---|
389 | int_fast64_t i;
|
---|
390 | clock_t endClock;
|
---|
391 |
|
---|
392 | count = 0;
|
---|
393 | inputNum = 0;
|
---|
394 | startClock = clock();
|
---|
395 | do {
|
---|
396 | for ( i = minIterations; i; --i ) {
|
---|
397 | function( inputs_ui64[inputNum] );
|
---|
398 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
399 | }
|
---|
400 | count += minIterations;
|
---|
401 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
402 | inputNum = 0;
|
---|
403 | startClock = clock();
|
---|
404 | for ( i = count; i; --i ) {
|
---|
405 | function( inputs_ui64[inputNum] );
|
---|
406 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
407 | }
|
---|
408 | endClock = clock();
|
---|
409 | reportTime( count, endClock - startClock );
|
---|
410 |
|
---|
411 | }
|
---|
412 |
|
---|
413 | #endif
|
---|
414 |
|
---|
415 | #ifdef EXTFLOAT80
|
---|
416 |
|
---|
417 | static void time_a_ui64_z_extF80( void function( uint64_t, extFloat80_t * ) )
|
---|
418 | {
|
---|
419 | int_fast64_t count;
|
---|
420 | int inputNum;
|
---|
421 | clock_t startClock;
|
---|
422 | int_fast64_t i;
|
---|
423 | extFloat80_t z;
|
---|
424 | clock_t endClock;
|
---|
425 |
|
---|
426 | count = 0;
|
---|
427 | inputNum = 0;
|
---|
428 | startClock = clock();
|
---|
429 | do {
|
---|
430 | for ( i = minIterations; i; --i ) {
|
---|
431 | function( inputs_ui64[inputNum], &z );
|
---|
432 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
433 | }
|
---|
434 | count += minIterations;
|
---|
435 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
436 | inputNum = 0;
|
---|
437 | startClock = clock();
|
---|
438 | for ( i = count; i; --i ) {
|
---|
439 | function( inputs_ui64[inputNum], &z );
|
---|
440 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
441 | }
|
---|
442 | endClock = clock();
|
---|
443 | reportTime( count, endClock - startClock );
|
---|
444 |
|
---|
445 | }
|
---|
446 |
|
---|
447 | #endif
|
---|
448 |
|
---|
449 | #ifdef FLOAT128
|
---|
450 |
|
---|
451 | static void time_a_ui64_z_f128( void function( uint64_t, float128_t * ) )
|
---|
452 | {
|
---|
453 | int_fast64_t count;
|
---|
454 | int inputNum;
|
---|
455 | clock_t startClock;
|
---|
456 | int_fast64_t i;
|
---|
457 | float128_t z;
|
---|
458 | clock_t endClock;
|
---|
459 |
|
---|
460 | count = 0;
|
---|
461 | inputNum = 0;
|
---|
462 | startClock = clock();
|
---|
463 | do {
|
---|
464 | for ( i = minIterations; i; --i ) {
|
---|
465 | function( inputs_ui64[inputNum], &z );
|
---|
466 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
467 | }
|
---|
468 | count += minIterations;
|
---|
469 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
470 | inputNum = 0;
|
---|
471 | startClock = clock();
|
---|
472 | for ( i = count; i; --i ) {
|
---|
473 | function( inputs_ui64[inputNum], &z );
|
---|
474 | inputNum = (inputNum + 1) & (numInputs_ui64 - 1);
|
---|
475 | }
|
---|
476 | endClock = clock();
|
---|
477 | reportTime( count, endClock - startClock );
|
---|
478 |
|
---|
479 | }
|
---|
480 |
|
---|
481 | #endif
|
---|
482 |
|
---|
483 | /*----------------------------------------------------------------------------
|
---|
484 | *----------------------------------------------------------------------------*/
|
---|
485 |
|
---|
486 | enum { numInputs_i32 = 32 };
|
---|
487 |
|
---|
488 | static const int32_t inputs_i32[numInputs_i32] = {
|
---|
489 | -0x00004487, 0x405CF80F, 0x00000000, -0x000002FC,
|
---|
490 | -0x000DFFFE, 0x0C8EF795, -0x0FFFEE01, 0x000006CA,
|
---|
491 | 0x00009BFE, -0x00B79D1D, -0x60001002, -0x00000049,
|
---|
492 | 0x0BFF7FFF, 0x0000F37A, 0x0011DFFE, 0x00000006,
|
---|
493 | -0x000FDFFA, -0x0000082F, 0x10200003, -0x2172089B,
|
---|
494 | 0x00003E02, 0x000019E8, 0x0008FFFE, -0x000004A4,
|
---|
495 | -0x00208002, 0x07C42FBF, 0x0FFFE3FF, 0x040B9F13,
|
---|
496 | -0x40000008, 0x0001BF56, 0x000017F6, 0x000A908A
|
---|
497 | };
|
---|
498 |
|
---|
499 | #ifdef FLOAT16
|
---|
500 |
|
---|
501 | static void time_a_i32_z_f16( float16_t function( int32_t ) )
|
---|
502 | {
|
---|
503 | int_fast64_t count;
|
---|
504 | int inputNum;
|
---|
505 | clock_t startClock;
|
---|
506 | int_fast64_t i;
|
---|
507 | clock_t endClock;
|
---|
508 |
|
---|
509 | count = 0;
|
---|
510 | inputNum = 0;
|
---|
511 | startClock = clock();
|
---|
512 | do {
|
---|
513 | for ( i = minIterations; i; --i ) {
|
---|
514 | function( inputs_i32[inputNum] );
|
---|
515 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
516 | }
|
---|
517 | count += minIterations;
|
---|
518 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
519 | inputNum = 0;
|
---|
520 | startClock = clock();
|
---|
521 | for ( i = count; i; --i ) {
|
---|
522 | function( inputs_i32[inputNum] );
|
---|
523 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
524 | }
|
---|
525 | endClock = clock();
|
---|
526 | reportTime( count, endClock - startClock );
|
---|
527 |
|
---|
528 | }
|
---|
529 |
|
---|
530 | #endif
|
---|
531 |
|
---|
532 | static void time_a_i32_z_f32( float32_t function( int32_t ) )
|
---|
533 | {
|
---|
534 | int_fast64_t count;
|
---|
535 | int inputNum;
|
---|
536 | clock_t startClock;
|
---|
537 | int_fast64_t i;
|
---|
538 | clock_t endClock;
|
---|
539 |
|
---|
540 | count = 0;
|
---|
541 | inputNum = 0;
|
---|
542 | startClock = clock();
|
---|
543 | do {
|
---|
544 | for ( i = minIterations; i; --i ) {
|
---|
545 | function( inputs_i32[inputNum] );
|
---|
546 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
547 | }
|
---|
548 | count += minIterations;
|
---|
549 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
550 | inputNum = 0;
|
---|
551 | startClock = clock();
|
---|
552 | for ( i = count; i; --i ) {
|
---|
553 | function( inputs_i32[inputNum] );
|
---|
554 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
555 | }
|
---|
556 | endClock = clock();
|
---|
557 | reportTime( count, endClock - startClock );
|
---|
558 |
|
---|
559 | }
|
---|
560 |
|
---|
561 | #ifdef FLOAT64
|
---|
562 |
|
---|
563 | static void time_a_i32_z_f64( float64_t function( int32_t ) )
|
---|
564 | {
|
---|
565 | int_fast64_t count;
|
---|
566 | int inputNum;
|
---|
567 | clock_t startClock;
|
---|
568 | int_fast64_t i;
|
---|
569 | clock_t endClock;
|
---|
570 |
|
---|
571 | count = 0;
|
---|
572 | inputNum = 0;
|
---|
573 | startClock = clock();
|
---|
574 | do {
|
---|
575 | for ( i = minIterations; i; --i ) {
|
---|
576 | function( inputs_i32[inputNum] );
|
---|
577 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
578 | }
|
---|
579 | count += minIterations;
|
---|
580 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
581 | inputNum = 0;
|
---|
582 | startClock = clock();
|
---|
583 | for ( i = count; i; --i ) {
|
---|
584 | function( inputs_i32[inputNum] );
|
---|
585 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
586 | }
|
---|
587 | endClock = clock();
|
---|
588 | reportTime( count, endClock - startClock );
|
---|
589 |
|
---|
590 | }
|
---|
591 |
|
---|
592 | #endif
|
---|
593 |
|
---|
594 | #ifdef EXTFLOAT80
|
---|
595 |
|
---|
596 | static void time_a_i32_z_extF80( void function( int32_t, extFloat80_t * ) )
|
---|
597 | {
|
---|
598 | int_fast64_t count;
|
---|
599 | int inputNum;
|
---|
600 | clock_t startClock;
|
---|
601 | int_fast64_t i;
|
---|
602 | extFloat80_t z;
|
---|
603 | clock_t endClock;
|
---|
604 |
|
---|
605 | count = 0;
|
---|
606 | inputNum = 0;
|
---|
607 | startClock = clock();
|
---|
608 | do {
|
---|
609 | for ( i = minIterations; i; --i ) {
|
---|
610 | function( inputs_i32[inputNum], &z );
|
---|
611 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
612 | }
|
---|
613 | count += minIterations;
|
---|
614 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
615 | inputNum = 0;
|
---|
616 | startClock = clock();
|
---|
617 | for ( i = count; i; --i ) {
|
---|
618 | function( inputs_i32[inputNum], &z );
|
---|
619 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
620 | }
|
---|
621 | endClock = clock();
|
---|
622 | reportTime( count, endClock - startClock );
|
---|
623 |
|
---|
624 | }
|
---|
625 |
|
---|
626 | #endif
|
---|
627 |
|
---|
628 | #ifdef FLOAT128
|
---|
629 |
|
---|
630 | static void time_a_i32_z_f128( void function( int32_t, float128_t * ) )
|
---|
631 | {
|
---|
632 | int_fast64_t count;
|
---|
633 | int inputNum;
|
---|
634 | clock_t startClock;
|
---|
635 | int_fast64_t i;
|
---|
636 | float128_t z;
|
---|
637 | clock_t endClock;
|
---|
638 |
|
---|
639 | count = 0;
|
---|
640 | inputNum = 0;
|
---|
641 | startClock = clock();
|
---|
642 | do {
|
---|
643 | for ( i = minIterations; i; --i ) {
|
---|
644 | function( inputs_i32[inputNum], &z );
|
---|
645 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
646 | }
|
---|
647 | count += minIterations;
|
---|
648 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
649 | inputNum = 0;
|
---|
650 | startClock = clock();
|
---|
651 | for ( i = count; i; --i ) {
|
---|
652 | function( inputs_i32[inputNum], &z );
|
---|
653 | inputNum = (inputNum + 1) & (numInputs_i32 - 1);
|
---|
654 | }
|
---|
655 | endClock = clock();
|
---|
656 | reportTime( count, endClock - startClock );
|
---|
657 |
|
---|
658 | }
|
---|
659 |
|
---|
660 | #endif
|
---|
661 |
|
---|
662 | /*----------------------------------------------------------------------------
|
---|
663 | *----------------------------------------------------------------------------*/
|
---|
664 |
|
---|
665 | enum { numInputs_i64 = 32 };
|
---|
666 |
|
---|
667 | static const int64_t inputs_i64[numInputs_i64] = {
|
---|
668 | -INT64_C( 0x04003C0000000001 ), INT64_C( 0x0000000003C589BC ),
|
---|
669 | INT64_C( 0x00000000400013FE ), INT64_C( 0x0000000000186171 ),
|
---|
670 | -INT64_C( 0x0000000000010406 ), -INT64_C( 0x000002861920038D ),
|
---|
671 | INT64_C( 0x0000000010001DFF ), -INT64_C( 0x22E5F0F387AEC8F0 ),
|
---|
672 | -INT64_C( 0x00007C0000010002 ), INT64_C( 0x00756EBD1AD0C1C7 ),
|
---|
673 | INT64_C( 0x0003FDFFFFFFFFBE ), INT64_C( 0x0007D0FB2C2CA951 ),
|
---|
674 | INT64_C( 0x0007FC0007FFFFFE ), INT64_C( 0x0000001F942B18BB ),
|
---|
675 | INT64_C( 0x0000080101FFFFFE ), -INT64_C( 0x000000000000F688 ),
|
---|
676 | INT64_C( 0x000000000008BFFF ), INT64_C( 0x0000000006F5AF08 ),
|
---|
677 | -INT64_C( 0x0021008000000002 ), INT64_C( 0x0000000000000003 ),
|
---|
678 | INT64_C( 0x3FFFFFFFFF80007D ), INT64_C( 0x0000000000000078 ),
|
---|
679 | -INT64_C( 0x0007FFFFFF802003 ), INT64_C( 0x1BBC775B78016AB0 ),
|
---|
680 | -INT64_C( 0x0006FFE000000002 ), -INT64_C( 0x0002B89854671BC1 ),
|
---|
681 | -INT64_C( 0x0000010001FFFFE2 ), -INT64_C( 0x00000000000FB103 ),
|
---|
682 | INT64_C( 0x07FFFFFFFFFFF7FF ), -INT64_C( 0x00036155C7076FB0 ),
|
---|
683 | INT64_C( 0x00000020FBFFFFFE ), INT64_C( 0x0000099AE6455357 )
|
---|
684 | };
|
---|
685 |
|
---|
686 | #ifdef FLOAT16
|
---|
687 |
|
---|
688 | static void time_a_i64_z_f16( float16_t function( int64_t ) )
|
---|
689 | {
|
---|
690 | int_fast64_t count;
|
---|
691 | int inputNum;
|
---|
692 | clock_t startClock;
|
---|
693 | int_fast64_t i;
|
---|
694 | clock_t endClock;
|
---|
695 |
|
---|
696 | count = 0;
|
---|
697 | inputNum = 0;
|
---|
698 | startClock = clock();
|
---|
699 | do {
|
---|
700 | for ( i = minIterations; i; --i ) {
|
---|
701 | function( inputs_i64[inputNum] );
|
---|
702 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
703 | }
|
---|
704 | count += minIterations;
|
---|
705 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
706 | inputNum = 0;
|
---|
707 | startClock = clock();
|
---|
708 | for ( i = count; i; --i ) {
|
---|
709 | function( inputs_i64[inputNum] );
|
---|
710 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
711 | }
|
---|
712 | endClock = clock();
|
---|
713 | reportTime( count, endClock - startClock );
|
---|
714 |
|
---|
715 | }
|
---|
716 |
|
---|
717 | #endif
|
---|
718 |
|
---|
719 | static void time_a_i64_z_f32( float32_t function( int64_t ) )
|
---|
720 | {
|
---|
721 | int_fast64_t count;
|
---|
722 | int inputNum;
|
---|
723 | clock_t startClock;
|
---|
724 | int_fast64_t i;
|
---|
725 | clock_t endClock;
|
---|
726 |
|
---|
727 | count = 0;
|
---|
728 | inputNum = 0;
|
---|
729 | startClock = clock();
|
---|
730 | do {
|
---|
731 | for ( i = minIterations; i; --i ) {
|
---|
732 | function( inputs_i64[inputNum] );
|
---|
733 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
734 | }
|
---|
735 | count += minIterations;
|
---|
736 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
737 | inputNum = 0;
|
---|
738 | startClock = clock();
|
---|
739 | for ( i = count; i; --i ) {
|
---|
740 | function( inputs_i64[inputNum] );
|
---|
741 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
742 | }
|
---|
743 | endClock = clock();
|
---|
744 | reportTime( count, endClock - startClock );
|
---|
745 |
|
---|
746 | }
|
---|
747 |
|
---|
748 | #ifdef FLOAT64
|
---|
749 |
|
---|
750 | static void time_a_i64_z_f64( float64_t function( int64_t ) )
|
---|
751 | {
|
---|
752 | int_fast64_t count;
|
---|
753 | int inputNum;
|
---|
754 | clock_t startClock;
|
---|
755 | int_fast64_t i;
|
---|
756 | clock_t endClock;
|
---|
757 |
|
---|
758 | count = 0;
|
---|
759 | inputNum = 0;
|
---|
760 | startClock = clock();
|
---|
761 | do {
|
---|
762 | for ( i = minIterations; i; --i ) {
|
---|
763 | function( inputs_i64[inputNum] );
|
---|
764 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
765 | }
|
---|
766 | count += minIterations;
|
---|
767 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
768 | inputNum = 0;
|
---|
769 | startClock = clock();
|
---|
770 | for ( i = count; i; --i ) {
|
---|
771 | function( inputs_i64[inputNum] );
|
---|
772 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
773 | }
|
---|
774 | endClock = clock();
|
---|
775 | reportTime( count, endClock - startClock );
|
---|
776 |
|
---|
777 | }
|
---|
778 |
|
---|
779 | #endif
|
---|
780 |
|
---|
781 | #ifdef EXTFLOAT80
|
---|
782 |
|
---|
783 | static void time_a_i64_z_extF80( void function( int64_t, extFloat80_t * ) )
|
---|
784 | {
|
---|
785 | int_fast64_t count;
|
---|
786 | int inputNum;
|
---|
787 | clock_t startClock;
|
---|
788 | int_fast64_t i;
|
---|
789 | extFloat80_t z;
|
---|
790 | clock_t endClock;
|
---|
791 |
|
---|
792 | count = 0;
|
---|
793 | inputNum = 0;
|
---|
794 | startClock = clock();
|
---|
795 | do {
|
---|
796 | for ( i = minIterations; i; --i ) {
|
---|
797 | function( inputs_i64[inputNum], &z );
|
---|
798 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
799 | }
|
---|
800 | count += minIterations;
|
---|
801 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
802 | inputNum = 0;
|
---|
803 | startClock = clock();
|
---|
804 | for ( i = count; i; --i ) {
|
---|
805 | function( inputs_i64[inputNum], &z );
|
---|
806 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
807 | }
|
---|
808 | endClock = clock();
|
---|
809 | reportTime( count, endClock - startClock );
|
---|
810 |
|
---|
811 | }
|
---|
812 |
|
---|
813 | #endif
|
---|
814 |
|
---|
815 | #ifdef FLOAT128
|
---|
816 |
|
---|
817 | static void time_a_i64_z_f128( void function( int64_t, float128_t * ) )
|
---|
818 | {
|
---|
819 | int_fast64_t count;
|
---|
820 | int inputNum;
|
---|
821 | clock_t startClock;
|
---|
822 | int_fast64_t i;
|
---|
823 | float128_t z;
|
---|
824 | clock_t endClock;
|
---|
825 |
|
---|
826 | count = 0;
|
---|
827 | inputNum = 0;
|
---|
828 | startClock = clock();
|
---|
829 | do {
|
---|
830 | for ( i = minIterations; i; --i ) {
|
---|
831 | function( inputs_i64[inputNum], &z );
|
---|
832 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
833 | }
|
---|
834 | count += minIterations;
|
---|
835 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
836 | inputNum = 0;
|
---|
837 | startClock = clock();
|
---|
838 | for ( i = count; i; --i ) {
|
---|
839 | function( inputs_i64[inputNum], &z );
|
---|
840 | inputNum = (inputNum + 1) & (numInputs_i64 - 1);
|
---|
841 | }
|
---|
842 | endClock = clock();
|
---|
843 | reportTime( count, endClock - startClock );
|
---|
844 |
|
---|
845 | }
|
---|
846 |
|
---|
847 | #endif
|
---|
848 |
|
---|
849 | /*----------------------------------------------------------------------------
|
---|
850 | *----------------------------------------------------------------------------*/
|
---|
851 |
|
---|
852 | #ifdef FLOAT16
|
---|
853 |
|
---|
854 | enum { numInputs_f16 = 32 };
|
---|
855 |
|
---|
856 | static const uint16_t inputs_F16UI[numInputs_f16] = {
|
---|
857 | 0x0BBA, 0x77FE, 0x084F, 0x9C0F, 0x7800, 0x4436, 0xCE67, 0x80F3,
|
---|
858 | 0x87EF, 0xC2FA, 0x7BFF, 0x13FE, 0x7BFE, 0x1C00, 0xAC46, 0xEAFA,
|
---|
859 | 0x3813, 0x4804, 0x385E, 0x8000, 0xB86C, 0x4B7D, 0xC7FD, 0xC97F,
|
---|
860 | 0x260C, 0x78EE, 0xB84F, 0x249E, 0x0D27, 0x37DC, 0x8400, 0xE8EF
|
---|
861 | };
|
---|
862 |
|
---|
863 | static
|
---|
864 | void
|
---|
865 | time_a_f16_z_ui32_rx(
|
---|
866 | uint_fast32_t function( float16_t, uint_fast8_t, bool ),
|
---|
867 | uint_fast8_t roundingMode,
|
---|
868 | bool exact
|
---|
869 | )
|
---|
870 | {
|
---|
871 | int_fast64_t count;
|
---|
872 | int inputNum;
|
---|
873 | clock_t startClock;
|
---|
874 | int_fast64_t i;
|
---|
875 | union ui16_f16 uA;
|
---|
876 | clock_t endClock;
|
---|
877 |
|
---|
878 | count = 0;
|
---|
879 | inputNum = 0;
|
---|
880 | startClock = clock();
|
---|
881 | do {
|
---|
882 | for ( i = minIterations; i; --i ) {
|
---|
883 | uA.ui = inputs_F16UI[inputNum];
|
---|
884 | function( uA.f, roundingMode, exact );
|
---|
885 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
886 | }
|
---|
887 | count += minIterations;
|
---|
888 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
889 | inputNum = 0;
|
---|
890 | startClock = clock();
|
---|
891 | for ( i = count; i; --i ) {
|
---|
892 | uA.ui = inputs_F16UI[inputNum];
|
---|
893 | function( uA.f, roundingMode, exact );
|
---|
894 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
895 | }
|
---|
896 | endClock = clock();
|
---|
897 | reportTime( count, endClock - startClock );
|
---|
898 |
|
---|
899 | }
|
---|
900 |
|
---|
901 | static
|
---|
902 | void
|
---|
903 | time_a_f16_z_ui64_rx(
|
---|
904 | uint_fast64_t function( float16_t, uint_fast8_t, bool ),
|
---|
905 | uint_fast8_t roundingMode,
|
---|
906 | bool exact
|
---|
907 | )
|
---|
908 | {
|
---|
909 | int_fast64_t count;
|
---|
910 | int inputNum;
|
---|
911 | clock_t startClock;
|
---|
912 | int_fast64_t i;
|
---|
913 | union ui16_f16 uA;
|
---|
914 | clock_t endClock;
|
---|
915 |
|
---|
916 | count = 0;
|
---|
917 | inputNum = 0;
|
---|
918 | startClock = clock();
|
---|
919 | do {
|
---|
920 | for ( i = minIterations; i; --i ) {
|
---|
921 | uA.ui = inputs_F16UI[inputNum];
|
---|
922 | function( uA.f, roundingMode, exact );
|
---|
923 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
924 | }
|
---|
925 | count += minIterations;
|
---|
926 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
927 | inputNum = 0;
|
---|
928 | startClock = clock();
|
---|
929 | for ( i = count; i; --i ) {
|
---|
930 | uA.ui = inputs_F16UI[inputNum];
|
---|
931 | function( uA.f, roundingMode, exact );
|
---|
932 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
933 | }
|
---|
934 | endClock = clock();
|
---|
935 | reportTime( count, endClock - startClock );
|
---|
936 |
|
---|
937 | }
|
---|
938 |
|
---|
939 | static
|
---|
940 | void
|
---|
941 | time_a_f16_z_i32_rx(
|
---|
942 | int_fast32_t function( float16_t, uint_fast8_t, bool ),
|
---|
943 | uint_fast8_t roundingMode,
|
---|
944 | bool exact
|
---|
945 | )
|
---|
946 | {
|
---|
947 | int_fast64_t count;
|
---|
948 | int inputNum;
|
---|
949 | clock_t startClock;
|
---|
950 | int_fast64_t i;
|
---|
951 | union ui16_f16 uA;
|
---|
952 | clock_t endClock;
|
---|
953 |
|
---|
954 | count = 0;
|
---|
955 | inputNum = 0;
|
---|
956 | startClock = clock();
|
---|
957 | do {
|
---|
958 | for ( i = minIterations; i; --i ) {
|
---|
959 | uA.ui = inputs_F16UI[inputNum];
|
---|
960 | function( uA.f, roundingMode, exact );
|
---|
961 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
962 | }
|
---|
963 | count += minIterations;
|
---|
964 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
965 | inputNum = 0;
|
---|
966 | startClock = clock();
|
---|
967 | for ( i = count; i; --i ) {
|
---|
968 | uA.ui = inputs_F16UI[inputNum];
|
---|
969 | function( uA.f, roundingMode, exact );
|
---|
970 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
971 | }
|
---|
972 | endClock = clock();
|
---|
973 | reportTime( count, endClock - startClock );
|
---|
974 |
|
---|
975 | }
|
---|
976 |
|
---|
977 | static
|
---|
978 | void
|
---|
979 | time_a_f16_z_i64_rx(
|
---|
980 | int_fast64_t function( float16_t, uint_fast8_t, bool ),
|
---|
981 | uint_fast8_t roundingMode,
|
---|
982 | bool exact
|
---|
983 | )
|
---|
984 | {
|
---|
985 | int_fast64_t count;
|
---|
986 | int inputNum;
|
---|
987 | clock_t startClock;
|
---|
988 | int_fast64_t i;
|
---|
989 | union ui16_f16 uA;
|
---|
990 | clock_t endClock;
|
---|
991 |
|
---|
992 | count = 0;
|
---|
993 | inputNum = 0;
|
---|
994 | startClock = clock();
|
---|
995 | do {
|
---|
996 | for ( i = minIterations; i; --i ) {
|
---|
997 | uA.ui = inputs_F16UI[inputNum];
|
---|
998 | function( uA.f, roundingMode, exact );
|
---|
999 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1000 | }
|
---|
1001 | count += minIterations;
|
---|
1002 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1003 | inputNum = 0;
|
---|
1004 | startClock = clock();
|
---|
1005 | for ( i = count; i; --i ) {
|
---|
1006 | uA.ui = inputs_F16UI[inputNum];
|
---|
1007 | function( uA.f, roundingMode, exact );
|
---|
1008 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1009 | }
|
---|
1010 | endClock = clock();
|
---|
1011 | reportTime( count, endClock - startClock );
|
---|
1012 |
|
---|
1013 | }
|
---|
1014 |
|
---|
1015 | static
|
---|
1016 | void
|
---|
1017 | time_a_f16_z_ui32_x( uint_fast32_t function( float16_t, bool ), bool exact )
|
---|
1018 | {
|
---|
1019 | int_fast64_t count;
|
---|
1020 | int inputNum;
|
---|
1021 | clock_t startClock;
|
---|
1022 | int_fast64_t i;
|
---|
1023 | union ui16_f16 uA;
|
---|
1024 | clock_t endClock;
|
---|
1025 |
|
---|
1026 | count = 0;
|
---|
1027 | inputNum = 0;
|
---|
1028 | startClock = clock();
|
---|
1029 | do {
|
---|
1030 | for ( i = minIterations; i; --i ) {
|
---|
1031 | uA.ui = inputs_F16UI[inputNum];
|
---|
1032 | function( uA.f, exact );
|
---|
1033 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1034 | }
|
---|
1035 | count += minIterations;
|
---|
1036 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1037 | inputNum = 0;
|
---|
1038 | startClock = clock();
|
---|
1039 | for ( i = count; i; --i ) {
|
---|
1040 | uA.ui = inputs_F16UI[inputNum];
|
---|
1041 | function( uA.f, exact );
|
---|
1042 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1043 | }
|
---|
1044 | endClock = clock();
|
---|
1045 | reportTime( count, endClock - startClock );
|
---|
1046 |
|
---|
1047 | }
|
---|
1048 |
|
---|
1049 | static
|
---|
1050 | void
|
---|
1051 | time_a_f16_z_ui64_x( uint_fast64_t function( float16_t, bool ), bool exact )
|
---|
1052 | {
|
---|
1053 | int_fast64_t count;
|
---|
1054 | int inputNum;
|
---|
1055 | clock_t startClock;
|
---|
1056 | int_fast64_t i;
|
---|
1057 | union ui16_f16 uA;
|
---|
1058 | clock_t endClock;
|
---|
1059 |
|
---|
1060 | count = 0;
|
---|
1061 | inputNum = 0;
|
---|
1062 | startClock = clock();
|
---|
1063 | do {
|
---|
1064 | for ( i = minIterations; i; --i ) {
|
---|
1065 | uA.ui = inputs_F16UI[inputNum];
|
---|
1066 | function( uA.f, exact );
|
---|
1067 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1068 | }
|
---|
1069 | count += minIterations;
|
---|
1070 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1071 | inputNum = 0;
|
---|
1072 | startClock = clock();
|
---|
1073 | for ( i = count; i; --i ) {
|
---|
1074 | uA.ui = inputs_F16UI[inputNum];
|
---|
1075 | function( uA.f, exact );
|
---|
1076 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1077 | }
|
---|
1078 | endClock = clock();
|
---|
1079 | reportTime( count, endClock - startClock );
|
---|
1080 |
|
---|
1081 | }
|
---|
1082 |
|
---|
1083 | static
|
---|
1084 | void time_a_f16_z_i32_x( int_fast32_t function( float16_t, bool ), bool exact )
|
---|
1085 | {
|
---|
1086 | int_fast64_t count;
|
---|
1087 | int inputNum;
|
---|
1088 | clock_t startClock;
|
---|
1089 | int_fast64_t i;
|
---|
1090 | union ui16_f16 uA;
|
---|
1091 | clock_t endClock;
|
---|
1092 |
|
---|
1093 | count = 0;
|
---|
1094 | inputNum = 0;
|
---|
1095 | startClock = clock();
|
---|
1096 | do {
|
---|
1097 | for ( i = minIterations; i; --i ) {
|
---|
1098 | uA.ui = inputs_F16UI[inputNum];
|
---|
1099 | function( uA.f, exact );
|
---|
1100 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1101 | }
|
---|
1102 | count += minIterations;
|
---|
1103 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1104 | inputNum = 0;
|
---|
1105 | startClock = clock();
|
---|
1106 | for ( i = count; i; --i ) {
|
---|
1107 | uA.ui = inputs_F16UI[inputNum];
|
---|
1108 | function( uA.f, exact );
|
---|
1109 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1110 | }
|
---|
1111 | endClock = clock();
|
---|
1112 | reportTime( count, endClock - startClock );
|
---|
1113 |
|
---|
1114 | }
|
---|
1115 |
|
---|
1116 | static
|
---|
1117 | void time_a_f16_z_i64_x( int_fast64_t function( float16_t, bool ), bool exact )
|
---|
1118 | {
|
---|
1119 | int_fast64_t count;
|
---|
1120 | int inputNum;
|
---|
1121 | clock_t startClock;
|
---|
1122 | int_fast64_t i;
|
---|
1123 | union ui16_f16 uA;
|
---|
1124 | clock_t endClock;
|
---|
1125 |
|
---|
1126 | count = 0;
|
---|
1127 | inputNum = 0;
|
---|
1128 | startClock = clock();
|
---|
1129 | do {
|
---|
1130 | for ( i = minIterations; i; --i ) {
|
---|
1131 | uA.ui = inputs_F16UI[inputNum];
|
---|
1132 | function( uA.f, exact );
|
---|
1133 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1134 | }
|
---|
1135 | count += minIterations;
|
---|
1136 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1137 | inputNum = 0;
|
---|
1138 | startClock = clock();
|
---|
1139 | for ( i = count; i; --i ) {
|
---|
1140 | uA.ui = inputs_F16UI[inputNum];
|
---|
1141 | function( uA.f, exact );
|
---|
1142 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1143 | }
|
---|
1144 | endClock = clock();
|
---|
1145 | reportTime( count, endClock - startClock );
|
---|
1146 |
|
---|
1147 | }
|
---|
1148 |
|
---|
1149 | static void time_a_f16_z_f32( float32_t function( float16_t ) )
|
---|
1150 | {
|
---|
1151 | int_fast64_t count;
|
---|
1152 | int inputNum;
|
---|
1153 | clock_t startClock;
|
---|
1154 | int_fast64_t i;
|
---|
1155 | union ui16_f16 uA;
|
---|
1156 | clock_t endClock;
|
---|
1157 |
|
---|
1158 | count = 0;
|
---|
1159 | inputNum = 0;
|
---|
1160 | startClock = clock();
|
---|
1161 | do {
|
---|
1162 | for ( i = minIterations; i; --i ) {
|
---|
1163 | uA.ui = inputs_F16UI[inputNum];
|
---|
1164 | function( uA.f );
|
---|
1165 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1166 | }
|
---|
1167 | count += minIterations;
|
---|
1168 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1169 | inputNum = 0;
|
---|
1170 | startClock = clock();
|
---|
1171 | for ( i = count; i; --i ) {
|
---|
1172 | uA.ui = inputs_F16UI[inputNum];
|
---|
1173 | function( uA.f );
|
---|
1174 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1175 | }
|
---|
1176 | endClock = clock();
|
---|
1177 | reportTime( count, endClock - startClock );
|
---|
1178 |
|
---|
1179 | }
|
---|
1180 |
|
---|
1181 | #ifdef FLOAT64
|
---|
1182 |
|
---|
1183 | static void time_a_f16_z_f64( float64_t function( float16_t ) )
|
---|
1184 | {
|
---|
1185 | int_fast64_t count;
|
---|
1186 | int inputNum;
|
---|
1187 | clock_t startClock;
|
---|
1188 | int_fast64_t i;
|
---|
1189 | union ui16_f16 uA;
|
---|
1190 | clock_t endClock;
|
---|
1191 |
|
---|
1192 | count = 0;
|
---|
1193 | inputNum = 0;
|
---|
1194 | startClock = clock();
|
---|
1195 | do {
|
---|
1196 | for ( i = minIterations; i; --i ) {
|
---|
1197 | uA.ui = inputs_F16UI[inputNum];
|
---|
1198 | function( uA.f );
|
---|
1199 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1200 | }
|
---|
1201 | count += minIterations;
|
---|
1202 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1203 | inputNum = 0;
|
---|
1204 | startClock = clock();
|
---|
1205 | for ( i = count; i; --i ) {
|
---|
1206 | uA.ui = inputs_F16UI[inputNum];
|
---|
1207 | function( uA.f );
|
---|
1208 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1209 | }
|
---|
1210 | endClock = clock();
|
---|
1211 | reportTime( count, endClock - startClock );
|
---|
1212 |
|
---|
1213 | }
|
---|
1214 |
|
---|
1215 | #endif
|
---|
1216 |
|
---|
1217 | #ifdef EXTFLOAT80
|
---|
1218 |
|
---|
1219 | static void time_a_f16_z_extF80( void function( float16_t, extFloat80_t * ) )
|
---|
1220 | {
|
---|
1221 | int_fast64_t count;
|
---|
1222 | int inputNum;
|
---|
1223 | clock_t startClock;
|
---|
1224 | int_fast64_t i;
|
---|
1225 | union ui16_f16 uA;
|
---|
1226 | extFloat80_t z;
|
---|
1227 | clock_t endClock;
|
---|
1228 |
|
---|
1229 | count = 0;
|
---|
1230 | inputNum = 0;
|
---|
1231 | startClock = clock();
|
---|
1232 | do {
|
---|
1233 | for ( i = minIterations; i; --i ) {
|
---|
1234 | uA.ui = inputs_F16UI[inputNum];
|
---|
1235 | function( uA.f, &z );
|
---|
1236 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1237 | }
|
---|
1238 | count += minIterations;
|
---|
1239 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1240 | inputNum = 0;
|
---|
1241 | startClock = clock();
|
---|
1242 | for ( i = count; i; --i ) {
|
---|
1243 | uA.ui = inputs_F16UI[inputNum];
|
---|
1244 | function( uA.f, &z );
|
---|
1245 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1246 | }
|
---|
1247 | endClock = clock();
|
---|
1248 | reportTime( count, endClock - startClock );
|
---|
1249 |
|
---|
1250 | }
|
---|
1251 |
|
---|
1252 | #endif
|
---|
1253 |
|
---|
1254 | #ifdef FLOAT128
|
---|
1255 |
|
---|
1256 | static void time_a_f16_z_f128( void function( float16_t, float128_t * ) )
|
---|
1257 | {
|
---|
1258 | int_fast64_t count;
|
---|
1259 | int inputNum;
|
---|
1260 | clock_t startClock;
|
---|
1261 | int_fast64_t i;
|
---|
1262 | union ui16_f16 uA;
|
---|
1263 | float128_t z;
|
---|
1264 | clock_t endClock;
|
---|
1265 |
|
---|
1266 | count = 0;
|
---|
1267 | inputNum = 0;
|
---|
1268 | startClock = clock();
|
---|
1269 | do {
|
---|
1270 | for ( i = minIterations; i; --i ) {
|
---|
1271 | uA.ui = inputs_F16UI[inputNum];
|
---|
1272 | function( uA.f, &z );
|
---|
1273 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1274 | }
|
---|
1275 | count += minIterations;
|
---|
1276 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1277 | inputNum = 0;
|
---|
1278 | startClock = clock();
|
---|
1279 | for ( i = count; i; --i ) {
|
---|
1280 | uA.ui = inputs_F16UI[inputNum];
|
---|
1281 | function( uA.f, &z );
|
---|
1282 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1283 | }
|
---|
1284 | endClock = clock();
|
---|
1285 | reportTime( count, endClock - startClock );
|
---|
1286 |
|
---|
1287 | }
|
---|
1288 |
|
---|
1289 | #endif
|
---|
1290 |
|
---|
1291 | static
|
---|
1292 | void
|
---|
1293 | time_az_f16_rx(
|
---|
1294 | float16_t function( float16_t, uint_fast8_t, bool ),
|
---|
1295 | uint_fast8_t roundingMode,
|
---|
1296 | bool exact
|
---|
1297 | )
|
---|
1298 | {
|
---|
1299 | int_fast64_t count;
|
---|
1300 | int inputNum;
|
---|
1301 | clock_t startClock;
|
---|
1302 | int_fast64_t i;
|
---|
1303 | union ui16_f16 uA;
|
---|
1304 | clock_t endClock;
|
---|
1305 |
|
---|
1306 | count = 0;
|
---|
1307 | inputNum = 0;
|
---|
1308 | startClock = clock();
|
---|
1309 | do {
|
---|
1310 | for ( i = minIterations; i; --i ) {
|
---|
1311 | uA.ui = inputs_F16UI[inputNum];
|
---|
1312 | function( uA.f, roundingMode, exact );
|
---|
1313 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1314 | }
|
---|
1315 | count += minIterations;
|
---|
1316 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1317 | inputNum = 0;
|
---|
1318 | startClock = clock();
|
---|
1319 | for ( i = count; i; --i ) {
|
---|
1320 | uA.ui = inputs_F16UI[inputNum];
|
---|
1321 | function( uA.f, roundingMode, exact );
|
---|
1322 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1323 | }
|
---|
1324 | endClock = clock();
|
---|
1325 | reportTime( count, endClock - startClock );
|
---|
1326 |
|
---|
1327 | }
|
---|
1328 |
|
---|
1329 | static void time_abz_f16( float16_t function( float16_t, float16_t ) )
|
---|
1330 | {
|
---|
1331 | int_fast64_t count;
|
---|
1332 | int inputNumA, inputNumB;
|
---|
1333 | clock_t startClock;
|
---|
1334 | int_fast64_t i;
|
---|
1335 | union ui16_f16 uA, uB;
|
---|
1336 | clock_t endClock;
|
---|
1337 |
|
---|
1338 | count = 0;
|
---|
1339 | inputNumA = 0;
|
---|
1340 | inputNumB = 0;
|
---|
1341 | startClock = clock();
|
---|
1342 | do {
|
---|
1343 | for ( i = minIterations; i; --i ) {
|
---|
1344 | uA.ui = inputs_F16UI[inputNumA];
|
---|
1345 | uB.ui = inputs_F16UI[inputNumB];
|
---|
1346 | function( uA.f, uB.f );
|
---|
1347 | inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
|
---|
1348 | if ( ! inputNumA ) ++inputNumB;
|
---|
1349 | inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
|
---|
1350 | }
|
---|
1351 | count += minIterations;
|
---|
1352 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1353 | inputNumA = 0;
|
---|
1354 | inputNumB = 0;
|
---|
1355 | startClock = clock();
|
---|
1356 | for ( i = count; i; --i ) {
|
---|
1357 | uA.ui = inputs_F16UI[inputNumA];
|
---|
1358 | uB.ui = inputs_F16UI[inputNumB];
|
---|
1359 | function( uA.f, uB.f );
|
---|
1360 | inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
|
---|
1361 | if ( ! inputNumA ) ++inputNumB;
|
---|
1362 | inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
|
---|
1363 | }
|
---|
1364 | endClock = clock();
|
---|
1365 | reportTime( count, endClock - startClock );
|
---|
1366 |
|
---|
1367 | }
|
---|
1368 |
|
---|
1369 | static
|
---|
1370 | void time_abcz_f16( float16_t function( float16_t, float16_t, float16_t ) )
|
---|
1371 | {
|
---|
1372 | int_fast64_t count;
|
---|
1373 | int inputNumA, inputNumB, inputNumC;
|
---|
1374 | clock_t startClock;
|
---|
1375 | int_fast64_t i;
|
---|
1376 | union ui16_f16 uA, uB, uC;
|
---|
1377 | clock_t endClock;
|
---|
1378 |
|
---|
1379 | count = 0;
|
---|
1380 | inputNumA = 0;
|
---|
1381 | inputNumB = 0;
|
---|
1382 | inputNumC = 0;
|
---|
1383 | startClock = clock();
|
---|
1384 | do {
|
---|
1385 | for ( i = minIterations; i; --i ) {
|
---|
1386 | uA.ui = inputs_F16UI[inputNumA];
|
---|
1387 | uB.ui = inputs_F16UI[inputNumB];
|
---|
1388 | uC.ui = inputs_F16UI[inputNumC];
|
---|
1389 | function( uA.f, uB.f, uC.f );
|
---|
1390 | inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
|
---|
1391 | if ( ! inputNumA ) ++inputNumB;
|
---|
1392 | inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
|
---|
1393 | if ( ! inputNumB ) ++inputNumC;
|
---|
1394 | inputNumC = (inputNumC + 1) & (numInputs_f16 - 1);
|
---|
1395 | }
|
---|
1396 | count += minIterations;
|
---|
1397 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1398 | inputNumA = 0;
|
---|
1399 | inputNumB = 0;
|
---|
1400 | inputNumC = 0;
|
---|
1401 | startClock = clock();
|
---|
1402 | for ( i = count; i; --i ) {
|
---|
1403 | uA.ui = inputs_F16UI[inputNumA];
|
---|
1404 | uB.ui = inputs_F16UI[inputNumB];
|
---|
1405 | uC.ui = inputs_F16UI[inputNumC];
|
---|
1406 | function( uA.f, uB.f, uC.f );
|
---|
1407 | inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
|
---|
1408 | if ( ! inputNumA ) ++inputNumB;
|
---|
1409 | inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
|
---|
1410 | if ( ! inputNumB ) ++inputNumC;
|
---|
1411 | inputNumC = (inputNumC + 1) & (numInputs_f16 - 1);
|
---|
1412 | }
|
---|
1413 | endClock = clock();
|
---|
1414 | reportTime( count, endClock - startClock );
|
---|
1415 |
|
---|
1416 | }
|
---|
1417 |
|
---|
1418 | static void time_ab_f16_z_bool( bool function( float16_t, float16_t ) )
|
---|
1419 | {
|
---|
1420 | int_fast64_t count;
|
---|
1421 | int inputNumA, inputNumB;
|
---|
1422 | clock_t startClock;
|
---|
1423 | int_fast64_t i;
|
---|
1424 | union ui16_f16 uA, uB;
|
---|
1425 | clock_t endClock;
|
---|
1426 |
|
---|
1427 | count = 0;
|
---|
1428 | inputNumA = 0;
|
---|
1429 | inputNumB = 0;
|
---|
1430 | startClock = clock();
|
---|
1431 | do {
|
---|
1432 | for ( i = minIterations; i; --i ) {
|
---|
1433 | uA.ui = inputs_F16UI[inputNumA];
|
---|
1434 | uB.ui = inputs_F16UI[inputNumB];
|
---|
1435 | function( uA.f, uB.f );
|
---|
1436 | inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
|
---|
1437 | if ( ! inputNumA ) ++inputNumB;
|
---|
1438 | inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
|
---|
1439 | }
|
---|
1440 | count += minIterations;
|
---|
1441 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1442 | inputNumA = 0;
|
---|
1443 | inputNumB = 0;
|
---|
1444 | startClock = clock();
|
---|
1445 | for ( i = count; i; --i ) {
|
---|
1446 | uA.ui = inputs_F16UI[inputNumA];
|
---|
1447 | uB.ui = inputs_F16UI[inputNumB];
|
---|
1448 | function( uA.f, uB.f );
|
---|
1449 | inputNumA = (inputNumA + 1) & (numInputs_f16 - 1);
|
---|
1450 | if ( ! inputNumA ) ++inputNumB;
|
---|
1451 | inputNumB = (inputNumB + 1) & (numInputs_f16 - 1);
|
---|
1452 | }
|
---|
1453 | endClock = clock();
|
---|
1454 | reportTime( count, endClock - startClock );
|
---|
1455 |
|
---|
1456 | }
|
---|
1457 |
|
---|
1458 | static const uint16_t inputs_F16UI_pos[numInputs_f16] = {
|
---|
1459 | 0x0BBA, 0x77FE, 0x084F, 0x1C0F, 0x7800, 0x4436, 0x4E67, 0x00F3,
|
---|
1460 | 0x07EF, 0x42FA, 0x7BFF, 0x13FE, 0x7BFE, 0x1C00, 0x2C46, 0x6AFA,
|
---|
1461 | 0x3813, 0x4804, 0x385E, 0x0000, 0x386C, 0x4B7D, 0x47FD, 0x497F,
|
---|
1462 | 0x260C, 0x78EE, 0x384F, 0x249E, 0x0D27, 0x37DC, 0x0400, 0x68EF
|
---|
1463 | };
|
---|
1464 |
|
---|
1465 | static void time_az_f16_pos( float16_t function( float16_t ) )
|
---|
1466 | {
|
---|
1467 | int_fast64_t count;
|
---|
1468 | int inputNum;
|
---|
1469 | clock_t startClock;
|
---|
1470 | int_fast64_t i;
|
---|
1471 | union ui16_f16 uA;
|
---|
1472 | clock_t endClock;
|
---|
1473 |
|
---|
1474 | count = 0;
|
---|
1475 | inputNum = 0;
|
---|
1476 | startClock = clock();
|
---|
1477 | do {
|
---|
1478 | for ( i = minIterations; i; --i ) {
|
---|
1479 | uA.ui = inputs_F16UI_pos[inputNum];
|
---|
1480 | function( uA.f );
|
---|
1481 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1482 | }
|
---|
1483 | count += minIterations;
|
---|
1484 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1485 | inputNum = 0;
|
---|
1486 | startClock = clock();
|
---|
1487 | for ( i = count; i; --i ) {
|
---|
1488 | uA.ui = inputs_F16UI_pos[inputNum];
|
---|
1489 | function( uA.f );
|
---|
1490 | inputNum = (inputNum + 1) & (numInputs_f16 - 1);
|
---|
1491 | }
|
---|
1492 | endClock = clock();
|
---|
1493 | reportTime( count, endClock - startClock );
|
---|
1494 |
|
---|
1495 | }
|
---|
1496 |
|
---|
1497 | #endif
|
---|
1498 |
|
---|
1499 | /*----------------------------------------------------------------------------
|
---|
1500 | *----------------------------------------------------------------------------*/
|
---|
1501 |
|
---|
1502 | enum { numInputs_f32 = 32 };
|
---|
1503 |
|
---|
1504 | static const uint32_t inputs_F32UI[numInputs_f32] = {
|
---|
1505 | 0x4EFA0000, 0xC1D0B328, 0x80000000, 0x3E69A31E,
|
---|
1506 | 0xAF803EFF, 0x3F800000, 0x17BF8000, 0xE74A301A,
|
---|
1507 | 0x4E010003, 0x7EE3C75D, 0xBD803FE0, 0xBFFEFF00,
|
---|
1508 | 0x7981F800, 0x431FFFFC, 0xC100C000, 0x3D87EFFF,
|
---|
1509 | 0x4103FEFE, 0xBC000007, 0xBF01F7FF, 0x4E6C6B5C,
|
---|
1510 | 0xC187FFFE, 0xC58B9F13, 0x4F88007F, 0xDF004007,
|
---|
1511 | 0xB7FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
|
---|
1512 | 0xDB428661, 0x33F89B1F, 0xA3BFEFFF, 0x537BFFBE
|
---|
1513 | };
|
---|
1514 |
|
---|
1515 | static
|
---|
1516 | void
|
---|
1517 | time_a_f32_z_ui32_rx(
|
---|
1518 | uint_fast32_t function( float32_t, uint_fast8_t, bool ),
|
---|
1519 | uint_fast8_t roundingMode,
|
---|
1520 | bool exact
|
---|
1521 | )
|
---|
1522 | {
|
---|
1523 | int_fast64_t count;
|
---|
1524 | int inputNum;
|
---|
1525 | clock_t startClock;
|
---|
1526 | int_fast64_t i;
|
---|
1527 | union ui32_f32 uA;
|
---|
1528 | clock_t endClock;
|
---|
1529 |
|
---|
1530 | count = 0;
|
---|
1531 | inputNum = 0;
|
---|
1532 | startClock = clock();
|
---|
1533 | do {
|
---|
1534 | for ( i = minIterations; i; --i ) {
|
---|
1535 | uA.ui = inputs_F32UI[inputNum];
|
---|
1536 | function( uA.f, roundingMode, exact );
|
---|
1537 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1538 | }
|
---|
1539 | count += minIterations;
|
---|
1540 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1541 | inputNum = 0;
|
---|
1542 | startClock = clock();
|
---|
1543 | for ( i = count; i; --i ) {
|
---|
1544 | uA.ui = inputs_F32UI[inputNum];
|
---|
1545 | function( uA.f, roundingMode, exact );
|
---|
1546 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1547 | }
|
---|
1548 | endClock = clock();
|
---|
1549 | reportTime( count, endClock - startClock );
|
---|
1550 |
|
---|
1551 | }
|
---|
1552 |
|
---|
1553 | static
|
---|
1554 | void
|
---|
1555 | time_a_f32_z_ui64_rx(
|
---|
1556 | uint_fast64_t function( float32_t, uint_fast8_t, bool ),
|
---|
1557 | uint_fast8_t roundingMode,
|
---|
1558 | bool exact
|
---|
1559 | )
|
---|
1560 | {
|
---|
1561 | int_fast64_t count;
|
---|
1562 | int inputNum;
|
---|
1563 | clock_t startClock;
|
---|
1564 | int_fast64_t i;
|
---|
1565 | union ui32_f32 uA;
|
---|
1566 | clock_t endClock;
|
---|
1567 |
|
---|
1568 | count = 0;
|
---|
1569 | inputNum = 0;
|
---|
1570 | startClock = clock();
|
---|
1571 | do {
|
---|
1572 | for ( i = minIterations; i; --i ) {
|
---|
1573 | uA.ui = inputs_F32UI[inputNum];
|
---|
1574 | function( uA.f, roundingMode, exact );
|
---|
1575 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1576 | }
|
---|
1577 | count += minIterations;
|
---|
1578 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1579 | inputNum = 0;
|
---|
1580 | startClock = clock();
|
---|
1581 | for ( i = count; i; --i ) {
|
---|
1582 | uA.ui = inputs_F32UI[inputNum];
|
---|
1583 | function( uA.f, roundingMode, exact );
|
---|
1584 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1585 | }
|
---|
1586 | endClock = clock();
|
---|
1587 | reportTime( count, endClock - startClock );
|
---|
1588 |
|
---|
1589 | }
|
---|
1590 |
|
---|
1591 | static
|
---|
1592 | void
|
---|
1593 | time_a_f32_z_i32_rx(
|
---|
1594 | int_fast32_t function( float32_t, uint_fast8_t, bool ),
|
---|
1595 | uint_fast8_t roundingMode,
|
---|
1596 | bool exact
|
---|
1597 | )
|
---|
1598 | {
|
---|
1599 | int_fast64_t count;
|
---|
1600 | int inputNum;
|
---|
1601 | clock_t startClock;
|
---|
1602 | int_fast64_t i;
|
---|
1603 | union ui32_f32 uA;
|
---|
1604 | clock_t endClock;
|
---|
1605 |
|
---|
1606 | count = 0;
|
---|
1607 | inputNum = 0;
|
---|
1608 | startClock = clock();
|
---|
1609 | do {
|
---|
1610 | for ( i = minIterations; i; --i ) {
|
---|
1611 | uA.ui = inputs_F32UI[inputNum];
|
---|
1612 | function( uA.f, roundingMode, exact );
|
---|
1613 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1614 | }
|
---|
1615 | count += minIterations;
|
---|
1616 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1617 | inputNum = 0;
|
---|
1618 | startClock = clock();
|
---|
1619 | for ( i = count; i; --i ) {
|
---|
1620 | uA.ui = inputs_F32UI[inputNum];
|
---|
1621 | function( uA.f, roundingMode, exact );
|
---|
1622 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1623 | }
|
---|
1624 | endClock = clock();
|
---|
1625 | reportTime( count, endClock - startClock );
|
---|
1626 |
|
---|
1627 | }
|
---|
1628 |
|
---|
1629 | static
|
---|
1630 | void
|
---|
1631 | time_a_f32_z_i64_rx(
|
---|
1632 | int_fast64_t function( float32_t, uint_fast8_t, bool ),
|
---|
1633 | uint_fast8_t roundingMode,
|
---|
1634 | bool exact
|
---|
1635 | )
|
---|
1636 | {
|
---|
1637 | int_fast64_t count;
|
---|
1638 | int inputNum;
|
---|
1639 | clock_t startClock;
|
---|
1640 | int_fast64_t i;
|
---|
1641 | union ui32_f32 uA;
|
---|
1642 | clock_t endClock;
|
---|
1643 |
|
---|
1644 | count = 0;
|
---|
1645 | inputNum = 0;
|
---|
1646 | startClock = clock();
|
---|
1647 | do {
|
---|
1648 | for ( i = minIterations; i; --i ) {
|
---|
1649 | uA.ui = inputs_F32UI[inputNum];
|
---|
1650 | function( uA.f, roundingMode, exact );
|
---|
1651 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1652 | }
|
---|
1653 | count += minIterations;
|
---|
1654 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1655 | inputNum = 0;
|
---|
1656 | startClock = clock();
|
---|
1657 | for ( i = count; i; --i ) {
|
---|
1658 | uA.ui = inputs_F32UI[inputNum];
|
---|
1659 | function( uA.f, roundingMode, exact );
|
---|
1660 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1661 | }
|
---|
1662 | endClock = clock();
|
---|
1663 | reportTime( count, endClock - startClock );
|
---|
1664 |
|
---|
1665 | }
|
---|
1666 |
|
---|
1667 | static
|
---|
1668 | void
|
---|
1669 | time_a_f32_z_ui32_x( uint_fast32_t function( float32_t, bool ), bool exact )
|
---|
1670 | {
|
---|
1671 | int_fast64_t count;
|
---|
1672 | int inputNum;
|
---|
1673 | clock_t startClock;
|
---|
1674 | int_fast64_t i;
|
---|
1675 | union ui32_f32 uA;
|
---|
1676 | clock_t endClock;
|
---|
1677 |
|
---|
1678 | count = 0;
|
---|
1679 | inputNum = 0;
|
---|
1680 | startClock = clock();
|
---|
1681 | do {
|
---|
1682 | for ( i = minIterations; i; --i ) {
|
---|
1683 | uA.ui = inputs_F32UI[inputNum];
|
---|
1684 | function( uA.f, exact );
|
---|
1685 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1686 | }
|
---|
1687 | count += minIterations;
|
---|
1688 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1689 | inputNum = 0;
|
---|
1690 | startClock = clock();
|
---|
1691 | for ( i = count; i; --i ) {
|
---|
1692 | uA.ui = inputs_F32UI[inputNum];
|
---|
1693 | function( uA.f, exact );
|
---|
1694 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1695 | }
|
---|
1696 | endClock = clock();
|
---|
1697 | reportTime( count, endClock - startClock );
|
---|
1698 |
|
---|
1699 | }
|
---|
1700 |
|
---|
1701 | static
|
---|
1702 | void
|
---|
1703 | time_a_f32_z_ui64_x( uint_fast64_t function( float32_t, bool ), bool exact )
|
---|
1704 | {
|
---|
1705 | int_fast64_t count;
|
---|
1706 | int inputNum;
|
---|
1707 | clock_t startClock;
|
---|
1708 | int_fast64_t i;
|
---|
1709 | union ui32_f32 uA;
|
---|
1710 | clock_t endClock;
|
---|
1711 |
|
---|
1712 | count = 0;
|
---|
1713 | inputNum = 0;
|
---|
1714 | startClock = clock();
|
---|
1715 | do {
|
---|
1716 | for ( i = minIterations; i; --i ) {
|
---|
1717 | uA.ui = inputs_F32UI[inputNum];
|
---|
1718 | function( uA.f, exact );
|
---|
1719 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1720 | }
|
---|
1721 | count += minIterations;
|
---|
1722 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1723 | inputNum = 0;
|
---|
1724 | startClock = clock();
|
---|
1725 | for ( i = count; i; --i ) {
|
---|
1726 | uA.ui = inputs_F32UI[inputNum];
|
---|
1727 | function( uA.f, exact );
|
---|
1728 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1729 | }
|
---|
1730 | endClock = clock();
|
---|
1731 | reportTime( count, endClock - startClock );
|
---|
1732 |
|
---|
1733 | }
|
---|
1734 |
|
---|
1735 | static
|
---|
1736 | void time_a_f32_z_i32_x( int_fast32_t function( float32_t, bool ), bool exact )
|
---|
1737 | {
|
---|
1738 | int_fast64_t count;
|
---|
1739 | int inputNum;
|
---|
1740 | clock_t startClock;
|
---|
1741 | int_fast64_t i;
|
---|
1742 | union ui32_f32 uA;
|
---|
1743 | clock_t endClock;
|
---|
1744 |
|
---|
1745 | count = 0;
|
---|
1746 | inputNum = 0;
|
---|
1747 | startClock = clock();
|
---|
1748 | do {
|
---|
1749 | for ( i = minIterations; i; --i ) {
|
---|
1750 | uA.ui = inputs_F32UI[inputNum];
|
---|
1751 | function( uA.f, exact );
|
---|
1752 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1753 | }
|
---|
1754 | count += minIterations;
|
---|
1755 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1756 | inputNum = 0;
|
---|
1757 | startClock = clock();
|
---|
1758 | for ( i = count; i; --i ) {
|
---|
1759 | uA.ui = inputs_F32UI[inputNum];
|
---|
1760 | function( uA.f, exact );
|
---|
1761 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1762 | }
|
---|
1763 | endClock = clock();
|
---|
1764 | reportTime( count, endClock - startClock );
|
---|
1765 |
|
---|
1766 | }
|
---|
1767 |
|
---|
1768 | static
|
---|
1769 | void time_a_f32_z_i64_x( int_fast64_t function( float32_t, bool ), bool exact )
|
---|
1770 | {
|
---|
1771 | int_fast64_t count;
|
---|
1772 | int inputNum;
|
---|
1773 | clock_t startClock;
|
---|
1774 | int_fast64_t i;
|
---|
1775 | union ui32_f32 uA;
|
---|
1776 | clock_t endClock;
|
---|
1777 |
|
---|
1778 | count = 0;
|
---|
1779 | inputNum = 0;
|
---|
1780 | startClock = clock();
|
---|
1781 | do {
|
---|
1782 | for ( i = minIterations; i; --i ) {
|
---|
1783 | uA.ui = inputs_F32UI[inputNum];
|
---|
1784 | function( uA.f, exact );
|
---|
1785 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1786 | }
|
---|
1787 | count += minIterations;
|
---|
1788 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1789 | inputNum = 0;
|
---|
1790 | startClock = clock();
|
---|
1791 | for ( i = count; i; --i ) {
|
---|
1792 | uA.ui = inputs_F32UI[inputNum];
|
---|
1793 | function( uA.f, exact );
|
---|
1794 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1795 | }
|
---|
1796 | endClock = clock();
|
---|
1797 | reportTime( count, endClock - startClock );
|
---|
1798 |
|
---|
1799 | }
|
---|
1800 |
|
---|
1801 | #ifdef FLOAT16
|
---|
1802 |
|
---|
1803 | static void time_a_f32_z_f16( float16_t function( float32_t ) )
|
---|
1804 | {
|
---|
1805 | int_fast64_t count;
|
---|
1806 | int inputNum;
|
---|
1807 | clock_t startClock;
|
---|
1808 | int_fast64_t i;
|
---|
1809 | union ui32_f32 uA;
|
---|
1810 | clock_t endClock;
|
---|
1811 |
|
---|
1812 | count = 0;
|
---|
1813 | inputNum = 0;
|
---|
1814 | startClock = clock();
|
---|
1815 | do {
|
---|
1816 | for ( i = minIterations; i; --i ) {
|
---|
1817 | uA.ui = inputs_F32UI[inputNum];
|
---|
1818 | function( uA.f );
|
---|
1819 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1820 | }
|
---|
1821 | count += minIterations;
|
---|
1822 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1823 | inputNum = 0;
|
---|
1824 | startClock = clock();
|
---|
1825 | for ( i = count; i; --i ) {
|
---|
1826 | uA.ui = inputs_F32UI[inputNum];
|
---|
1827 | function( uA.f );
|
---|
1828 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1829 | }
|
---|
1830 | endClock = clock();
|
---|
1831 | reportTime( count, endClock - startClock );
|
---|
1832 |
|
---|
1833 | }
|
---|
1834 |
|
---|
1835 | #endif
|
---|
1836 |
|
---|
1837 | #ifdef FLOAT64
|
---|
1838 |
|
---|
1839 | static void time_a_f32_z_f64( float64_t function( float32_t ) )
|
---|
1840 | {
|
---|
1841 | int_fast64_t count;
|
---|
1842 | int inputNum;
|
---|
1843 | clock_t startClock;
|
---|
1844 | int_fast64_t i;
|
---|
1845 | union ui32_f32 uA;
|
---|
1846 | clock_t endClock;
|
---|
1847 |
|
---|
1848 | count = 0;
|
---|
1849 | inputNum = 0;
|
---|
1850 | startClock = clock();
|
---|
1851 | do {
|
---|
1852 | for ( i = minIterations; i; --i ) {
|
---|
1853 | uA.ui = inputs_F32UI[inputNum];
|
---|
1854 | function( uA.f );
|
---|
1855 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1856 | }
|
---|
1857 | count += minIterations;
|
---|
1858 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1859 | inputNum = 0;
|
---|
1860 | startClock = clock();
|
---|
1861 | for ( i = count; i; --i ) {
|
---|
1862 | uA.ui = inputs_F32UI[inputNum];
|
---|
1863 | function( uA.f );
|
---|
1864 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1865 | }
|
---|
1866 | endClock = clock();
|
---|
1867 | reportTime( count, endClock - startClock );
|
---|
1868 |
|
---|
1869 | }
|
---|
1870 |
|
---|
1871 | #endif
|
---|
1872 |
|
---|
1873 | #ifdef EXTFLOAT80
|
---|
1874 |
|
---|
1875 | static void time_a_f32_z_extF80( void function( float32_t, extFloat80_t * ) )
|
---|
1876 | {
|
---|
1877 | int_fast64_t count;
|
---|
1878 | int inputNum;
|
---|
1879 | clock_t startClock;
|
---|
1880 | int_fast64_t i;
|
---|
1881 | union ui32_f32 uA;
|
---|
1882 | extFloat80_t z;
|
---|
1883 | clock_t endClock;
|
---|
1884 |
|
---|
1885 | count = 0;
|
---|
1886 | inputNum = 0;
|
---|
1887 | startClock = clock();
|
---|
1888 | do {
|
---|
1889 | for ( i = minIterations; i; --i ) {
|
---|
1890 | uA.ui = inputs_F32UI[inputNum];
|
---|
1891 | function( uA.f, &z );
|
---|
1892 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1893 | }
|
---|
1894 | count += minIterations;
|
---|
1895 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1896 | inputNum = 0;
|
---|
1897 | startClock = clock();
|
---|
1898 | for ( i = count; i; --i ) {
|
---|
1899 | uA.ui = inputs_F32UI[inputNum];
|
---|
1900 | function( uA.f, &z );
|
---|
1901 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1902 | }
|
---|
1903 | endClock = clock();
|
---|
1904 | reportTime( count, endClock - startClock );
|
---|
1905 |
|
---|
1906 | }
|
---|
1907 |
|
---|
1908 | #endif
|
---|
1909 |
|
---|
1910 | #ifdef FLOAT128
|
---|
1911 |
|
---|
1912 | static void time_a_f32_z_f128( void function( float32_t, float128_t * ) )
|
---|
1913 | {
|
---|
1914 | int_fast64_t count;
|
---|
1915 | int inputNum;
|
---|
1916 | clock_t startClock;
|
---|
1917 | int_fast64_t i;
|
---|
1918 | union ui32_f32 uA;
|
---|
1919 | float128_t z;
|
---|
1920 | clock_t endClock;
|
---|
1921 |
|
---|
1922 | count = 0;
|
---|
1923 | inputNum = 0;
|
---|
1924 | startClock = clock();
|
---|
1925 | do {
|
---|
1926 | for ( i = minIterations; i; --i ) {
|
---|
1927 | uA.ui = inputs_F32UI[inputNum];
|
---|
1928 | function( uA.f, &z );
|
---|
1929 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1930 | }
|
---|
1931 | count += minIterations;
|
---|
1932 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1933 | inputNum = 0;
|
---|
1934 | startClock = clock();
|
---|
1935 | for ( i = count; i; --i ) {
|
---|
1936 | uA.ui = inputs_F32UI[inputNum];
|
---|
1937 | function( uA.f, &z );
|
---|
1938 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1939 | }
|
---|
1940 | endClock = clock();
|
---|
1941 | reportTime( count, endClock - startClock );
|
---|
1942 |
|
---|
1943 | }
|
---|
1944 |
|
---|
1945 | #endif
|
---|
1946 |
|
---|
1947 | static
|
---|
1948 | void
|
---|
1949 | time_az_f32_rx(
|
---|
1950 | float32_t function( float32_t, uint_fast8_t, bool ),
|
---|
1951 | uint_fast8_t roundingMode,
|
---|
1952 | bool exact
|
---|
1953 | )
|
---|
1954 | {
|
---|
1955 | int_fast64_t count;
|
---|
1956 | int inputNum;
|
---|
1957 | clock_t startClock;
|
---|
1958 | int_fast64_t i;
|
---|
1959 | union ui32_f32 uA;
|
---|
1960 | clock_t endClock;
|
---|
1961 |
|
---|
1962 | count = 0;
|
---|
1963 | inputNum = 0;
|
---|
1964 | startClock = clock();
|
---|
1965 | do {
|
---|
1966 | for ( i = minIterations; i; --i ) {
|
---|
1967 | uA.ui = inputs_F32UI[inputNum];
|
---|
1968 | function( uA.f, roundingMode, exact );
|
---|
1969 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1970 | }
|
---|
1971 | count += minIterations;
|
---|
1972 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
1973 | inputNum = 0;
|
---|
1974 | startClock = clock();
|
---|
1975 | for ( i = count; i; --i ) {
|
---|
1976 | uA.ui = inputs_F32UI[inputNum];
|
---|
1977 | function( uA.f, roundingMode, exact );
|
---|
1978 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
1979 | }
|
---|
1980 | endClock = clock();
|
---|
1981 | reportTime( count, endClock - startClock );
|
---|
1982 |
|
---|
1983 | }
|
---|
1984 |
|
---|
1985 | static void time_abz_f32( float32_t function( float32_t, float32_t ) )
|
---|
1986 | {
|
---|
1987 | int_fast64_t count;
|
---|
1988 | int inputNumA, inputNumB;
|
---|
1989 | clock_t startClock;
|
---|
1990 | int_fast64_t i;
|
---|
1991 | union ui32_f32 uA, uB;
|
---|
1992 | clock_t endClock;
|
---|
1993 |
|
---|
1994 | count = 0;
|
---|
1995 | inputNumA = 0;
|
---|
1996 | inputNumB = 0;
|
---|
1997 | startClock = clock();
|
---|
1998 | do {
|
---|
1999 | for ( i = minIterations; i; --i ) {
|
---|
2000 | uA.ui = inputs_F32UI[inputNumA];
|
---|
2001 | uB.ui = inputs_F32UI[inputNumB];
|
---|
2002 | function( uA.f, uB.f );
|
---|
2003 | inputNumA = (inputNumA + 1) & (numInputs_f32 - 1);
|
---|
2004 | if ( ! inputNumA ) ++inputNumB;
|
---|
2005 | inputNumB = (inputNumB + 1) & (numInputs_f32 - 1);
|
---|
2006 | }
|
---|
2007 | count += minIterations;
|
---|
2008 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2009 | inputNumA = 0;
|
---|
2010 | inputNumB = 0;
|
---|
2011 | startClock = clock();
|
---|
2012 | for ( i = count; i; --i ) {
|
---|
2013 | uA.ui = inputs_F32UI[inputNumA];
|
---|
2014 | uB.ui = inputs_F32UI[inputNumB];
|
---|
2015 | function( uA.f, uB.f );
|
---|
2016 | inputNumA = (inputNumA + 1) & (numInputs_f32 - 1);
|
---|
2017 | if ( ! inputNumA ) ++inputNumB;
|
---|
2018 | inputNumB = (inputNumB + 1) & (numInputs_f32 - 1);
|
---|
2019 | }
|
---|
2020 | endClock = clock();
|
---|
2021 | reportTime( count, endClock - startClock );
|
---|
2022 |
|
---|
2023 | }
|
---|
2024 |
|
---|
2025 | static
|
---|
2026 | void time_abcz_f32( float32_t function( float32_t, float32_t, float32_t ) )
|
---|
2027 | {
|
---|
2028 | int_fast64_t count;
|
---|
2029 | int inputNumA, inputNumB, inputNumC;
|
---|
2030 | clock_t startClock;
|
---|
2031 | int_fast64_t i;
|
---|
2032 | union ui32_f32 uA, uB, uC;
|
---|
2033 | clock_t endClock;
|
---|
2034 |
|
---|
2035 | count = 0;
|
---|
2036 | inputNumA = 0;
|
---|
2037 | inputNumB = 0;
|
---|
2038 | inputNumC = 0;
|
---|
2039 | startClock = clock();
|
---|
2040 | do {
|
---|
2041 | for ( i = minIterations; i; --i ) {
|
---|
2042 | uA.ui = inputs_F32UI[inputNumA];
|
---|
2043 | uB.ui = inputs_F32UI[inputNumB];
|
---|
2044 | uC.ui = inputs_F32UI[inputNumC];
|
---|
2045 | function( uA.f, uB.f, uC.f );
|
---|
2046 | inputNumA = (inputNumA + 1) & (numInputs_f32 - 1);
|
---|
2047 | if ( ! inputNumA ) ++inputNumB;
|
---|
2048 | inputNumB = (inputNumB + 1) & (numInputs_f32 - 1);
|
---|
2049 | if ( ! inputNumB ) ++inputNumC;
|
---|
2050 | inputNumC = (inputNumC + 1) & (numInputs_f32 - 1);
|
---|
2051 | }
|
---|
2052 | count += minIterations;
|
---|
2053 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2054 | inputNumA = 0;
|
---|
2055 | inputNumB = 0;
|
---|
2056 | inputNumC = 0;
|
---|
2057 | startClock = clock();
|
---|
2058 | for ( i = count; i; --i ) {
|
---|
2059 | uA.ui = inputs_F32UI[inputNumA];
|
---|
2060 | uB.ui = inputs_F32UI[inputNumB];
|
---|
2061 | uC.ui = inputs_F32UI[inputNumC];
|
---|
2062 | function( uA.f, uB.f, uC.f );
|
---|
2063 | inputNumA = (inputNumA + 1) & (numInputs_f32 - 1);
|
---|
2064 | if ( ! inputNumA ) ++inputNumB;
|
---|
2065 | inputNumB = (inputNumB + 1) & (numInputs_f32 - 1);
|
---|
2066 | if ( ! inputNumB ) ++inputNumC;
|
---|
2067 | inputNumC = (inputNumC + 1) & (numInputs_f32 - 1);
|
---|
2068 | }
|
---|
2069 | endClock = clock();
|
---|
2070 | reportTime( count, endClock - startClock );
|
---|
2071 |
|
---|
2072 | }
|
---|
2073 |
|
---|
2074 | static void time_ab_f32_z_bool( bool function( float32_t, float32_t ) )
|
---|
2075 | {
|
---|
2076 | int_fast64_t count;
|
---|
2077 | int inputNumA, inputNumB;
|
---|
2078 | clock_t startClock;
|
---|
2079 | int_fast64_t i;
|
---|
2080 | union ui32_f32 uA, uB;
|
---|
2081 | clock_t endClock;
|
---|
2082 |
|
---|
2083 | count = 0;
|
---|
2084 | inputNumA = 0;
|
---|
2085 | inputNumB = 0;
|
---|
2086 | startClock = clock();
|
---|
2087 | do {
|
---|
2088 | for ( i = minIterations; i; --i ) {
|
---|
2089 | uA.ui = inputs_F32UI[inputNumA];
|
---|
2090 | uB.ui = inputs_F32UI[inputNumB];
|
---|
2091 | function( uA.f, uB.f );
|
---|
2092 | inputNumA = (inputNumA + 1) & (numInputs_f32 - 1);
|
---|
2093 | if ( ! inputNumA ) ++inputNumB;
|
---|
2094 | inputNumB = (inputNumB + 1) & (numInputs_f32 - 1);
|
---|
2095 | }
|
---|
2096 | count += minIterations;
|
---|
2097 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2098 | inputNumA = 0;
|
---|
2099 | inputNumB = 0;
|
---|
2100 | startClock = clock();
|
---|
2101 | for ( i = count; i; --i ) {
|
---|
2102 | uA.ui = inputs_F32UI[inputNumA];
|
---|
2103 | uB.ui = inputs_F32UI[inputNumB];
|
---|
2104 | function( uA.f, uB.f );
|
---|
2105 | inputNumA = (inputNumA + 1) & (numInputs_f32 - 1);
|
---|
2106 | if ( ! inputNumA ) ++inputNumB;
|
---|
2107 | inputNumB = (inputNumB + 1) & (numInputs_f32 - 1);
|
---|
2108 | }
|
---|
2109 | endClock = clock();
|
---|
2110 | reportTime( count, endClock - startClock );
|
---|
2111 |
|
---|
2112 | }
|
---|
2113 |
|
---|
2114 | static const uint32_t inputs_F32UI_pos[numInputs_f32] = {
|
---|
2115 | 0x4EFA0000, 0x41D0B328, 0x00000000, 0x3E69A31E,
|
---|
2116 | 0x2F803EFF, 0x3F800000, 0x17BF8000, 0x674A301A,
|
---|
2117 | 0x4E010003, 0x7EE3C75D, 0x3D803FE0, 0x3FFEFF00,
|
---|
2118 | 0x7981F800, 0x431FFFFC, 0x4100C000, 0x3D87EFFF,
|
---|
2119 | 0x4103FEFE, 0x3C000007, 0x3F01F7FF, 0x4E6C6B5C,
|
---|
2120 | 0x4187FFFE, 0x458B9F13, 0x4F88007F, 0x5F004007,
|
---|
2121 | 0x37FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000,
|
---|
2122 | 0x5B428661, 0x33F89B1F, 0x23BFEFFF, 0x537BFFBE
|
---|
2123 | };
|
---|
2124 |
|
---|
2125 | static void time_az_f32_pos( float32_t function( float32_t ) )
|
---|
2126 | {
|
---|
2127 | int_fast64_t count;
|
---|
2128 | int inputNum;
|
---|
2129 | clock_t startClock;
|
---|
2130 | int_fast64_t i;
|
---|
2131 | union ui32_f32 uA;
|
---|
2132 | clock_t endClock;
|
---|
2133 |
|
---|
2134 | count = 0;
|
---|
2135 | inputNum = 0;
|
---|
2136 | startClock = clock();
|
---|
2137 | do {
|
---|
2138 | for ( i = minIterations; i; --i ) {
|
---|
2139 | uA.ui = inputs_F32UI_pos[inputNum];
|
---|
2140 | function( uA.f );
|
---|
2141 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
2142 | }
|
---|
2143 | count += minIterations;
|
---|
2144 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2145 | inputNum = 0;
|
---|
2146 | startClock = clock();
|
---|
2147 | for ( i = count; i; --i ) {
|
---|
2148 | uA.ui = inputs_F32UI_pos[inputNum];
|
---|
2149 | function( uA.f );
|
---|
2150 | inputNum = (inputNum + 1) & (numInputs_f32 - 1);
|
---|
2151 | }
|
---|
2152 | endClock = clock();
|
---|
2153 | reportTime( count, endClock - startClock );
|
---|
2154 |
|
---|
2155 | }
|
---|
2156 |
|
---|
2157 | /*----------------------------------------------------------------------------
|
---|
2158 | *----------------------------------------------------------------------------*/
|
---|
2159 |
|
---|
2160 | #ifdef FLOAT64
|
---|
2161 |
|
---|
2162 | enum { numInputs_f64 = 32 };
|
---|
2163 |
|
---|
2164 | static const uint64_t inputs_F64UI[numInputs_f64] = {
|
---|
2165 | UINT64_C( 0x422FFFC008000000 ),
|
---|
2166 | UINT64_C( 0xB7E0000480000000 ),
|
---|
2167 | UINT64_C( 0xF3FD2546120B7935 ),
|
---|
2168 | UINT64_C( 0x3FF0000000000000 ),
|
---|
2169 | UINT64_C( 0xCE07F766F09588D6 ),
|
---|
2170 | UINT64_C( 0x8000000000000000 ),
|
---|
2171 | UINT64_C( 0x3FCE000400000000 ),
|
---|
2172 | UINT64_C( 0x8313B60F0032BED8 ),
|
---|
2173 | UINT64_C( 0xC1EFFFFFC0002000 ),
|
---|
2174 | UINT64_C( 0x3FB3C75D224F2B0F ),
|
---|
2175 | UINT64_C( 0x7FD00000004000FF ),
|
---|
2176 | UINT64_C( 0xA12FFF8000001FFF ),
|
---|
2177 | UINT64_C( 0x3EE0000000FE0000 ),
|
---|
2178 | UINT64_C( 0x0010000080000004 ),
|
---|
2179 | UINT64_C( 0x41CFFFFE00000020 ),
|
---|
2180 | UINT64_C( 0x40303FFFFFFFFFFD ),
|
---|
2181 | UINT64_C( 0x3FD000003FEFFFFF ),
|
---|
2182 | UINT64_C( 0xBFD0000010000000 ),
|
---|
2183 | UINT64_C( 0xB7FC6B5C16CA55CF ),
|
---|
2184 | UINT64_C( 0x413EEB940B9D1301 ),
|
---|
2185 | UINT64_C( 0xC7E00200001FFFFF ),
|
---|
2186 | UINT64_C( 0x47F00021FFFFFFFE ),
|
---|
2187 | UINT64_C( 0xBFFFFFFFF80000FF ),
|
---|
2188 | UINT64_C( 0xC07FFFFFE00FFFFF ),
|
---|
2189 | UINT64_C( 0x001497A63740C5E8 ),
|
---|
2190 | UINT64_C( 0xC4BFFFE0001FFFFF ),
|
---|
2191 | UINT64_C( 0x96FFDFFEFFFFFFFF ),
|
---|
2192 | UINT64_C( 0x403FC000000001FE ),
|
---|
2193 | UINT64_C( 0xFFD00000000001F6 ),
|
---|
2194 | UINT64_C( 0x0640400002000000 ),
|
---|
2195 | UINT64_C( 0x479CEE1E4F789FE0 ),
|
---|
2196 | UINT64_C( 0xC237FFFFFFFFFDFE )
|
---|
2197 | };
|
---|
2198 |
|
---|
2199 | static
|
---|
2200 | void
|
---|
2201 | time_a_f64_z_ui32_rx(
|
---|
2202 | uint_fast32_t function( float64_t, uint_fast8_t, bool ),
|
---|
2203 | uint_fast8_t roundingMode,
|
---|
2204 | bool exact
|
---|
2205 | )
|
---|
2206 | {
|
---|
2207 | int_fast64_t count;
|
---|
2208 | int inputNum;
|
---|
2209 | clock_t startClock;
|
---|
2210 | int_fast64_t i;
|
---|
2211 | union ui64_f64 uA;
|
---|
2212 | clock_t endClock;
|
---|
2213 |
|
---|
2214 | count = 0;
|
---|
2215 | inputNum = 0;
|
---|
2216 | startClock = clock();
|
---|
2217 | do {
|
---|
2218 | for ( i = minIterations; i; --i ) {
|
---|
2219 | uA.ui = inputs_F64UI[inputNum];
|
---|
2220 | function( uA.f, roundingMode, exact );
|
---|
2221 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2222 | }
|
---|
2223 | count += minIterations;
|
---|
2224 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2225 | inputNum = 0;
|
---|
2226 | startClock = clock();
|
---|
2227 | for ( i = count; i; --i ) {
|
---|
2228 | uA.ui = inputs_F64UI[inputNum];
|
---|
2229 | function( uA.f, roundingMode, exact );
|
---|
2230 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2231 | }
|
---|
2232 | endClock = clock();
|
---|
2233 | reportTime( count, endClock - startClock );
|
---|
2234 |
|
---|
2235 | }
|
---|
2236 |
|
---|
2237 | static
|
---|
2238 | void
|
---|
2239 | time_a_f64_z_ui64_rx(
|
---|
2240 | uint_fast64_t function( float64_t, uint_fast8_t, bool ),
|
---|
2241 | uint_fast8_t roundingMode,
|
---|
2242 | bool exact
|
---|
2243 | )
|
---|
2244 | {
|
---|
2245 | int_fast64_t count;
|
---|
2246 | int inputNum;
|
---|
2247 | clock_t startClock;
|
---|
2248 | int_fast64_t i;
|
---|
2249 | union ui64_f64 uA;
|
---|
2250 | clock_t endClock;
|
---|
2251 |
|
---|
2252 | count = 0;
|
---|
2253 | inputNum = 0;
|
---|
2254 | startClock = clock();
|
---|
2255 | do {
|
---|
2256 | for ( i = minIterations; i; --i ) {
|
---|
2257 | uA.ui = inputs_F64UI[inputNum];
|
---|
2258 | function( uA.f, roundingMode, exact );
|
---|
2259 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2260 | }
|
---|
2261 | count += minIterations;
|
---|
2262 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2263 | inputNum = 0;
|
---|
2264 | startClock = clock();
|
---|
2265 | for ( i = count; i; --i ) {
|
---|
2266 | uA.ui = inputs_F64UI[inputNum];
|
---|
2267 | function( uA.f, roundingMode, exact );
|
---|
2268 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2269 | }
|
---|
2270 | endClock = clock();
|
---|
2271 | reportTime( count, endClock - startClock );
|
---|
2272 |
|
---|
2273 | }
|
---|
2274 |
|
---|
2275 | static
|
---|
2276 | void
|
---|
2277 | time_a_f64_z_i32_rx(
|
---|
2278 | int_fast32_t function( float64_t, uint_fast8_t, bool ),
|
---|
2279 | uint_fast8_t roundingMode,
|
---|
2280 | bool exact
|
---|
2281 | )
|
---|
2282 | {
|
---|
2283 | int_fast64_t count;
|
---|
2284 | int inputNum;
|
---|
2285 | clock_t startClock;
|
---|
2286 | int_fast64_t i;
|
---|
2287 | union ui64_f64 uA;
|
---|
2288 | clock_t endClock;
|
---|
2289 |
|
---|
2290 | count = 0;
|
---|
2291 | inputNum = 0;
|
---|
2292 | startClock = clock();
|
---|
2293 | do {
|
---|
2294 | for ( i = minIterations; i; --i ) {
|
---|
2295 | uA.ui = inputs_F64UI[inputNum];
|
---|
2296 | function( uA.f, roundingMode, exact );
|
---|
2297 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2298 | }
|
---|
2299 | count += minIterations;
|
---|
2300 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2301 | inputNum = 0;
|
---|
2302 | startClock = clock();
|
---|
2303 | for ( i = count; i; --i ) {
|
---|
2304 | uA.ui = inputs_F64UI[inputNum];
|
---|
2305 | function( uA.f, roundingMode, exact );
|
---|
2306 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2307 | }
|
---|
2308 | endClock = clock();
|
---|
2309 | reportTime( count, endClock - startClock );
|
---|
2310 |
|
---|
2311 | }
|
---|
2312 |
|
---|
2313 | static
|
---|
2314 | void
|
---|
2315 | time_a_f64_z_i64_rx(
|
---|
2316 | int_fast64_t function( float64_t, uint_fast8_t, bool ),
|
---|
2317 | uint_fast8_t roundingMode,
|
---|
2318 | bool exact
|
---|
2319 | )
|
---|
2320 | {
|
---|
2321 | int_fast64_t count;
|
---|
2322 | int inputNum;
|
---|
2323 | clock_t startClock;
|
---|
2324 | int_fast64_t i;
|
---|
2325 | union ui64_f64 uA;
|
---|
2326 | clock_t endClock;
|
---|
2327 |
|
---|
2328 | count = 0;
|
---|
2329 | inputNum = 0;
|
---|
2330 | startClock = clock();
|
---|
2331 | do {
|
---|
2332 | for ( i = minIterations; i; --i ) {
|
---|
2333 | uA.ui = inputs_F64UI[inputNum];
|
---|
2334 | function( uA.f, roundingMode, exact );
|
---|
2335 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2336 | }
|
---|
2337 | count += minIterations;
|
---|
2338 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2339 | inputNum = 0;
|
---|
2340 | startClock = clock();
|
---|
2341 | for ( i = count; i; --i ) {
|
---|
2342 | uA.ui = inputs_F64UI[inputNum];
|
---|
2343 | function( uA.f, roundingMode, exact );
|
---|
2344 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2345 | }
|
---|
2346 | endClock = clock();
|
---|
2347 | reportTime( count, endClock - startClock );
|
---|
2348 |
|
---|
2349 | }
|
---|
2350 |
|
---|
2351 | static
|
---|
2352 | void
|
---|
2353 | time_a_f64_z_ui32_x( uint_fast32_t function( float64_t, bool ), bool exact )
|
---|
2354 | {
|
---|
2355 | int_fast64_t count;
|
---|
2356 | int inputNum;
|
---|
2357 | clock_t startClock;
|
---|
2358 | int_fast64_t i;
|
---|
2359 | union ui64_f64 uA;
|
---|
2360 | clock_t endClock;
|
---|
2361 |
|
---|
2362 | count = 0;
|
---|
2363 | inputNum = 0;
|
---|
2364 | startClock = clock();
|
---|
2365 | do {
|
---|
2366 | for ( i = minIterations; i; --i ) {
|
---|
2367 | uA.ui = inputs_F64UI[inputNum];
|
---|
2368 | function( uA.f, exact );
|
---|
2369 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2370 | }
|
---|
2371 | count += minIterations;
|
---|
2372 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2373 | inputNum = 0;
|
---|
2374 | startClock = clock();
|
---|
2375 | for ( i = count; i; --i ) {
|
---|
2376 | uA.ui = inputs_F64UI[inputNum];
|
---|
2377 | function( uA.f, exact );
|
---|
2378 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2379 | }
|
---|
2380 | endClock = clock();
|
---|
2381 | reportTime( count, endClock - startClock );
|
---|
2382 |
|
---|
2383 | }
|
---|
2384 |
|
---|
2385 | static
|
---|
2386 | void
|
---|
2387 | time_a_f64_z_ui64_x( uint_fast64_t function( float64_t, bool ), bool exact )
|
---|
2388 | {
|
---|
2389 | int_fast64_t count;
|
---|
2390 | int inputNum;
|
---|
2391 | clock_t startClock;
|
---|
2392 | int_fast64_t i;
|
---|
2393 | union ui64_f64 uA;
|
---|
2394 | clock_t endClock;
|
---|
2395 |
|
---|
2396 | count = 0;
|
---|
2397 | inputNum = 0;
|
---|
2398 | startClock = clock();
|
---|
2399 | do {
|
---|
2400 | for ( i = minIterations; i; --i ) {
|
---|
2401 | uA.ui = inputs_F64UI[inputNum];
|
---|
2402 | function( uA.f, exact );
|
---|
2403 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2404 | }
|
---|
2405 | count += minIterations;
|
---|
2406 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2407 | inputNum = 0;
|
---|
2408 | startClock = clock();
|
---|
2409 | for ( i = count; i; --i ) {
|
---|
2410 | uA.ui = inputs_F64UI[inputNum];
|
---|
2411 | function( uA.f, exact );
|
---|
2412 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2413 | }
|
---|
2414 | endClock = clock();
|
---|
2415 | reportTime( count, endClock - startClock );
|
---|
2416 |
|
---|
2417 | }
|
---|
2418 |
|
---|
2419 | static
|
---|
2420 | void time_a_f64_z_i32_x( int_fast32_t function( float64_t, bool ), bool exact )
|
---|
2421 | {
|
---|
2422 | int_fast64_t count;
|
---|
2423 | int inputNum;
|
---|
2424 | clock_t startClock;
|
---|
2425 | int_fast64_t i;
|
---|
2426 | union ui64_f64 uA;
|
---|
2427 | clock_t endClock;
|
---|
2428 |
|
---|
2429 | count = 0;
|
---|
2430 | inputNum = 0;
|
---|
2431 | startClock = clock();
|
---|
2432 | do {
|
---|
2433 | for ( i = minIterations; i; --i ) {
|
---|
2434 | uA.ui = inputs_F64UI[inputNum];
|
---|
2435 | function( uA.f, exact );
|
---|
2436 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2437 | }
|
---|
2438 | count += minIterations;
|
---|
2439 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2440 | inputNum = 0;
|
---|
2441 | startClock = clock();
|
---|
2442 | for ( i = count; i; --i ) {
|
---|
2443 | uA.ui = inputs_F64UI[inputNum];
|
---|
2444 | function( uA.f, exact );
|
---|
2445 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2446 | }
|
---|
2447 | endClock = clock();
|
---|
2448 | reportTime( count, endClock - startClock );
|
---|
2449 |
|
---|
2450 | }
|
---|
2451 |
|
---|
2452 | static
|
---|
2453 | void time_a_f64_z_i64_x( int_fast64_t function( float64_t, bool ), bool exact )
|
---|
2454 | {
|
---|
2455 | int_fast64_t count;
|
---|
2456 | int inputNum;
|
---|
2457 | clock_t startClock;
|
---|
2458 | int_fast64_t i;
|
---|
2459 | union ui64_f64 uA;
|
---|
2460 | clock_t endClock;
|
---|
2461 |
|
---|
2462 | count = 0;
|
---|
2463 | inputNum = 0;
|
---|
2464 | startClock = clock();
|
---|
2465 | do {
|
---|
2466 | for ( i = minIterations; i; --i ) {
|
---|
2467 | uA.ui = inputs_F64UI[inputNum];
|
---|
2468 | function( uA.f, exact );
|
---|
2469 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2470 | }
|
---|
2471 | count += minIterations;
|
---|
2472 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2473 | inputNum = 0;
|
---|
2474 | startClock = clock();
|
---|
2475 | for ( i = count; i; --i ) {
|
---|
2476 | uA.ui = inputs_F64UI[inputNum];
|
---|
2477 | function( uA.f, exact );
|
---|
2478 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2479 | }
|
---|
2480 | endClock = clock();
|
---|
2481 | reportTime( count, endClock - startClock );
|
---|
2482 |
|
---|
2483 | }
|
---|
2484 |
|
---|
2485 | #ifdef FLOAT16
|
---|
2486 |
|
---|
2487 | static void time_a_f64_z_f16( float16_t function( float64_t ) )
|
---|
2488 | {
|
---|
2489 | int_fast64_t count;
|
---|
2490 | int inputNum;
|
---|
2491 | clock_t startClock;
|
---|
2492 | int_fast64_t i;
|
---|
2493 | union ui64_f64 uA;
|
---|
2494 | clock_t endClock;
|
---|
2495 |
|
---|
2496 | count = 0;
|
---|
2497 | inputNum = 0;
|
---|
2498 | startClock = clock();
|
---|
2499 | do {
|
---|
2500 | for ( i = minIterations; i; --i ) {
|
---|
2501 | uA.ui = inputs_F64UI[inputNum];
|
---|
2502 | function( uA.f );
|
---|
2503 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2504 | }
|
---|
2505 | count += minIterations;
|
---|
2506 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2507 | inputNum = 0;
|
---|
2508 | startClock = clock();
|
---|
2509 | for ( i = count; i; --i ) {
|
---|
2510 | uA.ui = inputs_F64UI[inputNum];
|
---|
2511 | function( uA.f );
|
---|
2512 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2513 | }
|
---|
2514 | endClock = clock();
|
---|
2515 | reportTime( count, endClock - startClock );
|
---|
2516 |
|
---|
2517 | }
|
---|
2518 |
|
---|
2519 | #endif
|
---|
2520 |
|
---|
2521 | static void time_a_f64_z_f32( float32_t function( float64_t ) )
|
---|
2522 | {
|
---|
2523 | int_fast64_t count;
|
---|
2524 | int inputNum;
|
---|
2525 | clock_t startClock;
|
---|
2526 | int_fast64_t i;
|
---|
2527 | union ui64_f64 uA;
|
---|
2528 | clock_t endClock;
|
---|
2529 |
|
---|
2530 | count = 0;
|
---|
2531 | inputNum = 0;
|
---|
2532 | startClock = clock();
|
---|
2533 | do {
|
---|
2534 | for ( i = minIterations; i; --i ) {
|
---|
2535 | uA.ui = inputs_F64UI[inputNum];
|
---|
2536 | function( uA.f );
|
---|
2537 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2538 | }
|
---|
2539 | count += minIterations;
|
---|
2540 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2541 | inputNum = 0;
|
---|
2542 | startClock = clock();
|
---|
2543 | for ( i = count; i; --i ) {
|
---|
2544 | uA.ui = inputs_F64UI[inputNum];
|
---|
2545 | function( uA.f );
|
---|
2546 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2547 | }
|
---|
2548 | endClock = clock();
|
---|
2549 | reportTime( count, endClock - startClock );
|
---|
2550 |
|
---|
2551 | }
|
---|
2552 |
|
---|
2553 | #ifdef EXTFLOAT80
|
---|
2554 |
|
---|
2555 | static void time_a_f64_z_extF80( void function( float64_t, extFloat80_t * ) )
|
---|
2556 | {
|
---|
2557 | int_fast64_t count;
|
---|
2558 | int inputNum;
|
---|
2559 | clock_t startClock;
|
---|
2560 | int_fast64_t i;
|
---|
2561 | union ui64_f64 uA;
|
---|
2562 | extFloat80_t z;
|
---|
2563 | clock_t endClock;
|
---|
2564 |
|
---|
2565 | count = 0;
|
---|
2566 | inputNum = 0;
|
---|
2567 | startClock = clock();
|
---|
2568 | do {
|
---|
2569 | for ( i = minIterations; i; --i ) {
|
---|
2570 | uA.ui = inputs_F64UI[inputNum];
|
---|
2571 | function( uA.f, &z );
|
---|
2572 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2573 | }
|
---|
2574 | count += minIterations;
|
---|
2575 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2576 | inputNum = 0;
|
---|
2577 | startClock = clock();
|
---|
2578 | for ( i = count; i; --i ) {
|
---|
2579 | uA.ui = inputs_F64UI[inputNum];
|
---|
2580 | function( uA.f, &z );
|
---|
2581 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2582 | }
|
---|
2583 | endClock = clock();
|
---|
2584 | reportTime( count, endClock - startClock );
|
---|
2585 |
|
---|
2586 | }
|
---|
2587 |
|
---|
2588 | #endif
|
---|
2589 |
|
---|
2590 | #ifdef FLOAT128
|
---|
2591 |
|
---|
2592 | static void time_a_f64_z_f128( void function( float64_t, float128_t * ) )
|
---|
2593 | {
|
---|
2594 | int_fast64_t count;
|
---|
2595 | int inputNum;
|
---|
2596 | clock_t startClock;
|
---|
2597 | int_fast64_t i;
|
---|
2598 | union ui64_f64 uA;
|
---|
2599 | float128_t z;
|
---|
2600 | clock_t endClock;
|
---|
2601 |
|
---|
2602 | count = 0;
|
---|
2603 | inputNum = 0;
|
---|
2604 | startClock = clock();
|
---|
2605 | do {
|
---|
2606 | for ( i = minIterations; i; --i ) {
|
---|
2607 | uA.ui = inputs_F64UI[inputNum];
|
---|
2608 | function( uA.f, &z );
|
---|
2609 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2610 | }
|
---|
2611 | count += minIterations;
|
---|
2612 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2613 | inputNum = 0;
|
---|
2614 | startClock = clock();
|
---|
2615 | for ( i = count; i; --i ) {
|
---|
2616 | uA.ui = inputs_F64UI[inputNum];
|
---|
2617 | function( uA.f, &z );
|
---|
2618 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2619 | }
|
---|
2620 | endClock = clock();
|
---|
2621 | reportTime( count, endClock - startClock );
|
---|
2622 |
|
---|
2623 | }
|
---|
2624 |
|
---|
2625 | #endif
|
---|
2626 |
|
---|
2627 | static
|
---|
2628 | void
|
---|
2629 | time_az_f64_rx(
|
---|
2630 | float64_t function( float64_t, uint_fast8_t, bool ),
|
---|
2631 | uint_fast8_t roundingMode,
|
---|
2632 | bool exact
|
---|
2633 | )
|
---|
2634 | {
|
---|
2635 | int_fast64_t count;
|
---|
2636 | int inputNum;
|
---|
2637 | clock_t startClock;
|
---|
2638 | int_fast64_t i;
|
---|
2639 | union ui64_f64 uA;
|
---|
2640 | clock_t endClock;
|
---|
2641 |
|
---|
2642 | count = 0;
|
---|
2643 | inputNum = 0;
|
---|
2644 | startClock = clock();
|
---|
2645 | do {
|
---|
2646 | for ( i = minIterations; i; --i ) {
|
---|
2647 | uA.ui = inputs_F64UI[inputNum];
|
---|
2648 | function( uA.f, roundingMode, exact );
|
---|
2649 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2650 | }
|
---|
2651 | count += minIterations;
|
---|
2652 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2653 | inputNum = 0;
|
---|
2654 | startClock = clock();
|
---|
2655 | for ( i = count; i; --i ) {
|
---|
2656 | uA.ui = inputs_F64UI[inputNum];
|
---|
2657 | function( uA.f, roundingMode, exact );
|
---|
2658 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2659 | }
|
---|
2660 | endClock = clock();
|
---|
2661 | reportTime( count, endClock - startClock );
|
---|
2662 |
|
---|
2663 | }
|
---|
2664 |
|
---|
2665 | static void time_abz_f64( float64_t function( float64_t, float64_t ) )
|
---|
2666 | {
|
---|
2667 | int_fast64_t count;
|
---|
2668 | int inputNumA, inputNumB;
|
---|
2669 | clock_t startClock;
|
---|
2670 | int_fast64_t i;
|
---|
2671 | union ui64_f64 uA, uB;
|
---|
2672 | clock_t endClock;
|
---|
2673 |
|
---|
2674 | count = 0;
|
---|
2675 | inputNumA = 0;
|
---|
2676 | inputNumB = 0;
|
---|
2677 | startClock = clock();
|
---|
2678 | do {
|
---|
2679 | for ( i = minIterations; i; --i ) {
|
---|
2680 | uA.ui = inputs_F64UI[inputNumA];
|
---|
2681 | uB.ui = inputs_F64UI[inputNumB];
|
---|
2682 | function( uA.f, uB.f );
|
---|
2683 | inputNumA = (inputNumA + 1) & (numInputs_f64 - 1);
|
---|
2684 | if ( ! inputNumA ) ++inputNumB;
|
---|
2685 | inputNumB = (inputNumB + 1) & (numInputs_f64 - 1);
|
---|
2686 | }
|
---|
2687 | count += minIterations;
|
---|
2688 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2689 | inputNumA = 0;
|
---|
2690 | inputNumB = 0;
|
---|
2691 | startClock = clock();
|
---|
2692 | for ( i = count; i; --i ) {
|
---|
2693 | uA.ui = inputs_F64UI[inputNumA];
|
---|
2694 | uB.ui = inputs_F64UI[inputNumB];
|
---|
2695 | function( uA.f, uB.f );
|
---|
2696 | inputNumA = (inputNumA + 1) & (numInputs_f64 - 1);
|
---|
2697 | if ( ! inputNumA ) ++inputNumB;
|
---|
2698 | inputNumB = (inputNumB + 1) & (numInputs_f64 - 1);
|
---|
2699 | }
|
---|
2700 | endClock = clock();
|
---|
2701 | reportTime( count, endClock - startClock );
|
---|
2702 |
|
---|
2703 | }
|
---|
2704 |
|
---|
2705 | static
|
---|
2706 | void time_abcz_f64( float64_t function( float64_t, float64_t, float64_t ) )
|
---|
2707 | {
|
---|
2708 | int_fast64_t count;
|
---|
2709 | int inputNumA, inputNumB, inputNumC;
|
---|
2710 | clock_t startClock;
|
---|
2711 | int_fast64_t i;
|
---|
2712 | union ui64_f64 uA, uB, uC;
|
---|
2713 | clock_t endClock;
|
---|
2714 |
|
---|
2715 | count = 0;
|
---|
2716 | inputNumA = 0;
|
---|
2717 | inputNumB = 0;
|
---|
2718 | inputNumC = 0;
|
---|
2719 | startClock = clock();
|
---|
2720 | do {
|
---|
2721 | for ( i = minIterations; i; --i ) {
|
---|
2722 | uA.ui = inputs_F64UI[inputNumA];
|
---|
2723 | uB.ui = inputs_F64UI[inputNumB];
|
---|
2724 | uC.ui = inputs_F64UI[inputNumC];
|
---|
2725 | function( uA.f, uB.f, uC.f );
|
---|
2726 | inputNumA = (inputNumA + 1) & (numInputs_f64 - 1);
|
---|
2727 | if ( ! inputNumA ) ++inputNumB;
|
---|
2728 | inputNumB = (inputNumB + 1) & (numInputs_f64 - 1);
|
---|
2729 | if ( ! inputNumB ) ++inputNumC;
|
---|
2730 | inputNumC = (inputNumC + 1) & (numInputs_f64 - 1);
|
---|
2731 | }
|
---|
2732 | count += minIterations;
|
---|
2733 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2734 | inputNumA = 0;
|
---|
2735 | inputNumB = 0;
|
---|
2736 | inputNumC = 0;
|
---|
2737 | startClock = clock();
|
---|
2738 | for ( i = count; i; --i ) {
|
---|
2739 | uA.ui = inputs_F64UI[inputNumA];
|
---|
2740 | uB.ui = inputs_F64UI[inputNumB];
|
---|
2741 | uC.ui = inputs_F64UI[inputNumC];
|
---|
2742 | function( uA.f, uB.f, uC.f );
|
---|
2743 | inputNumA = (inputNumA + 1) & (numInputs_f64 - 1);
|
---|
2744 | if ( ! inputNumA ) ++inputNumB;
|
---|
2745 | inputNumB = (inputNumB + 1) & (numInputs_f64 - 1);
|
---|
2746 | if ( ! inputNumB ) ++inputNumC;
|
---|
2747 | inputNumC = (inputNumC + 1) & (numInputs_f64 - 1);
|
---|
2748 | }
|
---|
2749 | endClock = clock();
|
---|
2750 | reportTime( count, endClock - startClock );
|
---|
2751 |
|
---|
2752 | }
|
---|
2753 |
|
---|
2754 | static void time_ab_f64_z_bool( bool function( float64_t, float64_t ) )
|
---|
2755 | {
|
---|
2756 | int_fast64_t count;
|
---|
2757 | int inputNumA, inputNumB;
|
---|
2758 | clock_t startClock;
|
---|
2759 | int_fast64_t i;
|
---|
2760 | union ui64_f64 uA, uB;
|
---|
2761 | clock_t endClock;
|
---|
2762 |
|
---|
2763 | count = 0;
|
---|
2764 | inputNumA = 0;
|
---|
2765 | inputNumB = 0;
|
---|
2766 | startClock = clock();
|
---|
2767 | do {
|
---|
2768 | for ( i = minIterations; i; --i ) {
|
---|
2769 | uA.ui = inputs_F64UI[inputNumA];
|
---|
2770 | uB.ui = inputs_F64UI[inputNumB];
|
---|
2771 | function( uA.f, uB.f );
|
---|
2772 | inputNumA = (inputNumA + 1) & (numInputs_f64 - 1);
|
---|
2773 | if ( ! inputNumA ) ++inputNumB;
|
---|
2774 | inputNumB = (inputNumB + 1) & (numInputs_f64 - 1);
|
---|
2775 | }
|
---|
2776 | count += minIterations;
|
---|
2777 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2778 | inputNumA = 0;
|
---|
2779 | inputNumB = 0;
|
---|
2780 | startClock = clock();
|
---|
2781 | for ( i = count; i; --i ) {
|
---|
2782 | uA.ui = inputs_F64UI[inputNumA];
|
---|
2783 | uB.ui = inputs_F64UI[inputNumB];
|
---|
2784 | function( uA.f, uB.f );
|
---|
2785 | inputNumA = (inputNumA + 1) & (numInputs_f64 - 1);
|
---|
2786 | if ( ! inputNumA ) ++inputNumB;
|
---|
2787 | inputNumB = (inputNumB + 1) & (numInputs_f64 - 1);
|
---|
2788 | }
|
---|
2789 | endClock = clock();
|
---|
2790 | reportTime( count, endClock - startClock );
|
---|
2791 |
|
---|
2792 | }
|
---|
2793 |
|
---|
2794 | static const uint64_t inputs_F64UI_pos[numInputs_f64] = {
|
---|
2795 | UINT64_C( 0x422FFFC008000000 ),
|
---|
2796 | UINT64_C( 0x37E0000480000000 ),
|
---|
2797 | UINT64_C( 0x73FD2546120B7935 ),
|
---|
2798 | UINT64_C( 0x3FF0000000000000 ),
|
---|
2799 | UINT64_C( 0x4E07F766F09588D6 ),
|
---|
2800 | UINT64_C( 0x0000000000000000 ),
|
---|
2801 | UINT64_C( 0x3FCE000400000000 ),
|
---|
2802 | UINT64_C( 0x0313B60F0032BED8 ),
|
---|
2803 | UINT64_C( 0x41EFFFFFC0002000 ),
|
---|
2804 | UINT64_C( 0x3FB3C75D224F2B0F ),
|
---|
2805 | UINT64_C( 0x7FD00000004000FF ),
|
---|
2806 | UINT64_C( 0x212FFF8000001FFF ),
|
---|
2807 | UINT64_C( 0x3EE0000000FE0000 ),
|
---|
2808 | UINT64_C( 0x0010000080000004 ),
|
---|
2809 | UINT64_C( 0x41CFFFFE00000020 ),
|
---|
2810 | UINT64_C( 0x40303FFFFFFFFFFD ),
|
---|
2811 | UINT64_C( 0x3FD000003FEFFFFF ),
|
---|
2812 | UINT64_C( 0x3FD0000010000000 ),
|
---|
2813 | UINT64_C( 0x37FC6B5C16CA55CF ),
|
---|
2814 | UINT64_C( 0x413EEB940B9D1301 ),
|
---|
2815 | UINT64_C( 0x47E00200001FFFFF ),
|
---|
2816 | UINT64_C( 0x47F00021FFFFFFFE ),
|
---|
2817 | UINT64_C( 0x3FFFFFFFF80000FF ),
|
---|
2818 | UINT64_C( 0x407FFFFFE00FFFFF ),
|
---|
2819 | UINT64_C( 0x001497A63740C5E8 ),
|
---|
2820 | UINT64_C( 0x44BFFFE0001FFFFF ),
|
---|
2821 | UINT64_C( 0x16FFDFFEFFFFFFFF ),
|
---|
2822 | UINT64_C( 0x403FC000000001FE ),
|
---|
2823 | UINT64_C( 0x7FD00000000001F6 ),
|
---|
2824 | UINT64_C( 0x0640400002000000 ),
|
---|
2825 | UINT64_C( 0x479CEE1E4F789FE0 ),
|
---|
2826 | UINT64_C( 0x4237FFFFFFFFFDFE )
|
---|
2827 | };
|
---|
2828 |
|
---|
2829 | static void time_az_f64_pos( float64_t function( float64_t ) )
|
---|
2830 | {
|
---|
2831 | int_fast64_t count;
|
---|
2832 | int inputNum;
|
---|
2833 | clock_t startClock;
|
---|
2834 | int_fast64_t i;
|
---|
2835 | union ui64_f64 uA;
|
---|
2836 | clock_t endClock;
|
---|
2837 |
|
---|
2838 | count = 0;
|
---|
2839 | inputNum = 0;
|
---|
2840 | startClock = clock();
|
---|
2841 | do {
|
---|
2842 | for ( i = minIterations; i; --i ) {
|
---|
2843 | uA.ui = inputs_F64UI_pos[inputNum];
|
---|
2844 | function( uA.f );
|
---|
2845 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2846 | }
|
---|
2847 | count += minIterations;
|
---|
2848 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2849 | inputNum = 0;
|
---|
2850 | startClock = clock();
|
---|
2851 | for ( i = count; i; --i ) {
|
---|
2852 | uA.ui = inputs_F64UI_pos[inputNum];
|
---|
2853 | function( uA.f );
|
---|
2854 | inputNum = (inputNum + 1) & (numInputs_f64 - 1);
|
---|
2855 | }
|
---|
2856 | endClock = clock();
|
---|
2857 | reportTime( count, endClock - startClock );
|
---|
2858 |
|
---|
2859 | }
|
---|
2860 |
|
---|
2861 | #endif
|
---|
2862 |
|
---|
2863 | /*----------------------------------------------------------------------------
|
---|
2864 | *----------------------------------------------------------------------------*/
|
---|
2865 |
|
---|
2866 | #ifdef EXTFLOAT80
|
---|
2867 |
|
---|
2868 | #ifdef LITTLEENDIAN
|
---|
2869 | #define extF80Const( v64, v0 ) { UINT64_C( v0 ), v64 }
|
---|
2870 | #else
|
---|
2871 | #define extF80Const( v64, v0 ) { v64, UINT64_C( v0 ) }
|
---|
2872 | #endif
|
---|
2873 |
|
---|
2874 | enum { numInputs_extF80 = 32 };
|
---|
2875 |
|
---|
2876 | static
|
---|
2877 | const union { struct extFloat80M s; extFloat80_t f; }
|
---|
2878 | inputs_extF80[numInputs_extF80] = {
|
---|
2879 | extF80Const( 0xC03F, 0xA9BE15A19C1E8B62 ),
|
---|
2880 | extF80Const( 0x8000, 0x0000000000000000 ),
|
---|
2881 | extF80Const( 0x75A8, 0xE59591E4788957A5 ),
|
---|
2882 | extF80Const( 0xBFFF, 0xFFF0000000000040 ),
|
---|
2883 | extF80Const( 0x0CD8, 0xFC000000000007FE ),
|
---|
2884 | extF80Const( 0x43BA, 0x99A4000000000000 ),
|
---|
2885 | extF80Const( 0x3FFF, 0x8000000000000000 ),
|
---|
2886 | extF80Const( 0x4081, 0x94FBF1BCEB5545F0 ),
|
---|
2887 | extF80Const( 0x403E, 0xFFF0000000002000 ),
|
---|
2888 | extF80Const( 0x3FFE, 0xC860E3C75D224F28 ),
|
---|
2889 | extF80Const( 0x407E, 0xFC00000FFFFFFFFE ),
|
---|
2890 | extF80Const( 0x737A, 0x800000007FFDFFFE ),
|
---|
2891 | extF80Const( 0x4044, 0xFFFFFF80000FFFFF ),
|
---|
2892 | extF80Const( 0xBBFE, 0x8000040000001FFE ),
|
---|
2893 | extF80Const( 0xC002, 0xFF80000000000020 ),
|
---|
2894 | extF80Const( 0xDE8D, 0xFFFFFFFFFFE00004 ),
|
---|
2895 | extF80Const( 0xC004, 0x8000000000003FFB ),
|
---|
2896 | extF80Const( 0x407F, 0x800000000003FFFE ),
|
---|
2897 | extF80Const( 0xC000, 0xA459EE6A5C16CA55 ),
|
---|
2898 | extF80Const( 0x8003, 0xC42CBF7399AEEB94 ),
|
---|
2899 | extF80Const( 0xBF7F, 0xF800000000000006 ),
|
---|
2900 | extF80Const( 0xC07F, 0xBF56BE8871F28FEA ),
|
---|
2901 | extF80Const( 0xC07E, 0xFFFF77FFFFFFFFFE ),
|
---|
2902 | extF80Const( 0xADC9, 0x8000000FFFFFFFDE ),
|
---|
2903 | extF80Const( 0xC001, 0xEFF7FFFFFFFFFFFF ),
|
---|
2904 | extF80Const( 0x4001, 0xBE84F30125C497A6 ),
|
---|
2905 | extF80Const( 0xC06B, 0xEFFFFFFFFFFFFFFF ),
|
---|
2906 | extF80Const( 0x4080, 0xFFFFFFFFBFFFFFFF ),
|
---|
2907 | extF80Const( 0x87E9, 0x81FFFFFFFFFFFBFF ),
|
---|
2908 | extF80Const( 0xA63F, 0x801FFFFFFEFFFFFE ),
|
---|
2909 | extF80Const( 0x403C, 0x801FFFFFFFF7FFFF ),
|
---|
2910 | extF80Const( 0x4018, 0x8000000000080003 )
|
---|
2911 | };
|
---|
2912 |
|
---|
2913 | static
|
---|
2914 | void
|
---|
2915 | time_a_extF80_z_ui32_rx(
|
---|
2916 | uint_fast32_t function( const extFloat80_t *, uint_fast8_t, bool ),
|
---|
2917 | uint_fast8_t roundingMode,
|
---|
2918 | bool exact
|
---|
2919 | )
|
---|
2920 | {
|
---|
2921 | int_fast64_t count;
|
---|
2922 | int inputNum;
|
---|
2923 | clock_t startClock;
|
---|
2924 | int_fast64_t i;
|
---|
2925 | clock_t endClock;
|
---|
2926 |
|
---|
2927 | count = 0;
|
---|
2928 | inputNum = 0;
|
---|
2929 | startClock = clock();
|
---|
2930 | do {
|
---|
2931 | for ( i = minIterations; i; --i ) {
|
---|
2932 | function( &inputs_extF80[inputNum].f, roundingMode, exact );
|
---|
2933 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
2934 | }
|
---|
2935 | count += minIterations;
|
---|
2936 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2937 | inputNum = 0;
|
---|
2938 | startClock = clock();
|
---|
2939 | for ( i = count; i; --i ) {
|
---|
2940 | function( &inputs_extF80[inputNum].f, roundingMode, exact );
|
---|
2941 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
2942 | }
|
---|
2943 | endClock = clock();
|
---|
2944 | reportTime( count, endClock - startClock );
|
---|
2945 |
|
---|
2946 | }
|
---|
2947 |
|
---|
2948 | static
|
---|
2949 | void
|
---|
2950 | time_a_extF80_z_ui64_rx(
|
---|
2951 | uint_fast64_t function( const extFloat80_t *, uint_fast8_t, bool ),
|
---|
2952 | uint_fast8_t roundingMode,
|
---|
2953 | bool exact
|
---|
2954 | )
|
---|
2955 | {
|
---|
2956 | int_fast64_t count;
|
---|
2957 | int inputNum;
|
---|
2958 | clock_t startClock;
|
---|
2959 | int_fast64_t i;
|
---|
2960 | clock_t endClock;
|
---|
2961 |
|
---|
2962 | count = 0;
|
---|
2963 | inputNum = 0;
|
---|
2964 | startClock = clock();
|
---|
2965 | do {
|
---|
2966 | for ( i = minIterations; i; --i ) {
|
---|
2967 | function( &inputs_extF80[inputNum].f, roundingMode, exact );
|
---|
2968 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
2969 | }
|
---|
2970 | count += minIterations;
|
---|
2971 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
2972 | inputNum = 0;
|
---|
2973 | startClock = clock();
|
---|
2974 | for ( i = count; i; --i ) {
|
---|
2975 | function( &inputs_extF80[inputNum].f, roundingMode, exact );
|
---|
2976 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
2977 | }
|
---|
2978 | endClock = clock();
|
---|
2979 | reportTime( count, endClock - startClock );
|
---|
2980 |
|
---|
2981 | }
|
---|
2982 |
|
---|
2983 | static
|
---|
2984 | void
|
---|
2985 | time_a_extF80_z_i32_rx(
|
---|
2986 | int_fast32_t function( const extFloat80_t *, uint_fast8_t, bool ),
|
---|
2987 | uint_fast8_t roundingMode,
|
---|
2988 | bool exact
|
---|
2989 | )
|
---|
2990 | {
|
---|
2991 | int_fast64_t count;
|
---|
2992 | int inputNum;
|
---|
2993 | clock_t startClock;
|
---|
2994 | int_fast64_t i;
|
---|
2995 | clock_t endClock;
|
---|
2996 |
|
---|
2997 | count = 0;
|
---|
2998 | inputNum = 0;
|
---|
2999 | startClock = clock();
|
---|
3000 | do {
|
---|
3001 | for ( i = minIterations; i; --i ) {
|
---|
3002 | function( &inputs_extF80[inputNum].f, roundingMode, exact );
|
---|
3003 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3004 | }
|
---|
3005 | count += minIterations;
|
---|
3006 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3007 | inputNum = 0;
|
---|
3008 | startClock = clock();
|
---|
3009 | for ( i = count; i; --i ) {
|
---|
3010 | function( &inputs_extF80[inputNum].f, roundingMode, exact );
|
---|
3011 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3012 | }
|
---|
3013 | endClock = clock();
|
---|
3014 | reportTime( count, endClock - startClock );
|
---|
3015 |
|
---|
3016 | }
|
---|
3017 |
|
---|
3018 | static
|
---|
3019 | void
|
---|
3020 | time_a_extF80_z_i64_rx(
|
---|
3021 | int_fast64_t function( const extFloat80_t *, uint_fast8_t, bool ),
|
---|
3022 | uint_fast8_t roundingMode,
|
---|
3023 | bool exact
|
---|
3024 | )
|
---|
3025 | {
|
---|
3026 | int_fast64_t count;
|
---|
3027 | int inputNum;
|
---|
3028 | clock_t startClock;
|
---|
3029 | int_fast64_t i;
|
---|
3030 | clock_t endClock;
|
---|
3031 |
|
---|
3032 | count = 0;
|
---|
3033 | inputNum = 0;
|
---|
3034 | startClock = clock();
|
---|
3035 | do {
|
---|
3036 | for ( i = minIterations; i; --i ) {
|
---|
3037 | function( &inputs_extF80[inputNum].f, roundingMode, exact );
|
---|
3038 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3039 | }
|
---|
3040 | count += minIterations;
|
---|
3041 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3042 | inputNum = 0;
|
---|
3043 | startClock = clock();
|
---|
3044 | for ( i = count; i; --i ) {
|
---|
3045 | function( &inputs_extF80[inputNum].f, roundingMode, exact );
|
---|
3046 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3047 | }
|
---|
3048 | endClock = clock();
|
---|
3049 | reportTime( count, endClock - startClock );
|
---|
3050 |
|
---|
3051 | }
|
---|
3052 |
|
---|
3053 | static
|
---|
3054 | void
|
---|
3055 | time_a_extF80_z_ui32_x(
|
---|
3056 | uint_fast32_t function( const extFloat80_t *, bool ), bool exact )
|
---|
3057 | {
|
---|
3058 | int_fast64_t count;
|
---|
3059 | int inputNum;
|
---|
3060 | clock_t startClock;
|
---|
3061 | int_fast64_t i;
|
---|
3062 | clock_t endClock;
|
---|
3063 |
|
---|
3064 | count = 0;
|
---|
3065 | inputNum = 0;
|
---|
3066 | startClock = clock();
|
---|
3067 | do {
|
---|
3068 | for ( i = minIterations; i; --i ) {
|
---|
3069 | function( &inputs_extF80[inputNum].f, exact );
|
---|
3070 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3071 | }
|
---|
3072 | count += minIterations;
|
---|
3073 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3074 | inputNum = 0;
|
---|
3075 | startClock = clock();
|
---|
3076 | for ( i = count; i; --i ) {
|
---|
3077 | function( &inputs_extF80[inputNum].f, exact );
|
---|
3078 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3079 | }
|
---|
3080 | endClock = clock();
|
---|
3081 | reportTime( count, endClock - startClock );
|
---|
3082 |
|
---|
3083 | }
|
---|
3084 |
|
---|
3085 | static
|
---|
3086 | void
|
---|
3087 | time_a_extF80_z_ui64_x(
|
---|
3088 | uint_fast64_t function( const extFloat80_t *, bool ), bool exact )
|
---|
3089 | {
|
---|
3090 | int_fast64_t count;
|
---|
3091 | int inputNum;
|
---|
3092 | clock_t startClock;
|
---|
3093 | int_fast64_t i;
|
---|
3094 | clock_t endClock;
|
---|
3095 |
|
---|
3096 | count = 0;
|
---|
3097 | inputNum = 0;
|
---|
3098 | startClock = clock();
|
---|
3099 | do {
|
---|
3100 | for ( i = minIterations; i; --i ) {
|
---|
3101 | function( &inputs_extF80[inputNum].f, exact );
|
---|
3102 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3103 | }
|
---|
3104 | count += minIterations;
|
---|
3105 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3106 | inputNum = 0;
|
---|
3107 | startClock = clock();
|
---|
3108 | for ( i = count; i; --i ) {
|
---|
3109 | function( &inputs_extF80[inputNum].f, exact );
|
---|
3110 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3111 | }
|
---|
3112 | endClock = clock();
|
---|
3113 | reportTime( count, endClock - startClock );
|
---|
3114 |
|
---|
3115 | }
|
---|
3116 |
|
---|
3117 | static
|
---|
3118 | void
|
---|
3119 | time_a_extF80_z_i32_x(
|
---|
3120 | int_fast32_t function( const extFloat80_t *, bool ), bool exact )
|
---|
3121 | {
|
---|
3122 | int_fast64_t count;
|
---|
3123 | int inputNum;
|
---|
3124 | clock_t startClock;
|
---|
3125 | int_fast64_t i;
|
---|
3126 | clock_t endClock;
|
---|
3127 |
|
---|
3128 | count = 0;
|
---|
3129 | inputNum = 0;
|
---|
3130 | startClock = clock();
|
---|
3131 | do {
|
---|
3132 | for ( i = minIterations; i; --i ) {
|
---|
3133 | function( &inputs_extF80[inputNum].f, exact );
|
---|
3134 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3135 | }
|
---|
3136 | count += minIterations;
|
---|
3137 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3138 | inputNum = 0;
|
---|
3139 | startClock = clock();
|
---|
3140 | for ( i = count; i; --i ) {
|
---|
3141 | function( &inputs_extF80[inputNum].f, exact );
|
---|
3142 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3143 | }
|
---|
3144 | endClock = clock();
|
---|
3145 | reportTime( count, endClock - startClock );
|
---|
3146 |
|
---|
3147 | }
|
---|
3148 |
|
---|
3149 | static
|
---|
3150 | void
|
---|
3151 | time_a_extF80_z_i64_x(
|
---|
3152 | int_fast64_t function( const extFloat80_t *, bool ), bool exact )
|
---|
3153 | {
|
---|
3154 | int_fast64_t count;
|
---|
3155 | int inputNum;
|
---|
3156 | clock_t startClock;
|
---|
3157 | int_fast64_t i;
|
---|
3158 | clock_t endClock;
|
---|
3159 |
|
---|
3160 | count = 0;
|
---|
3161 | inputNum = 0;
|
---|
3162 | startClock = clock();
|
---|
3163 | do {
|
---|
3164 | for ( i = minIterations; i; --i ) {
|
---|
3165 | function( &inputs_extF80[inputNum].f, exact );
|
---|
3166 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3167 | }
|
---|
3168 | count += minIterations;
|
---|
3169 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3170 | inputNum = 0;
|
---|
3171 | startClock = clock();
|
---|
3172 | for ( i = count; i; --i ) {
|
---|
3173 | function( &inputs_extF80[inputNum].f, exact );
|
---|
3174 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3175 | }
|
---|
3176 | endClock = clock();
|
---|
3177 | reportTime( count, endClock - startClock );
|
---|
3178 |
|
---|
3179 | }
|
---|
3180 |
|
---|
3181 | #ifdef FLOAT16
|
---|
3182 |
|
---|
3183 | static void time_a_extF80_z_f16( float16_t function( const extFloat80_t * ) )
|
---|
3184 | {
|
---|
3185 | int_fast64_t count;
|
---|
3186 | int inputNum;
|
---|
3187 | clock_t startClock;
|
---|
3188 | int_fast64_t i;
|
---|
3189 | clock_t endClock;
|
---|
3190 |
|
---|
3191 | count = 0;
|
---|
3192 | inputNum = 0;
|
---|
3193 | startClock = clock();
|
---|
3194 | do {
|
---|
3195 | for ( i = minIterations; i; --i ) {
|
---|
3196 | function( &inputs_extF80[inputNum].f );
|
---|
3197 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3198 | }
|
---|
3199 | count += minIterations;
|
---|
3200 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3201 | inputNum = 0;
|
---|
3202 | startClock = clock();
|
---|
3203 | for ( i = count; i; --i ) {
|
---|
3204 | function( &inputs_extF80[inputNum].f );
|
---|
3205 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3206 | }
|
---|
3207 | endClock = clock();
|
---|
3208 | reportTime( count, endClock - startClock );
|
---|
3209 |
|
---|
3210 | }
|
---|
3211 |
|
---|
3212 | #endif
|
---|
3213 |
|
---|
3214 | static void time_a_extF80_z_f32( float32_t function( const extFloat80_t * ) )
|
---|
3215 | {
|
---|
3216 | int_fast64_t count;
|
---|
3217 | int inputNum;
|
---|
3218 | clock_t startClock;
|
---|
3219 | int_fast64_t i;
|
---|
3220 | clock_t endClock;
|
---|
3221 |
|
---|
3222 | count = 0;
|
---|
3223 | inputNum = 0;
|
---|
3224 | startClock = clock();
|
---|
3225 | do {
|
---|
3226 | for ( i = minIterations; i; --i ) {
|
---|
3227 | function( &inputs_extF80[inputNum].f );
|
---|
3228 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3229 | }
|
---|
3230 | count += minIterations;
|
---|
3231 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3232 | inputNum = 0;
|
---|
3233 | startClock = clock();
|
---|
3234 | for ( i = count; i; --i ) {
|
---|
3235 | function( &inputs_extF80[inputNum].f );
|
---|
3236 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3237 | }
|
---|
3238 | endClock = clock();
|
---|
3239 | reportTime( count, endClock - startClock );
|
---|
3240 |
|
---|
3241 | }
|
---|
3242 |
|
---|
3243 | #ifdef FLOAT64
|
---|
3244 |
|
---|
3245 | static void time_a_extF80_z_f64( float64_t function( const extFloat80_t * ) )
|
---|
3246 | {
|
---|
3247 | int_fast64_t count;
|
---|
3248 | int inputNum;
|
---|
3249 | clock_t startClock;
|
---|
3250 | int_fast64_t i;
|
---|
3251 | clock_t endClock;
|
---|
3252 |
|
---|
3253 | count = 0;
|
---|
3254 | inputNum = 0;
|
---|
3255 | startClock = clock();
|
---|
3256 | do {
|
---|
3257 | for ( i = minIterations; i; --i ) {
|
---|
3258 | function( &inputs_extF80[inputNum].f );
|
---|
3259 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3260 | }
|
---|
3261 | count += minIterations;
|
---|
3262 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3263 | inputNum = 0;
|
---|
3264 | startClock = clock();
|
---|
3265 | for ( i = count; i; --i ) {
|
---|
3266 | function( &inputs_extF80[inputNum].f );
|
---|
3267 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3268 | }
|
---|
3269 | endClock = clock();
|
---|
3270 | reportTime( count, endClock - startClock );
|
---|
3271 |
|
---|
3272 | }
|
---|
3273 |
|
---|
3274 | #endif
|
---|
3275 |
|
---|
3276 | #ifdef FLOAT128
|
---|
3277 |
|
---|
3278 | static
|
---|
3279 | void
|
---|
3280 | time_a_extF80_z_f128( void function( const extFloat80_t *, float128_t * ) )
|
---|
3281 | {
|
---|
3282 | int_fast64_t count;
|
---|
3283 | int inputNum;
|
---|
3284 | clock_t startClock;
|
---|
3285 | int_fast64_t i;
|
---|
3286 | float128_t z;
|
---|
3287 | clock_t endClock;
|
---|
3288 |
|
---|
3289 | count = 0;
|
---|
3290 | inputNum = 0;
|
---|
3291 | startClock = clock();
|
---|
3292 | do {
|
---|
3293 | for ( i = minIterations; i; --i ) {
|
---|
3294 | function( &inputs_extF80[inputNum].f, &z );
|
---|
3295 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3296 | }
|
---|
3297 | count += minIterations;
|
---|
3298 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3299 | inputNum = 0;
|
---|
3300 | startClock = clock();
|
---|
3301 | for ( i = count; i; --i ) {
|
---|
3302 | function( &inputs_extF80[inputNum].f, &z );
|
---|
3303 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3304 | }
|
---|
3305 | endClock = clock();
|
---|
3306 | reportTime( count, endClock - startClock );
|
---|
3307 |
|
---|
3308 | }
|
---|
3309 |
|
---|
3310 | #endif
|
---|
3311 |
|
---|
3312 | static
|
---|
3313 | void
|
---|
3314 | time_az_extF80_rx(
|
---|
3315 | void function( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ),
|
---|
3316 | uint_fast8_t roundingMode,
|
---|
3317 | bool exact
|
---|
3318 | )
|
---|
3319 | {
|
---|
3320 | int_fast64_t count;
|
---|
3321 | int inputNum;
|
---|
3322 | clock_t startClock;
|
---|
3323 | int_fast64_t i;
|
---|
3324 | extFloat80_t z;
|
---|
3325 | clock_t endClock;
|
---|
3326 |
|
---|
3327 | count = 0;
|
---|
3328 | inputNum = 0;
|
---|
3329 | startClock = clock();
|
---|
3330 | do {
|
---|
3331 | for ( i = minIterations; i; --i ) {
|
---|
3332 | function( &inputs_extF80[inputNum].f, roundingMode, exact, &z );
|
---|
3333 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3334 | }
|
---|
3335 | count += minIterations;
|
---|
3336 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3337 | inputNum = 0;
|
---|
3338 | startClock = clock();
|
---|
3339 | for ( i = count; i; --i ) {
|
---|
3340 | function( &inputs_extF80[inputNum].f, roundingMode, exact, &z );
|
---|
3341 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3342 | }
|
---|
3343 | endClock = clock();
|
---|
3344 | reportTime( count, endClock - startClock );
|
---|
3345 |
|
---|
3346 | }
|
---|
3347 |
|
---|
3348 | static
|
---|
3349 | void
|
---|
3350 | time_abz_extF80(
|
---|
3351 | void
|
---|
3352 | function( const extFloat80_t *, const extFloat80_t *, extFloat80_t * )
|
---|
3353 | )
|
---|
3354 | {
|
---|
3355 | int_fast64_t count;
|
---|
3356 | int inputNumA, inputNumB;
|
---|
3357 | clock_t startClock;
|
---|
3358 | int_fast64_t i;
|
---|
3359 | extFloat80_t z;
|
---|
3360 | clock_t endClock;
|
---|
3361 |
|
---|
3362 | count = 0;
|
---|
3363 | inputNumA = 0;
|
---|
3364 | inputNumB = 0;
|
---|
3365 | startClock = clock();
|
---|
3366 | do {
|
---|
3367 | for ( i = minIterations; i; --i ) {
|
---|
3368 | function(
|
---|
3369 | &inputs_extF80[inputNumA].f, &inputs_extF80[inputNumB].f, &z );
|
---|
3370 | inputNumA = (inputNumA + 1) & (numInputs_extF80 - 1);
|
---|
3371 | if ( ! inputNumA ) ++inputNumB;
|
---|
3372 | inputNumB = (inputNumB + 1) & (numInputs_extF80 - 1);
|
---|
3373 | }
|
---|
3374 | count += minIterations;
|
---|
3375 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3376 | inputNumA = 0;
|
---|
3377 | inputNumB = 0;
|
---|
3378 | startClock = clock();
|
---|
3379 | for ( i = count; i; --i ) {
|
---|
3380 | function(
|
---|
3381 | &inputs_extF80[inputNumA].f, &inputs_extF80[inputNumB].f, &z );
|
---|
3382 | inputNumA = (inputNumA + 1) & (numInputs_extF80 - 1);
|
---|
3383 | if ( ! inputNumA ) ++inputNumB;
|
---|
3384 | inputNumB = (inputNumB + 1) & (numInputs_extF80 - 1);
|
---|
3385 | }
|
---|
3386 | endClock = clock();
|
---|
3387 | reportTime( count, endClock - startClock );
|
---|
3388 |
|
---|
3389 | }
|
---|
3390 |
|
---|
3391 | static
|
---|
3392 | void
|
---|
3393 | time_ab_extF80_z_bool(
|
---|
3394 | bool function( const extFloat80_t *, const extFloat80_t * ) )
|
---|
3395 | {
|
---|
3396 | int_fast64_t count;
|
---|
3397 | int inputNumA, inputNumB;
|
---|
3398 | clock_t startClock;
|
---|
3399 | int_fast64_t i;
|
---|
3400 | clock_t endClock;
|
---|
3401 |
|
---|
3402 | count = 0;
|
---|
3403 | inputNumA = 0;
|
---|
3404 | inputNumB = 0;
|
---|
3405 | startClock = clock();
|
---|
3406 | do {
|
---|
3407 | for ( i = minIterations; i; --i ) {
|
---|
3408 | function(
|
---|
3409 | &inputs_extF80[inputNumA].f, &inputs_extF80[inputNumB].f );
|
---|
3410 | inputNumA = (inputNumA + 1) & (numInputs_extF80 - 1);
|
---|
3411 | if ( ! inputNumA ) ++inputNumB;
|
---|
3412 | inputNumB = (inputNumB + 1) & (numInputs_extF80 - 1);
|
---|
3413 | }
|
---|
3414 | count += minIterations;
|
---|
3415 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3416 | inputNumA = 0;
|
---|
3417 | inputNumB = 0;
|
---|
3418 | startClock = clock();
|
---|
3419 | for ( i = count; i; --i ) {
|
---|
3420 | function( &inputs_extF80[inputNumA].f, &inputs_extF80[inputNumB].f );
|
---|
3421 | inputNumA = (inputNumA + 1) & (numInputs_extF80 - 1);
|
---|
3422 | if ( ! inputNumA ) ++inputNumB;
|
---|
3423 | inputNumB = (inputNumB + 1) & (numInputs_extF80 - 1);
|
---|
3424 | }
|
---|
3425 | endClock = clock();
|
---|
3426 | reportTime( count, endClock - startClock );
|
---|
3427 |
|
---|
3428 | }
|
---|
3429 |
|
---|
3430 | static
|
---|
3431 | const union { struct extFloat80M s; extFloat80_t f; }
|
---|
3432 | inputs_extF80_pos[numInputs_extF80] = {
|
---|
3433 | extF80Const( 0x403F, 0xA9BE15A19C1E8B62 ),
|
---|
3434 | extF80Const( 0x0000, 0x0000000000000000 ),
|
---|
3435 | extF80Const( 0x75A8, 0xE59591E4788957A5 ),
|
---|
3436 | extF80Const( 0x3FFF, 0xFFF0000000000040 ),
|
---|
3437 | extF80Const( 0x0CD8, 0xFC000000000007FE ),
|
---|
3438 | extF80Const( 0x43BA, 0x99A4000000000000 ),
|
---|
3439 | extF80Const( 0x3FFF, 0x8000000000000000 ),
|
---|
3440 | extF80Const( 0x4081, 0x94FBF1BCEB5545F0 ),
|
---|
3441 | extF80Const( 0x403E, 0xFFF0000000002000 ),
|
---|
3442 | extF80Const( 0x3FFE, 0xC860E3C75D224F28 ),
|
---|
3443 | extF80Const( 0x407E, 0xFC00000FFFFFFFFE ),
|
---|
3444 | extF80Const( 0x737A, 0x800000007FFDFFFE ),
|
---|
3445 | extF80Const( 0x4044, 0xFFFFFF80000FFFFF ),
|
---|
3446 | extF80Const( 0x3BFE, 0x8000040000001FFE ),
|
---|
3447 | extF80Const( 0x4002, 0xFF80000000000020 ),
|
---|
3448 | extF80Const( 0x5E8D, 0xFFFFFFFFFFE00004 ),
|
---|
3449 | extF80Const( 0x4004, 0x8000000000003FFB ),
|
---|
3450 | extF80Const( 0x407F, 0x800000000003FFFE ),
|
---|
3451 | extF80Const( 0x4000, 0xA459EE6A5C16CA55 ),
|
---|
3452 | extF80Const( 0x0003, 0xC42CBF7399AEEB94 ),
|
---|
3453 | extF80Const( 0x3F7F, 0xF800000000000006 ),
|
---|
3454 | extF80Const( 0x407F, 0xBF56BE8871F28FEA ),
|
---|
3455 | extF80Const( 0x407E, 0xFFFF77FFFFFFFFFE ),
|
---|
3456 | extF80Const( 0x2DC9, 0x8000000FFFFFFFDE ),
|
---|
3457 | extF80Const( 0x4001, 0xEFF7FFFFFFFFFFFF ),
|
---|
3458 | extF80Const( 0x4001, 0xBE84F30125C497A6 ),
|
---|
3459 | extF80Const( 0x406B, 0xEFFFFFFFFFFFFFFF ),
|
---|
3460 | extF80Const( 0x4080, 0xFFFFFFFFBFFFFFFF ),
|
---|
3461 | extF80Const( 0x07E9, 0x81FFFFFFFFFFFBFF ),
|
---|
3462 | extF80Const( 0x263F, 0x801FFFFFFEFFFFFE ),
|
---|
3463 | extF80Const( 0x403C, 0x801FFFFFFFF7FFFF ),
|
---|
3464 | extF80Const( 0x4018, 0x8000000000080003 )
|
---|
3465 | };
|
---|
3466 |
|
---|
3467 | static
|
---|
3468 | void
|
---|
3469 | time_az_extF80_pos( void function( const extFloat80_t *, extFloat80_t * ) )
|
---|
3470 | {
|
---|
3471 | int_fast64_t count;
|
---|
3472 | int inputNum;
|
---|
3473 | clock_t startClock;
|
---|
3474 | int_fast64_t i;
|
---|
3475 | extFloat80_t z;
|
---|
3476 | clock_t endClock;
|
---|
3477 |
|
---|
3478 | count = 0;
|
---|
3479 | inputNum = 0;
|
---|
3480 | startClock = clock();
|
---|
3481 | do {
|
---|
3482 | for ( i = minIterations; i; --i ) {
|
---|
3483 | function( &inputs_extF80[inputNum].f, &z );
|
---|
3484 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3485 | }
|
---|
3486 | count += minIterations;
|
---|
3487 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3488 | inputNum = 0;
|
---|
3489 | startClock = clock();
|
---|
3490 | for ( i = count; i; --i ) {
|
---|
3491 | function( &inputs_extF80[inputNum].f, &z );
|
---|
3492 | inputNum = (inputNum + 1) & (numInputs_extF80 - 1);
|
---|
3493 | }
|
---|
3494 | endClock = clock();
|
---|
3495 | reportTime( count, endClock - startClock );
|
---|
3496 |
|
---|
3497 | }
|
---|
3498 |
|
---|
3499 | #endif
|
---|
3500 |
|
---|
3501 | /*----------------------------------------------------------------------------
|
---|
3502 | *----------------------------------------------------------------------------*/
|
---|
3503 |
|
---|
3504 | #ifdef FLOAT128
|
---|
3505 |
|
---|
3506 | #ifdef LITTLEENDIAN
|
---|
3507 | #define f128Const( v64, v0 ) { UINT64_C( v0 ), UINT64_C( v64 ) }
|
---|
3508 | #else
|
---|
3509 | #define f128Const( v64, v0 ) { UINT64_C( v64 ), UINT64_C( v0 ) }
|
---|
3510 | #endif
|
---|
3511 |
|
---|
3512 | enum { numInputs_f128 = 32 };
|
---|
3513 |
|
---|
3514 | static
|
---|
3515 | const union { struct uint128 ui; float128_t f; }
|
---|
3516 | inputs_f128[numInputs_f128] = {
|
---|
3517 | f128Const( 0x3FDA200000100000, 0x0000000000000000 ),
|
---|
3518 | f128Const( 0x3FFF000000000000, 0x0000000000000000 ),
|
---|
3519 | f128Const( 0x85F14776190C8306, 0xD8715F4E3D54BB92 ),
|
---|
3520 | f128Const( 0xF2B00000007FFFFF, 0xFFFFFFFFFFF7FFFF ),
|
---|
3521 | f128Const( 0x8000000000000000, 0x0000000000000000 ),
|
---|
3522 | f128Const( 0xBFFFFFFFFFE00000, 0x0000008000000000 ),
|
---|
3523 | f128Const( 0x407F1719CE722F3E, 0xDA6B3FE5FF29425B ),
|
---|
3524 | f128Const( 0x43FFFF8000000000, 0x0000000000400000 ),
|
---|
3525 | f128Const( 0x401E000000000100, 0x0000000000002000 ),
|
---|
3526 | f128Const( 0x3FFED71DACDA8E47, 0x4860E3C75D224F28 ),
|
---|
3527 | f128Const( 0xBF7ECFC1E90647D1, 0x7A124FE55623EE44 ),
|
---|
3528 | f128Const( 0x0DF7007FFFFFFFFF, 0xFFFFFFFFEFFFFFFF ),
|
---|
3529 | f128Const( 0x3FE5FFEFFFFFFFFF, 0xFFFFFFFFFFFFEFFF ),
|
---|
3530 | f128Const( 0x403FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFBFE ),
|
---|
3531 | f128Const( 0xBFFB2FBF7399AFEB, 0xA459EE6A5C16CA55 ),
|
---|
3532 | f128Const( 0xBDB8FFFFFFFFFFFC, 0x0000000000000400 ),
|
---|
3533 | f128Const( 0x3FC8FFDFFFFFFFFF, 0xFFFFFFFFF0000000 ),
|
---|
3534 | f128Const( 0x3FFBFFFFFFDFFFFF, 0xFFF8000000000000 ),
|
---|
3535 | f128Const( 0x407043C11737BE84, 0xDDD58212ADC937F4 ),
|
---|
3536 | f128Const( 0x8001000000000000, 0x0000001000000001 ),
|
---|
3537 | f128Const( 0xC036FFFFFFFFFFFF, 0xFE40000000000000 ),
|
---|
3538 | f128Const( 0x4002FFFFFE000002, 0x0000000000000000 ),
|
---|
3539 | f128Const( 0x4000C3FEDE897773, 0x326AC4FD8EFBE6DC ),
|
---|
3540 | f128Const( 0xBFFF0000000FFFFF, 0xFFFFFE0000000000 ),
|
---|
3541 | f128Const( 0x62C3E502146E426D, 0x43F3CAA0DC7DF1A0 ),
|
---|
3542 | f128Const( 0xB5CBD32E52BB570E, 0xBCC477CB11C6236C ),
|
---|
3543 | f128Const( 0xE228FFFFFFC00000, 0x0000000000000000 ),
|
---|
3544 | f128Const( 0x3F80000000000000, 0x0000000080000008 ),
|
---|
3545 | f128Const( 0xC1AFFFDFFFFFFFFF, 0xFFFC000000000000 ),
|
---|
3546 | f128Const( 0xC96F000000000000, 0x00000001FFFBFFFF ),
|
---|
3547 | f128Const( 0x3DE09BFE7923A338, 0xBCC8FBBD7CEC1F4F ),
|
---|
3548 | f128Const( 0x401CFFFFFFFFFFFF, 0xFFFFFFFEFFFFFF80 )
|
---|
3549 | };
|
---|
3550 |
|
---|
3551 | static
|
---|
3552 | void
|
---|
3553 | time_a_f128_z_ui32_rx(
|
---|
3554 | uint_fast32_t function( const float128_t *, uint_fast8_t, bool ),
|
---|
3555 | uint_fast8_t roundingMode,
|
---|
3556 | bool exact
|
---|
3557 | )
|
---|
3558 | {
|
---|
3559 | int_fast64_t count;
|
---|
3560 | int inputNum;
|
---|
3561 | clock_t startClock;
|
---|
3562 | int_fast64_t i;
|
---|
3563 | clock_t endClock;
|
---|
3564 |
|
---|
3565 | count = 0;
|
---|
3566 | inputNum = 0;
|
---|
3567 | startClock = clock();
|
---|
3568 | do {
|
---|
3569 | for ( i = minIterations; i; --i ) {
|
---|
3570 | function( &inputs_f128[inputNum].f, roundingMode, exact );
|
---|
3571 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3572 | }
|
---|
3573 | count += minIterations;
|
---|
3574 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3575 | inputNum = 0;
|
---|
3576 | startClock = clock();
|
---|
3577 | for ( i = count; i; --i ) {
|
---|
3578 | function( &inputs_f128[inputNum].f, roundingMode, exact );
|
---|
3579 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3580 | }
|
---|
3581 | endClock = clock();
|
---|
3582 | reportTime( count, endClock - startClock );
|
---|
3583 |
|
---|
3584 | }
|
---|
3585 |
|
---|
3586 | static
|
---|
3587 | void
|
---|
3588 | time_a_f128_z_ui64_rx(
|
---|
3589 | uint_fast64_t function( const float128_t *, uint_fast8_t, bool ),
|
---|
3590 | uint_fast8_t roundingMode,
|
---|
3591 | bool exact
|
---|
3592 | )
|
---|
3593 | {
|
---|
3594 | int_fast64_t count;
|
---|
3595 | int inputNum;
|
---|
3596 | clock_t startClock;
|
---|
3597 | int_fast64_t i;
|
---|
3598 | clock_t endClock;
|
---|
3599 |
|
---|
3600 | count = 0;
|
---|
3601 | inputNum = 0;
|
---|
3602 | startClock = clock();
|
---|
3603 | do {
|
---|
3604 | for ( i = minIterations; i; --i ) {
|
---|
3605 | function( &inputs_f128[inputNum].f, roundingMode, exact );
|
---|
3606 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3607 | }
|
---|
3608 | count += minIterations;
|
---|
3609 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3610 | inputNum = 0;
|
---|
3611 | startClock = clock();
|
---|
3612 | for ( i = count; i; --i ) {
|
---|
3613 | function( &inputs_f128[inputNum].f, roundingMode, exact );
|
---|
3614 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3615 | }
|
---|
3616 | endClock = clock();
|
---|
3617 | reportTime( count, endClock - startClock );
|
---|
3618 |
|
---|
3619 | }
|
---|
3620 |
|
---|
3621 | static
|
---|
3622 | void
|
---|
3623 | time_a_f128_z_i32_rx(
|
---|
3624 | int_fast32_t function( const float128_t *, uint_fast8_t, bool ),
|
---|
3625 | uint_fast8_t roundingMode,
|
---|
3626 | bool exact
|
---|
3627 | )
|
---|
3628 | {
|
---|
3629 | int_fast64_t count;
|
---|
3630 | int inputNum;
|
---|
3631 | clock_t startClock;
|
---|
3632 | int_fast64_t i;
|
---|
3633 | clock_t endClock;
|
---|
3634 |
|
---|
3635 | count = 0;
|
---|
3636 | inputNum = 0;
|
---|
3637 | startClock = clock();
|
---|
3638 | do {
|
---|
3639 | for ( i = minIterations; i; --i ) {
|
---|
3640 | function( &inputs_f128[inputNum].f, roundingMode, exact );
|
---|
3641 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3642 | }
|
---|
3643 | count += minIterations;
|
---|
3644 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3645 | inputNum = 0;
|
---|
3646 | startClock = clock();
|
---|
3647 | for ( i = count; i; --i ) {
|
---|
3648 | function( &inputs_f128[inputNum].f, roundingMode, exact );
|
---|
3649 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3650 | }
|
---|
3651 | endClock = clock();
|
---|
3652 | reportTime( count, endClock - startClock );
|
---|
3653 |
|
---|
3654 | }
|
---|
3655 |
|
---|
3656 | static
|
---|
3657 | void
|
---|
3658 | time_a_f128_z_i64_rx(
|
---|
3659 | int_fast64_t function( const float128_t *, uint_fast8_t, bool ),
|
---|
3660 | uint_fast8_t roundingMode,
|
---|
3661 | bool exact
|
---|
3662 | )
|
---|
3663 | {
|
---|
3664 | int_fast64_t count;
|
---|
3665 | int inputNum;
|
---|
3666 | clock_t startClock;
|
---|
3667 | int_fast64_t i;
|
---|
3668 | clock_t endClock;
|
---|
3669 |
|
---|
3670 | count = 0;
|
---|
3671 | inputNum = 0;
|
---|
3672 | startClock = clock();
|
---|
3673 | do {
|
---|
3674 | for ( i = minIterations; i; --i ) {
|
---|
3675 | function( &inputs_f128[inputNum].f, roundingMode, exact );
|
---|
3676 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3677 | }
|
---|
3678 | count += minIterations;
|
---|
3679 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3680 | inputNum = 0;
|
---|
3681 | startClock = clock();
|
---|
3682 | for ( i = count; i; --i ) {
|
---|
3683 | function( &inputs_f128[inputNum].f, roundingMode, exact );
|
---|
3684 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3685 | }
|
---|
3686 | endClock = clock();
|
---|
3687 | reportTime( count, endClock - startClock );
|
---|
3688 |
|
---|
3689 | }
|
---|
3690 |
|
---|
3691 | static
|
---|
3692 | void
|
---|
3693 | time_a_f128_z_ui32_x(
|
---|
3694 | uint_fast32_t function( const float128_t *, bool ), bool exact )
|
---|
3695 | {
|
---|
3696 | int_fast64_t count;
|
---|
3697 | int inputNum;
|
---|
3698 | clock_t startClock;
|
---|
3699 | int_fast64_t i;
|
---|
3700 | clock_t endClock;
|
---|
3701 |
|
---|
3702 | count = 0;
|
---|
3703 | inputNum = 0;
|
---|
3704 | startClock = clock();
|
---|
3705 | do {
|
---|
3706 | for ( i = minIterations; i; --i ) {
|
---|
3707 | function( &inputs_f128[inputNum].f, exact );
|
---|
3708 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3709 | }
|
---|
3710 | count += minIterations;
|
---|
3711 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3712 | inputNum = 0;
|
---|
3713 | startClock = clock();
|
---|
3714 | for ( i = count; i; --i ) {
|
---|
3715 | function( &inputs_f128[inputNum].f, exact );
|
---|
3716 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3717 | }
|
---|
3718 | endClock = clock();
|
---|
3719 | reportTime( count, endClock - startClock );
|
---|
3720 |
|
---|
3721 | }
|
---|
3722 |
|
---|
3723 | static
|
---|
3724 | void
|
---|
3725 | time_a_f128_z_ui64_x(
|
---|
3726 | uint_fast64_t function( const float128_t *, bool ), bool exact )
|
---|
3727 | {
|
---|
3728 | int_fast64_t count;
|
---|
3729 | int inputNum;
|
---|
3730 | clock_t startClock;
|
---|
3731 | int_fast64_t i;
|
---|
3732 | clock_t endClock;
|
---|
3733 |
|
---|
3734 | count = 0;
|
---|
3735 | inputNum = 0;
|
---|
3736 | startClock = clock();
|
---|
3737 | do {
|
---|
3738 | for ( i = minIterations; i; --i ) {
|
---|
3739 | function( &inputs_f128[inputNum].f, exact );
|
---|
3740 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3741 | }
|
---|
3742 | count += minIterations;
|
---|
3743 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3744 | inputNum = 0;
|
---|
3745 | startClock = clock();
|
---|
3746 | for ( i = count; i; --i ) {
|
---|
3747 | function( &inputs_f128[inputNum].f, exact );
|
---|
3748 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3749 | }
|
---|
3750 | endClock = clock();
|
---|
3751 | reportTime( count, endClock - startClock );
|
---|
3752 |
|
---|
3753 | }
|
---|
3754 |
|
---|
3755 | static
|
---|
3756 | void
|
---|
3757 | time_a_f128_z_i32_x(
|
---|
3758 | int_fast32_t function( const float128_t *, bool ), bool exact )
|
---|
3759 | {
|
---|
3760 | int_fast64_t count;
|
---|
3761 | int inputNum;
|
---|
3762 | clock_t startClock;
|
---|
3763 | int_fast64_t i;
|
---|
3764 | clock_t endClock;
|
---|
3765 |
|
---|
3766 | count = 0;
|
---|
3767 | inputNum = 0;
|
---|
3768 | startClock = clock();
|
---|
3769 | do {
|
---|
3770 | for ( i = minIterations; i; --i ) {
|
---|
3771 | function( &inputs_f128[inputNum].f, exact );
|
---|
3772 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3773 | }
|
---|
3774 | count += minIterations;
|
---|
3775 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3776 | inputNum = 0;
|
---|
3777 | startClock = clock();
|
---|
3778 | for ( i = count; i; --i ) {
|
---|
3779 | function( &inputs_f128[inputNum].f, exact );
|
---|
3780 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3781 | }
|
---|
3782 | endClock = clock();
|
---|
3783 | reportTime( count, endClock - startClock );
|
---|
3784 |
|
---|
3785 | }
|
---|
3786 |
|
---|
3787 | static
|
---|
3788 | void
|
---|
3789 | time_a_f128_z_i64_x(
|
---|
3790 | int_fast64_t function( const float128_t *, bool ), bool exact )
|
---|
3791 | {
|
---|
3792 | int_fast64_t count;
|
---|
3793 | int inputNum;
|
---|
3794 | clock_t startClock;
|
---|
3795 | int_fast64_t i;
|
---|
3796 | clock_t endClock;
|
---|
3797 |
|
---|
3798 | count = 0;
|
---|
3799 | inputNum = 0;
|
---|
3800 | startClock = clock();
|
---|
3801 | do {
|
---|
3802 | for ( i = minIterations; i; --i ) {
|
---|
3803 | function( &inputs_f128[inputNum].f, exact );
|
---|
3804 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3805 | }
|
---|
3806 | count += minIterations;
|
---|
3807 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3808 | inputNum = 0;
|
---|
3809 | startClock = clock();
|
---|
3810 | for ( i = count; i; --i ) {
|
---|
3811 | function( &inputs_f128[inputNum].f, exact );
|
---|
3812 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3813 | }
|
---|
3814 | endClock = clock();
|
---|
3815 | reportTime( count, endClock - startClock );
|
---|
3816 |
|
---|
3817 | }
|
---|
3818 |
|
---|
3819 | #ifdef FLOAT16
|
---|
3820 |
|
---|
3821 | static void time_a_f128_z_f16( float16_t function( const float128_t * ) )
|
---|
3822 | {
|
---|
3823 | int_fast64_t count;
|
---|
3824 | int inputNum;
|
---|
3825 | clock_t startClock;
|
---|
3826 | int_fast64_t i;
|
---|
3827 | clock_t endClock;
|
---|
3828 |
|
---|
3829 | count = 0;
|
---|
3830 | inputNum = 0;
|
---|
3831 | startClock = clock();
|
---|
3832 | do {
|
---|
3833 | for ( i = minIterations; i; --i ) {
|
---|
3834 | function( &inputs_f128[inputNum].f );
|
---|
3835 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3836 | }
|
---|
3837 | count += minIterations;
|
---|
3838 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3839 | inputNum = 0;
|
---|
3840 | startClock = clock();
|
---|
3841 | for ( i = count; i; --i ) {
|
---|
3842 | function( &inputs_f128[inputNum].f );
|
---|
3843 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3844 | }
|
---|
3845 | endClock = clock();
|
---|
3846 | reportTime( count, endClock - startClock );
|
---|
3847 |
|
---|
3848 | }
|
---|
3849 |
|
---|
3850 | #endif
|
---|
3851 |
|
---|
3852 | static void time_a_f128_z_f32( float32_t function( const float128_t * ) )
|
---|
3853 | {
|
---|
3854 | int_fast64_t count;
|
---|
3855 | int inputNum;
|
---|
3856 | clock_t startClock;
|
---|
3857 | int_fast64_t i;
|
---|
3858 | clock_t endClock;
|
---|
3859 |
|
---|
3860 | count = 0;
|
---|
3861 | inputNum = 0;
|
---|
3862 | startClock = clock();
|
---|
3863 | do {
|
---|
3864 | for ( i = minIterations; i; --i ) {
|
---|
3865 | function( &inputs_f128[inputNum].f );
|
---|
3866 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3867 | }
|
---|
3868 | count += minIterations;
|
---|
3869 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3870 | inputNum = 0;
|
---|
3871 | startClock = clock();
|
---|
3872 | for ( i = count; i; --i ) {
|
---|
3873 | function( &inputs_f128[inputNum].f );
|
---|
3874 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3875 | }
|
---|
3876 | endClock = clock();
|
---|
3877 | reportTime( count, endClock - startClock );
|
---|
3878 |
|
---|
3879 | }
|
---|
3880 |
|
---|
3881 | #ifdef FLOAT64
|
---|
3882 |
|
---|
3883 | static void time_a_f128_z_f64( float64_t function( const float128_t * ) )
|
---|
3884 | {
|
---|
3885 | int_fast64_t count;
|
---|
3886 | int inputNum;
|
---|
3887 | clock_t startClock;
|
---|
3888 | int_fast64_t i;
|
---|
3889 | clock_t endClock;
|
---|
3890 |
|
---|
3891 | count = 0;
|
---|
3892 | inputNum = 0;
|
---|
3893 | startClock = clock();
|
---|
3894 | do {
|
---|
3895 | for ( i = minIterations; i; --i ) {
|
---|
3896 | function( &inputs_f128[inputNum].f );
|
---|
3897 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3898 | }
|
---|
3899 | count += minIterations;
|
---|
3900 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3901 | inputNum = 0;
|
---|
3902 | startClock = clock();
|
---|
3903 | for ( i = count; i; --i ) {
|
---|
3904 | function( &inputs_f128[inputNum].f );
|
---|
3905 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3906 | }
|
---|
3907 | endClock = clock();
|
---|
3908 | reportTime( count, endClock - startClock );
|
---|
3909 |
|
---|
3910 | }
|
---|
3911 |
|
---|
3912 | #endif
|
---|
3913 |
|
---|
3914 | #ifdef EXTFLOAT80
|
---|
3915 |
|
---|
3916 | static
|
---|
3917 | void
|
---|
3918 | time_a_f128_z_extF80( void function( const float128_t *, extFloat80_t * ) )
|
---|
3919 | {
|
---|
3920 | int_fast64_t count;
|
---|
3921 | int inputNum;
|
---|
3922 | clock_t startClock;
|
---|
3923 | int_fast64_t i;
|
---|
3924 | extFloat80_t z;
|
---|
3925 | clock_t endClock;
|
---|
3926 |
|
---|
3927 | count = 0;
|
---|
3928 | inputNum = 0;
|
---|
3929 | startClock = clock();
|
---|
3930 | do {
|
---|
3931 | for ( i = minIterations; i; --i ) {
|
---|
3932 | function( &inputs_f128[inputNum].f, &z );
|
---|
3933 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3934 | }
|
---|
3935 | count += minIterations;
|
---|
3936 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3937 | inputNum = 0;
|
---|
3938 | startClock = clock();
|
---|
3939 | for ( i = count; i; --i ) {
|
---|
3940 | function( &inputs_f128[inputNum].f, &z );
|
---|
3941 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3942 | }
|
---|
3943 | endClock = clock();
|
---|
3944 | reportTime( count, endClock - startClock );
|
---|
3945 |
|
---|
3946 | }
|
---|
3947 |
|
---|
3948 | #endif
|
---|
3949 |
|
---|
3950 | static
|
---|
3951 | void
|
---|
3952 | time_az_f128_rx(
|
---|
3953 | void function( const float128_t *, uint_fast8_t, bool, float128_t * ),
|
---|
3954 | uint_fast8_t roundingMode,
|
---|
3955 | bool exact
|
---|
3956 | )
|
---|
3957 | {
|
---|
3958 | int_fast64_t count;
|
---|
3959 | int inputNum;
|
---|
3960 | clock_t startClock;
|
---|
3961 | int_fast64_t i;
|
---|
3962 | float128_t z;
|
---|
3963 | clock_t endClock;
|
---|
3964 |
|
---|
3965 | count = 0;
|
---|
3966 | inputNum = 0;
|
---|
3967 | startClock = clock();
|
---|
3968 | do {
|
---|
3969 | for ( i = minIterations; i; --i ) {
|
---|
3970 | function( &inputs_f128[inputNum].f, roundingMode, exact, &z );
|
---|
3971 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3972 | }
|
---|
3973 | count += minIterations;
|
---|
3974 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
3975 | inputNum = 0;
|
---|
3976 | startClock = clock();
|
---|
3977 | for ( i = count; i; --i ) {
|
---|
3978 | function( &inputs_f128[inputNum].f, roundingMode, exact, &z );
|
---|
3979 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
3980 | }
|
---|
3981 | endClock = clock();
|
---|
3982 | reportTime( count, endClock - startClock );
|
---|
3983 |
|
---|
3984 | }
|
---|
3985 |
|
---|
3986 | static
|
---|
3987 | void
|
---|
3988 | time_abz_f128(
|
---|
3989 | void function( const float128_t *, const float128_t *, float128_t * ) )
|
---|
3990 | {
|
---|
3991 | int_fast64_t count;
|
---|
3992 | int inputNumA, inputNumB;
|
---|
3993 | clock_t startClock;
|
---|
3994 | int_fast64_t i;
|
---|
3995 | float128_t z;
|
---|
3996 | clock_t endClock;
|
---|
3997 |
|
---|
3998 | count = 0;
|
---|
3999 | inputNumA = 0;
|
---|
4000 | inputNumB = 0;
|
---|
4001 | startClock = clock();
|
---|
4002 | do {
|
---|
4003 | for ( i = minIterations; i; --i ) {
|
---|
4004 | function(
|
---|
4005 | &inputs_f128[inputNumA].f, &inputs_f128[inputNumB].f, &z );
|
---|
4006 | inputNumA = (inputNumA + 1) & (numInputs_f128 - 1);
|
---|
4007 | if ( ! inputNumA ) ++inputNumB;
|
---|
4008 | inputNumB = (inputNumB + 1) & (numInputs_f128 - 1);
|
---|
4009 | }
|
---|
4010 | count += minIterations;
|
---|
4011 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
4012 | inputNumA = 0;
|
---|
4013 | inputNumB = 0;
|
---|
4014 | startClock = clock();
|
---|
4015 | for ( i = count; i; --i ) {
|
---|
4016 | function( &inputs_f128[inputNumA].f, &inputs_f128[inputNumB].f, &z );
|
---|
4017 | inputNumA = (inputNumA + 1) & (numInputs_f128 - 1);
|
---|
4018 | if ( ! inputNumA ) ++inputNumB;
|
---|
4019 | inputNumB = (inputNumB + 1) & (numInputs_f128 - 1);
|
---|
4020 | }
|
---|
4021 | endClock = clock();
|
---|
4022 | reportTime( count, endClock - startClock );
|
---|
4023 |
|
---|
4024 | }
|
---|
4025 |
|
---|
4026 | static
|
---|
4027 | void
|
---|
4028 | time_abcz_f128(
|
---|
4029 | void
|
---|
4030 | function(
|
---|
4031 | const float128_t *,
|
---|
4032 | const float128_t *,
|
---|
4033 | const float128_t *,
|
---|
4034 | float128_t *
|
---|
4035 | )
|
---|
4036 | )
|
---|
4037 | {
|
---|
4038 | int_fast64_t count;
|
---|
4039 | int inputNumA, inputNumB, inputNumC;
|
---|
4040 | clock_t startClock;
|
---|
4041 | int_fast64_t i;
|
---|
4042 | float128_t z;
|
---|
4043 | clock_t endClock;
|
---|
4044 |
|
---|
4045 | count = 0;
|
---|
4046 | inputNumA = 0;
|
---|
4047 | inputNumB = 0;
|
---|
4048 | inputNumC = 0;
|
---|
4049 | startClock = clock();
|
---|
4050 | do {
|
---|
4051 | for ( i = minIterations; i; --i ) {
|
---|
4052 | function(
|
---|
4053 | &inputs_f128[inputNumA].f,
|
---|
4054 | &inputs_f128[inputNumB].f,
|
---|
4055 | &inputs_f128[inputNumC].f,
|
---|
4056 | &z
|
---|
4057 | );
|
---|
4058 | inputNumA = (inputNumA + 1) & (numInputs_f128 - 1);
|
---|
4059 | if ( ! inputNumA ) ++inputNumB;
|
---|
4060 | inputNumB = (inputNumB + 1) & (numInputs_f128 - 1);
|
---|
4061 | if ( ! inputNumB ) ++inputNumC;
|
---|
4062 | inputNumC = (inputNumC + 1) & (numInputs_f128 - 1);
|
---|
4063 | }
|
---|
4064 | count += minIterations;
|
---|
4065 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
4066 | inputNumA = 0;
|
---|
4067 | inputNumB = 0;
|
---|
4068 | inputNumC = 0;
|
---|
4069 | startClock = clock();
|
---|
4070 | for ( i = count; i; --i ) {
|
---|
4071 | function(
|
---|
4072 | &inputs_f128[inputNumA].f,
|
---|
4073 | &inputs_f128[inputNumB].f,
|
---|
4074 | &inputs_f128[inputNumC].f,
|
---|
4075 | &z
|
---|
4076 | );
|
---|
4077 | inputNumA = (inputNumA + 1) & (numInputs_f128 - 1);
|
---|
4078 | if ( ! inputNumA ) ++inputNumB;
|
---|
4079 | inputNumB = (inputNumB + 1) & (numInputs_f128 - 1);
|
---|
4080 | if ( ! inputNumB ) ++inputNumC;
|
---|
4081 | inputNumC = (inputNumC + 1) & (numInputs_f128 - 1);
|
---|
4082 | }
|
---|
4083 | endClock = clock();
|
---|
4084 | reportTime( count, endClock - startClock );
|
---|
4085 |
|
---|
4086 | }
|
---|
4087 |
|
---|
4088 | static
|
---|
4089 | void
|
---|
4090 | time_ab_f128_z_bool( bool function( const float128_t *, const float128_t * ) )
|
---|
4091 | {
|
---|
4092 | int_fast64_t count;
|
---|
4093 | int inputNumA, inputNumB;
|
---|
4094 | clock_t startClock;
|
---|
4095 | int_fast64_t i;
|
---|
4096 | clock_t endClock;
|
---|
4097 |
|
---|
4098 | count = 0;
|
---|
4099 | inputNumA = 0;
|
---|
4100 | inputNumB = 0;
|
---|
4101 | startClock = clock();
|
---|
4102 | do {
|
---|
4103 | for ( i = minIterations; i; --i ) {
|
---|
4104 | function( &inputs_f128[inputNumA].f, &inputs_f128[inputNumB].f );
|
---|
4105 | inputNumA = (inputNumA + 1) & (numInputs_f128 - 1);
|
---|
4106 | if ( ! inputNumA ) ++inputNumB;
|
---|
4107 | inputNumB = (inputNumB + 1) & (numInputs_f128 - 1);
|
---|
4108 | }
|
---|
4109 | count += minIterations;
|
---|
4110 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
4111 | inputNumA = 0;
|
---|
4112 | inputNumB = 0;
|
---|
4113 | startClock = clock();
|
---|
4114 | for ( i = count; i; --i ) {
|
---|
4115 | function( &inputs_f128[inputNumA].f, &inputs_f128[inputNumB].f );
|
---|
4116 | inputNumA = (inputNumA + 1) & (numInputs_f128 - 1);
|
---|
4117 | if ( ! inputNumA ) ++inputNumB;
|
---|
4118 | inputNumB = (inputNumB + 1) & (numInputs_f128 - 1);
|
---|
4119 | }
|
---|
4120 | endClock = clock();
|
---|
4121 | reportTime( count, endClock - startClock );
|
---|
4122 |
|
---|
4123 | }
|
---|
4124 |
|
---|
4125 | static
|
---|
4126 | const union { struct uint128 ui; float128_t f; }
|
---|
4127 | inputs_f128_pos[numInputs_f128] = {
|
---|
4128 | f128Const( 0x3FDA200000100000, 0x0000000000000000 ),
|
---|
4129 | f128Const( 0x3FFF000000000000, 0x0000000000000000 ),
|
---|
4130 | f128Const( 0x05F14776190C8306, 0xD8715F4E3D54BB92 ),
|
---|
4131 | f128Const( 0x72B00000007FFFFF, 0xFFFFFFFFFFF7FFFF ),
|
---|
4132 | f128Const( 0x0000000000000000, 0x0000000000000000 ),
|
---|
4133 | f128Const( 0x3FFFFFFFFFE00000, 0x0000008000000000 ),
|
---|
4134 | f128Const( 0x407F1719CE722F3E, 0xDA6B3FE5FF29425B ),
|
---|
4135 | f128Const( 0x43FFFF8000000000, 0x0000000000400000 ),
|
---|
4136 | f128Const( 0x401E000000000100, 0x0000000000002000 ),
|
---|
4137 | f128Const( 0x3FFED71DACDA8E47, 0x4860E3C75D224F28 ),
|
---|
4138 | f128Const( 0x3F7ECFC1E90647D1, 0x7A124FE55623EE44 ),
|
---|
4139 | f128Const( 0x0DF7007FFFFFFFFF, 0xFFFFFFFFEFFFFFFF ),
|
---|
4140 | f128Const( 0x3FE5FFEFFFFFFFFF, 0xFFFFFFFFFFFFEFFF ),
|
---|
4141 | f128Const( 0x403FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFBFE ),
|
---|
4142 | f128Const( 0x3FFB2FBF7399AFEB, 0xA459EE6A5C16CA55 ),
|
---|
4143 | f128Const( 0x3DB8FFFFFFFFFFFC, 0x0000000000000400 ),
|
---|
4144 | f128Const( 0x3FC8FFDFFFFFFFFF, 0xFFFFFFFFF0000000 ),
|
---|
4145 | f128Const( 0x3FFBFFFFFFDFFFFF, 0xFFF8000000000000 ),
|
---|
4146 | f128Const( 0x407043C11737BE84, 0xDDD58212ADC937F4 ),
|
---|
4147 | f128Const( 0x0001000000000000, 0x0000001000000001 ),
|
---|
4148 | f128Const( 0x4036FFFFFFFFFFFF, 0xFE40000000000000 ),
|
---|
4149 | f128Const( 0x4002FFFFFE000002, 0x0000000000000000 ),
|
---|
4150 | f128Const( 0x4000C3FEDE897773, 0x326AC4FD8EFBE6DC ),
|
---|
4151 | f128Const( 0x3FFF0000000FFFFF, 0xFFFFFE0000000000 ),
|
---|
4152 | f128Const( 0x62C3E502146E426D, 0x43F3CAA0DC7DF1A0 ),
|
---|
4153 | f128Const( 0x35CBD32E52BB570E, 0xBCC477CB11C6236C ),
|
---|
4154 | f128Const( 0x6228FFFFFFC00000, 0x0000000000000000 ),
|
---|
4155 | f128Const( 0x3F80000000000000, 0x0000000080000008 ),
|
---|
4156 | f128Const( 0x41AFFFDFFFFFFFFF, 0xFFFC000000000000 ),
|
---|
4157 | f128Const( 0x496F000000000000, 0x00000001FFFBFFFF ),
|
---|
4158 | f128Const( 0x3DE09BFE7923A338, 0xBCC8FBBD7CEC1F4F ),
|
---|
4159 | f128Const( 0x401CFFFFFFFFFFFF, 0xFFFFFFFEFFFFFF80 )
|
---|
4160 | };
|
---|
4161 |
|
---|
4162 | static
|
---|
4163 | void time_az_f128_pos( void function( const float128_t *, float128_t * ) )
|
---|
4164 | {
|
---|
4165 | int_fast64_t count;
|
---|
4166 | int inputNum;
|
---|
4167 | clock_t startClock;
|
---|
4168 | int_fast64_t i;
|
---|
4169 | float128_t z;
|
---|
4170 | clock_t endClock;
|
---|
4171 |
|
---|
4172 | count = 0;
|
---|
4173 | inputNum = 0;
|
---|
4174 | startClock = clock();
|
---|
4175 | do {
|
---|
4176 | for ( i = minIterations; i; --i ) {
|
---|
4177 | function( &inputs_f128[inputNum].f, &z );
|
---|
4178 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
4179 | }
|
---|
4180 | count += minIterations;
|
---|
4181 | } while ( clock() - startClock < CLOCKS_PER_SEC );
|
---|
4182 | inputNum = 0;
|
---|
4183 | startClock = clock();
|
---|
4184 | for ( i = count; i; --i ) {
|
---|
4185 | function( &inputs_f128[inputNum].f, &z );
|
---|
4186 | inputNum = (inputNum + 1) & (numInputs_f128 - 1);
|
---|
4187 | }
|
---|
4188 | endClock = clock();
|
---|
4189 | reportTime( count, endClock - startClock );
|
---|
4190 |
|
---|
4191 | }
|
---|
4192 |
|
---|
4193 | #endif
|
---|
4194 |
|
---|
4195 | /*----------------------------------------------------------------------------
|
---|
4196 | *----------------------------------------------------------------------------*/
|
---|
4197 |
|
---|
4198 | static
|
---|
4199 | void
|
---|
4200 | timeFunctionInstance(
|
---|
4201 | int functionCode, uint_fast8_t roundingMode, bool exact )
|
---|
4202 | {
|
---|
4203 | #ifdef FLOAT16
|
---|
4204 | float16_t (*function_abz_f16)( float16_t, float16_t );
|
---|
4205 | bool (*function_ab_f16_z_bool)( float16_t, float16_t );
|
---|
4206 | #endif
|
---|
4207 | float32_t (*function_abz_f32)( float32_t, float32_t );
|
---|
4208 | bool (*function_ab_f32_z_bool)( float32_t, float32_t );
|
---|
4209 | #ifdef FLOAT64
|
---|
4210 | float64_t (*function_abz_f64)( float64_t, float64_t );
|
---|
4211 | bool (*function_ab_f64_z_bool)( float64_t, float64_t );
|
---|
4212 | #endif
|
---|
4213 | #ifdef EXTFLOAT80
|
---|
4214 | void
|
---|
4215 | (*function_abz_extF80)(
|
---|
4216 | const extFloat80_t *, const extFloat80_t *, extFloat80_t * );
|
---|
4217 | bool
|
---|
4218 | (*function_ab_extF80_z_bool)(
|
---|
4219 | const extFloat80_t *, const extFloat80_t * );
|
---|
4220 | #endif
|
---|
4221 | #ifdef FLOAT128
|
---|
4222 | void
|
---|
4223 | (*function_abz_f128)(
|
---|
4224 | const float128_t *, const float128_t *, float128_t * );
|
---|
4225 | bool (*function_ab_f128_z_bool)( const float128_t *, const float128_t * );
|
---|
4226 | #endif
|
---|
4227 |
|
---|
4228 | switch ( functionCode ) {
|
---|
4229 | /*--------------------------------------------------------------------
|
---|
4230 | *--------------------------------------------------------------------*/
|
---|
4231 | #ifdef FLOAT16
|
---|
4232 | case UI32_TO_F16:
|
---|
4233 | time_a_ui32_z_f16( ui32_to_f16 );
|
---|
4234 | break;
|
---|
4235 | #endif
|
---|
4236 | case UI32_TO_F32:
|
---|
4237 | time_a_ui32_z_f32( ui32_to_f32 );
|
---|
4238 | break;
|
---|
4239 | #ifdef FLOAT64
|
---|
4240 | case UI32_TO_F64:
|
---|
4241 | time_a_ui32_z_f64( ui32_to_f64 );
|
---|
4242 | break;
|
---|
4243 | #endif
|
---|
4244 | #ifdef EXTFLOAT80
|
---|
4245 | case UI32_TO_EXTF80:
|
---|
4246 | time_a_ui32_z_extF80( ui32_to_extF80M );
|
---|
4247 | break;
|
---|
4248 | #endif
|
---|
4249 | #ifdef FLOAT128
|
---|
4250 | case UI32_TO_F128:
|
---|
4251 | time_a_ui32_z_f128( ui32_to_f128M );
|
---|
4252 | break;
|
---|
4253 | #endif
|
---|
4254 | #ifdef FLOAT16
|
---|
4255 | case UI64_TO_F16:
|
---|
4256 | time_a_ui64_z_f16( ui64_to_f16 );
|
---|
4257 | break;
|
---|
4258 | #endif
|
---|
4259 | case UI64_TO_F32:
|
---|
4260 | time_a_ui64_z_f32( ui64_to_f32 );
|
---|
4261 | break;
|
---|
4262 | #ifdef FLOAT64
|
---|
4263 | case UI64_TO_F64:
|
---|
4264 | time_a_ui64_z_f64( ui64_to_f64 );
|
---|
4265 | break;
|
---|
4266 | #endif
|
---|
4267 | #ifdef EXTFLOAT80
|
---|
4268 | case UI64_TO_EXTF80:
|
---|
4269 | time_a_ui64_z_extF80( ui64_to_extF80M );
|
---|
4270 | break;
|
---|
4271 | #endif
|
---|
4272 | #ifdef FLOAT128
|
---|
4273 | case UI64_TO_F128:
|
---|
4274 | time_a_ui64_z_f128( ui64_to_f128M );
|
---|
4275 | break;
|
---|
4276 | #endif
|
---|
4277 | #ifdef FLOAT16
|
---|
4278 | case I32_TO_F16:
|
---|
4279 | time_a_i32_z_f16( i32_to_f16 );
|
---|
4280 | break;
|
---|
4281 | #endif
|
---|
4282 | case I32_TO_F32:
|
---|
4283 | time_a_i32_z_f32( i32_to_f32 );
|
---|
4284 | break;
|
---|
4285 | #ifdef FLOAT64
|
---|
4286 | case I32_TO_F64:
|
---|
4287 | time_a_i32_z_f64( i32_to_f64 );
|
---|
4288 | break;
|
---|
4289 | #endif
|
---|
4290 | #ifdef EXTFLOAT80
|
---|
4291 | case I32_TO_EXTF80:
|
---|
4292 | time_a_i32_z_extF80( i32_to_extF80M );
|
---|
4293 | break;
|
---|
4294 | #endif
|
---|
4295 | #ifdef FLOAT128
|
---|
4296 | case I32_TO_F128:
|
---|
4297 | time_a_i32_z_f128( i32_to_f128M );
|
---|
4298 | break;
|
---|
4299 | #endif
|
---|
4300 | #ifdef FLOAT16
|
---|
4301 | case I64_TO_F16:
|
---|
4302 | time_a_i64_z_f16( i64_to_f16 );
|
---|
4303 | break;
|
---|
4304 | #endif
|
---|
4305 | case I64_TO_F32:
|
---|
4306 | time_a_i64_z_f32( i64_to_f32 );
|
---|
4307 | break;
|
---|
4308 | #ifdef FLOAT64
|
---|
4309 | case I64_TO_F64:
|
---|
4310 | time_a_i64_z_f64( i64_to_f64 );
|
---|
4311 | break;
|
---|
4312 | #endif
|
---|
4313 | #ifdef EXTFLOAT80
|
---|
4314 | case I64_TO_EXTF80:
|
---|
4315 | time_a_i64_z_extF80( i64_to_extF80M );
|
---|
4316 | break;
|
---|
4317 | #endif
|
---|
4318 | #ifdef FLOAT128
|
---|
4319 | case I64_TO_F128:
|
---|
4320 | time_a_i64_z_f128( i64_to_f128M );
|
---|
4321 | break;
|
---|
4322 | #endif
|
---|
4323 | /*--------------------------------------------------------------------
|
---|
4324 | *--------------------------------------------------------------------*/
|
---|
4325 | #ifdef FLOAT16
|
---|
4326 | case F16_TO_UI32:
|
---|
4327 | time_a_f16_z_ui32_rx( f16_to_ui32, roundingMode, exact );
|
---|
4328 | break;
|
---|
4329 | case F16_TO_UI64:
|
---|
4330 | time_a_f16_z_ui64_rx( f16_to_ui64, roundingMode, exact );
|
---|
4331 | break;
|
---|
4332 | case F16_TO_I32:
|
---|
4333 | time_a_f16_z_i32_rx( f16_to_i32, roundingMode, exact );
|
---|
4334 | break;
|
---|
4335 | case F16_TO_I64:
|
---|
4336 | time_a_f16_z_i64_rx( f16_to_i64, roundingMode, exact );
|
---|
4337 | break;
|
---|
4338 | case F16_TO_UI32_R_MINMAG:
|
---|
4339 | time_a_f16_z_ui32_x( f16_to_ui32_r_minMag, exact );
|
---|
4340 | break;
|
---|
4341 | case F16_TO_UI64_R_MINMAG:
|
---|
4342 | time_a_f16_z_ui64_x( f16_to_ui64_r_minMag, exact );
|
---|
4343 | break;
|
---|
4344 | case F16_TO_I32_R_MINMAG:
|
---|
4345 | time_a_f16_z_i32_x( f16_to_i32_r_minMag, exact );
|
---|
4346 | break;
|
---|
4347 | case F16_TO_I64_R_MINMAG:
|
---|
4348 | time_a_f16_z_i64_x( f16_to_i64_r_minMag, exact );
|
---|
4349 | break;
|
---|
4350 | case F16_TO_F32:
|
---|
4351 | time_a_f16_z_f32( f16_to_f32 );
|
---|
4352 | break;
|
---|
4353 | #ifdef FLOAT64
|
---|
4354 | case F16_TO_F64:
|
---|
4355 | time_a_f16_z_f64( f16_to_f64 );
|
---|
4356 | break;
|
---|
4357 | #endif
|
---|
4358 | #ifdef EXTFLOAT80
|
---|
4359 | case F16_TO_EXTF80:
|
---|
4360 | time_a_f16_z_extF80( f16_to_extF80M );
|
---|
4361 | break;
|
---|
4362 | #endif
|
---|
4363 | #ifdef FLOAT128
|
---|
4364 | case F16_TO_F128:
|
---|
4365 | time_a_f16_z_f128( f16_to_f128M );
|
---|
4366 | break;
|
---|
4367 | #endif
|
---|
4368 | case F16_ROUNDTOINT:
|
---|
4369 | time_az_f16_rx( f16_roundToInt, roundingMode, exact );
|
---|
4370 | break;
|
---|
4371 | case F16_ADD:
|
---|
4372 | function_abz_f16 = f16_add;
|
---|
4373 | goto time_abz_f16;
|
---|
4374 | case F16_SUB:
|
---|
4375 | function_abz_f16 = f16_sub;
|
---|
4376 | goto time_abz_f16;
|
---|
4377 | case F16_MUL:
|
---|
4378 | function_abz_f16 = f16_mul;
|
---|
4379 | goto time_abz_f16;
|
---|
4380 | case F16_DIV:
|
---|
4381 | function_abz_f16 = f16_div;
|
---|
4382 | goto time_abz_f16;
|
---|
4383 | case F16_REM:
|
---|
4384 | function_abz_f16 = f16_rem;
|
---|
4385 | time_abz_f16:
|
---|
4386 | time_abz_f16( function_abz_f16 );
|
---|
4387 | break;
|
---|
4388 | case F16_MULADD:
|
---|
4389 | time_abcz_f16( f16_mulAdd );
|
---|
4390 | break;
|
---|
4391 | case F16_SQRT:
|
---|
4392 | time_az_f16_pos( f16_sqrt );
|
---|
4393 | break;
|
---|
4394 | case F16_EQ:
|
---|
4395 | function_ab_f16_z_bool = f16_eq;
|
---|
4396 | goto time_ab_f16_z_bool;
|
---|
4397 | case F16_LE:
|
---|
4398 | function_ab_f16_z_bool = f16_le;
|
---|
4399 | goto time_ab_f16_z_bool;
|
---|
4400 | case F16_LT:
|
---|
4401 | function_ab_f16_z_bool = f16_lt;
|
---|
4402 | goto time_ab_f16_z_bool;
|
---|
4403 | case F16_EQ_SIGNALING:
|
---|
4404 | function_ab_f16_z_bool = f16_eq_signaling;
|
---|
4405 | goto time_ab_f16_z_bool;
|
---|
4406 | case F16_LE_QUIET:
|
---|
4407 | function_ab_f16_z_bool = f16_le_quiet;
|
---|
4408 | goto time_ab_f16_z_bool;
|
---|
4409 | case F16_LT_QUIET:
|
---|
4410 | function_ab_f16_z_bool = f16_lt_quiet;
|
---|
4411 | time_ab_f16_z_bool:
|
---|
4412 | time_ab_f16_z_bool( function_ab_f16_z_bool );
|
---|
4413 | break;
|
---|
4414 | #endif
|
---|
4415 | /*--------------------------------------------------------------------
|
---|
4416 | *--------------------------------------------------------------------*/
|
---|
4417 | case F32_TO_UI32:
|
---|
4418 | time_a_f32_z_ui32_rx( f32_to_ui32, roundingMode, exact );
|
---|
4419 | break;
|
---|
4420 | case F32_TO_UI64:
|
---|
4421 | time_a_f32_z_ui64_rx( f32_to_ui64, roundingMode, exact );
|
---|
4422 | break;
|
---|
4423 | case F32_TO_I32:
|
---|
4424 | time_a_f32_z_i32_rx( f32_to_i32, roundingMode, exact );
|
---|
4425 | break;
|
---|
4426 | case F32_TO_I64:
|
---|
4427 | time_a_f32_z_i64_rx( f32_to_i64, roundingMode, exact );
|
---|
4428 | break;
|
---|
4429 | case F32_TO_UI32_R_MINMAG:
|
---|
4430 | time_a_f32_z_ui32_x( f32_to_ui32_r_minMag, exact );
|
---|
4431 | break;
|
---|
4432 | case F32_TO_UI64_R_MINMAG:
|
---|
4433 | time_a_f32_z_ui64_x( f32_to_ui64_r_minMag, exact );
|
---|
4434 | break;
|
---|
4435 | case F32_TO_I32_R_MINMAG:
|
---|
4436 | time_a_f32_z_i32_x( f32_to_i32_r_minMag, exact );
|
---|
4437 | break;
|
---|
4438 | case F32_TO_I64_R_MINMAG:
|
---|
4439 | time_a_f32_z_i64_x( f32_to_i64_r_minMag, exact );
|
---|
4440 | break;
|
---|
4441 | #ifdef FLOAT16
|
---|
4442 | case F32_TO_F16:
|
---|
4443 | time_a_f32_z_f16( f32_to_f16 );
|
---|
4444 | break;
|
---|
4445 | #endif
|
---|
4446 | #ifdef FLOAT64
|
---|
4447 | case F32_TO_F64:
|
---|
4448 | time_a_f32_z_f64( f32_to_f64 );
|
---|
4449 | break;
|
---|
4450 | #endif
|
---|
4451 | #ifdef EXTFLOAT80
|
---|
4452 | case F32_TO_EXTF80:
|
---|
4453 | time_a_f32_z_extF80( f32_to_extF80M );
|
---|
4454 | break;
|
---|
4455 | #endif
|
---|
4456 | #ifdef FLOAT128
|
---|
4457 | case F32_TO_F128:
|
---|
4458 | time_a_f32_z_f128( f32_to_f128M );
|
---|
4459 | break;
|
---|
4460 | #endif
|
---|
4461 | case F32_ROUNDTOINT:
|
---|
4462 | time_az_f32_rx( f32_roundToInt, roundingMode, exact );
|
---|
4463 | break;
|
---|
4464 | case F32_ADD:
|
---|
4465 | function_abz_f32 = f32_add;
|
---|
4466 | goto time_abz_f32;
|
---|
4467 | case F32_SUB:
|
---|
4468 | function_abz_f32 = f32_sub;
|
---|
4469 | goto time_abz_f32;
|
---|
4470 | case F32_MUL:
|
---|
4471 | function_abz_f32 = f32_mul;
|
---|
4472 | goto time_abz_f32;
|
---|
4473 | case F32_DIV:
|
---|
4474 | function_abz_f32 = f32_div;
|
---|
4475 | goto time_abz_f32;
|
---|
4476 | case F32_REM:
|
---|
4477 | function_abz_f32 = f32_rem;
|
---|
4478 | time_abz_f32:
|
---|
4479 | time_abz_f32( function_abz_f32 );
|
---|
4480 | break;
|
---|
4481 | case F32_MULADD:
|
---|
4482 | time_abcz_f32( f32_mulAdd );
|
---|
4483 | break;
|
---|
4484 | case F32_SQRT:
|
---|
4485 | time_az_f32_pos( f32_sqrt );
|
---|
4486 | break;
|
---|
4487 | case F32_EQ:
|
---|
4488 | function_ab_f32_z_bool = f32_eq;
|
---|
4489 | goto time_ab_f32_z_bool;
|
---|
4490 | case F32_LE:
|
---|
4491 | function_ab_f32_z_bool = f32_le;
|
---|
4492 | goto time_ab_f32_z_bool;
|
---|
4493 | case F32_LT:
|
---|
4494 | function_ab_f32_z_bool = f32_lt;
|
---|
4495 | goto time_ab_f32_z_bool;
|
---|
4496 | case F32_EQ_SIGNALING:
|
---|
4497 | function_ab_f32_z_bool = f32_eq_signaling;
|
---|
4498 | goto time_ab_f32_z_bool;
|
---|
4499 | case F32_LE_QUIET:
|
---|
4500 | function_ab_f32_z_bool = f32_le_quiet;
|
---|
4501 | goto time_ab_f32_z_bool;
|
---|
4502 | case F32_LT_QUIET:
|
---|
4503 | function_ab_f32_z_bool = f32_lt_quiet;
|
---|
4504 | time_ab_f32_z_bool:
|
---|
4505 | time_ab_f32_z_bool( function_ab_f32_z_bool );
|
---|
4506 | break;
|
---|
4507 | /*--------------------------------------------------------------------
|
---|
4508 | *--------------------------------------------------------------------*/
|
---|
4509 | #ifdef FLOAT64
|
---|
4510 | case F64_TO_UI32:
|
---|
4511 | time_a_f64_z_ui32_rx( f64_to_ui32, roundingMode, exact );
|
---|
4512 | break;
|
---|
4513 | case F64_TO_UI64:
|
---|
4514 | time_a_f64_z_ui64_rx( f64_to_ui64, roundingMode, exact );
|
---|
4515 | break;
|
---|
4516 | case F64_TO_I32:
|
---|
4517 | time_a_f64_z_i32_rx( f64_to_i32, roundingMode, exact );
|
---|
4518 | break;
|
---|
4519 | case F64_TO_I64:
|
---|
4520 | time_a_f64_z_i64_rx( f64_to_i64, roundingMode, exact );
|
---|
4521 | break;
|
---|
4522 | case F64_TO_UI32_R_MINMAG:
|
---|
4523 | time_a_f64_z_ui32_x( f64_to_ui32_r_minMag, exact );
|
---|
4524 | break;
|
---|
4525 | case F64_TO_UI64_R_MINMAG:
|
---|
4526 | time_a_f64_z_ui64_x( f64_to_ui64_r_minMag, exact );
|
---|
4527 | break;
|
---|
4528 | case F64_TO_I32_R_MINMAG:
|
---|
4529 | time_a_f64_z_i32_x( f64_to_i32_r_minMag, exact );
|
---|
4530 | break;
|
---|
4531 | case F64_TO_I64_R_MINMAG:
|
---|
4532 | time_a_f64_z_i64_x( f64_to_i64_r_minMag, exact );
|
---|
4533 | break;
|
---|
4534 | #ifdef FLOAT16
|
---|
4535 | case F64_TO_F16:
|
---|
4536 | time_a_f64_z_f16( f64_to_f16 );
|
---|
4537 | break;
|
---|
4538 | #endif
|
---|
4539 | case F64_TO_F32:
|
---|
4540 | time_a_f64_z_f32( f64_to_f32 );
|
---|
4541 | break;
|
---|
4542 | #ifdef EXTFLOAT80
|
---|
4543 | case F64_TO_EXTF80:
|
---|
4544 | time_a_f64_z_extF80( f64_to_extF80M );
|
---|
4545 | break;
|
---|
4546 | #endif
|
---|
4547 | #ifdef FLOAT128
|
---|
4548 | case F64_TO_F128:
|
---|
4549 | time_a_f64_z_f128( f64_to_f128M );
|
---|
4550 | break;
|
---|
4551 | #endif
|
---|
4552 | case F64_ROUNDTOINT:
|
---|
4553 | time_az_f64_rx( f64_roundToInt, roundingMode, exact );
|
---|
4554 | break;
|
---|
4555 | case F64_ADD:
|
---|
4556 | function_abz_f64 = f64_add;
|
---|
4557 | goto time_abz_f64;
|
---|
4558 | case F64_SUB:
|
---|
4559 | function_abz_f64 = f64_sub;
|
---|
4560 | goto time_abz_f64;
|
---|
4561 | case F64_MUL:
|
---|
4562 | function_abz_f64 = f64_mul;
|
---|
4563 | goto time_abz_f64;
|
---|
4564 | case F64_DIV:
|
---|
4565 | function_abz_f64 = f64_div;
|
---|
4566 | goto time_abz_f64;
|
---|
4567 | case F64_REM:
|
---|
4568 | function_abz_f64 = f64_rem;
|
---|
4569 | time_abz_f64:
|
---|
4570 | time_abz_f64( function_abz_f64 );
|
---|
4571 | break;
|
---|
4572 | case F64_MULADD:
|
---|
4573 | time_abcz_f64( f64_mulAdd );
|
---|
4574 | break;
|
---|
4575 | case F64_SQRT:
|
---|
4576 | time_az_f64_pos( f64_sqrt );
|
---|
4577 | break;
|
---|
4578 | case F64_EQ:
|
---|
4579 | function_ab_f64_z_bool = f64_eq;
|
---|
4580 | goto time_ab_f64_z_bool;
|
---|
4581 | case F64_LE:
|
---|
4582 | function_ab_f64_z_bool = f64_le;
|
---|
4583 | goto time_ab_f64_z_bool;
|
---|
4584 | case F64_LT:
|
---|
4585 | function_ab_f64_z_bool = f64_lt;
|
---|
4586 | goto time_ab_f64_z_bool;
|
---|
4587 | case F64_EQ_SIGNALING:
|
---|
4588 | function_ab_f64_z_bool = f64_eq_signaling;
|
---|
4589 | goto time_ab_f64_z_bool;
|
---|
4590 | case F64_LE_QUIET:
|
---|
4591 | function_ab_f64_z_bool = f64_le_quiet;
|
---|
4592 | goto time_ab_f64_z_bool;
|
---|
4593 | case F64_LT_QUIET:
|
---|
4594 | function_ab_f64_z_bool = f64_lt_quiet;
|
---|
4595 | time_ab_f64_z_bool:
|
---|
4596 | time_ab_f64_z_bool( function_ab_f64_z_bool );
|
---|
4597 | break;
|
---|
4598 | #endif
|
---|
4599 | /*--------------------------------------------------------------------
|
---|
4600 | *--------------------------------------------------------------------*/
|
---|
4601 | #ifdef EXTFLOAT80
|
---|
4602 | case EXTF80_TO_UI32:
|
---|
4603 | time_a_extF80_z_ui32_rx( extF80M_to_ui32, roundingMode, exact );
|
---|
4604 | break;
|
---|
4605 | case EXTF80_TO_UI64:
|
---|
4606 | time_a_extF80_z_ui64_rx( extF80M_to_ui64, roundingMode, exact );
|
---|
4607 | break;
|
---|
4608 | case EXTF80_TO_I32:
|
---|
4609 | time_a_extF80_z_i32_rx( extF80M_to_i32, roundingMode, exact );
|
---|
4610 | break;
|
---|
4611 | case EXTF80_TO_I64:
|
---|
4612 | time_a_extF80_z_i64_rx( extF80M_to_i64, roundingMode, exact );
|
---|
4613 | break;
|
---|
4614 | case EXTF80_TO_UI32_R_MINMAG:
|
---|
4615 | time_a_extF80_z_ui32_x( extF80M_to_ui32_r_minMag, exact );
|
---|
4616 | break;
|
---|
4617 | case EXTF80_TO_UI64_R_MINMAG:
|
---|
4618 | time_a_extF80_z_ui64_x( extF80M_to_ui64_r_minMag, exact );
|
---|
4619 | break;
|
---|
4620 | case EXTF80_TO_I32_R_MINMAG:
|
---|
4621 | time_a_extF80_z_i32_x( extF80M_to_i32_r_minMag, exact );
|
---|
4622 | break;
|
---|
4623 | case EXTF80_TO_I64_R_MINMAG:
|
---|
4624 | time_a_extF80_z_i64_x( extF80M_to_i64_r_minMag, exact );
|
---|
4625 | break;
|
---|
4626 | #ifdef FLOAT16
|
---|
4627 | case EXTF80_TO_F16:
|
---|
4628 | time_a_extF80_z_f16( extF80M_to_f16 );
|
---|
4629 | break;
|
---|
4630 | #endif
|
---|
4631 | case EXTF80_TO_F32:
|
---|
4632 | time_a_extF80_z_f32( extF80M_to_f32 );
|
---|
4633 | break;
|
---|
4634 | #ifdef FLOAT64
|
---|
4635 | case EXTF80_TO_F64:
|
---|
4636 | time_a_extF80_z_f64( extF80M_to_f64 );
|
---|
4637 | break;
|
---|
4638 | #endif
|
---|
4639 | #ifdef FLOAT128
|
---|
4640 | case EXTF80_TO_F128:
|
---|
4641 | time_a_extF80_z_f128( extF80M_to_f128M );
|
---|
4642 | break;
|
---|
4643 | #endif
|
---|
4644 | case EXTF80_ROUNDTOINT:
|
---|
4645 | time_az_extF80_rx( extF80M_roundToInt, roundingMode, exact );
|
---|
4646 | break;
|
---|
4647 | case EXTF80_ADD:
|
---|
4648 | function_abz_extF80 = extF80M_add;
|
---|
4649 | goto time_abz_extF80;
|
---|
4650 | case EXTF80_SUB:
|
---|
4651 | function_abz_extF80 = extF80M_sub;
|
---|
4652 | goto time_abz_extF80;
|
---|
4653 | case EXTF80_MUL:
|
---|
4654 | function_abz_extF80 = extF80M_mul;
|
---|
4655 | goto time_abz_extF80;
|
---|
4656 | case EXTF80_DIV:
|
---|
4657 | function_abz_extF80 = extF80M_div;
|
---|
4658 | goto time_abz_extF80;
|
---|
4659 | case EXTF80_REM:
|
---|
4660 | function_abz_extF80 = extF80M_rem;
|
---|
4661 | time_abz_extF80:
|
---|
4662 | time_abz_extF80( function_abz_extF80 );
|
---|
4663 | break;
|
---|
4664 | case EXTF80_SQRT:
|
---|
4665 | time_az_extF80_pos( extF80M_sqrt );
|
---|
4666 | break;
|
---|
4667 | case EXTF80_EQ:
|
---|
4668 | function_ab_extF80_z_bool = extF80M_eq;
|
---|
4669 | goto time_ab_extF80_z_bool;
|
---|
4670 | case EXTF80_LE:
|
---|
4671 | function_ab_extF80_z_bool = extF80M_le;
|
---|
4672 | goto time_ab_extF80_z_bool;
|
---|
4673 | case EXTF80_LT:
|
---|
4674 | function_ab_extF80_z_bool = extF80M_lt;
|
---|
4675 | goto time_ab_extF80_z_bool;
|
---|
4676 | case EXTF80_EQ_SIGNALING:
|
---|
4677 | function_ab_extF80_z_bool = extF80M_eq_signaling;
|
---|
4678 | goto time_ab_extF80_z_bool;
|
---|
4679 | case EXTF80_LE_QUIET:
|
---|
4680 | function_ab_extF80_z_bool = extF80M_le_quiet;
|
---|
4681 | goto time_ab_extF80_z_bool;
|
---|
4682 | case EXTF80_LT_QUIET:
|
---|
4683 | function_ab_extF80_z_bool = extF80M_lt_quiet;
|
---|
4684 | time_ab_extF80_z_bool:
|
---|
4685 | time_ab_extF80_z_bool( function_ab_extF80_z_bool );
|
---|
4686 | break;
|
---|
4687 | #endif
|
---|
4688 | /*--------------------------------------------------------------------
|
---|
4689 | *--------------------------------------------------------------------*/
|
---|
4690 | #ifdef FLOAT128
|
---|
4691 | case F128_TO_UI32:
|
---|
4692 | time_a_f128_z_ui32_rx( f128M_to_ui32, roundingMode, exact );
|
---|
4693 | break;
|
---|
4694 | case F128_TO_UI64:
|
---|
4695 | time_a_f128_z_ui64_rx( f128M_to_ui64, roundingMode, exact );
|
---|
4696 | break;
|
---|
4697 | case F128_TO_I32:
|
---|
4698 | time_a_f128_z_i32_rx( f128M_to_i32, roundingMode, exact );
|
---|
4699 | break;
|
---|
4700 | case F128_TO_I64:
|
---|
4701 | time_a_f128_z_i64_rx( f128M_to_i64, roundingMode, exact );
|
---|
4702 | break;
|
---|
4703 | case F128_TO_UI32_R_MINMAG:
|
---|
4704 | time_a_f128_z_ui32_x( f128M_to_ui32_r_minMag, exact );
|
---|
4705 | break;
|
---|
4706 | case F128_TO_UI64_R_MINMAG:
|
---|
4707 | time_a_f128_z_ui64_x( f128M_to_ui64_r_minMag, exact );
|
---|
4708 | break;
|
---|
4709 | case F128_TO_I32_R_MINMAG:
|
---|
4710 | time_a_f128_z_i32_x( f128M_to_i32_r_minMag, exact );
|
---|
4711 | break;
|
---|
4712 | case F128_TO_I64_R_MINMAG:
|
---|
4713 | time_a_f128_z_i64_x( f128M_to_i64_r_minMag, exact );
|
---|
4714 | break;
|
---|
4715 | #ifdef FLOAT16
|
---|
4716 | case F128_TO_F16:
|
---|
4717 | time_a_f128_z_f16( f128M_to_f16 );
|
---|
4718 | break;
|
---|
4719 | #endif
|
---|
4720 | case F128_TO_F32:
|
---|
4721 | time_a_f128_z_f32( f128M_to_f32 );
|
---|
4722 | break;
|
---|
4723 | #ifdef FLOAT64
|
---|
4724 | case F128_TO_F64:
|
---|
4725 | time_a_f128_z_f64( f128M_to_f64 );
|
---|
4726 | break;
|
---|
4727 | #endif
|
---|
4728 | #ifdef EXTFLOAT80
|
---|
4729 | case F128_TO_EXTF80:
|
---|
4730 | time_a_f128_z_extF80( f128M_to_extF80M );
|
---|
4731 | break;
|
---|
4732 | #endif
|
---|
4733 | case F128_ROUNDTOINT:
|
---|
4734 | time_az_f128_rx( f128M_roundToInt, roundingMode, exact );
|
---|
4735 | break;
|
---|
4736 | case F128_ADD:
|
---|
4737 | function_abz_f128 = f128M_add;
|
---|
4738 | goto time_abz_f128;
|
---|
4739 | case F128_SUB:
|
---|
4740 | function_abz_f128 = f128M_sub;
|
---|
4741 | goto time_abz_f128;
|
---|
4742 | case F128_MUL:
|
---|
4743 | function_abz_f128 = f128M_mul;
|
---|
4744 | goto time_abz_f128;
|
---|
4745 | case F128_DIV:
|
---|
4746 | function_abz_f128 = f128M_div;
|
---|
4747 | goto time_abz_f128;
|
---|
4748 | case F128_REM:
|
---|
4749 | function_abz_f128 = f128M_rem;
|
---|
4750 | time_abz_f128:
|
---|
4751 | time_abz_f128( function_abz_f128 );
|
---|
4752 | break;
|
---|
4753 | case F128_MULADD:
|
---|
4754 | time_abcz_f128( f128M_mulAdd );
|
---|
4755 | break;
|
---|
4756 | case F128_SQRT:
|
---|
4757 | time_az_f128_pos( f128M_sqrt );
|
---|
4758 | break;
|
---|
4759 | case F128_EQ:
|
---|
4760 | function_ab_f128_z_bool = f128M_eq;
|
---|
4761 | goto time_ab_f128_z_bool;
|
---|
4762 | case F128_LE:
|
---|
4763 | function_ab_f128_z_bool = f128M_le;
|
---|
4764 | goto time_ab_f128_z_bool;
|
---|
4765 | case F128_LT:
|
---|
4766 | function_ab_f128_z_bool = f128M_lt;
|
---|
4767 | goto time_ab_f128_z_bool;
|
---|
4768 | case F128_EQ_SIGNALING:
|
---|
4769 | function_ab_f128_z_bool = f128M_eq_signaling;
|
---|
4770 | goto time_ab_f128_z_bool;
|
---|
4771 | case F128_LE_QUIET:
|
---|
4772 | function_ab_f128_z_bool = f128M_le_quiet;
|
---|
4773 | goto time_ab_f128_z_bool;
|
---|
4774 | case F128_LT_QUIET:
|
---|
4775 | function_ab_f128_z_bool = f128M_lt_quiet;
|
---|
4776 | time_ab_f128_z_bool:
|
---|
4777 | time_ab_f128_z_bool( function_ab_f128_z_bool );
|
---|
4778 | break;
|
---|
4779 | #endif
|
---|
4780 | }
|
---|
4781 |
|
---|
4782 | }
|
---|
4783 |
|
---|
4784 | enum { EXACT_FALSE = 1, EXACT_TRUE };
|
---|
4785 |
|
---|
4786 | static
|
---|
4787 | void
|
---|
4788 | timeFunction(
|
---|
4789 | int functionCode,
|
---|
4790 | uint_fast8_t roundingPrecisionIn,
|
---|
4791 | int roundingCodeIn,
|
---|
4792 | int tininessCodeIn,
|
---|
4793 | int exactCodeIn
|
---|
4794 | )
|
---|
4795 | {
|
---|
4796 | int functionAttribs, exactCode;
|
---|
4797 | uint_fast8_t roundingMode = softfloat_round_near_even, tininessMode;
|
---|
4798 |
|
---|
4799 | functionNamePtr = functionInfos[functionCode].namePtr;
|
---|
4800 | functionAttribs = functionInfos[functionCode].attribs;
|
---|
4801 | roundingPrecision = 32;
|
---|
4802 | for (;;) {
|
---|
4803 | if ( functionAttribs & FUNC_EFF_ROUNDINGPRECISION ) {
|
---|
4804 | if ( roundingPrecisionIn ) roundingPrecision = roundingPrecisionIn;
|
---|
4805 | } else {
|
---|
4806 | roundingPrecision = 0;
|
---|
4807 | }
|
---|
4808 | #ifdef EXTFLOAT80
|
---|
4809 | if ( roundingPrecision ) extF80_roundingPrecision = roundingPrecision;
|
---|
4810 | #endif
|
---|
4811 | for (
|
---|
4812 | roundingCode = 1; roundingCode < NUM_ROUNDINGMODES; ++roundingCode
|
---|
4813 | ) {
|
---|
4814 | if (
|
---|
4815 | functionAttribs
|
---|
4816 | & (FUNC_ARG_ROUNDINGMODE | FUNC_EFF_ROUNDINGMODE)
|
---|
4817 | ) {
|
---|
4818 | if ( roundingCodeIn ) roundingCode = roundingCodeIn;
|
---|
4819 | } else {
|
---|
4820 | roundingCode = 0;
|
---|
4821 | }
|
---|
4822 | if ( roundingCode ) {
|
---|
4823 | roundingMode = roundingModes[roundingCode];
|
---|
4824 | if ( functionAttribs & FUNC_EFF_ROUNDINGMODE ) {
|
---|
4825 | softfloat_roundingMode = roundingMode;
|
---|
4826 | }
|
---|
4827 | }
|
---|
4828 | for (
|
---|
4829 | exactCode = EXACT_FALSE; exactCode <= EXACT_TRUE; ++exactCode
|
---|
4830 | ) {
|
---|
4831 | if ( functionAttribs & FUNC_ARG_EXACT ) {
|
---|
4832 | if ( exactCodeIn ) exactCode = exactCodeIn;
|
---|
4833 | } else {
|
---|
4834 | exactCode = 0;
|
---|
4835 | }
|
---|
4836 | exact = (exactCode == EXACT_TRUE );
|
---|
4837 | usesExact = (exactCode != 0 );
|
---|
4838 | for (
|
---|
4839 | tininessCode = 1;
|
---|
4840 | tininessCode < NUM_TININESSMODES;
|
---|
4841 | ++tininessCode
|
---|
4842 | ) {
|
---|
4843 | if (
|
---|
4844 | (functionAttribs & FUNC_EFF_TININESSMODE)
|
---|
4845 | || ((functionAttribs
|
---|
4846 | & FUNC_EFF_TININESSMODE_REDUCEDPREC)
|
---|
4847 | && roundingPrecision
|
---|
4848 | && (roundingPrecision < 80))
|
---|
4849 | ) {
|
---|
4850 | if ( tininessCodeIn ) tininessCode = tininessCodeIn;
|
---|
4851 | } else {
|
---|
4852 | tininessCode = 0;
|
---|
4853 | }
|
---|
4854 | if ( tininessCode ) {
|
---|
4855 | tininessMode = tininessModes[tininessCode];
|
---|
4856 | softfloat_detectTininess = tininessMode;
|
---|
4857 | }
|
---|
4858 | timeFunctionInstance( functionCode, roundingMode, exact );
|
---|
4859 | if ( tininessCodeIn || ! tininessCode ) break;
|
---|
4860 | }
|
---|
4861 | if ( exactCodeIn || ! exactCode ) break;
|
---|
4862 | }
|
---|
4863 | if ( roundingCodeIn || ! roundingCode ) break;
|
---|
4864 | }
|
---|
4865 | if ( roundingPrecisionIn || ! roundingPrecision ) break;
|
---|
4866 | if ( roundingPrecision == 80 ) {
|
---|
4867 | break;
|
---|
4868 | } else if ( roundingPrecision == 64 ) {
|
---|
4869 | roundingPrecision = 80;
|
---|
4870 | } else if ( roundingPrecision == 32 ) {
|
---|
4871 | roundingPrecision = 64;
|
---|
4872 | }
|
---|
4873 | }
|
---|
4874 |
|
---|
4875 | }
|
---|
4876 |
|
---|
4877 | int main( int argc, char *argv[] )
|
---|
4878 | {
|
---|
4879 | bool haveFunctionArg;
|
---|
4880 | int functionCode, numOperands;
|
---|
4881 | uint_fast8_t roundingPrecision;
|
---|
4882 | int roundingCode, tininessCode, exactCode;
|
---|
4883 | const char *argPtr;
|
---|
4884 |
|
---|
4885 | fail_programName = "timesoftfloat";
|
---|
4886 | if ( argc <= 1 ) goto writeHelpMessage;
|
---|
4887 | haveFunctionArg = false;
|
---|
4888 | functionCode = 0;
|
---|
4889 | numOperands = 0;
|
---|
4890 | roundingPrecision = 0;
|
---|
4891 | roundingCode = 0;
|
---|
4892 | tininessCode = 0;
|
---|
4893 | exactCode = 0;
|
---|
4894 | for (;;) {
|
---|
4895 | --argc;
|
---|
4896 | if ( ! argc ) break;
|
---|
4897 | argPtr = *++argv;
|
---|
4898 | if ( ! argPtr ) break;
|
---|
4899 | if ( argPtr[0] == '-' ) ++argPtr;
|
---|
4900 | if (
|
---|
4901 | ! strcmp( argPtr, "help" ) || ! strcmp( argPtr, "-help" )
|
---|
4902 | || ! strcmp( argPtr, "h" )
|
---|
4903 | ) {
|
---|
4904 | writeHelpMessage:
|
---|
4905 | fputs(
|
---|
4906 | "timesoftfloat [<option>...] <function>\n"
|
---|
4907 | " <option>: (* is default)\n"
|
---|
4908 | " -help --Write this message and exit.\n"
|
---|
4909 | #ifdef EXTFLOAT80
|
---|
4910 | " -precision32 --For extF80, time only 32-bit rounding precision.\n"
|
---|
4911 | " -precision64 --For extF80, time only 64-bit rounding precision.\n"
|
---|
4912 | " -precision80 --For extF80, time only 80-bit rounding precision.\n"
|
---|
4913 | #endif
|
---|
4914 | " -rnear_even --Time only rounding to nearest/even.\n"
|
---|
4915 | " -rminMag --Time only rounding to minimum magnitude (toward zero).\n"
|
---|
4916 | " -rmin --Time only rounding to minimum (down).\n"
|
---|
4917 | " -rmax --Time only rounding to maximum (up).\n"
|
---|
4918 | " -rnear_maxMag --Time only rounding to nearest/maximum magnitude\n"
|
---|
4919 | " (nearest/away).\n"
|
---|
4920 | #ifdef FLOAT_ROUND_ODD
|
---|
4921 | " -rodd --Time only rounding to odd (jamming).\n"
|
---|
4922 | #endif
|
---|
4923 | " -tininessbefore --Time only underflow tininess detected before rounding.\n"
|
---|
4924 | " -tininessafter --Time only underflow tininess detected after rounding.\n"
|
---|
4925 | " -notexact --Time only non-exact rounding to integer (no inexact\n"
|
---|
4926 | " exception).\n"
|
---|
4927 | " -exact --Time only exact rounding to integer (allow inexact\n"
|
---|
4928 | " exception).\n"
|
---|
4929 | " <function>:\n"
|
---|
4930 | " <int>_to_<float> <float>_add <float>_eq\n"
|
---|
4931 | " <float>_to_<int> <float>_sub <float>_le\n"
|
---|
4932 | " <float>_to_<int>_r_minMag <float>_mul <float>_lt\n"
|
---|
4933 | " <float>_to_<float> <float>_mulAdd <float>_eq_signaling\n"
|
---|
4934 | " <float>_roundToInt <float>_div <float>_le_quiet\n"
|
---|
4935 | " <float>_rem <float>_lt_quiet\n"
|
---|
4936 | " <float>_sqrt\n"
|
---|
4937 | " -all1 --All unary functions.\n"
|
---|
4938 | " -all2 --All binary functions.\n"
|
---|
4939 | " -all --All functions.\n"
|
---|
4940 | " <int>:\n"
|
---|
4941 | " ui32 --Unsigned 32-bit integer.\n"
|
---|
4942 | " ui64 --Unsigned 64-bit integer.\n"
|
---|
4943 | " i32 --Signed 32-bit integer.\n"
|
---|
4944 | " i64 --Signed 64-bit integer.\n"
|
---|
4945 | " <float>:\n"
|
---|
4946 | #ifdef FLOAT16
|
---|
4947 | " f16 --Binary 16-bit floating-point (half-precision).\n"
|
---|
4948 | #endif
|
---|
4949 | " f32 --Binary 32-bit floating-point (single-precision).\n"
|
---|
4950 | #ifdef FLOAT64
|
---|
4951 | " f64 --Binary 64-bit floating-point (double-precision).\n"
|
---|
4952 | #endif
|
---|
4953 | #ifdef EXTFLOAT80
|
---|
4954 | " extF80 --Binary 80-bit extended floating-point.\n"
|
---|
4955 | #endif
|
---|
4956 | #ifdef FLOAT128
|
---|
4957 | " f128 --Binary 128-bit floating-point (quadruple-precision).\n"
|
---|
4958 | #endif
|
---|
4959 | ,
|
---|
4960 | stdout
|
---|
4961 | );
|
---|
4962 | return EXIT_SUCCESS;
|
---|
4963 | #ifdef EXTFLOAT80
|
---|
4964 | } else if ( ! strcmp( argPtr, "precision32" ) ) {
|
---|
4965 | roundingPrecision = 32;
|
---|
4966 | } else if ( ! strcmp( argPtr, "precision64" ) ) {
|
---|
4967 | roundingPrecision = 64;
|
---|
4968 | } else if ( ! strcmp( argPtr, "precision80" ) ) {
|
---|
4969 | roundingPrecision = 80;
|
---|
4970 | #endif
|
---|
4971 | } else if (
|
---|
4972 | ! strcmp( argPtr, "rnear_even" )
|
---|
4973 | || ! strcmp( argPtr, "rneareven" )
|
---|
4974 | || ! strcmp( argPtr, "rnearest_even" )
|
---|
4975 | ) {
|
---|
4976 | roundingCode = ROUND_NEAR_EVEN;
|
---|
4977 | } else if (
|
---|
4978 | ! strcmp( argPtr, "rminmag" ) || ! strcmp( argPtr, "rminMag" )
|
---|
4979 | ) {
|
---|
4980 | roundingCode = ROUND_MINMAG;
|
---|
4981 | } else if ( ! strcmp( argPtr, "rmin" ) ) {
|
---|
4982 | roundingCode = ROUND_MIN;
|
---|
4983 | } else if ( ! strcmp( argPtr, "rmax" ) ) {
|
---|
4984 | roundingCode = ROUND_MAX;
|
---|
4985 | } else if (
|
---|
4986 | ! strcmp( argPtr, "rnear_maxmag" )
|
---|
4987 | || ! strcmp( argPtr, "rnear_maxMag" )
|
---|
4988 | || ! strcmp( argPtr, "rnearmaxmag" )
|
---|
4989 | || ! strcmp( argPtr, "rnearest_maxmag" )
|
---|
4990 | || ! strcmp( argPtr, "rnearest_maxMag" )
|
---|
4991 | ) {
|
---|
4992 | roundingCode = ROUND_NEAR_MAXMAG;
|
---|
4993 | #ifdef FLOAT_ROUND_ODD
|
---|
4994 | } else if ( ! strcmp( argPtr, "rodd" ) ) {
|
---|
4995 | roundingCode = ROUND_ODD;
|
---|
4996 | #endif
|
---|
4997 | } else if ( ! strcmp( argPtr, "tininessbefore" ) ) {
|
---|
4998 | tininessCode = TININESS_BEFORE_ROUNDING;
|
---|
4999 | } else if ( ! strcmp( argPtr, "tininessafter" ) ) {
|
---|
5000 | tininessCode = TININESS_AFTER_ROUNDING;
|
---|
5001 | } else if ( ! strcmp( argPtr, "notexact" ) ) {
|
---|
5002 | exactCode = EXACT_FALSE;
|
---|
5003 | } else if ( ! strcmp( argPtr, "exact" ) ) {
|
---|
5004 | exactCode = EXACT_TRUE;
|
---|
5005 | } else if ( ! strcmp( argPtr, "all1" ) ) {
|
---|
5006 | haveFunctionArg = true;
|
---|
5007 | functionCode = 0;
|
---|
5008 | numOperands = 1;
|
---|
5009 | } else if ( ! strcmp( argPtr, "all2" ) ) {
|
---|
5010 | haveFunctionArg = true;
|
---|
5011 | functionCode = 0;
|
---|
5012 | numOperands = 2;
|
---|
5013 | } else if ( ! strcmp( argPtr, "all" ) ) {
|
---|
5014 | haveFunctionArg = true;
|
---|
5015 | functionCode = 0;
|
---|
5016 | numOperands = 0;
|
---|
5017 | } else {
|
---|
5018 | functionCode = 1;
|
---|
5019 | while ( strcmp( argPtr, functionInfos[functionCode].namePtr ) ) {
|
---|
5020 | ++functionCode;
|
---|
5021 | if ( functionCode == NUM_FUNCTIONS ) {
|
---|
5022 | fail( "Invalid argument '%s'", *argv );
|
---|
5023 | }
|
---|
5024 | }
|
---|
5025 | haveFunctionArg = true;
|
---|
5026 | }
|
---|
5027 | }
|
---|
5028 | if ( ! haveFunctionArg ) fail( "Function argument required" );
|
---|
5029 | if ( functionCode ) {
|
---|
5030 | timeFunction(
|
---|
5031 | functionCode,
|
---|
5032 | roundingPrecision,
|
---|
5033 | roundingCode,
|
---|
5034 | tininessCode,
|
---|
5035 | exactCode
|
---|
5036 | );
|
---|
5037 | } else {
|
---|
5038 | for (
|
---|
5039 | functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode
|
---|
5040 | ) {
|
---|
5041 | if (
|
---|
5042 | ! numOperands
|
---|
5043 | || (functionInfos[functionCode].attribs
|
---|
5044 | & ((numOperands == 1) ? FUNC_ARG_UNARY
|
---|
5045 | : FUNC_ARG_BINARY))
|
---|
5046 | ) {
|
---|
5047 | timeFunction(
|
---|
5048 | functionCode,
|
---|
5049 | roundingPrecision,
|
---|
5050 | roundingCode,
|
---|
5051 | tininessCode,
|
---|
5052 | exactCode
|
---|
5053 | );
|
---|
5054 | }
|
---|
5055 | }
|
---|
5056 | }
|
---|
5057 | return EXIT_SUCCESS;
|
---|
5058 |
|
---|
5059 | }
|
---|
5060 |
|
---|