VirtualBox

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

Last change on this file since 102535 was 95515, checked in by vboxsync, 3 years ago

VMM/IEM: Reverted previous commit (included too much) r152134. bugref:9898

  • Property svn:eol-style set to native
File size: 49.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, 2018 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 "subjfloat_config.h"
48#include "subjfloat.h"
49#include "functions.h"
50#include "genCases.h"
51#include "verCases.h"
52#include "testLoops.h"
53
54static void catchSIGINT( int signalCode )
55{
56
57 if ( verCases_stop ) exit( EXIT_FAILURE );
58 verCases_stop = true;
59
60}
61
62static void (*subjFunctionPtr)();
63
64#ifdef FLOAT16
65typedef float16_t funcType_a_ui32_z_f16( uint32_t );
66#endif
67typedef float32_t funcType_a_ui32_z_f32( uint32_t );
68#ifdef FLOAT64
69typedef float64_t funcType_a_ui32_z_f64( uint32_t );
70#endif
71#ifdef EXTFLOAT80
72typedef void funcType_a_ui32_z_extF80( uint32_t, extFloat80_t * );
73#endif
74#ifdef FLOAT128
75typedef void funcType_a_ui32_z_f128( uint32_t, float128_t * );
76#endif
77#ifdef FLOAT16
78typedef float16_t funcType_a_ui64_z_f16( uint64_t );
79#endif
80typedef float32_t funcType_a_ui64_z_f32( uint64_t );
81#ifdef FLOAT64
82typedef float64_t funcType_a_ui64_z_f64( uint64_t );
83#endif
84#ifdef EXTFLOAT80
85typedef void funcType_a_ui64_z_extF80( uint64_t, extFloat80_t * );
86#endif
87#ifdef FLOAT128
88typedef void funcType_a_ui64_z_f128( uint64_t, float128_t * );
89#endif
90#ifdef FLOAT16
91typedef float16_t funcType_a_i32_z_f16( int32_t );
92#endif
93typedef float32_t funcType_a_i32_z_f32( int32_t );
94#ifdef FLOAT64
95typedef float64_t funcType_a_i32_z_f64( int32_t );
96#endif
97#ifdef EXTFLOAT80
98typedef void funcType_a_i32_z_extF80( int32_t, extFloat80_t * );
99#endif
100#ifdef FLOAT128
101typedef void funcType_a_i32_z_f128( int32_t, float128_t * );
102#endif
103#ifdef FLOAT16
104typedef float16_t funcType_a_i64_z_f16( int64_t );
105#endif
106typedef float32_t funcType_a_i64_z_f32( int64_t );
107#ifdef FLOAT64
108typedef float64_t funcType_a_i64_z_f64( int64_t );
109#endif
110#ifdef EXTFLOAT80
111typedef void funcType_a_i64_z_extF80( int64_t, extFloat80_t * );
112#endif
113#ifdef FLOAT128
114typedef void funcType_a_i64_z_f128( int64_t, float128_t * );
115#endif
116
117#ifdef FLOAT16
118typedef uint_fast32_t funcType_a_f16_z_ui32( float16_t );
119typedef uint_fast64_t funcType_a_f16_z_ui64( float16_t );
120typedef int_fast32_t funcType_a_f16_z_i32( float16_t );
121typedef int_fast64_t funcType_a_f16_z_i64( float16_t );
122typedef float32_t funcType_a_f16_z_f32( float16_t );
123#ifdef FLOAT64
124typedef float64_t funcType_a_f16_z_f64( float16_t );
125#endif
126#ifdef EXTFLOAT80
127typedef void funcType_a_f16_z_extF80( float16_t, extFloat80_t * );
128#endif
129#ifdef FLOAT128
130typedef void funcType_a_f16_z_f128( float16_t, float128_t * );
131#endif
132typedef float16_t funcType_az_f16( float16_t );
133typedef float16_t funcType_abz_f16( float16_t, float16_t );
134typedef float16_t funcType_abcz_f16( float16_t, float16_t, float16_t );
135typedef bool funcType_ab_f16_z_bool( float16_t, float16_t );
136#endif
137
138typedef uint_fast32_t funcType_a_f32_z_ui32( float32_t );
139typedef uint_fast64_t funcType_a_f32_z_ui64( float32_t );
140typedef int_fast32_t funcType_a_f32_z_i32( float32_t );
141typedef int_fast64_t funcType_a_f32_z_i64( float32_t );
142#ifdef FLOAT16
143typedef float16_t funcType_a_f32_z_f16( float32_t );
144#endif
145#ifdef FLOAT64
146typedef float64_t funcType_a_f32_z_f64( float32_t );
147#endif
148#ifdef EXTFLOAT80
149typedef void funcType_a_f32_z_extF80( float32_t, extFloat80_t * );
150#endif
151#ifdef FLOAT128
152typedef void funcType_a_f32_z_f128( float32_t, float128_t * );
153#endif
154typedef float32_t funcType_az_f32( float32_t );
155typedef float32_t funcType_abz_f32( float32_t, float32_t );
156typedef float32_t funcType_abcz_f32( float32_t, float32_t, float32_t );
157typedef bool funcType_ab_f32_z_bool( float32_t, float32_t );
158
159#ifdef FLOAT64
160typedef uint_fast32_t funcType_a_f64_z_ui32( float64_t );
161typedef uint_fast64_t funcType_a_f64_z_ui64( float64_t );
162typedef int_fast32_t funcType_a_f64_z_i32( float64_t );
163typedef int_fast64_t funcType_a_f64_z_i64( float64_t );
164#ifdef FLOAT16
165typedef float16_t funcType_a_f64_z_f16( float64_t );
166#endif
167typedef float32_t funcType_a_f64_z_f32( float64_t );
168#ifdef EXTFLOAT80
169typedef void funcType_a_f64_z_extF80( float64_t, extFloat80_t * );
170#endif
171#ifdef FLOAT128
172typedef void funcType_a_f64_z_f128( float64_t, float128_t * );
173#endif
174typedef float64_t funcType_az_f64( float64_t );
175typedef float64_t funcType_abz_f64( float64_t, float64_t );
176typedef float64_t funcType_abcz_f64( float64_t, float64_t, float64_t );
177typedef bool funcType_ab_f64_z_bool( float64_t, float64_t );
178#endif
179
180#ifdef EXTFLOAT80
181typedef uint_fast32_t funcType_a_extF80_z_ui32( const extFloat80_t * );
182typedef uint_fast64_t funcType_a_extF80_z_ui64( const extFloat80_t * );
183typedef int_fast32_t funcType_a_extF80_z_i32( const extFloat80_t * );
184typedef int_fast64_t funcType_a_extF80_z_i64( const extFloat80_t * );
185#ifdef FLOAT16
186typedef float16_t funcType_a_extF80_z_f16( const extFloat80_t * );
187#endif
188typedef float32_t funcType_a_extF80_z_f32( const extFloat80_t * );
189#ifdef FLOAT64
190typedef float64_t funcType_a_extF80_z_f64( const extFloat80_t * );
191#endif
192#ifdef FLOAT128
193typedef void funcType_a_extF80_z_f128( const extFloat80_t *, float128_t * );
194#endif
195typedef void funcType_az_extF80( const extFloat80_t *, extFloat80_t * );
196typedef
197 void
198 funcType_abz_extF80(
199 const extFloat80_t *, const extFloat80_t *, extFloat80_t * );
200typedef
201 bool funcType_ab_extF80_z_bool( const extFloat80_t *, const extFloat80_t * );
202#endif
203
204#ifdef FLOAT128
205typedef uint_fast32_t funcType_a_f128_z_ui32( const float128_t * );
206typedef uint_fast64_t funcType_a_f128_z_ui64( const float128_t * );
207typedef int_fast32_t funcType_a_f128_z_i32( const float128_t * );
208typedef int_fast64_t funcType_a_f128_z_i64( const float128_t * );
209#ifdef FLOAT16
210typedef float16_t funcType_a_f128_z_f16( const float128_t * );
211#endif
212typedef float32_t funcType_a_f128_z_f32( const float128_t * );
213#ifdef FLOAT64
214typedef float64_t funcType_a_f128_z_f64( const float128_t * );
215#endif
216#ifdef EXTFLOAT80
217typedef void funcType_a_f128_z_extF80( const float128_t *, extFloat80_t * );
218#endif
219typedef void funcType_az_f128( const float128_t *, float128_t * );
220typedef
221 void
222 funcType_abz_f128( const float128_t *, const float128_t *, float128_t * );
223typedef
224 void
225 funcType_abcz_f128(
226 const float128_t *, const float128_t *, const float128_t *, float128_t *
227 );
228typedef bool funcType_ab_f128_z_bool( const float128_t *, const float128_t * );
229#endif
230
231#ifdef FLOAT16
232
233static
234uint_fast32_t
235 subjFunction_a_f16_z_ui32_rx(
236 float16_t a, uint_fast8_t roundingMode, bool exact )
237{
238
239 return ((funcType_a_f16_z_ui32 *) subjFunctionPtr)( a );
240
241}
242
243static
244uint_fast64_t
245 subjFunction_a_f16_z_ui64_rx(
246 float16_t a, uint_fast8_t roundingMode, bool exact )
247{
248
249 return ((funcType_a_f16_z_ui64 *) subjFunctionPtr)( a );
250
251}
252
253static
254int_fast32_t
255 subjFunction_a_f16_z_i32_rx(
256 float16_t a, uint_fast8_t roundingMode, bool exact )
257{
258
259 return ((funcType_a_f16_z_i32 *) subjFunctionPtr)( a );
260
261}
262
263static
264int_fast64_t
265 subjFunction_a_f16_z_i64_rx(
266 float16_t a, uint_fast8_t roundingMode, bool exact )
267{
268
269 return ((funcType_a_f16_z_i64 *) subjFunctionPtr)( a );
270
271}
272
273static
274float16_t
275 subjFunction_az_f16_rx( float16_t a, uint_fast8_t roundingMode, bool exact )
276{
277
278 return ((funcType_az_f16 *) subjFunctionPtr)( a );
279
280}
281
282#endif
283
284static
285uint_fast32_t
286 subjFunction_a_f32_z_ui32_rx(
287 float32_t a, uint_fast8_t roundingMode, bool exact )
288{
289
290 return ((funcType_a_f32_z_ui32 *) subjFunctionPtr)( a );
291
292}
293
294static
295uint_fast64_t
296 subjFunction_a_f32_z_ui64_rx(
297 float32_t a, uint_fast8_t roundingMode, bool exact )
298{
299
300 return ((funcType_a_f32_z_ui64 *) subjFunctionPtr)( a );
301
302}
303
304static
305int_fast32_t
306 subjFunction_a_f32_z_i32_rx(
307 float32_t a, uint_fast8_t roundingMode, bool exact )
308{
309
310 return ((funcType_a_f32_z_i32 *) subjFunctionPtr)( a );
311
312}
313
314static
315int_fast64_t
316 subjFunction_a_f32_z_i64_rx(
317 float32_t a, uint_fast8_t roundingMode, bool exact )
318{
319
320 return ((funcType_a_f32_z_i64 *) subjFunctionPtr)( a );
321
322}
323
324static
325float32_t
326 subjFunction_az_f32_rx( float32_t a, uint_fast8_t roundingMode, bool exact )
327{
328
329 return ((funcType_az_f32 *) subjFunctionPtr)( a );
330
331}
332
333#ifdef FLOAT64
334
335static
336uint_fast32_t
337 subjFunction_a_f64_z_ui32_rx(
338 float64_t a, uint_fast8_t roundingMode, bool exact )
339{
340
341 return ((funcType_a_f64_z_ui32 *) subjFunctionPtr)( a );
342
343}
344
345static
346uint_fast64_t
347 subjFunction_a_f64_z_ui64_rx(
348 float64_t a, uint_fast8_t roundingMode, bool exact )
349{
350
351 return ((funcType_a_f64_z_ui64 *) subjFunctionPtr)( a );
352
353}
354
355static
356int_fast32_t
357 subjFunction_a_f64_z_i32_rx(
358 float64_t a, uint_fast8_t roundingMode, bool exact )
359{
360
361 return ((funcType_a_f64_z_i32 *) subjFunctionPtr)( a );
362
363}
364
365static
366int_fast64_t
367 subjFunction_a_f64_z_i64_rx(
368 float64_t a, uint_fast8_t roundingMode, bool exact )
369{
370
371 return ((funcType_a_f64_z_i64 *) subjFunctionPtr)( a );
372
373}
374
375static
376float64_t
377 subjFunction_az_f64_rx( float64_t a, uint_fast8_t roundingMode, bool exact )
378{
379
380 return ((funcType_az_f64 *) subjFunctionPtr)( a );
381
382}
383
384#endif
385
386#ifdef EXTFLOAT80
387
388static
389uint_fast32_t
390 subjFunction_a_extF80_z_ui32_rx(
391 const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
392{
393
394 return ((funcType_a_extF80_z_ui32 *) subjFunctionPtr)( aPtr );
395
396}
397
398static
399uint_fast64_t
400 subjFunction_a_extF80_z_ui64_rx(
401 const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
402{
403
404 return ((funcType_a_extF80_z_ui64 *) subjFunctionPtr)( aPtr );
405
406}
407
408static
409int_fast32_t
410 subjFunction_a_extF80_z_i32_rx(
411 const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
412{
413
414 return ((funcType_a_extF80_z_i32 *) subjFunctionPtr)( aPtr );
415
416}
417
418static
419int_fast64_t
420 subjFunction_a_extF80_z_i64_rx(
421 const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact )
422{
423
424 return ((funcType_a_extF80_z_i64 *) subjFunctionPtr)( aPtr );
425
426}
427
428static
429void
430 subjFunction_az_extF80_rx(
431 const extFloat80_t *aPtr,
432 uint_fast8_t roundingMode,
433 bool exact,
434 extFloat80_t *zPtr
435 )
436{
437
438 return ((funcType_az_extF80 *) subjFunctionPtr)( aPtr, zPtr );
439
440}
441
442#endif
443
444#ifdef FLOAT128
445
446static
447uint_fast32_t
448 subjFunction_a_f128_z_ui32_rx(
449 const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
450{
451
452 return ((funcType_a_f128_z_ui32 *) subjFunctionPtr)( aPtr );
453
454}
455
456static
457uint_fast64_t
458 subjFunction_a_f128_z_ui64_rx(
459 const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
460{
461
462 return ((funcType_a_f128_z_ui64 *) subjFunctionPtr)( aPtr );
463
464}
465
466static
467int_fast32_t
468 subjFunction_a_f128_z_i32_rx(
469 const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
470{
471
472 return ((funcType_a_f128_z_i32 *) subjFunctionPtr)( aPtr );
473
474}
475
476static
477int_fast64_t
478 subjFunction_a_f128_z_i64_rx(
479 const float128_t *aPtr, uint_fast8_t roundingMode, bool exact )
480{
481
482 return ((funcType_a_f128_z_i64 *) subjFunctionPtr)( aPtr );
483
484}
485
486static
487void
488 subjFunction_az_f128_rx(
489 const float128_t *aPtr,
490 uint_fast8_t roundingMode,
491 bool exact,
492 float128_t *zPtr
493 )
494{
495
496 return ((funcType_az_f128 *) subjFunctionPtr)( aPtr, zPtr );
497
498}
499
500#endif
501
502static
503void
504 testFunctionInstance(
505 int functionCode, uint_fast8_t roundingMode, bool exact )
506{
507#ifdef FLOAT16
508 funcType_abz_f16 *trueFunction_abz_f16;
509 funcType_ab_f16_z_bool *trueFunction_ab_f16_z_bool;
510#endif
511 funcType_abz_f32 *trueFunction_abz_f32;
512 funcType_ab_f32_z_bool *trueFunction_ab_f32_z_bool;
513#ifdef FLOAT64
514 funcType_abz_f64 *trueFunction_abz_f64;
515 funcType_ab_f64_z_bool *trueFunction_ab_f64_z_bool;
516#endif
517#ifdef EXTFLOAT80
518 funcType_abz_extF80 *trueFunction_abz_extF80;
519 funcType_ab_extF80_z_bool *trueFunction_ab_extF80_z_bool;
520#endif
521#ifdef FLOAT128
522 funcType_abz_f128 *trueFunction_abz_f128;
523 funcType_ab_f128_z_bool *trueFunction_ab_f128_z_bool;
524#endif
525
526 fputs( "Testing ", stderr );
527 verCases_writeFunctionName( stderr );
528 fputs( ".\n", stderr );
529 switch ( functionCode ) {
530 /*--------------------------------------------------------------------
531 *--------------------------------------------------------------------*/
532#ifdef FLOAT16
533#ifdef SUBJ_UI32_TO_F16
534 case UI32_TO_F16:
535 test_a_ui32_z_f16(
536 ui32_to_f16, (funcType_a_ui32_z_f16 *) subjFunctionPtr );
537 break;
538#endif
539#endif
540#ifdef SUBJ_UI32_TO_F32
541 case UI32_TO_F32:
542 test_a_ui32_z_f32(
543 ui32_to_f32, (funcType_a_ui32_z_f32 *) subjFunctionPtr );
544 break;
545#endif
546#ifdef FLOAT64
547#ifdef SUBJ_UI32_TO_F64
548 case UI32_TO_F64:
549 test_a_ui32_z_f64(
550 ui32_to_f64, (funcType_a_ui32_z_f64 *) subjFunctionPtr );
551 break;
552#endif
553#endif
554#ifdef EXTFLOAT80
555#ifdef SUBJ_UI32_TO_EXTF80
556 case UI32_TO_EXTF80:
557 test_a_ui32_z_extF80(
558 ui32_to_extF80M, (funcType_a_ui32_z_extF80 *) subjFunctionPtr );
559 break;
560#endif
561#endif
562#ifdef FLOAT128
563#ifdef SUBJ_UI32_TO_F128
564 case UI32_TO_F128:
565 test_a_ui32_z_f128(
566 ui32_to_f128M, (funcType_a_ui32_z_f128 *) subjFunctionPtr );
567 break;
568#endif
569#endif
570#ifdef FLOAT16
571#ifdef SUBJ_UI64_TO_F16
572 case UI64_TO_F16:
573 test_a_ui64_z_f16(
574 ui64_to_f16, (funcType_a_ui64_z_f16 *) subjFunctionPtr );
575 break;
576#endif
577#endif
578#ifdef SUBJ_UI64_TO_F32
579 case UI64_TO_F32:
580 test_a_ui64_z_f32(
581 ui64_to_f32, (funcType_a_ui64_z_f32 *) subjFunctionPtr );
582 break;
583#endif
584#ifdef FLOAT64
585#ifdef SUBJ_UI64_TO_F64
586 case UI64_TO_F64:
587 test_a_ui64_z_f64(
588 ui64_to_f64, (funcType_a_ui64_z_f64 *) subjFunctionPtr );
589 break;
590#endif
591#endif
592#ifdef EXTFLOAT80
593#ifdef SUBJ_UI64_TO_EXTF80
594 case UI64_TO_EXTF80:
595 test_a_ui64_z_extF80(
596 ui64_to_extF80M, (funcType_a_ui64_z_extF80 *) subjFunctionPtr );
597 break;
598#endif
599#endif
600#ifdef FLOAT128
601#ifdef SUBJ_UI64_TO_F128
602 case UI64_TO_F128:
603 test_a_ui64_z_f128(
604 ui64_to_f128M, (funcType_a_ui64_z_f128 *) subjFunctionPtr );
605 break;
606#endif
607#endif
608#ifdef FLOAT16
609#ifdef SUBJ_I32_TO_F16
610 case I32_TO_F16:
611 test_a_i32_z_f16(
612 i32_to_f16, (funcType_a_i32_z_f16 *) subjFunctionPtr );
613 break;
614#endif
615#endif
616#ifdef SUBJ_I32_TO_F32
617 case I32_TO_F32:
618 test_a_i32_z_f32(
619 i32_to_f32, (funcType_a_i32_z_f32 *) subjFunctionPtr );
620 break;
621#endif
622#ifdef FLOAT64
623#ifdef SUBJ_I32_TO_F64
624 case I32_TO_F64:
625 test_a_i32_z_f64(
626 i32_to_f64, (funcType_a_i32_z_f64 *) subjFunctionPtr );
627 break;
628#endif
629#endif
630#ifdef EXTFLOAT80
631#ifdef SUBJ_I32_TO_EXTF80
632 case I32_TO_EXTF80:
633 test_a_i32_z_extF80(
634 i32_to_extF80M, (funcType_a_i32_z_extF80 *) subjFunctionPtr );
635 break;
636#endif
637#endif
638#ifdef FLOAT128
639#ifdef SUBJ_I32_TO_F128
640 case I32_TO_F128:
641 test_a_i32_z_f128(
642 i32_to_f128M, (funcType_a_i32_z_f128 *) subjFunctionPtr );
643 break;
644#endif
645#endif
646#ifdef FLOAT16
647#ifdef SUBJ_I64_TO_F16
648 case I64_TO_F16:
649 test_a_i64_z_f16(
650 i64_to_f16, (funcType_a_i64_z_f16 *) subjFunctionPtr );
651 break;
652#endif
653#endif
654#ifdef SUBJ_I64_TO_F32
655 case I64_TO_F32:
656 test_a_i64_z_f32(
657 i64_to_f32, (funcType_a_i64_z_f32 *) subjFunctionPtr );
658 break;
659#endif
660#ifdef FLOAT64
661#ifdef SUBJ_I64_TO_F64
662 case I64_TO_F64:
663 test_a_i64_z_f64(
664 i64_to_f64, (funcType_a_i64_z_f64 *) subjFunctionPtr );
665 break;
666#endif
667#endif
668#ifdef EXTFLOAT80
669#ifdef SUBJ_I64_TO_EXTF80
670 case I64_TO_EXTF80:
671 test_a_i64_z_extF80(
672 i64_to_extF80M, (funcType_a_i64_z_extF80 *) subjFunctionPtr );
673 break;
674#endif
675#endif
676#ifdef FLOAT128
677#ifdef SUBJ_I64_TO_F128
678 case I64_TO_F128:
679 test_a_i64_z_f128(
680 i64_to_f128M, (funcType_a_i64_z_f128 *) subjFunctionPtr );
681 break;
682#endif
683#endif
684 /*--------------------------------------------------------------------
685 *--------------------------------------------------------------------*/
686#ifdef FLOAT16
687 case F16_TO_UI32:
688 test_a_f16_z_ui32_rx(
689 f16_to_ui32, subjFunction_a_f16_z_ui32_rx, roundingMode, exact );
690 break;
691 case F16_TO_UI64:
692 test_a_f16_z_ui64_rx(
693 f16_to_ui64, subjFunction_a_f16_z_ui64_rx, roundingMode, exact );
694 break;
695 case F16_TO_I32:
696 test_a_f16_z_i32_rx(
697 f16_to_i32, subjFunction_a_f16_z_i32_rx, roundingMode, exact );
698 break;
699 case F16_TO_I64:
700 test_a_f16_z_i64_rx(
701 f16_to_i64, subjFunction_a_f16_z_i64_rx, roundingMode, exact );
702 break;
703#ifdef SUBJ_F16_TO_F32
704 case F16_TO_F32:
705 test_a_f16_z_f32(
706 f16_to_f32, (funcType_a_f16_z_f32 *) subjFunctionPtr );
707 break;
708#endif
709#ifdef FLOAT64
710#ifdef SUBJ_F16_TO_F64
711 case F16_TO_F64:
712 test_a_f16_z_f64(
713 f16_to_f64, (funcType_a_f16_z_f64 *) subjFunctionPtr );
714 break;
715#endif
716#endif
717#ifdef EXTFLOAT80
718#ifdef SUBJ_F16_TO_EXTF80
719 case F16_TO_EXTF80:
720 test_a_f16_z_extF80(
721 f16_to_extF80M, (funcType_a_f16_z_extF80 *) subjFunctionPtr );
722 break;
723#endif
724#endif
725#ifdef FLOAT128
726#ifdef SUBJ_F16_TO_F128
727 case F16_TO_F128:
728 test_a_f16_z_f128(
729 f16_to_f128M, (funcType_a_f16_z_f128 *) subjFunctionPtr );
730 break;
731#endif
732#endif
733 case F16_ROUNDTOINT:
734 test_az_f16_rx(
735 f16_roundToInt, subjFunction_az_f16_rx, roundingMode, exact );
736 break;
737#ifdef SUBJ_F16_ADD
738 case F16_ADD:
739 trueFunction_abz_f16 = f16_add;
740 goto test_abz_f16;
741#endif
742#ifdef SUBJ_F16_SUB
743 case F16_SUB:
744 trueFunction_abz_f16 = f16_sub;
745 goto test_abz_f16;
746#endif
747#ifdef SUBJ_F16_MUL
748 case F16_MUL:
749 trueFunction_abz_f16 = f16_mul;
750 goto test_abz_f16;
751#endif
752#ifdef SUBJ_F16_MULADD
753 case F16_MULADD:
754 test_abcz_f16( f16_mulAdd, (funcType_abcz_f16 *) subjFunctionPtr );
755 break;
756#endif
757#ifdef SUBJ_F16_DIV
758 case F16_DIV:
759 trueFunction_abz_f16 = f16_div;
760 goto test_abz_f16;
761#endif
762#ifdef SUBJ_F16_REM
763 case F16_REM:
764 trueFunction_abz_f16 = f16_rem;
765 goto test_abz_f16;
766#endif
767 test_abz_f16:
768 test_abz_f16(
769 trueFunction_abz_f16, (funcType_abz_f16 *) subjFunctionPtr );
770 break;
771#ifdef SUBJ_F16_SQRT
772 case F16_SQRT:
773 test_az_f16( f16_sqrt, (funcType_az_f16 *) subjFunctionPtr );
774 break;
775#endif
776#ifdef SUBJ_F16_EQ
777 case F16_EQ:
778 trueFunction_ab_f16_z_bool = f16_eq;
779 goto test_ab_f16_z_bool;
780#endif
781#ifdef SUBJ_F16_LE
782 case F16_LE:
783 trueFunction_ab_f16_z_bool = f16_le;
784 goto test_ab_f16_z_bool;
785#endif
786#ifdef SUBJ_F16_LT
787 case F16_LT:
788 trueFunction_ab_f16_z_bool = f16_lt;
789 goto test_ab_f16_z_bool;
790#endif
791#ifdef SUBJ_F16_EQ_SIGNALING
792 case F16_EQ_SIGNALING:
793 trueFunction_ab_f16_z_bool = f16_eq_signaling;
794 goto test_ab_f16_z_bool;
795#endif
796#ifdef SUBJ_F16_LE_QUIET
797 case F16_LE_QUIET:
798 trueFunction_ab_f16_z_bool = f16_le_quiet;
799 goto test_ab_f16_z_bool;
800#endif
801#ifdef SUBJ_F16_LT_QUIET
802 case F16_LT_QUIET:
803 trueFunction_ab_f16_z_bool = f16_lt_quiet;
804 goto test_ab_f16_z_bool;
805#endif
806 test_ab_f16_z_bool:
807 test_ab_f16_z_bool(
808 trueFunction_ab_f16_z_bool,
809 (funcType_ab_f16_z_bool *) subjFunctionPtr
810 );
811 break;
812#endif
813 /*--------------------------------------------------------------------
814 *--------------------------------------------------------------------*/
815 case F32_TO_UI32:
816 test_a_f32_z_ui32_rx(
817 f32_to_ui32, subjFunction_a_f32_z_ui32_rx, roundingMode, exact );
818 break;
819 case F32_TO_UI64:
820 test_a_f32_z_ui64_rx(
821 f32_to_ui64, subjFunction_a_f32_z_ui64_rx, roundingMode, exact );
822 break;
823 case F32_TO_I32:
824 test_a_f32_z_i32_rx(
825 f32_to_i32, subjFunction_a_f32_z_i32_rx, roundingMode, exact );
826 break;
827 case F32_TO_I64:
828 test_a_f32_z_i64_rx(
829 f32_to_i64, subjFunction_a_f32_z_i64_rx, roundingMode, exact );
830 break;
831#ifdef FLOAT16
832#ifdef SUBJ_F32_TO_F16
833 case F32_TO_F16:
834 test_a_f32_z_f16(
835 f32_to_f16, (funcType_a_f32_z_f16 *) subjFunctionPtr );
836 break;
837#endif
838#endif
839#ifdef FLOAT64
840#ifdef SUBJ_F32_TO_F64
841 case F32_TO_F64:
842 test_a_f32_z_f64(
843 f32_to_f64, (funcType_a_f32_z_f64 *) subjFunctionPtr );
844 break;
845#endif
846#endif
847#ifdef EXTFLOAT80
848#ifdef SUBJ_F32_TO_EXTF80
849 case F32_TO_EXTF80:
850 test_a_f32_z_extF80(
851 f32_to_extF80M, (funcType_a_f32_z_extF80 *) subjFunctionPtr );
852 break;
853#endif
854#endif
855#ifdef FLOAT128
856#ifdef SUBJ_F32_TO_F128
857 case F32_TO_F128:
858 test_a_f32_z_f128(
859 f32_to_f128M, (funcType_a_f32_z_f128 *) subjFunctionPtr );
860 break;
861#endif
862#endif
863 case F32_ROUNDTOINT:
864 test_az_f32_rx(
865 f32_roundToInt, subjFunction_az_f32_rx, roundingMode, exact );
866 break;
867#ifdef SUBJ_F32_ADD
868 case F32_ADD:
869 trueFunction_abz_f32 = f32_add;
870 goto test_abz_f32;
871#endif
872#ifdef SUBJ_F32_SUB
873 case F32_SUB:
874 trueFunction_abz_f32 = f32_sub;
875 goto test_abz_f32;
876#endif
877#ifdef SUBJ_F32_MUL
878 case F32_MUL:
879 trueFunction_abz_f32 = f32_mul;
880 goto test_abz_f32;
881#endif
882#ifdef SUBJ_F32_MULADD
883 case F32_MULADD:
884 test_abcz_f32( f32_mulAdd, (funcType_abcz_f32 *) subjFunctionPtr );
885 break;
886#endif
887#ifdef SUBJ_F32_DIV
888 case F32_DIV:
889 trueFunction_abz_f32 = f32_div;
890 goto test_abz_f32;
891#endif
892#ifdef SUBJ_F32_REM
893 case F32_REM:
894 trueFunction_abz_f32 = f32_rem;
895 goto test_abz_f32;
896#endif
897 test_abz_f32:
898 test_abz_f32(
899 trueFunction_abz_f32, (funcType_abz_f32 *) subjFunctionPtr );
900 break;
901#ifdef SUBJ_F32_SQRT
902 case F32_SQRT:
903 test_az_f32( f32_sqrt, (funcType_az_f32 *) subjFunctionPtr );
904 break;
905#endif
906#ifdef SUBJ_F32_EQ
907 case F32_EQ:
908 trueFunction_ab_f32_z_bool = f32_eq;
909 goto test_ab_f32_z_bool;
910#endif
911#ifdef SUBJ_F32_LE
912 case F32_LE:
913 trueFunction_ab_f32_z_bool = f32_le;
914 goto test_ab_f32_z_bool;
915#endif
916#ifdef SUBJ_F32_LT
917 case F32_LT:
918 trueFunction_ab_f32_z_bool = f32_lt;
919 goto test_ab_f32_z_bool;
920#endif
921#ifdef SUBJ_F32_EQ_SIGNALING
922 case F32_EQ_SIGNALING:
923 trueFunction_ab_f32_z_bool = f32_eq_signaling;
924 goto test_ab_f32_z_bool;
925#endif
926#ifdef SUBJ_F32_LE_QUIET
927 case F32_LE_QUIET:
928 trueFunction_ab_f32_z_bool = f32_le_quiet;
929 goto test_ab_f32_z_bool;
930#endif
931#ifdef SUBJ_F32_LT_QUIET
932 case F32_LT_QUIET:
933 trueFunction_ab_f32_z_bool = f32_lt_quiet;
934 goto test_ab_f32_z_bool;
935#endif
936 test_ab_f32_z_bool:
937 test_ab_f32_z_bool(
938 trueFunction_ab_f32_z_bool,
939 (funcType_ab_f32_z_bool *) subjFunctionPtr
940 );
941 break;
942 /*--------------------------------------------------------------------
943 *--------------------------------------------------------------------*/
944#ifdef FLOAT64
945 case F64_TO_UI32:
946 test_a_f64_z_ui32_rx(
947 f64_to_ui32, subjFunction_a_f64_z_ui32_rx, roundingMode, exact );
948 break;
949 case F64_TO_UI64:
950 test_a_f64_z_ui64_rx(
951 f64_to_ui64, subjFunction_a_f64_z_ui64_rx, roundingMode, exact );
952 break;
953 case F64_TO_I32:
954 test_a_f64_z_i32_rx(
955 f64_to_i32, subjFunction_a_f64_z_i32_rx, roundingMode, exact );
956 break;
957 case F64_TO_I64:
958 test_a_f64_z_i64_rx(
959 f64_to_i64, subjFunction_a_f64_z_i64_rx, roundingMode, exact );
960 break;
961#ifdef FLOAT16
962#ifdef SUBJ_F64_TO_F16
963 case F64_TO_F16:
964 test_a_f64_z_f16(
965 f64_to_f16, (funcType_a_f64_z_f16 *) subjFunctionPtr );
966 break;
967#endif
968#endif
969#ifdef SUBJ_F64_TO_F32
970 case F64_TO_F32:
971 test_a_f64_z_f32(
972 f64_to_f32, (funcType_a_f64_z_f32 *) subjFunctionPtr );
973 break;
974#endif
975#ifdef EXTFLOAT80
976#ifdef SUBJ_F64_TO_EXTF80
977 case F64_TO_EXTF80:
978 test_a_f64_z_extF80(
979 f64_to_extF80M, (funcType_a_f64_z_extF80 *) subjFunctionPtr );
980 break;
981#endif
982#endif
983#ifdef FLOAT128
984#ifdef SUBJ_F64_TO_F128
985 case F64_TO_F128:
986 test_a_f64_z_f128(
987 f64_to_f128M, (funcType_a_f64_z_f128 *) subjFunctionPtr );
988 break;
989#endif
990#endif
991 case F64_ROUNDTOINT:
992 test_az_f64_rx(
993 f64_roundToInt, subjFunction_az_f64_rx, roundingMode, exact );
994 break;
995#ifdef SUBJ_F64_ADD
996 case F64_ADD:
997 trueFunction_abz_f64 = f64_add;
998 goto test_abz_f64;
999#endif
1000#ifdef SUBJ_F64_SUB
1001 case F64_SUB:
1002 trueFunction_abz_f64 = f64_sub;
1003 goto test_abz_f64;
1004#endif
1005#ifdef SUBJ_F64_MUL
1006 case F64_MUL:
1007 trueFunction_abz_f64 = f64_mul;
1008 goto test_abz_f64;
1009#endif
1010#ifdef SUBJ_F64_MULADD
1011 case F64_MULADD:
1012 test_abcz_f64( f64_mulAdd, (funcType_abcz_f64 *) subjFunctionPtr );
1013 break;
1014#endif
1015#ifdef SUBJ_F64_DIV
1016 case F64_DIV:
1017 trueFunction_abz_f64 = f64_div;
1018 goto test_abz_f64;
1019#endif
1020#ifdef SUBJ_F64_REM
1021 case F64_REM:
1022 trueFunction_abz_f64 = f64_rem;
1023 goto test_abz_f64;
1024#endif
1025 test_abz_f64:
1026 test_abz_f64(
1027 trueFunction_abz_f64, (funcType_abz_f64 *) subjFunctionPtr );
1028 break;
1029#ifdef SUBJ_F64_SQRT
1030 case F64_SQRT:
1031 test_az_f64( f64_sqrt, (funcType_az_f64 *) subjFunctionPtr );
1032 break;
1033#endif
1034#ifdef SUBJ_F64_EQ
1035 case F64_EQ:
1036 trueFunction_ab_f64_z_bool = f64_eq;
1037 goto test_ab_f64_z_bool;
1038#endif
1039#ifdef SUBJ_F64_LE
1040 case F64_LE:
1041 trueFunction_ab_f64_z_bool = f64_le;
1042 goto test_ab_f64_z_bool;
1043#endif
1044#ifdef SUBJ_F64_LT
1045 case F64_LT:
1046 trueFunction_ab_f64_z_bool = f64_lt;
1047 goto test_ab_f64_z_bool;
1048#endif
1049#ifdef SUBJ_F64_EQ_SIGNALING
1050 case F64_EQ_SIGNALING:
1051 trueFunction_ab_f64_z_bool = f64_eq_signaling;
1052 goto test_ab_f64_z_bool;
1053#endif
1054#ifdef SUBJ_F64_LE_QUIET
1055 case F64_LE_QUIET:
1056 trueFunction_ab_f64_z_bool = f64_le_quiet;
1057 goto test_ab_f64_z_bool;
1058#endif
1059#ifdef SUBJ_F64_LT_QUIET
1060 case F64_LT_QUIET:
1061 trueFunction_ab_f64_z_bool = f64_lt_quiet;
1062 goto test_ab_f64_z_bool;
1063#endif
1064 test_ab_f64_z_bool:
1065 test_ab_f64_z_bool(
1066 trueFunction_ab_f64_z_bool,
1067 (funcType_ab_f64_z_bool *) subjFunctionPtr
1068 );
1069 break;
1070#endif
1071 /*--------------------------------------------------------------------
1072 *--------------------------------------------------------------------*/
1073#ifdef EXTFLOAT80
1074 case EXTF80_TO_UI32:
1075 test_a_extF80_z_ui32_rx(
1076 extF80M_to_ui32,
1077 subjFunction_a_extF80_z_ui32_rx,
1078 roundingMode,
1079 exact
1080 );
1081 break;
1082 case EXTF80_TO_UI64:
1083 test_a_extF80_z_ui64_rx(
1084 extF80M_to_ui64,
1085 subjFunction_a_extF80_z_ui64_rx,
1086 roundingMode,
1087 exact
1088 );
1089 break;
1090 case EXTF80_TO_I32:
1091 test_a_extF80_z_i32_rx(
1092 extF80M_to_i32, subjFunction_a_extF80_z_i32_rx, roundingMode, exact
1093 );
1094 break;
1095 case EXTF80_TO_I64:
1096 test_a_extF80_z_i64_rx(
1097 extF80M_to_i64, subjFunction_a_extF80_z_i64_rx, roundingMode, exact
1098 );
1099 break;
1100#ifdef FLOAT16
1101#ifdef SUBJ_EXTF80_TO_F16
1102 case EXTF80_TO_F16:
1103 test_a_extF80_z_f16(
1104 extF80M_to_f16, (funcType_a_extF80_z_f16 *) subjFunctionPtr );
1105 break;
1106#endif
1107#endif
1108#ifdef SUBJ_EXTF80_TO_F32
1109 case EXTF80_TO_F32:
1110 test_a_extF80_z_f32(
1111 extF80M_to_f32, (funcType_a_extF80_z_f32 *) subjFunctionPtr );
1112 break;
1113#endif
1114#ifdef FLOAT64
1115#ifdef SUBJ_EXTF80_TO_F64
1116 case EXTF80_TO_F64:
1117 test_a_extF80_z_f64(
1118 extF80M_to_f64, (funcType_a_extF80_z_f64 *) subjFunctionPtr );
1119 break;
1120#endif
1121#endif
1122#ifdef FLOAT128
1123#ifdef SUBJ_EXTF80_TO_F128
1124 case EXTF80_TO_F128:
1125 test_a_extF80_z_f128(
1126 extF80M_to_f128M, (funcType_a_extF80_z_f128 *) subjFunctionPtr );
1127 break;
1128#endif
1129#endif
1130 case EXTF80_ROUNDTOINT:
1131 test_az_extF80_rx(
1132 extF80M_roundToInt, subjFunction_az_extF80_rx, roundingMode, exact
1133 );
1134 break;
1135#ifdef SUBJ_EXTF80_ADD
1136 case EXTF80_ADD:
1137 trueFunction_abz_extF80 = extF80M_add;
1138 goto test_abz_extF80;
1139#endif
1140#ifdef SUBJ_EXTF80_SUB
1141 case EXTF80_SUB:
1142 trueFunction_abz_extF80 = extF80M_sub;
1143 goto test_abz_extF80;
1144#endif
1145#ifdef SUBJ_EXTF80_MUL
1146 case EXTF80_MUL:
1147 trueFunction_abz_extF80 = extF80M_mul;
1148 goto test_abz_extF80;
1149#endif
1150#ifdef SUBJ_EXTF80_DIV
1151 case EXTF80_DIV:
1152 trueFunction_abz_extF80 = extF80M_div;
1153 goto test_abz_extF80;
1154#endif
1155#ifdef SUBJ_EXTF80_REM
1156 case EXTF80_REM:
1157 trueFunction_abz_extF80 = extF80M_rem;
1158 goto test_abz_extF80;
1159#endif
1160 test_abz_extF80:
1161 test_abz_extF80(
1162 trueFunction_abz_extF80, (funcType_abz_extF80 *) subjFunctionPtr );
1163 break;
1164#ifdef SUBJ_EXTF80_SQRT
1165 case EXTF80_SQRT:
1166 test_az_extF80( extF80M_sqrt, (funcType_az_extF80 *) subjFunctionPtr );
1167 break;
1168#endif
1169#ifdef SUBJ_EXTF80_EQ
1170 case EXTF80_EQ:
1171 trueFunction_ab_extF80_z_bool = extF80M_eq;
1172 goto test_ab_extF80_z_bool;
1173#endif
1174#ifdef SUBJ_EXTF80_LE
1175 case EXTF80_LE:
1176 trueFunction_ab_extF80_z_bool = extF80M_le;
1177 goto test_ab_extF80_z_bool;
1178#endif
1179#ifdef SUBJ_EXTF80_LT
1180 case EXTF80_LT:
1181 trueFunction_ab_extF80_z_bool = extF80M_lt;
1182 goto test_ab_extF80_z_bool;
1183#endif
1184#ifdef SUBJ_EXTF80_EQ_SIGNALING
1185 case EXTF80_EQ_SIGNALING:
1186 trueFunction_ab_extF80_z_bool = extF80M_eq_signaling;
1187 goto test_ab_extF80_z_bool;
1188#endif
1189#ifdef SUBJ_EXTF80_LE_QUIET
1190 case EXTF80_LE_QUIET:
1191 trueFunction_ab_extF80_z_bool = extF80M_le_quiet;
1192 goto test_ab_extF80_z_bool;
1193#endif
1194#ifdef SUBJ_EXTF80_LT_QUIET
1195 case EXTF80_LT_QUIET:
1196 trueFunction_ab_extF80_z_bool = extF80M_lt_quiet;
1197 goto test_ab_extF80_z_bool;
1198#endif
1199 test_ab_extF80_z_bool:
1200 test_ab_extF80_z_bool(
1201 trueFunction_ab_extF80_z_bool,
1202 (funcType_ab_extF80_z_bool *) subjFunctionPtr
1203 );
1204 break;
1205#endif
1206 /*--------------------------------------------------------------------
1207 *--------------------------------------------------------------------*/
1208#ifdef FLOAT128
1209 case F128_TO_UI32:
1210 test_a_f128_z_ui32_rx(
1211 f128M_to_ui32, subjFunction_a_f128_z_ui32_rx, roundingMode, exact
1212 );
1213 break;
1214 case F128_TO_UI64:
1215 test_a_f128_z_ui64_rx(
1216 f128M_to_ui64, subjFunction_a_f128_z_ui64_rx, roundingMode, exact
1217 );
1218 break;
1219 case F128_TO_I32:
1220 test_a_f128_z_i32_rx(
1221 f128M_to_i32, subjFunction_a_f128_z_i32_rx, roundingMode, exact );
1222 break;
1223 case F128_TO_I64:
1224 test_a_f128_z_i64_rx(
1225 f128M_to_i64, subjFunction_a_f128_z_i64_rx, roundingMode, exact );
1226 break;
1227#ifdef FLOAT16
1228#ifdef SUBJ_F128_TO_F16
1229 case F128_TO_F16:
1230 test_a_f128_z_f16(
1231 f128M_to_f16, (funcType_a_f128_z_f16 *) subjFunctionPtr );
1232 break;
1233#endif
1234#endif
1235#ifdef SUBJ_F128_TO_F32
1236 case F128_TO_F32:
1237 test_a_f128_z_f32(
1238 f128M_to_f32, (funcType_a_f128_z_f32 *) subjFunctionPtr );
1239 break;
1240#endif
1241#ifdef FLOAT64
1242#ifdef SUBJ_F128_TO_F64
1243 case F128_TO_F64:
1244 test_a_f128_z_f64(
1245 f128M_to_f64, (funcType_a_f128_z_f64 *) subjFunctionPtr );
1246 break;
1247#endif
1248#endif
1249#ifdef EXTFLOAT80
1250#ifdef SUBJ_F128_TO_EXTF80
1251 case F128_TO_EXTF80:
1252 test_a_f128_z_extF80(
1253 f128M_to_extF80M, (funcType_a_f128_z_extF80 *) subjFunctionPtr );
1254 break;
1255#endif
1256#endif
1257 case F128_ROUNDTOINT:
1258 test_az_f128_rx(
1259 f128M_roundToInt, subjFunction_az_f128_rx, roundingMode, exact );
1260 break;
1261#ifdef SUBJ_F128_ADD
1262 case F128_ADD:
1263 trueFunction_abz_f128 = f128M_add;
1264 goto test_abz_f128;
1265#endif
1266#ifdef SUBJ_F128_SUB
1267 case F128_SUB:
1268 trueFunction_abz_f128 = f128M_sub;
1269 goto test_abz_f128;
1270#endif
1271#ifdef SUBJ_F128_MUL
1272 case F128_MUL:
1273 trueFunction_abz_f128 = f128M_mul;
1274 goto test_abz_f128;
1275#endif
1276#ifdef SUBJ_F128_MULADD
1277 case F128_MULADD:
1278 test_abcz_f128( f128M_mulAdd, (funcType_abcz_f128 *) subjFunctionPtr );
1279 break;
1280#endif
1281#ifdef SUBJ_F128_DIV
1282 case F128_DIV:
1283 trueFunction_abz_f128 = f128M_div;
1284 goto test_abz_f128;
1285#endif
1286#ifdef SUBJ_F128_REM
1287 case F128_REM:
1288 trueFunction_abz_f128 = f128M_rem;
1289 goto test_abz_f128;
1290#endif
1291 test_abz_f128:
1292 test_abz_f128(
1293 trueFunction_abz_f128, (funcType_abz_f128 *) subjFunctionPtr );
1294 break;
1295#ifdef SUBJ_F128_SQRT
1296 case F128_SQRT:
1297 test_az_f128( f128M_sqrt, (funcType_az_f128 *) subjFunctionPtr );
1298 break;
1299#endif
1300#ifdef SUBJ_F128_EQ
1301 case F128_EQ:
1302 trueFunction_ab_f128_z_bool = f128M_eq;
1303 goto test_ab_f128_z_bool;
1304#endif
1305#ifdef SUBJ_F128_LE
1306 case F128_LE:
1307 trueFunction_ab_f128_z_bool = f128M_le;
1308 goto test_ab_f128_z_bool;
1309#endif
1310#ifdef SUBJ_F128_LT
1311 case F128_LT:
1312 trueFunction_ab_f128_z_bool = f128M_lt;
1313 goto test_ab_f128_z_bool;
1314#endif
1315#ifdef SUBJ_F128_EQ_SIGNALING
1316 case F128_EQ_SIGNALING:
1317 trueFunction_ab_f128_z_bool = f128M_eq_signaling;
1318 goto test_ab_f128_z_bool;
1319#endif
1320#ifdef SUBJ_F128_LE_QUIET
1321 case F128_LE_QUIET:
1322 trueFunction_ab_f128_z_bool = f128M_le_quiet;
1323 goto test_ab_f128_z_bool;
1324#endif
1325#ifdef SUBJ_F128_LT_QUIET
1326 case F128_LT_QUIET:
1327 trueFunction_ab_f128_z_bool = f128M_lt_quiet;
1328 goto test_ab_f128_z_bool;
1329#endif
1330 test_ab_f128_z_bool:
1331 test_ab_f128_z_bool(
1332 trueFunction_ab_f128_z_bool,
1333 (funcType_ab_f128_z_bool *) subjFunctionPtr
1334 );
1335 break;
1336#endif
1337 }
1338 if ( (verCases_errorStop && verCases_anyErrors) || verCases_stop ) {
1339 verCases_exitWithStatus();
1340 }
1341
1342}
1343
1344static
1345void
1346 testFunction(
1347 const struct standardFunctionInfo *standardFunctionInfoPtr,
1348 uint_fast8_t roundingPrecisionIn,
1349 int roundingCodeIn
1350 )
1351{
1352 int functionCode, functionAttribs;
1353 bool standardFunctionHasFixedRounding;
1354 int roundingCode;
1355 bool exact;
1356 uint_fast8_t roundingPrecision, roundingMode = 0;
1357
1358 functionCode = standardFunctionInfoPtr->functionCode;
1359 functionAttribs = functionInfos[functionCode].attribs;
1360 standardFunctionHasFixedRounding = false;
1361 if ( functionAttribs & FUNC_ARG_ROUNDINGMODE ) {
1362 roundingCode = standardFunctionInfoPtr->roundingCode;
1363 if ( roundingCode ) {
1364 standardFunctionHasFixedRounding = true;
1365 roundingCodeIn = roundingCode;
1366 }
1367 }
1368 exact = standardFunctionInfoPtr->exact;
1369 verCases_functionNamePtr = standardFunctionInfoPtr->namePtr;
1370 roundingPrecision = 32;
1371 for (;;) {
1372 if ( functionAttribs & FUNC_EFF_ROUNDINGPRECISION ) {
1373 if ( roundingPrecisionIn ) roundingPrecision = roundingPrecisionIn;
1374 } else {
1375 roundingPrecision = 0;
1376 }
1377#ifdef EXTFLOAT80
1378 verCases_roundingPrecision = roundingPrecision;
1379 if ( roundingPrecision ) {
1380 extF80_roundingPrecision = roundingPrecision;
1381 subjfloat_setExtF80RoundingPrecision( roundingPrecision );
1382 }
1383#endif
1384 for (
1385 roundingCode = 1; roundingCode < NUM_ROUNDINGMODES; ++roundingCode
1386 ) {
1387#ifndef SUBJFLOAT_ROUND_NEAR_MAXMAG
1388 if ( roundingCode != ROUND_NEAR_MAXMAG ) {
1389#endif
1390#if defined FLOAT_ROUND_ODD && ! defined SUBJFLOAT_ROUND_NEAR_MAXMAG
1391 if ( roundingCode != ROUND_ODD ) {
1392#endif
1393 if (
1394 functionAttribs
1395 & (FUNC_ARG_ROUNDINGMODE | FUNC_EFF_ROUNDINGMODE)
1396 ) {
1397 if ( roundingCodeIn ) roundingCode = roundingCodeIn;
1398 } else {
1399 roundingCode = 0;
1400 }
1401 verCases_roundingCode =
1402 standardFunctionHasFixedRounding ? 0 : roundingCode;
1403 if ( roundingCode ) {
1404 roundingMode = roundingModes[roundingCode];
1405 softfloat_roundingMode = roundingMode;
1406 if ( ! standardFunctionHasFixedRounding ) {
1407 subjfloat_setRoundingMode( roundingMode );
1408 }
1409 }
1410 testFunctionInstance( functionCode, roundingMode, exact );
1411 if ( roundingCodeIn || ! roundingCode ) break;
1412#if defined FLOAT_ROUND_ODD && ! defined SUBJFLOAT_ROUND_NEAR_MAXMAG
1413 }
1414#endif
1415#ifndef SUBJFLOAT_ROUND_NEAR_MAXMAG
1416 }
1417#endif
1418 }
1419 if ( roundingPrecisionIn || ! roundingPrecision ) break;
1420 if ( roundingPrecision == 80 ) {
1421 break;
1422 } else if ( roundingPrecision == 64 ) {
1423 roundingPrecision = 80;
1424 } else if ( roundingPrecision == 32 ) {
1425 roundingPrecision = 64;
1426 }
1427 }
1428
1429}
1430
1431int main( int argc, char *argv[] )
1432{
1433 bool haveFunctionArg;
1434 const struct standardFunctionInfo *standardFunctionInfoPtr;
1435 int numOperands;
1436 uint_fast8_t roundingPrecision;
1437 int roundingCode;
1438 const char *argPtr;
1439 void (*const *subjFunctionPtrPtr)();
1440 const char *functionNamePtr;
1441 unsigned long ui;
1442 long i;
1443 int functionMatchAttrib;
1444
1445 /*------------------------------------------------------------------------
1446 *------------------------------------------------------------------------*/
1447 fail_programName = "testfloat";
1448 if ( argc <= 1 ) goto writeHelpMessage;
1449 genCases_setLevel( 1 );
1450 verCases_maxErrorCount = 20;
1451 testLoops_trueFlagsPtr = &softfloat_exceptionFlags;
1452 testLoops_subjFlagsFunction = subjfloat_clearExceptionFlags;
1453 haveFunctionArg = false;
1454 standardFunctionInfoPtr = 0;
1455 numOperands = 0;
1456 roundingPrecision = 0;
1457 roundingCode = 0;
1458 for (;;) {
1459 --argc;
1460 if ( ! argc ) break;
1461 argPtr = *++argv;
1462 if ( ! argPtr ) break;
1463 if ( argPtr[0] == '-' ) ++argPtr;
1464 if (
1465 ! strcmp( argPtr, "help" ) || ! strcmp( argPtr, "-help" )
1466 || ! strcmp( argPtr, "h" )
1467 ) {
1468 writeHelpMessage:
1469 fputs(
1470"testfloat [<option>...] <function>\n"
1471" <option>: (* is default)\n"
1472" -help --Write this message and exit.\n"
1473" -list --List all testable subject functions and exit.\n"
1474" -seed <num> --Set pseudo-random number generator seed to <num>.\n"
1475" * -seed 1\n"
1476" -level <num> --Testing level <num> (1 or 2).\n"
1477" * -level 1\n"
1478" -errors <num> --Stop each function test after <num> errors.\n"
1479" * -errors 20\n"
1480" -errorstop --Exit after first function with any error.\n"
1481" -forever --Test one function repeatedly (implies '-level 2').\n"
1482" -checkNaNs --Check for specific NaN results.\n"
1483" -checkInvInts --Check for specific invalid integer results.\n"
1484" -checkAll --Same as both '-checkNaNs' and '-checkInvInts'.\n"
1485#ifdef EXTFLOAT80
1486" -precision32 --For extF80, test only 32-bit rounding precision.\n"
1487" -precision64 --For extF80, test only 64-bit rounding precision.\n"
1488" -precision80 --For extF80, test only 80-bit rounding precision.\n"
1489#endif
1490" -r<round> --Test only specified rounding (if not inherent to\n"
1491" function).\n"
1492" -tininessbefore --Underflow tininess is detected before rounding.\n"
1493" -tininessafter --Underflow tininess is detected after rounding.\n"
1494" <function>:\n"
1495" <int>_to_<float> <float>_add <float>_eq\n"
1496" <float>_to_<int>_r_<round> <float>_sub <float>_le\n"
1497" <float>_to_<int>_rx_<round> <float>_mul <float>_lt\n"
1498" <float>_to_<float> <float>_mulAdd <float>_eq_signaling\n"
1499" <float>_roundToInt_r_<round> <float>_div <float>_le_quiet\n"
1500" <float>_roundToInt_x <float>_rem <float>_lt_quiet\n"
1501" <float>_sqrt\n"
1502" -all1 --All unary functions.\n"
1503" -all2 --All binary functions.\n"
1504" <int>:\n"
1505" ui32 --Unsigned 32-bit integer.\n"
1506" ui64 --Unsigned 64-bit integer.\n"
1507" i32 --Signed 32-bit integer.\n"
1508" i64 --Signed 64-bit integer.\n"
1509" <float>:\n"
1510#ifdef FLOAT16
1511" f16 --Binary 16-bit floating-point (half-precision).\n"
1512#endif
1513" f32 --Binary 32-bit floating-point (single-precision).\n"
1514#ifdef FLOAT64
1515" f64 --Binary 64-bit floating-point (double-precision).\n"
1516#endif
1517#ifdef EXTFLOAT80
1518" extF80 --Binary 80-bit extended floating-point.\n"
1519#endif
1520#ifdef FLOAT128
1521" f128 --Binary 128-bit floating-point (quadruple-precision).\n"
1522#endif
1523" <round>:\n"
1524" near_even --Round to nearest/even.\n"
1525" minMag --Round to minimum magnitude (toward zero).\n"
1526" min --Round to minimum (down).\n"
1527" max --Round to maximum (up).\n"
1528#ifdef SUBJFLOAT_ROUND_NEAR_MAXMAG
1529" near_maxMag --Round to nearest/maximum magnitude (nearest/away).\n"
1530#endif
1531#if defined FLOAT_ROUND_ODD && defined SUBJFLOAT_ROUND_ODD
1532" odd --Round to odd (jamming). (Not allowed as an inherent\n"
1533" rounding mode. For 'roundToInt_x', rounds to minimum\n"
1534" magnitude instead.)\n"
1535#endif
1536 ,
1537 stdout
1538 );
1539 return EXIT_SUCCESS;
1540 } else if ( ! strcmp( argPtr, "list" ) ) {
1541 standardFunctionInfoPtr = standardFunctionInfos;
1542 subjFunctionPtrPtr = subjfloat_functions;
1543 for (;;) {
1544 functionNamePtr = standardFunctionInfoPtr->namePtr;
1545 if ( ! functionNamePtr ) break;
1546 if ( *subjFunctionPtrPtr ) puts( functionNamePtr );
1547 ++standardFunctionInfoPtr;
1548 ++subjFunctionPtrPtr;
1549 }
1550 return EXIT_SUCCESS;
1551 } else if ( ! strcmp( argPtr, "seed" ) ) {
1552 if ( argc < 2 ) goto optionError;
1553 ui = strtoul( argv[1], (char **) &argPtr, 10 );
1554 if ( *argPtr ) goto optionError;
1555 srand( ui );
1556 --argc;
1557 ++argv;
1558 } else if ( ! strcmp( argPtr, "level" ) ) {
1559 if ( argc < 2 ) goto optionError;
1560 i = strtol( argv[1], (char **) &argPtr, 10 );
1561 if ( *argPtr ) goto optionError;
1562 genCases_setLevel( i );
1563 --argc;
1564 ++argv;
1565 } else if ( ! strcmp( argPtr, "level1" ) ) {
1566 genCases_setLevel( 1 );
1567 } else if ( ! strcmp( argPtr, "level2" ) ) {
1568 genCases_setLevel( 2 );
1569 } else if ( ! strcmp( argPtr, "errors" ) ) {
1570 if ( argc < 2 ) goto optionError;
1571 i = strtol( argv[1], (char **) &argPtr, 10 );
1572 if ( *argPtr ) goto optionError;
1573 verCases_maxErrorCount = i;
1574 --argc;
1575 ++argv;
1576 } else if ( ! strcmp( argPtr, "errorstop" ) ) {
1577 verCases_errorStop = true;
1578 } else if ( ! strcmp( argPtr, "forever" ) ) {
1579 genCases_setLevel( 2 );
1580 testLoops_forever = true;
1581 } else if (
1582 ! strcmp( argPtr, "checkNaNs" ) || ! strcmp( argPtr, "checknans" )
1583 ) {
1584 verCases_checkNaNs = true;
1585 } else if (
1586 ! strcmp( argPtr, "checkInvInts" )
1587 || ! strcmp( argPtr, "checkinvints" )
1588 ) {
1589 verCases_checkInvInts = true;
1590 } else if (
1591 ! strcmp( argPtr, "checkAll" ) || ! strcmp( argPtr, "checkall" )
1592 ) {
1593 verCases_checkNaNs = true;
1594 verCases_checkInvInts = true;
1595#ifdef EXTFLOAT80
1596 } else if ( ! strcmp( argPtr, "precision32" ) ) {
1597 roundingPrecision = 32;
1598 } else if ( ! strcmp( argPtr, "precision64" ) ) {
1599 roundingPrecision = 64;
1600 } else if ( ! strcmp( argPtr, "precision80" ) ) {
1601 roundingPrecision = 80;
1602#endif
1603 } else if (
1604 ! strcmp( argPtr, "rnear_even" )
1605 || ! strcmp( argPtr, "rneareven" )
1606 || ! strcmp( argPtr, "rnearest_even" )
1607 ) {
1608 roundingCode = ROUND_NEAR_EVEN;
1609 } else if (
1610 ! strcmp( argPtr, "rminmag" ) || ! strcmp( argPtr, "rminMag" )
1611 ) {
1612 roundingCode = ROUND_MINMAG;
1613 } else if ( ! strcmp( argPtr, "rmin" ) ) {
1614 roundingCode = ROUND_MIN;
1615 } else if ( ! strcmp( argPtr, "rmax" ) ) {
1616 roundingCode = ROUND_MAX;
1617 } else if (
1618 ! strcmp( argPtr, "rnear_maxmag" )
1619 || ! strcmp( argPtr, "rnear_maxMag" )
1620 || ! strcmp( argPtr, "rnearmaxmag" )
1621 || ! strcmp( argPtr, "rnearest_maxmag" )
1622 || ! strcmp( argPtr, "rnearest_maxMag" )
1623 ) {
1624#ifdef SUBJFLOAT_ROUND_NEAR_MAXMAG
1625 roundingCode = ROUND_NEAR_MAXMAG;
1626#else
1627 fail(
1628 "Rounding mode 'near_maxMag' is not supported or cannot be tested"
1629 );
1630#endif
1631#ifdef FLOAT_ROUND_ODD
1632 } else if ( ! strcmp( argPtr, "rodd" ) ) {
1633#ifdef SUBJFLOAT_ROUND_ODD
1634 roundingCode = ROUND_ODD;
1635#else
1636 fail( "Rounding mode 'odd' is not supported or cannot be tested" );
1637#endif
1638#endif
1639 } else if ( ! strcmp( argPtr, "tininessbefore" ) ) {
1640 softfloat_detectTininess = softfloat_tininess_beforeRounding;
1641 } else if ( ! strcmp( argPtr, "tininessafter" ) ) {
1642 softfloat_detectTininess = softfloat_tininess_afterRounding;
1643 } else if ( ! strcmp( argPtr, "all1" ) ) {
1644 haveFunctionArg = true;
1645 standardFunctionInfoPtr = 0;
1646 numOperands = 1;
1647 } else if ( ! strcmp( argPtr, "all2" ) ) {
1648 haveFunctionArg = true;
1649 standardFunctionInfoPtr = 0;
1650 numOperands = 2;
1651 } else {
1652 standardFunctionInfoPtr = standardFunctionInfos;
1653 for (;;) {
1654 functionNamePtr = standardFunctionInfoPtr->namePtr;
1655 if ( ! functionNamePtr ) {
1656 fail( "Invalid argument '%s'", *argv );
1657 }
1658 if ( ! strcmp( argPtr, functionNamePtr ) ) break;
1659 ++standardFunctionInfoPtr;
1660 }
1661 subjFunctionPtr =
1662 subjfloat_functions
1663 [standardFunctionInfoPtr - standardFunctionInfos];
1664 if ( ! subjFunctionPtr ) {
1665 fail(
1666 "Function '%s' is not supported or cannot be tested",
1667 argPtr
1668 );
1669 }
1670 haveFunctionArg = true;
1671 }
1672 }
1673 if ( ! haveFunctionArg ) fail( "Function argument required" );
1674 /*------------------------------------------------------------------------
1675 *------------------------------------------------------------------------*/
1676 signal( SIGINT, catchSIGINT );
1677 signal( SIGTERM, catchSIGINT );
1678 if ( standardFunctionInfoPtr ) {
1679 if ( testLoops_forever ) {
1680 if ( ! roundingPrecision ) roundingPrecision = 80;
1681 if ( ! roundingCode ) roundingCode = ROUND_NEAR_EVEN;
1682 }
1683 testFunction(
1684 standardFunctionInfoPtr, roundingPrecision, roundingCode );
1685 } else {
1686 if ( testLoops_forever ) {
1687 fail( "Can test only one function with '-forever' option" );
1688 }
1689 functionMatchAttrib =
1690 (numOperands == 1) ? FUNC_ARG_UNARY : FUNC_ARG_BINARY;
1691 standardFunctionInfoPtr = standardFunctionInfos;
1692 subjFunctionPtrPtr = subjfloat_functions;
1693 while ( standardFunctionInfoPtr->namePtr ) {
1694 subjFunctionPtr = *subjFunctionPtrPtr;
1695 if (
1696 subjFunctionPtr
1697 && (functionInfos[standardFunctionInfoPtr->functionCode]
1698 .attribs
1699 & functionMatchAttrib)
1700 ) {
1701 testFunction(
1702 standardFunctionInfoPtr, roundingPrecision, roundingCode );
1703 }
1704 ++standardFunctionInfoPtr;
1705 ++subjFunctionPtrPtr;
1706 }
1707 }
1708 verCases_exitWithStatus();
1709 /*------------------------------------------------------------------------
1710 *------------------------------------------------------------------------*/
1711 optionError:
1712 fail( "'%s' option requires numeric argument", *argv );
1713
1714}
1715
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