Home | History | Annotate | Line # | Download | only in testfloat
testFunction.c revision 1.5
      1 /*	$NetBSD: testFunction.c,v 1.5 2008/04/01 19:20:43 drochner Exp $	*/
      2 
      3 /* This is a derivative work. */
      4 
      5 /*-
      6  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      7  * All rights reserved.
      8  *
      9  * This code is derived from software contributed to The NetBSD Foundation
     10  * by Ross Harvey.
     11  *
     12  * Redistribution and use in source and binary forms, with or without
     13  * modification, are permitted provided that the following conditions
     14  * are met:
     15  * 1. Redistributions of source code must retain the above copyright
     16  *    notice, this list of conditions and the following disclaimer.
     17  * 2. Redistributions in binary form must reproduce the above copyright
     18  *    notice, this list of conditions and the following disclaimer in the
     19  *    documentation and/or other materials provided with the distribution.
     20  * 3. All advertising materials mentioning features or use of this software
     21  *    must display the following acknowledgement:
     22  *        This product includes software developed by the NetBSD
     23  *        Foundation, Inc. and its contributors.
     24  * 4. Neither the name of The NetBSD Foundation nor the names of its
     25  *    contributors may be used to endorse or promote products derived
     26  *    from this software without specific prior written permission.
     27  *
     28  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     29  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     31  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     32  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     33  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     35  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     36  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     37  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     38  * POSSIBILITY OF SUCH DAMAGE.
     39  */
     40 
     41 /*
     42 ===============================================================================
     43 
     44 This C source file is part of TestFloat, Release 2a, a package of programs
     45 for testing the correctness of floating-point arithmetic complying to the
     46 IEC/IEEE Standard for Floating-Point.
     47 
     48 Written by John R. Hauser.  More information is available through the Web
     49 page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
     50 
     51 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
     52 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
     53 TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
     54 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
     55 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
     56 
     57 Derivative works are acceptable, even for commercial purposes, so long as
     58 (1) they include prominent notice that the work is derivative, and (2) they
     59 include prominent notice akin to these four paragraphs for those parts of
     60 this code that are retained.
     61 
     62 ===============================================================================
     63 */
     64 
     65 #include "milieu.h"
     66 #include "softfloat.h"
     67 #include "testCases.h"
     68 #include "testLoops.h"
     69 #include "systmodes.h"
     70 #include "systflags.h"
     71 #include "systfloat.h"
     72 #include "testFunction.h"
     73 
     74 const functionT functions[ NUM_FUNCTIONS ] = {
     75     { 0, 0, 0, 0 },
     76     { "int32_to_float32",                1, FALSE, TRUE  },
     77     { "int32_to_float64",                1, FALSE, FALSE },
     78     { "int32_to_floatx80",               1, FALSE, FALSE },
     79     { "int32_to_float128",               1, FALSE, FALSE },
     80     { "int64_to_float32",                1, FALSE, TRUE  },
     81     { "int64_to_float64",                1, FALSE, TRUE  },
     82     { "int64_to_floatx80",               1, FALSE, FALSE },
     83     { "int64_to_float128",               1, FALSE, FALSE },
     84     { "float32_to_int32",                1, FALSE, TRUE  },
     85     { "float32_to_int32_round_to_zero",  1, FALSE, FALSE },
     86     { "float32_to_int64",                1, FALSE, TRUE  },
     87     { "float32_to_int64_round_to_zero",  1, FALSE, FALSE },
     88     { "float32_to_float64",              1, FALSE, FALSE },
     89     { "float32_to_floatx80",             1, FALSE, FALSE },
     90     { "float32_to_float128",             1, FALSE, FALSE },
     91     { "float32_round_to_int",            1, FALSE, TRUE  },
     92     { "float32_add",                     2, FALSE, TRUE  },
     93     { "float32_sub",                     2, FALSE, TRUE  },
     94     { "float32_mul",                     2, FALSE, TRUE  },
     95     { "float32_div",                     2, FALSE, TRUE  },
     96     { "float32_rem",                     2, FALSE, FALSE },
     97     { "float32_sqrt",                    1, FALSE, TRUE  },
     98     { "float32_eq",                      2, FALSE, FALSE },
     99     { "float32_le",                      2, FALSE, FALSE },
    100     { "float32_lt",                      2, FALSE, FALSE },
    101     { "float32_eq_signaling",            2, FALSE, FALSE },
    102     { "float32_le_quiet",                2, FALSE, FALSE },
    103     { "float32_lt_quiet",                2, FALSE, FALSE },
    104     { "float64_to_int32",                1, FALSE, TRUE  },
    105     { "float64_to_int32_round_to_zero",  1, FALSE, FALSE },
    106     { "float64_to_int64",                1, FALSE, TRUE  },
    107     { "float64_to_int64_round_to_zero",  1, FALSE, FALSE },
    108     { "float64_to_float32",              1, FALSE, TRUE  },
    109     { "float64_to_floatx80",             1, FALSE, FALSE },
    110     { "float64_to_float128",             1, FALSE, FALSE },
    111     { "float64_round_to_int",            1, FALSE, TRUE  },
    112     { "float64_add",                     2, FALSE, TRUE  },
    113     { "float64_sub",                     2, FALSE, TRUE  },
    114     { "float64_mul",                     2, FALSE, TRUE  },
    115     { "float64_div",                     2, FALSE, TRUE  },
    116     { "float64_rem",                     2, FALSE, FALSE },
    117     { "float64_sqrt",                    1, FALSE, TRUE  },
    118     { "float64_eq",                      2, FALSE, FALSE },
    119     { "float64_le",                      2, FALSE, FALSE },
    120     { "float64_lt",                      2, FALSE, FALSE },
    121     { "float64_eq_signaling",            2, FALSE, FALSE },
    122     { "float64_le_quiet",                2, FALSE, FALSE },
    123     { "float64_lt_quiet",                2, FALSE, FALSE },
    124     { "floatx80_to_int32",               1, FALSE, TRUE  },
    125     { "floatx80_to_int32_round_to_zero", 1, FALSE, FALSE },
    126     { "floatx80_to_int64",               1, FALSE, TRUE  },
    127     { "floatx80_to_int64_round_to_zero", 1, FALSE, FALSE },
    128     { "floatx80_to_float32",             1, FALSE, TRUE  },
    129     { "floatx80_to_float64",             1, FALSE, TRUE  },
    130     { "floatx80_to_float128",            1, FALSE, FALSE },
    131     { "floatx80_round_to_int",           1, FALSE, TRUE  },
    132     { "floatx80_add",                    2, TRUE,  TRUE  },
    133     { "floatx80_sub",                    2, TRUE,  TRUE  },
    134     { "floatx80_mul",                    2, TRUE,  TRUE  },
    135     { "floatx80_div",                    2, TRUE,  TRUE  },
    136     { "floatx80_rem",                    2, FALSE, FALSE },
    137     { "floatx80_sqrt",                   1, TRUE,  TRUE  },
    138     { "floatx80_eq",                     2, FALSE, FALSE },
    139     { "floatx80_le",                     2, FALSE, FALSE },
    140     { "floatx80_lt",                     2, FALSE, FALSE },
    141     { "floatx80_eq_signaling",           2, FALSE, FALSE },
    142     { "floatx80_le_quiet",               2, FALSE, FALSE },
    143     { "floatx80_lt_quiet",               2, FALSE, FALSE },
    144     { "float128_to_int32",               1, FALSE, TRUE  },
    145     { "float128_to_int32_round_to_zero", 1, FALSE, FALSE },
    146     { "float128_to_int64",               1, FALSE, TRUE  },
    147     { "float128_to_int64_round_to_zero", 1, FALSE, FALSE },
    148     { "float128_to_float32",             1, FALSE, TRUE  },
    149     { "float128_to_float64",             1, FALSE, TRUE  },
    150     { "float128_to_floatx80",            1, FALSE, TRUE  },
    151     { "float128_round_to_int",           1, FALSE, TRUE  },
    152     { "float128_add",                    2, FALSE, TRUE  },
    153     { "float128_sub",                    2, FALSE, TRUE  },
    154     { "float128_mul",                    2, FALSE, TRUE  },
    155     { "float128_div",                    2, FALSE, TRUE  },
    156     { "float128_rem",                    2, FALSE, FALSE },
    157     { "float128_sqrt",                   1, FALSE, TRUE  },
    158     { "float128_eq",                     2, FALSE, FALSE },
    159     { "float128_le",                     2, FALSE, FALSE },
    160     { "float128_lt",                     2, FALSE, FALSE },
    161     { "float128_eq_signaling",           2, FALSE, FALSE },
    162     { "float128_le_quiet",               2, FALSE, FALSE },
    163     { "float128_lt_quiet",               2, FALSE, FALSE },
    164 };
    165 
    166 const flag functionExists[ NUM_FUNCTIONS ] = {
    167     0,
    168 #ifdef SYST_INT32_TO_FLOAT32
    169     1,
    170 #else
    171     0,
    172 #endif
    173 #ifdef SYST_INT32_TO_FLOAT64
    174     1,
    175 #else
    176     0,
    177 #endif
    178 #ifdef SYST_INT32_TO_FLOATX80
    179     1,
    180 #else
    181     0,
    182 #endif
    183 #ifdef SYST_INT32_TO_FLOAT128
    184     1,
    185 #else
    186     0,
    187 #endif
    188 #ifdef SYST_INT64_TO_FLOAT32
    189     1,
    190 #else
    191     0,
    192 #endif
    193 #ifdef SYST_INT64_TO_FLOAT64
    194     1,
    195 #else
    196     0,
    197 #endif
    198 #ifdef SYST_INT64_TO_FLOATX80
    199     1,
    200 #else
    201     0,
    202 #endif
    203 #ifdef SYST_INT64_TO_FLOAT128
    204     1,
    205 #else
    206     0,
    207 #endif
    208 #ifdef SYST_FLOAT32_TO_INT32
    209     1,
    210 #else
    211     0,
    212 #endif
    213 #ifdef SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
    214     1,
    215 #else
    216     0,
    217 #endif
    218 #ifdef SYST_FLOAT32_TO_INT64
    219     1,
    220 #else
    221     0,
    222 #endif
    223 #ifdef SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
    224     1,
    225 #else
    226     0,
    227 #endif
    228 #ifdef SYST_FLOAT32_TO_FLOAT64
    229     1,
    230 #else
    231     0,
    232 #endif
    233 #ifdef SYST_FLOAT32_TO_FLOATX80
    234     1,
    235 #else
    236     0,
    237 #endif
    238 #ifdef SYST_FLOAT32_TO_FLOAT128
    239     1,
    240 #else
    241     0,
    242 #endif
    243 #ifdef SYST_FLOAT32_ROUND_TO_INT
    244     1,
    245 #else
    246     0,
    247 #endif
    248 #ifdef SYST_FLOAT32_ADD
    249     1,
    250 #else
    251     0,
    252 #endif
    253 #ifdef SYST_FLOAT32_SUB
    254     1,
    255 #else
    256     0,
    257 #endif
    258 #ifdef SYST_FLOAT32_MUL
    259     1,
    260 #else
    261     0,
    262 #endif
    263 #ifdef SYST_FLOAT32_DIV
    264     1,
    265 #else
    266     0,
    267 #endif
    268 #ifdef SYST_FLOAT32_REM
    269     1,
    270 #else
    271     0,
    272 #endif
    273 #ifdef SYST_FLOAT32_SQRT
    274     1,
    275 #else
    276     0,
    277 #endif
    278 #ifdef SYST_FLOAT32_EQ
    279     1,
    280 #else
    281     0,
    282 #endif
    283 #ifdef SYST_FLOAT32_LE
    284     1,
    285 #else
    286     0,
    287 #endif
    288 #ifdef SYST_FLOAT32_LT
    289     1,
    290 #else
    291     0,
    292 #endif
    293 #ifdef SYST_FLOAT32_EQ_SIGNALING
    294     1,
    295 #else
    296     0,
    297 #endif
    298 #ifdef SYST_FLOAT32_LE_QUIET
    299     1,
    300 #else
    301     0,
    302 #endif
    303 #ifdef SYST_FLOAT32_LT_QUIET
    304     1,
    305 #else
    306     0,
    307 #endif
    308 #ifdef SYST_FLOAT64_TO_INT32
    309     1,
    310 #else
    311     0,
    312 #endif
    313 #ifdef SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
    314     1,
    315 #else
    316     0,
    317 #endif
    318 #ifdef SYST_FLOAT64_TO_INT64
    319     1,
    320 #else
    321     0,
    322 #endif
    323 #ifdef SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
    324     1,
    325 #else
    326     0,
    327 #endif
    328 #ifdef SYST_FLOAT64_TO_FLOAT32
    329     1,
    330 #else
    331     0,
    332 #endif
    333 #ifdef SYST_FLOAT64_TO_FLOATX80
    334     1,
    335 #else
    336     0,
    337 #endif
    338 #ifdef SYST_FLOAT64_TO_FLOAT128
    339     1,
    340 #else
    341     0,
    342 #endif
    343 #ifdef SYST_FLOAT64_ROUND_TO_INT
    344     1,
    345 #else
    346     0,
    347 #endif
    348 #ifdef SYST_FLOAT64_ADD
    349     1,
    350 #else
    351     0,
    352 #endif
    353 #ifdef SYST_FLOAT64_SUB
    354     1,
    355 #else
    356     0,
    357 #endif
    358 #ifdef SYST_FLOAT64_MUL
    359     1,
    360 #else
    361     0,
    362 #endif
    363 #ifdef SYST_FLOAT64_DIV
    364     1,
    365 #else
    366     0,
    367 #endif
    368 #ifdef SYST_FLOAT64_REM
    369     1,
    370 #else
    371     0,
    372 #endif
    373 #ifdef SYST_FLOAT64_SQRT
    374     1,
    375 #else
    376     0,
    377 #endif
    378 #ifdef SYST_FLOAT64_EQ
    379     1,
    380 #else
    381     0,
    382 #endif
    383 #ifdef SYST_FLOAT64_LE
    384     1,
    385 #else
    386     0,
    387 #endif
    388 #ifdef SYST_FLOAT64_LT
    389     1,
    390 #else
    391     0,
    392 #endif
    393 #ifdef SYST_FLOAT64_EQ_SIGNALING
    394     1,
    395 #else
    396     0,
    397 #endif
    398 #ifdef SYST_FLOAT64_LE_QUIET
    399     1,
    400 #else
    401     0,
    402 #endif
    403 #ifdef SYST_FLOAT64_LT_QUIET
    404     1,
    405 #else
    406     0,
    407 #endif
    408 #ifdef SYST_FLOATX80_TO_INT32
    409     1,
    410 #else
    411     0,
    412 #endif
    413 #ifdef SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
    414     1,
    415 #else
    416     0,
    417 #endif
    418 #ifdef SYST_FLOATX80_TO_INT64
    419     1,
    420 #else
    421     0,
    422 #endif
    423 #ifdef SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
    424     1,
    425 #else
    426     0,
    427 #endif
    428 #ifdef SYST_FLOATX80_TO_FLOAT32
    429     1,
    430 #else
    431     0,
    432 #endif
    433 #ifdef SYST_FLOATX80_TO_FLOAT64
    434     1,
    435 #else
    436     0,
    437 #endif
    438 #ifdef SYST_FLOATX80_TO_FLOAT128
    439     1,
    440 #else
    441     0,
    442 #endif
    443 #ifdef SYST_FLOATX80_ROUND_TO_INT
    444     1,
    445 #else
    446     0,
    447 #endif
    448 #ifdef SYST_FLOATX80_ADD
    449     1,
    450 #else
    451     0,
    452 #endif
    453 #ifdef SYST_FLOATX80_SUB
    454     1,
    455 #else
    456     0,
    457 #endif
    458 #ifdef SYST_FLOATX80_MUL
    459     1,
    460 #else
    461     0,
    462 #endif
    463 #ifdef SYST_FLOATX80_DIV
    464     1,
    465 #else
    466     0,
    467 #endif
    468 #ifdef SYST_FLOATX80_REM
    469     1,
    470 #else
    471     0,
    472 #endif
    473 #ifdef SYST_FLOATX80_SQRT
    474     1,
    475 #else
    476     0,
    477 #endif
    478 #ifdef SYST_FLOATX80_EQ
    479     1,
    480 #else
    481     0,
    482 #endif
    483 #ifdef SYST_FLOATX80_LE
    484     1,
    485 #else
    486     0,
    487 #endif
    488 #ifdef SYST_FLOATX80_LT
    489     1,
    490 #else
    491     0,
    492 #endif
    493 #ifdef SYST_FLOATX80_EQ_SIGNALING
    494     1,
    495 #else
    496     0,
    497 #endif
    498 #ifdef SYST_FLOATX80_LE_QUIET
    499     1,
    500 #else
    501     0,
    502 #endif
    503 #ifdef SYST_FLOATX80_LT_QUIET
    504     1,
    505 #else
    506     0,
    507 #endif
    508 #ifdef SYST_FLOAT128_TO_INT32
    509     1,
    510 #else
    511     0,
    512 #endif
    513 #ifdef SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
    514     1,
    515 #else
    516     0,
    517 #endif
    518 #ifdef SYST_FLOAT128_TO_INT64
    519     1,
    520 #else
    521     0,
    522 #endif
    523 #ifdef SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
    524     1,
    525 #else
    526     0,
    527 #endif
    528 #ifdef SYST_FLOAT128_TO_FLOAT32
    529     1,
    530 #else
    531     0,
    532 #endif
    533 #ifdef SYST_FLOAT128_TO_FLOAT64
    534     1,
    535 #else
    536     0,
    537 #endif
    538 #ifdef SYST_FLOAT128_TO_FLOATX80
    539     1,
    540 #else
    541     0,
    542 #endif
    543 #ifdef SYST_FLOAT128_ROUND_TO_INT
    544     1,
    545 #else
    546     0,
    547 #endif
    548 #ifdef SYST_FLOAT128_ADD
    549     1,
    550 #else
    551     0,
    552 #endif
    553 #ifdef SYST_FLOAT128_SUB
    554     1,
    555 #else
    556     0,
    557 #endif
    558 #ifdef SYST_FLOAT128_MUL
    559     1,
    560 #else
    561     0,
    562 #endif
    563 #ifdef SYST_FLOAT128_DIV
    564     1,
    565 #else
    566     0,
    567 #endif
    568 #ifdef SYST_FLOAT128_REM
    569     1,
    570 #else
    571     0,
    572 #endif
    573 #ifdef SYST_FLOAT128_SQRT
    574     1,
    575 #else
    576     0,
    577 #endif
    578 #ifdef SYST_FLOAT128_EQ
    579     1,
    580 #else
    581     0,
    582 #endif
    583 #ifdef SYST_FLOAT128_LE
    584     1,
    585 #else
    586     0,
    587 #endif
    588 #ifdef SYST_FLOAT128_LT
    589     1,
    590 #else
    591     0,
    592 #endif
    593 #ifdef SYST_FLOAT128_EQ_SIGNALING
    594     1,
    595 #else
    596     0,
    597 #endif
    598 #ifdef SYST_FLOAT128_LE_QUIET
    599     1,
    600 #else
    601     0,
    602 #endif
    603 #ifdef SYST_FLOAT128_LT_QUIET
    604     1,
    605 #else
    606     0,
    607 #endif
    608 };
    609 
    610 static void
    611  testFunctionVariety(
    612      uint8 functionCode, int8 roundingPrecision, int8 roundingMode )
    613 {
    614     uint8 roundingCode;
    615 
    616     functionName = functions[ functionCode ].name;
    617 #ifdef FLOATX80
    618     if ( roundingPrecision == 32 ) {
    619         roundingPrecisionName = "32";
    620     }
    621     else if ( roundingPrecision == 64 ) {
    622         roundingPrecisionName = "64";
    623     }
    624     else if ( roundingPrecision == 80 ) {
    625         roundingPrecisionName = "80";
    626     }
    627     else {
    628         roundingPrecision = 80;
    629         roundingPrecisionName = 0;
    630     }
    631     floatx80_rounding_precision = roundingPrecision;
    632     syst_float_set_rounding_precision( roundingPrecision );
    633 #endif
    634     switch ( roundingMode ) {
    635      case 0:
    636         roundingModeName = 0;
    637         roundingCode = float_round_nearest_even;
    638         break;
    639      case ROUND_NEAREST_EVEN:
    640         roundingModeName = "nearest_even";
    641         roundingCode = float_round_nearest_even;
    642         break;
    643      case ROUND_TO_ZERO:
    644         roundingModeName = "to_zero";
    645         roundingCode = float_round_to_zero;
    646         break;
    647      case ROUND_DOWN:
    648         roundingModeName = "down";
    649         roundingCode = float_round_down;
    650         break;
    651      case ROUND_UP:
    652         roundingModeName = "up";
    653         roundingCode = float_round_up;
    654         break;
    655      default:
    656 	return;
    657     }
    658     float_rounding_mode = roundingCode;
    659     syst_float_set_rounding_mode( roundingCode );
    660     fputs( "Testing ", stderr );
    661     writeFunctionName( stderr );
    662     fputs( ".\n", stderr );
    663     switch ( functionCode ) {
    664 #ifdef SYST_INT32_TO_FLOAT32
    665      case INT32_TO_FLOAT32:
    666         test_a_int32_z_float32( int32_to_float32, syst_int32_to_float32 );
    667         break;
    668 #endif
    669 #ifdef SYST_INT32_TO_FLOAT64
    670      case INT32_TO_FLOAT64:
    671         test_a_int32_z_float64( int32_to_float64, syst_int32_to_float64 );
    672         break;
    673 #endif
    674 #ifdef SYST_INT32_TO_FLOATX80
    675      case INT32_TO_FLOATX80:
    676         test_a_int32_z_floatx80( int32_to_floatx80, syst_int32_to_floatx80 );
    677         break;
    678 #endif
    679 #ifdef SYST_INT32_TO_FLOAT128
    680      case INT32_TO_FLOAT128:
    681         test_a_int32_z_float128( int32_to_float128, syst_int32_to_float128 );
    682         break;
    683 #endif
    684 #ifdef SYST_INT64_TO_FLOAT32
    685      case INT64_TO_FLOAT32:
    686         test_a_int64_z_float32( int64_to_float32, syst_int64_to_float32 );
    687         break;
    688 #endif
    689 #ifdef SYST_INT64_TO_FLOAT64
    690      case INT64_TO_FLOAT64:
    691         test_a_int64_z_float64( int64_to_float64, syst_int64_to_float64 );
    692         break;
    693 #endif
    694 #ifdef SYST_INT64_TO_FLOATX80
    695      case INT64_TO_FLOATX80:
    696         test_a_int64_z_floatx80( int64_to_floatx80, syst_int64_to_floatx80 );
    697         break;
    698 #endif
    699 #ifdef SYST_INT64_TO_FLOAT128
    700      case INT64_TO_FLOAT128:
    701         test_a_int64_z_float128( int64_to_float128, syst_int64_to_float128 );
    702         break;
    703 #endif
    704 #ifdef SYST_FLOAT32_TO_INT32
    705      case FLOAT32_TO_INT32:
    706         test_a_float32_z_int32( float32_to_int32, syst_float32_to_int32 );
    707         break;
    708 #endif
    709 #ifdef SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
    710      case FLOAT32_TO_INT32_ROUND_TO_ZERO:
    711         test_a_float32_z_int32(
    712             float32_to_int32_round_to_zero,
    713             syst_float32_to_int32_round_to_zero
    714         );
    715         break;
    716 #endif
    717 #ifdef SYST_FLOAT32_TO_INT64
    718      case FLOAT32_TO_INT64:
    719         test_a_float32_z_int64( float32_to_int64, syst_float32_to_int64 );
    720         break;
    721 #endif
    722 #ifdef SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
    723      case FLOAT32_TO_INT64_ROUND_TO_ZERO:
    724         test_a_float32_z_int64(
    725             float32_to_int64_round_to_zero,
    726             syst_float32_to_int64_round_to_zero
    727         );
    728         break;
    729 #endif
    730 #ifdef SYST_FLOAT32_TO_FLOAT64
    731      case FLOAT32_TO_FLOAT64:
    732         test_a_float32_z_float64(
    733             float32_to_float64, syst_float32_to_float64 );
    734         break;
    735 #endif
    736 #ifdef SYST_FLOAT32_TO_FLOATX80
    737      case FLOAT32_TO_FLOATX80:
    738         test_a_float32_z_floatx80(
    739             float32_to_floatx80, syst_float32_to_floatx80 );
    740         break;
    741 #endif
    742 #ifdef SYST_FLOAT32_TO_FLOAT128
    743      case FLOAT32_TO_FLOAT128:
    744         test_a_float32_z_float128(
    745             float32_to_float128, syst_float32_to_float128 );
    746         break;
    747 #endif
    748 #ifdef SYST_FLOAT32_ROUND_TO_INT
    749      case FLOAT32_ROUND_TO_INT:
    750         test_az_float32( float32_round_to_int, syst_float32_round_to_int );
    751         break;
    752 #endif
    753 #ifdef SYST_FLOAT32_ADD
    754      case FLOAT32_ADD:
    755         test_abz_float32( float32_add, syst_float32_add );
    756         break;
    757 #endif
    758 #ifdef SYST_FLOAT32_SUB
    759      case FLOAT32_SUB:
    760         test_abz_float32( float32_sub, syst_float32_sub );
    761         break;
    762 #endif
    763 #ifdef SYST_FLOAT32_MUL
    764      case FLOAT32_MUL:
    765         test_abz_float32( float32_mul, syst_float32_mul );
    766         break;
    767 #endif
    768 #ifdef SYST_FLOAT32_DIV
    769      case FLOAT32_DIV:
    770         test_abz_float32( float32_div, syst_float32_div );
    771         break;
    772 #endif
    773 #ifdef SYST_FLOAT32_REM
    774      case FLOAT32_REM:
    775         test_abz_float32( float32_rem, syst_float32_rem );
    776         break;
    777 #endif
    778 #ifdef SYST_FLOAT32_SQRT
    779      case FLOAT32_SQRT:
    780         test_az_float32( float32_sqrt, syst_float32_sqrt );
    781         break;
    782 #endif
    783 #ifdef SYST_FLOAT32_EQ
    784      case FLOAT32_EQ:
    785         test_ab_float32_z_flag( float32_eq, syst_float32_eq );
    786         break;
    787 #endif
    788 #ifdef SYST_FLOAT32_LE
    789      case FLOAT32_LE:
    790         test_ab_float32_z_flag( float32_le, syst_float32_le );
    791         break;
    792 #endif
    793 #ifdef SYST_FLOAT32_LT
    794      case FLOAT32_LT:
    795         test_ab_float32_z_flag( float32_lt, syst_float32_lt );
    796         break;
    797 #endif
    798 #ifdef SYST_FLOAT32_EQ_SIGNALING
    799      case FLOAT32_EQ_SIGNALING:
    800         test_ab_float32_z_flag(
    801             float32_eq_signaling, syst_float32_eq_signaling );
    802         break;
    803 #endif
    804 #ifdef SYST_FLOAT32_LE_QUIET
    805      case FLOAT32_LE_QUIET:
    806         test_ab_float32_z_flag( float32_le_quiet, syst_float32_le_quiet );
    807         break;
    808 #endif
    809 #ifdef SYST_FLOAT32_LT_QUIET
    810      case FLOAT32_LT_QUIET:
    811         test_ab_float32_z_flag( float32_lt_quiet, syst_float32_lt_quiet );
    812         break;
    813 #endif
    814 #ifdef SYST_FLOAT64_TO_INT32
    815      case FLOAT64_TO_INT32:
    816         test_a_float64_z_int32( float64_to_int32, syst_float64_to_int32 );
    817         break;
    818 #endif
    819 #ifdef SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
    820      case FLOAT64_TO_INT32_ROUND_TO_ZERO:
    821         test_a_float64_z_int32(
    822             float64_to_int32_round_to_zero,
    823             syst_float64_to_int32_round_to_zero
    824         );
    825         break;
    826 #endif
    827 #ifdef SYST_FLOAT64_TO_INT64
    828      case FLOAT64_TO_INT64:
    829         test_a_float64_z_int64( float64_to_int64, syst_float64_to_int64 );
    830         break;
    831 #endif
    832 #ifdef SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
    833      case FLOAT64_TO_INT64_ROUND_TO_ZERO:
    834         test_a_float64_z_int64(
    835             float64_to_int64_round_to_zero,
    836             syst_float64_to_int64_round_to_zero
    837         );
    838         break;
    839 #endif
    840 #ifdef SYST_FLOAT64_TO_FLOAT32
    841      case FLOAT64_TO_FLOAT32:
    842         test_a_float64_z_float32(
    843             float64_to_float32, syst_float64_to_float32 );
    844         break;
    845 #endif
    846 #ifdef SYST_FLOAT64_TO_FLOATX80
    847      case FLOAT64_TO_FLOATX80:
    848         test_a_float64_z_floatx80(
    849             float64_to_floatx80, syst_float64_to_floatx80 );
    850         break;
    851 #endif
    852 #ifdef SYST_FLOAT64_TO_FLOAT128
    853      case FLOAT64_TO_FLOAT128:
    854         test_a_float64_z_float128(
    855             float64_to_float128, syst_float64_to_float128 );
    856         break;
    857 #endif
    858 #ifdef SYST_FLOAT64_ROUND_TO_INT
    859      case FLOAT64_ROUND_TO_INT:
    860         test_az_float64( float64_round_to_int, syst_float64_round_to_int );
    861         break;
    862 #endif
    863 #ifdef SYST_FLOAT64_ADD
    864      case FLOAT64_ADD:
    865         test_abz_float64( float64_add, syst_float64_add );
    866         break;
    867 #endif
    868 #ifdef SYST_FLOAT64_SUB
    869      case FLOAT64_SUB:
    870         test_abz_float64( float64_sub, syst_float64_sub );
    871         break;
    872 #endif
    873 #ifdef SYST_FLOAT64_MUL
    874      case FLOAT64_MUL:
    875         test_abz_float64( float64_mul, syst_float64_mul );
    876         break;
    877 #endif
    878 #ifdef SYST_FLOAT64_DIV
    879      case FLOAT64_DIV:
    880         test_abz_float64( float64_div, syst_float64_div );
    881         break;
    882 #endif
    883 #ifdef SYST_FLOAT64_REM
    884      case FLOAT64_REM:
    885         test_abz_float64( float64_rem, syst_float64_rem );
    886         break;
    887 #endif
    888 #ifdef SYST_FLOAT64_SQRT
    889      case FLOAT64_SQRT:
    890         test_az_float64( float64_sqrt, syst_float64_sqrt );
    891         break;
    892 #endif
    893 #ifdef SYST_FLOAT64_EQ
    894      case FLOAT64_EQ:
    895         test_ab_float64_z_flag( float64_eq, syst_float64_eq );
    896         break;
    897 #endif
    898 #ifdef SYST_FLOAT64_LE
    899      case FLOAT64_LE:
    900         test_ab_float64_z_flag( float64_le, syst_float64_le );
    901         break;
    902 #endif
    903 #ifdef SYST_FLOAT64_LT
    904      case FLOAT64_LT:
    905         test_ab_float64_z_flag( float64_lt, syst_float64_lt );
    906         break;
    907 #endif
    908 #ifdef SYST_FLOAT64_EQ_SIGNALING
    909      case FLOAT64_EQ_SIGNALING:
    910         test_ab_float64_z_flag(
    911             float64_eq_signaling, syst_float64_eq_signaling );
    912         break;
    913 #endif
    914 #ifdef SYST_FLOAT64_LE_QUIET
    915      case FLOAT64_LE_QUIET:
    916         test_ab_float64_z_flag( float64_le_quiet, syst_float64_le_quiet );
    917         break;
    918 #endif
    919 #ifdef SYST_FLOAT64_LT_QUIET
    920      case FLOAT64_LT_QUIET:
    921         test_ab_float64_z_flag( float64_lt_quiet, syst_float64_lt_quiet );
    922         break;
    923 #endif
    924 #ifdef SYST_FLOATX80_TO_INT32
    925      case FLOATX80_TO_INT32:
    926         test_a_floatx80_z_int32( floatx80_to_int32, syst_floatx80_to_int32 );
    927         break;
    928 #endif
    929 #ifdef SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
    930      case FLOATX80_TO_INT32_ROUND_TO_ZERO:
    931         test_a_floatx80_z_int32(
    932             floatx80_to_int32_round_to_zero,
    933             syst_floatx80_to_int32_round_to_zero
    934         );
    935         break;
    936 #endif
    937 #ifdef SYST_FLOATX80_TO_INT64
    938      case FLOATX80_TO_INT64:
    939         test_a_floatx80_z_int64( floatx80_to_int64, syst_floatx80_to_int64 );
    940         break;
    941 #endif
    942 #ifdef SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
    943      case FLOATX80_TO_INT64_ROUND_TO_ZERO:
    944         test_a_floatx80_z_int64(
    945             floatx80_to_int64_round_to_zero,
    946             syst_floatx80_to_int64_round_to_zero
    947         );
    948         break;
    949 #endif
    950 #ifdef SYST_FLOATX80_TO_FLOAT32
    951      case FLOATX80_TO_FLOAT32:
    952         test_a_floatx80_z_float32(
    953             floatx80_to_float32, syst_floatx80_to_float32 );
    954         break;
    955 #endif
    956 #ifdef SYST_FLOATX80_TO_FLOAT64
    957      case FLOATX80_TO_FLOAT64:
    958         test_a_floatx80_z_float64(
    959             floatx80_to_float64, syst_floatx80_to_float64 );
    960         break;
    961 #endif
    962 #ifdef SYST_FLOATX80_TO_FLOAT128
    963      case FLOATX80_TO_FLOAT128:
    964         test_a_floatx80_z_float128(
    965             floatx80_to_float128, syst_floatx80_to_float128 );
    966         break;
    967 #endif
    968 #ifdef SYST_FLOATX80_ROUND_TO_INT
    969      case FLOATX80_ROUND_TO_INT:
    970         test_az_floatx80( floatx80_round_to_int, syst_floatx80_round_to_int );
    971         break;
    972 #endif
    973 #ifdef SYST_FLOATX80_ADD
    974      case FLOATX80_ADD:
    975         test_abz_floatx80( floatx80_add, syst_floatx80_add );
    976         break;
    977 #endif
    978 #ifdef SYST_FLOATX80_SUB
    979      case FLOATX80_SUB:
    980         test_abz_floatx80( floatx80_sub, syst_floatx80_sub );
    981         break;
    982 #endif
    983 #ifdef SYST_FLOATX80_MUL
    984      case FLOATX80_MUL:
    985         test_abz_floatx80( floatx80_mul, syst_floatx80_mul );
    986         break;
    987 #endif
    988 #ifdef SYST_FLOATX80_DIV
    989      case FLOATX80_DIV:
    990         test_abz_floatx80( floatx80_div, syst_floatx80_div );
    991         break;
    992 #endif
    993 #ifdef SYST_FLOATX80_REM
    994      case FLOATX80_REM:
    995         test_abz_floatx80( floatx80_rem, syst_floatx80_rem );
    996         break;
    997 #endif
    998 #ifdef SYST_FLOATX80_SQRT
    999      case FLOATX80_SQRT:
   1000         test_az_floatx80( floatx80_sqrt, syst_floatx80_sqrt );
   1001         break;
   1002 #endif
   1003 #ifdef SYST_FLOATX80_EQ
   1004      case FLOATX80_EQ:
   1005         test_ab_floatx80_z_flag( floatx80_eq, syst_floatx80_eq );
   1006         break;
   1007 #endif
   1008 #ifdef SYST_FLOATX80_LE
   1009      case FLOATX80_LE:
   1010         test_ab_floatx80_z_flag( floatx80_le, syst_floatx80_le );
   1011         break;
   1012 #endif
   1013 #ifdef SYST_FLOATX80_LT
   1014      case FLOATX80_LT:
   1015         test_ab_floatx80_z_flag( floatx80_lt, syst_floatx80_lt );
   1016         break;
   1017 #endif
   1018 #ifdef SYST_FLOATX80_EQ_SIGNALING
   1019      case FLOATX80_EQ_SIGNALING:
   1020         test_ab_floatx80_z_flag(
   1021             floatx80_eq_signaling, syst_floatx80_eq_signaling );
   1022         break;
   1023 #endif
   1024 #ifdef SYST_FLOATX80_LE_QUIET
   1025      case FLOATX80_LE_QUIET:
   1026         test_ab_floatx80_z_flag( floatx80_le_quiet, syst_floatx80_le_quiet );
   1027         break;
   1028 #endif
   1029 #ifdef SYST_FLOATX80_LT_QUIET
   1030      case FLOATX80_LT_QUIET:
   1031         test_ab_floatx80_z_flag( floatx80_lt_quiet, syst_floatx80_lt_quiet );
   1032         break;
   1033 #endif
   1034 #ifdef SYST_FLOAT128_TO_INT32
   1035      case FLOAT128_TO_INT32:
   1036         test_a_float128_z_int32( float128_to_int32, syst_float128_to_int32 );
   1037         break;
   1038 #endif
   1039 #ifdef SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
   1040      case FLOAT128_TO_INT32_ROUND_TO_ZERO:
   1041         test_a_float128_z_int32(
   1042             float128_to_int32_round_to_zero,
   1043             syst_float128_to_int32_round_to_zero
   1044         );
   1045         break;
   1046 #endif
   1047 #ifdef SYST_FLOAT128_TO_INT64
   1048      case FLOAT128_TO_INT64:
   1049         test_a_float128_z_int64( float128_to_int64, syst_float128_to_int64 );
   1050         break;
   1051 #endif
   1052 #ifdef SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
   1053      case FLOAT128_TO_INT64_ROUND_TO_ZERO:
   1054         test_a_float128_z_int64(
   1055             float128_to_int64_round_to_zero,
   1056             syst_float128_to_int64_round_to_zero
   1057         );
   1058         break;
   1059 #endif
   1060 #ifdef SYST_FLOAT128_TO_FLOAT32
   1061      case FLOAT128_TO_FLOAT32:
   1062         test_a_float128_z_float32(
   1063             float128_to_float32, syst_float128_to_float32 );
   1064         break;
   1065 #endif
   1066 #ifdef SYST_FLOAT128_TO_FLOAT64
   1067      case FLOAT128_TO_FLOAT64:
   1068         test_a_float128_z_float64(
   1069             float128_to_float64, syst_float128_to_float64 );
   1070         break;
   1071 #endif
   1072 #ifdef SYST_FLOAT128_TO_FLOATX80
   1073      case FLOAT128_TO_FLOATX80:
   1074         test_a_float128_z_floatx80(
   1075             float128_to_floatx80, syst_float128_to_floatx80 );
   1076         break;
   1077 #endif
   1078 #ifdef SYST_FLOAT128_ROUND_TO_INT
   1079      case FLOAT128_ROUND_TO_INT:
   1080         test_az_float128( float128_round_to_int, syst_float128_round_to_int );
   1081         break;
   1082 #endif
   1083 #ifdef SYST_FLOAT128_ADD
   1084      case FLOAT128_ADD:
   1085         test_abz_float128( float128_add, syst_float128_add );
   1086         break;
   1087 #endif
   1088 #ifdef SYST_FLOAT128_SUB
   1089      case FLOAT128_SUB:
   1090         test_abz_float128( float128_sub, syst_float128_sub );
   1091         break;
   1092 #endif
   1093 #ifdef SYST_FLOAT128_MUL
   1094      case FLOAT128_MUL:
   1095         test_abz_float128( float128_mul, syst_float128_mul );
   1096         break;
   1097 #endif
   1098 #ifdef SYST_FLOAT128_DIV
   1099      case FLOAT128_DIV:
   1100         test_abz_float128( float128_div, syst_float128_div );
   1101         break;
   1102 #endif
   1103 #ifdef SYST_FLOAT128_REM
   1104      case FLOAT128_REM:
   1105         test_abz_float128( float128_rem, syst_float128_rem );
   1106         break;
   1107 #endif
   1108 #ifdef SYST_FLOAT128_SQRT
   1109      case FLOAT128_SQRT:
   1110         test_az_float128( float128_sqrt, syst_float128_sqrt );
   1111         break;
   1112 #endif
   1113 #ifdef SYST_FLOAT128_EQ
   1114      case FLOAT128_EQ:
   1115         test_ab_float128_z_flag( float128_eq, syst_float128_eq );
   1116         break;
   1117 #endif
   1118 #ifdef SYST_FLOAT128_LE
   1119      case FLOAT128_LE:
   1120         test_ab_float128_z_flag( float128_le, syst_float128_le );
   1121         break;
   1122 #endif
   1123 #ifdef SYST_FLOAT128_LT
   1124      case FLOAT128_LT:
   1125         test_ab_float128_z_flag( float128_lt, syst_float128_lt );
   1126         break;
   1127 #endif
   1128 #ifdef SYST_FLOAT128_EQ_SIGNALING
   1129      case FLOAT128_EQ_SIGNALING:
   1130         test_ab_float128_z_flag(
   1131             float128_eq_signaling, syst_float128_eq_signaling );
   1132         break;
   1133 #endif
   1134 #ifdef SYST_FLOAT128_LE_QUIET
   1135      case FLOAT128_LE_QUIET:
   1136         test_ab_float128_z_flag( float128_le_quiet, syst_float128_le_quiet );
   1137         break;
   1138 #endif
   1139 #ifdef SYST_FLOAT128_LT_QUIET
   1140      case FLOAT128_LT_QUIET:
   1141         test_ab_float128_z_flag( float128_lt_quiet, syst_float128_lt_quiet );
   1142         break;
   1143 #endif
   1144     }
   1145     if ( ( errorStop && anyErrors ) || stop ) exitWithStatus();
   1146 
   1147 }
   1148 
   1149 void
   1150  testFunction(
   1151      uint8 functionCode, int8 roundingPrecisionIn, int8 roundingModeIn )
   1152 {
   1153     int8 roundingPrecision, roundingMode;
   1154 
   1155     roundingPrecision = 32;
   1156     for (;;) {
   1157         if ( ! functions[ functionCode ].roundingPrecision ) {
   1158             roundingPrecision = 0;
   1159         }
   1160         else if ( roundingPrecisionIn ) {
   1161             roundingPrecision = roundingPrecisionIn;
   1162         }
   1163         for ( roundingMode = 1;
   1164               roundingMode < NUM_ROUNDINGMODES;
   1165               ++roundingMode
   1166             ) {
   1167             if ( ! functions[ functionCode ].roundingMode ) {
   1168                 roundingMode = 0;
   1169             }
   1170             else if ( roundingModeIn ) {
   1171                 roundingMode = roundingModeIn;
   1172             }
   1173             testFunctionVariety(
   1174                 functionCode, roundingPrecision, roundingMode );
   1175             if ( roundingModeIn || ! roundingMode ) break;
   1176         }
   1177         if ( roundingPrecisionIn || ! roundingPrecision ) break;
   1178         if ( roundingPrecision == 80 ) {
   1179             break;
   1180         }
   1181         else if ( roundingPrecision == 64 ) {
   1182             roundingPrecision = 80;
   1183         }
   1184         else if ( roundingPrecision == 32 ) {
   1185             roundingPrecision = 64;
   1186         }
   1187     }
   1188 
   1189 }
   1190 
   1191