VirtualBox

source: vbox/trunk/src/libs/softfloat-3e/testfloat/source/testfloat_gen.c@ 106842

Last change on this file since 106842 was 94551, checked in by vboxsync, 3 years ago

libs/softfloat: Copied TestFloat-3e from vendor branch and to testfloat subdir. bugref:9898

  • Property svn:eol-style set to native
File size: 29.5 KB
Line 
1
2/*============================================================================
3
4This C source file is part of TestFloat, Release 3e, a package of programs for
5testing the correctness of floating-point arithmetic complying with the IEEE
6Standard for Floating-Point, by John R. Hauser.
7
8Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the
9University of California. All rights reserved.
10
11Redistribution and use in source and binary forms, with or without
12modification, 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
25THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
26EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
27WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
28DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
29DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
32ON 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
34SOFTWARE, 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 <signal.h>
44#include "platform.h"
45#include "fail.h"
46#include "softfloat.h"
47#include "functions.h"
48#include "genCases.h"
49#include "genLoops.h"
50
51enum {
52 TYPE_UI32 = NUM_FUNCTIONS,
53 TYPE_UI64,
54 TYPE_I32,
55 TYPE_I64,
56 TYPE_F16,
57 TYPE_F16_2,
58 TYPE_F16_3,
59 TYPE_F32,
60 TYPE_F32_2,
61 TYPE_F32_3,
62 TYPE_F64,
63 TYPE_F64_2,
64 TYPE_F64_3,
65 TYPE_EXTF80,
66 TYPE_EXTF80_2,
67 TYPE_EXTF80_3,
68 TYPE_F128,
69 TYPE_F128_2,
70 TYPE_F128_3
71};
72
73static void catchSIGINT( int signalCode )
74{
75
76 if ( genLoops_stop ) exit( EXIT_FAILURE );
77 genLoops_stop = true;
78
79}
80
81int main( int argc, char *argv[] )
82{
83 const char *prefixTextPtr;
84 uint_fast8_t roundingMode;
85 bool exact;
86 int functionCode;
87 const char *argPtr;
88 unsigned long ui;
89 long i;
90 int functionAttribs;
91#ifdef FLOAT16
92 float16_t (*trueFunction_abz_f16)( float16_t, float16_t );
93 bool (*trueFunction_ab_f16_z_bool)( float16_t, float16_t );
94#endif
95 float32_t (*trueFunction_abz_f32)( float32_t, float32_t );
96 bool (*trueFunction_ab_f32_z_bool)( float32_t, float32_t );
97#ifdef FLOAT64
98 float64_t (*trueFunction_abz_f64)( float64_t, float64_t );
99 bool (*trueFunction_ab_f64_z_bool)( float64_t, float64_t );
100#endif
101#ifdef EXTFLOAT80
102 void
103 (*trueFunction_abz_extF80)(
104 const extFloat80_t *, const extFloat80_t *, extFloat80_t * );
105 bool
106 (*trueFunction_ab_extF80_z_bool)(
107 const extFloat80_t *, const extFloat80_t * );
108#endif
109#ifdef FLOAT128
110 void
111 (*trueFunction_abz_f128)(
112 const float128_t *, const float128_t *, float128_t * );
113 bool
114 (*trueFunction_ab_f128_z_bool)( const float128_t *, const float128_t * );
115#endif
116
117 /*------------------------------------------------------------------------
118 *------------------------------------------------------------------------*/
119 fail_programName = "testfloat_gen";
120 if ( argc <= 1 ) goto writeHelpMessage;
121 prefixTextPtr = 0;
122 softfloat_detectTininess = softfloat_tininess_afterRounding;
123#ifdef EXTFLOAT80
124 extF80_roundingPrecision = 80;
125#endif
126 roundingMode = softfloat_round_near_even;
127 exact = false;
128 genCases_setLevel( 1 );
129 genLoops_trueFlagsPtr = &softfloat_exceptionFlags;
130 genLoops_forever = false;
131 genLoops_givenCount = false;
132 functionCode = 0;
133 for (;;) {
134 --argc;
135 if ( ! argc ) break;
136 argPtr = *++argv;
137 if ( ! argPtr ) break;
138 if ( argPtr[0] == '-' ) ++argPtr;
139 if (
140 ! strcmp( argPtr, "help" ) || ! strcmp( argPtr, "-help" )
141 || ! strcmp( argPtr, "h" )
142 ) {
143 writeHelpMessage:
144 fputs(
145"testfloat_gen [<option>...] <type>|<function>\n"
146" <option>: (* is default)\n"
147" -help --Write this message and exit.\n"
148" -prefix <text> --Write <text> as a line of output before any test cases.\n"
149" -seed <num> --Set pseudo-random number generator seed to <num>.\n"
150" * -seed 1\n"
151" -level <num> --Testing level <num> (1 or 2).\n"
152" * -level 1\n"
153" -n <num> --Generate <num> test cases.\n"
154" -forever --Generate test cases indefinitely (implies '-level 2').\n"
155#ifdef EXTFLOAT80
156" -precision32 --For extF80, rounding precision is 32 bits.\n"
157" -precision64 --For extF80, rounding precision is 64 bits.\n"
158" * -precision80 --For extF80, rounding precision is 80 bits.\n"
159#endif
160" * -rnear_even --Round to nearest/even.\n"
161" -rminMag --Round to minimum magnitude (toward zero).\n"
162" -rmin --Round to minimum (down).\n"
163" -rmax --Round to maximum (up).\n"
164" -rnear_maxMag --Round to nearest/maximum magnitude (nearest/away).\n"
165#ifdef FLOAT_ROUND_ODD
166" -rodd --Round to odd (jamming). (For rounding to an integer\n"
167" value, rounds to minimum magnitude instead.)\n"
168#endif
169" -tininessbefore --Detect underflow tininess before rounding.\n"
170" * -tininessafter --Detect underflow tininess after rounding.\n"
171" * -notexact --Rounding to integer is not exact (no inexact\n"
172" exceptions).\n"
173" -exact --Rounding to integer is exact (raising inexact\n"
174" exceptions).\n"
175" <type>:\n"
176" <int> --Generate test cases with one integer operand.\n"
177" <float> --Generate test cases with one floating-point operand.\n"
178" <float> <num> --Generate test cases with <num> (1, 2, or 3)\n"
179" floating-point operands.\n"
180" <function>:\n"
181" <int>_to_<float> <float>_add <float>_eq\n"
182" <float>_to_<int> <float>_sub <float>_le\n"
183" <float>_to_<float> <float>_mul <float>_lt\n"
184" <float>_roundToInt <float>_mulAdd <float>_eq_signaling\n"
185" <float>_div <float>_le_quiet\n"
186" <float>_rem <float>_lt_quiet\n"
187" <float>_sqrt\n"
188" <int>:\n"
189" ui32 --Unsigned 32-bit integer.\n"
190" ui64 --Unsigned 64-bit integer.\n"
191" i32 --Signed 32-bit integer.\n"
192" i64 --Signed 64-bit integer.\n"
193" <float>:\n"
194#ifdef FLOAT16
195" f16 --Binary 16-bit floating-point (half-precision).\n"
196#endif
197" f32 --Binary 32-bit floating-point (single-precision).\n"
198#ifdef FLOAT64
199" f64 --Binary 64-bit floating-point (double-precision).\n"
200#endif
201#ifdef EXTFLOAT80
202" extF80 --Binary 80-bit extended floating-point.\n"
203#endif
204#ifdef FLOAT128
205" f128 --Binary 128-bit floating-point (quadruple-precision).\n"
206#endif
207 ,
208 stdout
209 );
210 return EXIT_SUCCESS;
211 } else if ( ! strcmp( argPtr, "prefix" ) ) {
212 if ( argc < 2 ) goto optionError;
213 prefixTextPtr = argv[1];
214 --argc;
215 ++argv;
216 } else if ( ! strcmp( argPtr, "seed" ) ) {
217 if ( argc < 2 ) goto optionError;
218 ui = strtoul( argv[1], (char **) &argPtr, 10 );
219 if ( *argPtr ) goto optionError;
220 srand( ui );
221 --argc;
222 ++argv;
223 } else if ( ! strcmp( argPtr, "level" ) ) {
224 if ( argc < 2 ) goto optionError;
225 i = strtol( argv[1], (char **) &argPtr, 10 );
226 if ( *argPtr ) goto optionError;
227 genCases_setLevel( i );
228 --argc;
229 ++argv;
230 } else if ( ! strcmp( argPtr, "level1" ) ) {
231 genCases_setLevel( 1 );
232 } else if ( ! strcmp( argPtr, "level2" ) ) {
233 genCases_setLevel( 2 );
234 } else if ( ! strcmp( argPtr, "n" ) ) {
235 if ( argc < 2 ) goto optionError;
236 genLoops_forever = true;
237 genLoops_givenCount = true;
238 i = strtol( argv[1], (char **) &argPtr, 10 );
239 if ( *argPtr ) goto optionError;
240 genLoops_count = i;
241 --argc;
242 ++argv;
243 } else if ( ! strcmp( argPtr, "forever" ) ) {
244 genCases_setLevel( 2 );
245 genLoops_forever = true;
246 genLoops_givenCount = false;
247#ifdef EXTFLOAT80
248 } else if ( ! strcmp( argPtr, "precision32" ) ) {
249 extF80_roundingPrecision = 32;
250 } else if ( ! strcmp( argPtr, "precision64" ) ) {
251 extF80_roundingPrecision = 64;
252 } else if ( ! strcmp( argPtr, "precision80" ) ) {
253 extF80_roundingPrecision = 80;
254#endif
255 } else if (
256 ! strcmp( argPtr, "rnear_even" )
257 || ! strcmp( argPtr, "rneareven" )
258 || ! strcmp( argPtr, "rnearest_even" )
259 ) {
260 roundingMode = softfloat_round_near_even;
261 } else if (
262 ! strcmp( argPtr, "rminmag" ) || ! strcmp( argPtr, "rminMag" )
263 ) {
264 roundingMode = softfloat_round_minMag;
265 } else if ( ! strcmp( argPtr, "rmin" ) ) {
266 roundingMode = softfloat_round_min;
267 } else if ( ! strcmp( argPtr, "rmax" ) ) {
268 roundingMode = softfloat_round_max;
269 } else if (
270 ! strcmp( argPtr, "rnear_maxmag" )
271 || ! strcmp( argPtr, "rnear_maxMag" )
272 || ! strcmp( argPtr, "rnearmaxmag" )
273 || ! strcmp( argPtr, "rnearest_maxmag" )
274 || ! strcmp( argPtr, "rnearest_maxMag" )
275 ) {
276 roundingMode = softfloat_round_near_maxMag;
277#ifdef FLOAT_ROUND_ODD
278 } else if ( ! strcmp( argPtr, "rodd" ) ) {
279 roundingMode = softfloat_round_odd;
280#endif
281 } else if ( ! strcmp( argPtr, "tininessbefore" ) ) {
282 softfloat_detectTininess = softfloat_tininess_beforeRounding;
283 } else if ( ! strcmp( argPtr, "tininessafter" ) ) {
284 softfloat_detectTininess = softfloat_tininess_afterRounding;
285 } else if ( ! strcmp( argPtr, "notexact" ) ) {
286 exact = false;
287 } else if ( ! strcmp( argPtr, "exact" ) ) {
288 exact = true;
289 } else if (
290 ! strcmp( argPtr, "ui32" ) || ! strcmp( argPtr, "uint32" )
291 ) {
292 functionCode = TYPE_UI32;
293 if ( 2 <= argc ) goto absorbArg1;
294 } else if (
295 ! strcmp( argPtr, "ui64" ) || ! strcmp( argPtr, "uint64" )
296 ) {
297 functionCode = TYPE_UI64;
298 if ( 2 <= argc ) goto absorbArg1;
299 } else if (
300 ! strcmp( argPtr, "i32" ) || ! strcmp( argPtr, "int32" )
301 ) {
302 functionCode = TYPE_I32;
303 if ( 2 <= argc ) goto absorbArg1;
304 } else if (
305 ! strcmp( argPtr, "i64" ) || ! strcmp( argPtr, "int64" )
306 ) {
307 functionCode = TYPE_I64;
308 if ( 2 <= argc ) goto absorbArg1;
309#ifdef FLOAT16
310 } else if (
311 ! strcmp( argPtr, "f16" ) || ! strcmp( argPtr, "float16" )
312 ) {
313 functionCode = TYPE_F16;
314 goto absorbArg;
315#endif
316 } else if (
317 ! strcmp( argPtr, "f32" ) || ! strcmp( argPtr, "float32" )
318 ) {
319 functionCode = TYPE_F32;
320#ifdef FLOAT64
321 goto absorbArg;
322 } else if (
323 ! strcmp( argPtr, "f64" ) || ! strcmp( argPtr, "float64" )
324 ) {
325 functionCode = TYPE_F64;
326#endif
327#ifdef EXTFLOAT80
328 goto absorbArg;
329 } else if (
330 ! strcmp( argPtr, "extF80" ) || ! strcmp( argPtr, "extFloat80" )
331 ) {
332 functionCode = TYPE_EXTF80;
333#endif
334#ifdef FLOAT128
335 goto absorbArg;
336 } else if (
337 ! strcmp( argPtr, "f128" ) || ! strcmp( argPtr, "float128" )
338 ) {
339 functionCode = TYPE_F128;
340#endif
341 absorbArg:
342 if ( 2 <= argc ) {
343 if ( ! strcmp( argv[1], "2" ) ) {
344 --argc;
345 ++argv;
346 ++functionCode;
347 } else if ( ! strcmp( argv[1], "3" ) ) {
348 --argc;
349 ++argv;
350 functionCode += 2;
351 } else {
352 absorbArg1:
353 if ( ! strcmp( argv[1], "1" ) ) {
354 --argc;
355 ++argv;
356 }
357 }
358 }
359 } else {
360 functionCode = 1;
361 while ( strcmp( argPtr, functionInfos[functionCode].namePtr ) ) {
362 ++functionCode;
363 if ( functionCode == NUM_FUNCTIONS ) goto invalidArg;
364 }
365 functionAttribs = functionInfos[functionCode].attribs;
366 if (
367 (functionAttribs & FUNC_ARG_EXACT)
368 && ! (functionAttribs & FUNC_ARG_ROUNDINGMODE)
369 ) {
370 goto invalidArg;
371 }
372 }
373 }
374 if ( ! functionCode ) fail( "Type or function argument required" );
375 /*------------------------------------------------------------------------
376 *------------------------------------------------------------------------*/
377 if ( prefixTextPtr ) {
378 fputs( prefixTextPtr, stdout );
379 fputc( '\n', stdout );
380 }
381 softfloat_roundingMode = roundingMode;
382 signal( SIGINT, catchSIGINT );
383 signal( SIGTERM, catchSIGINT );
384 switch ( functionCode ) {
385 /*--------------------------------------------------------------------
386 *--------------------------------------------------------------------*/
387 case TYPE_UI32:
388 gen_a_ui32();
389 break;
390 case TYPE_UI64:
391 gen_a_ui64();
392 break;
393 case TYPE_I32:
394 gen_a_i32();
395 break;
396 case TYPE_I64:
397 gen_a_i64();
398 break;
399#ifdef FLOAT16
400 case TYPE_F16:
401 gen_a_f16();
402 break;
403 case TYPE_F16_2:
404 gen_ab_f16();
405 break;
406 case TYPE_F16_3:
407 gen_abc_f16();
408 break;
409#endif
410 case TYPE_F32:
411 gen_a_f32();
412 break;
413 case TYPE_F32_2:
414 gen_ab_f32();
415 break;
416 case TYPE_F32_3:
417 gen_abc_f32();
418 break;
419#ifdef FLOAT64
420 case TYPE_F64:
421 gen_a_f64();
422 break;
423 case TYPE_F64_2:
424 gen_ab_f64();
425 break;
426 case TYPE_F64_3:
427 gen_abc_f64();
428 break;
429#endif
430#ifdef EXTFLOAT80
431 case TYPE_EXTF80:
432 gen_a_extF80();
433 break;
434 case TYPE_EXTF80_2:
435 gen_ab_extF80();
436 break;
437 case TYPE_EXTF80_3:
438 gen_abc_extF80();
439 break;
440#endif
441#ifdef FLOAT128
442 case TYPE_F128:
443 gen_a_f128();
444 break;
445 case TYPE_F128_2:
446 gen_ab_f128();
447 break;
448 case TYPE_F128_3:
449 gen_abc_f128();
450 break;
451#endif
452 /*--------------------------------------------------------------------
453 *--------------------------------------------------------------------*/
454#ifdef FLOAT16
455 case UI32_TO_F16:
456 gen_a_ui32_z_f16( ui32_to_f16 );
457 break;
458#endif
459 case UI32_TO_F32:
460 gen_a_ui32_z_f32( ui32_to_f32 );
461 break;
462#ifdef FLOAT64
463 case UI32_TO_F64:
464 gen_a_ui32_z_f64( ui32_to_f64 );
465 break;
466#endif
467#ifdef EXTFLOAT80
468 case UI32_TO_EXTF80:
469 gen_a_ui32_z_extF80( ui32_to_extF80M );
470 break;
471#endif
472#ifdef FLOAT128
473 case UI32_TO_F128:
474 gen_a_ui32_z_f128( ui32_to_f128M );
475 break;
476#endif
477#ifdef FLOAT16
478 case UI64_TO_F16:
479 gen_a_ui64_z_f16( ui64_to_f16 );
480 break;
481#endif
482 case UI64_TO_F32:
483 gen_a_ui64_z_f32( ui64_to_f32 );
484 break;
485#ifdef FLOAT64
486 case UI64_TO_F64:
487 gen_a_ui64_z_f64( ui64_to_f64 );
488 break;
489#endif
490#ifdef EXTFLOAT80
491 case UI64_TO_EXTF80:
492 gen_a_ui64_z_extF80( ui64_to_extF80M );
493 break;
494#endif
495#ifdef FLOAT128
496 case UI64_TO_F128:
497 gen_a_ui64_z_f128( ui64_to_f128M );
498 break;
499#endif
500#ifdef FLOAT16
501 case I32_TO_F16:
502 gen_a_i32_z_f16( i32_to_f16 );
503 break;
504#endif
505 case I32_TO_F32:
506 gen_a_i32_z_f32( i32_to_f32 );
507 break;
508#ifdef FLOAT64
509 case I32_TO_F64:
510 gen_a_i32_z_f64( i32_to_f64 );
511 break;
512#endif
513#ifdef EXTFLOAT80
514 case I32_TO_EXTF80:
515 gen_a_i32_z_extF80( i32_to_extF80M );
516 break;
517#endif
518#ifdef FLOAT128
519 case I32_TO_F128:
520 gen_a_i32_z_f128( i32_to_f128M );
521 break;
522#endif
523#ifdef FLOAT16
524 case I64_TO_F16:
525 gen_a_i64_z_f16( i64_to_f16 );
526 break;
527#endif
528 case I64_TO_F32:
529 gen_a_i64_z_f32( i64_to_f32 );
530 break;
531#ifdef FLOAT64
532 case I64_TO_F64:
533 gen_a_i64_z_f64( i64_to_f64 );
534 break;
535#endif
536#ifdef EXTFLOAT80
537 case I64_TO_EXTF80:
538 gen_a_i64_z_extF80( i64_to_extF80M );
539 break;
540#endif
541#ifdef FLOAT128
542 case I64_TO_F128:
543 gen_a_i64_z_f128( i64_to_f128M );
544 break;
545#endif
546 /*--------------------------------------------------------------------
547 *--------------------------------------------------------------------*/
548#ifdef FLOAT16
549 case F16_TO_UI32:
550 gen_a_f16_z_ui32_rx( f16_to_ui32, roundingMode, exact );
551 break;
552 case F16_TO_UI64:
553 gen_a_f16_z_ui64_rx( f16_to_ui64, roundingMode, exact );
554 break;
555 case F16_TO_I32:
556 gen_a_f16_z_i32_rx( f16_to_i32, roundingMode, exact );
557 break;
558 case F16_TO_I64:
559 gen_a_f16_z_i64_rx( f16_to_i64, roundingMode, exact );
560 break;
561 case F16_TO_F32:
562 gen_a_f16_z_f32( f16_to_f32 );
563 break;
564#ifdef FLOAT64
565 case F16_TO_F64:
566 gen_a_f16_z_f64( f16_to_f64 );
567 break;
568#endif
569#ifdef EXTFLOAT80
570 case F16_TO_EXTF80:
571 gen_a_f16_z_extF80( f16_to_extF80M );
572 break;
573#endif
574#ifdef FLOAT128
575 case F16_TO_F128:
576 gen_a_f16_z_f128( f16_to_f128M );
577 break;
578#endif
579 case F16_ROUNDTOINT:
580 gen_az_f16_rx( f16_roundToInt, roundingMode, exact );
581 break;
582 case F16_ADD:
583 trueFunction_abz_f16 = f16_add;
584 goto gen_abz_f16;
585 case F16_SUB:
586 trueFunction_abz_f16 = f16_sub;
587 goto gen_abz_f16;
588 case F16_MUL:
589 trueFunction_abz_f16 = f16_mul;
590 goto gen_abz_f16;
591 case F16_DIV:
592 trueFunction_abz_f16 = f16_div;
593 goto gen_abz_f16;
594 case F16_REM:
595 trueFunction_abz_f16 = f16_rem;
596 gen_abz_f16:
597 gen_abz_f16( trueFunction_abz_f16 );
598 break;
599 case F16_MULADD:
600 gen_abcz_f16( f16_mulAdd );
601 break;
602 case F16_SQRT:
603 gen_az_f16( f16_sqrt );
604 break;
605 case F16_EQ:
606 trueFunction_ab_f16_z_bool = f16_eq;
607 goto gen_ab_f16_z_bool;
608 case F16_LE:
609 trueFunction_ab_f16_z_bool = f16_le;
610 goto gen_ab_f16_z_bool;
611 case F16_LT:
612 trueFunction_ab_f16_z_bool = f16_lt;
613 goto gen_ab_f16_z_bool;
614 case F16_EQ_SIGNALING:
615 trueFunction_ab_f16_z_bool = f16_eq_signaling;
616 goto gen_ab_f16_z_bool;
617 case F16_LE_QUIET:
618 trueFunction_ab_f16_z_bool = f16_le_quiet;
619 goto gen_ab_f16_z_bool;
620 case F16_LT_QUIET:
621 trueFunction_ab_f16_z_bool = f16_lt_quiet;
622 gen_ab_f16_z_bool:
623 gen_ab_f16_z_bool( trueFunction_ab_f16_z_bool );
624 break;
625#endif
626 /*--------------------------------------------------------------------
627 *--------------------------------------------------------------------*/
628 case F32_TO_UI32:
629 gen_a_f32_z_ui32_rx( f32_to_ui32, roundingMode, exact );
630 break;
631 case F32_TO_UI64:
632 gen_a_f32_z_ui64_rx( f32_to_ui64, roundingMode, exact );
633 break;
634 case F32_TO_I32:
635 gen_a_f32_z_i32_rx( f32_to_i32, roundingMode, exact );
636 break;
637 case F32_TO_I64:
638 gen_a_f32_z_i64_rx( f32_to_i64, roundingMode, exact );
639 break;
640#ifdef FLOAT16
641 case F32_TO_F16:
642 gen_a_f32_z_f16( f32_to_f16 );
643 break;
644#endif
645#ifdef FLOAT64
646 case F32_TO_F64:
647 gen_a_f32_z_f64( f32_to_f64 );
648 break;
649#endif
650#ifdef EXTFLOAT80
651 case F32_TO_EXTF80:
652 gen_a_f32_z_extF80( f32_to_extF80M );
653 break;
654#endif
655#ifdef FLOAT128
656 case F32_TO_F128:
657 gen_a_f32_z_f128( f32_to_f128M );
658 break;
659#endif
660 case F32_ROUNDTOINT:
661 gen_az_f32_rx( f32_roundToInt, roundingMode, exact );
662 break;
663 case F32_ADD:
664 trueFunction_abz_f32 = f32_add;
665 goto gen_abz_f32;
666 case F32_SUB:
667 trueFunction_abz_f32 = f32_sub;
668 goto gen_abz_f32;
669 case F32_MUL:
670 trueFunction_abz_f32 = f32_mul;
671 goto gen_abz_f32;
672 case F32_DIV:
673 trueFunction_abz_f32 = f32_div;
674 goto gen_abz_f32;
675 case F32_REM:
676 trueFunction_abz_f32 = f32_rem;
677 gen_abz_f32:
678 gen_abz_f32( trueFunction_abz_f32 );
679 break;
680 case F32_MULADD:
681 gen_abcz_f32( f32_mulAdd );
682 break;
683 case F32_SQRT:
684 gen_az_f32( f32_sqrt );
685 break;
686 case F32_EQ:
687 trueFunction_ab_f32_z_bool = f32_eq;
688 goto gen_ab_f32_z_bool;
689 case F32_LE:
690 trueFunction_ab_f32_z_bool = f32_le;
691 goto gen_ab_f32_z_bool;
692 case F32_LT:
693 trueFunction_ab_f32_z_bool = f32_lt;
694 goto gen_ab_f32_z_bool;
695 case F32_EQ_SIGNALING:
696 trueFunction_ab_f32_z_bool = f32_eq_signaling;
697 goto gen_ab_f32_z_bool;
698 case F32_LE_QUIET:
699 trueFunction_ab_f32_z_bool = f32_le_quiet;
700 goto gen_ab_f32_z_bool;
701 case F32_LT_QUIET:
702 trueFunction_ab_f32_z_bool = f32_lt_quiet;
703 gen_ab_f32_z_bool:
704 gen_ab_f32_z_bool( trueFunction_ab_f32_z_bool );
705 break;
706 /*--------------------------------------------------------------------
707 *--------------------------------------------------------------------*/
708#ifdef FLOAT64
709 case F64_TO_UI32:
710 gen_a_f64_z_ui32_rx( f64_to_ui32, roundingMode, exact );
711 break;
712 case F64_TO_UI64:
713 gen_a_f64_z_ui64_rx( f64_to_ui64, roundingMode, exact );
714 break;
715 case F64_TO_I32:
716 gen_a_f64_z_i32_rx( f64_to_i32, roundingMode, exact );
717 break;
718 case F64_TO_I64:
719 gen_a_f64_z_i64_rx( f64_to_i64, roundingMode, exact );
720 break;
721#ifdef FLOAT16
722 case F64_TO_F16:
723 gen_a_f64_z_f16( f64_to_f16 );
724 break;
725#endif
726 case F64_TO_F32:
727 gen_a_f64_z_f32( f64_to_f32 );
728 break;
729#ifdef EXTFLOAT80
730 case F64_TO_EXTF80:
731 gen_a_f64_z_extF80( f64_to_extF80M );
732 break;
733#endif
734#ifdef FLOAT128
735 case F64_TO_F128:
736 gen_a_f64_z_f128( f64_to_f128M );
737 break;
738#endif
739 case F64_ROUNDTOINT:
740 gen_az_f64_rx( f64_roundToInt, roundingMode, exact );
741 break;
742 case F64_ADD:
743 trueFunction_abz_f64 = f64_add;
744 goto gen_abz_f64;
745 case F64_SUB:
746 trueFunction_abz_f64 = f64_sub;
747 goto gen_abz_f64;
748 case F64_MUL:
749 trueFunction_abz_f64 = f64_mul;
750 goto gen_abz_f64;
751 case F64_DIV:
752 trueFunction_abz_f64 = f64_div;
753 goto gen_abz_f64;
754 case F64_REM:
755 trueFunction_abz_f64 = f64_rem;
756 gen_abz_f64:
757 gen_abz_f64( trueFunction_abz_f64 );
758 break;
759 case F64_MULADD:
760 gen_abcz_f64( f64_mulAdd );
761 break;
762 case F64_SQRT:
763 gen_az_f64( f64_sqrt );
764 break;
765 case F64_EQ:
766 trueFunction_ab_f64_z_bool = f64_eq;
767 goto gen_ab_f64_z_bool;
768 case F64_LE:
769 trueFunction_ab_f64_z_bool = f64_le;
770 goto gen_ab_f64_z_bool;
771 case F64_LT:
772 trueFunction_ab_f64_z_bool = f64_lt;
773 goto gen_ab_f64_z_bool;
774 case F64_EQ_SIGNALING:
775 trueFunction_ab_f64_z_bool = f64_eq_signaling;
776 goto gen_ab_f64_z_bool;
777 case F64_LE_QUIET:
778 trueFunction_ab_f64_z_bool = f64_le_quiet;
779 goto gen_ab_f64_z_bool;
780 case F64_LT_QUIET:
781 trueFunction_ab_f64_z_bool = f64_lt_quiet;
782 gen_ab_f64_z_bool:
783 gen_ab_f64_z_bool( trueFunction_ab_f64_z_bool );
784 break;
785#endif
786 /*--------------------------------------------------------------------
787 *--------------------------------------------------------------------*/
788#ifdef EXTFLOAT80
789 case EXTF80_TO_UI32:
790 gen_a_extF80_z_ui32_rx( extF80M_to_ui32, roundingMode, exact );
791 break;
792 case EXTF80_TO_UI64:
793 gen_a_extF80_z_ui64_rx( extF80M_to_ui64, roundingMode, exact );
794 break;
795 case EXTF80_TO_I32:
796 gen_a_extF80_z_i32_rx( extF80M_to_i32, roundingMode, exact );
797 break;
798 case EXTF80_TO_I64:
799 gen_a_extF80_z_i64_rx( extF80M_to_i64, roundingMode, exact );
800 break;
801#ifdef FLOAT16
802 case EXTF80_TO_F16:
803 gen_a_extF80_z_f16( extF80M_to_f16 );
804 break;
805#endif
806 case EXTF80_TO_F32:
807 gen_a_extF80_z_f32( extF80M_to_f32 );
808 break;
809#ifdef FLOAT64
810 case EXTF80_TO_F64:
811 gen_a_extF80_z_f64( extF80M_to_f64 );
812 break;
813#endif
814#ifdef FLOAT128
815 case EXTF80_TO_F128:
816 gen_a_extF80_z_f128( extF80M_to_f128M );
817 break;
818#endif
819 case EXTF80_ROUNDTOINT:
820 gen_az_extF80_rx( extF80M_roundToInt, roundingMode, exact );
821 break;
822 case EXTF80_ADD:
823 trueFunction_abz_extF80 = extF80M_add;
824 goto gen_abz_extF80;
825 case EXTF80_SUB:
826 trueFunction_abz_extF80 = extF80M_sub;
827 goto gen_abz_extF80;
828 case EXTF80_MUL:
829 trueFunction_abz_extF80 = extF80M_mul;
830 goto gen_abz_extF80;
831 case EXTF80_DIV:
832 trueFunction_abz_extF80 = extF80M_div;
833 goto gen_abz_extF80;
834 case EXTF80_REM:
835 trueFunction_abz_extF80 = extF80M_rem;
836 gen_abz_extF80:
837 gen_abz_extF80( trueFunction_abz_extF80 );
838 break;
839 case EXTF80_SQRT:
840 gen_az_extF80( extF80M_sqrt );
841 break;
842 case EXTF80_EQ:
843 trueFunction_ab_extF80_z_bool = extF80M_eq;
844 goto gen_ab_extF80_z_bool;
845 case EXTF80_LE:
846 trueFunction_ab_extF80_z_bool = extF80M_le;
847 goto gen_ab_extF80_z_bool;
848 case EXTF80_LT:
849 trueFunction_ab_extF80_z_bool = extF80M_lt;
850 goto gen_ab_extF80_z_bool;
851 case EXTF80_EQ_SIGNALING:
852 trueFunction_ab_extF80_z_bool = extF80M_eq_signaling;
853 goto gen_ab_extF80_z_bool;
854 case EXTF80_LE_QUIET:
855 trueFunction_ab_extF80_z_bool = extF80M_le_quiet;
856 goto gen_ab_extF80_z_bool;
857 case EXTF80_LT_QUIET:
858 trueFunction_ab_extF80_z_bool = extF80M_lt_quiet;
859 gen_ab_extF80_z_bool:
860 gen_ab_extF80_z_bool( trueFunction_ab_extF80_z_bool );
861 break;
862#endif
863 /*--------------------------------------------------------------------
864 *--------------------------------------------------------------------*/
865#ifdef FLOAT128
866 case F128_TO_UI32:
867 gen_a_f128_z_ui32_rx( f128M_to_ui32, roundingMode, exact );
868 break;
869 case F128_TO_UI64:
870 gen_a_f128_z_ui64_rx( f128M_to_ui64, roundingMode, exact );
871 break;
872 case F128_TO_I32:
873 gen_a_f128_z_i32_rx( f128M_to_i32, roundingMode, exact );
874 break;
875 case F128_TO_I64:
876 gen_a_f128_z_i64_rx( f128M_to_i64, roundingMode, exact );
877 break;
878#ifdef FLOAT16
879 case F128_TO_F16:
880 gen_a_f128_z_f16( f128M_to_f16 );
881 break;
882#endif
883 case F128_TO_F32:
884 gen_a_f128_z_f32( f128M_to_f32 );
885 break;
886#ifdef FLOAT64
887 case F128_TO_F64:
888 gen_a_f128_z_f64( f128M_to_f64 );
889 break;
890#endif
891#ifdef EXTFLOAT80
892 case F128_TO_EXTF80:
893 gen_a_f128_z_extF80( f128M_to_extF80M );
894 break;
895#endif
896 case F128_ROUNDTOINT:
897 gen_az_f128_rx( f128M_roundToInt, roundingMode, exact );
898 break;
899 case F128_ADD:
900 trueFunction_abz_f128 = f128M_add;
901 goto gen_abz_f128;
902 case F128_SUB:
903 trueFunction_abz_f128 = f128M_sub;
904 goto gen_abz_f128;
905 case F128_MUL:
906 trueFunction_abz_f128 = f128M_mul;
907 goto gen_abz_f128;
908 case F128_DIV:
909 trueFunction_abz_f128 = f128M_div;
910 goto gen_abz_f128;
911 case F128_REM:
912 trueFunction_abz_f128 = f128M_rem;
913 gen_abz_f128:
914 gen_abz_f128( trueFunction_abz_f128 );
915 break;
916 case F128_MULADD:
917 gen_abcz_f128( f128M_mulAdd );
918 break;
919 case F128_SQRT:
920 gen_az_f128( f128M_sqrt );
921 break;
922 case F128_EQ:
923 trueFunction_ab_f128_z_bool = f128M_eq;
924 goto gen_ab_f128_z_bool;
925 case F128_LE:
926 trueFunction_ab_f128_z_bool = f128M_le;
927 goto gen_ab_f128_z_bool;
928 case F128_LT:
929 trueFunction_ab_f128_z_bool = f128M_lt;
930 goto gen_ab_f128_z_bool;
931 case F128_EQ_SIGNALING:
932 trueFunction_ab_f128_z_bool = f128M_eq_signaling;
933 goto gen_ab_f128_z_bool;
934 case F128_LE_QUIET:
935 trueFunction_ab_f128_z_bool = f128M_le_quiet;
936 goto gen_ab_f128_z_bool;
937 case F128_LT_QUIET:
938 trueFunction_ab_f128_z_bool = f128M_lt_quiet;
939 gen_ab_f128_z_bool:
940 gen_ab_f128_z_bool( trueFunction_ab_f128_z_bool );
941 break;
942#endif
943 }
944 return EXIT_SUCCESS;
945 /*------------------------------------------------------------------------
946 *------------------------------------------------------------------------*/
947 optionError:
948 fail( "'%s' option requires numeric argument", *argv );
949 invalidArg:
950 fail( "Invalid argument '%s'", *argv );
951
952}
953
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette