diff options
Diffstat (limited to 'src/libs/softfloat-3e/testfloat/source')
177 files changed, 47516 insertions, 0 deletions
diff --git a/src/libs/softfloat-3e/testfloat/source/fail.c b/src/libs/softfloat-3e/testfloat/source/fail.c new file mode 100644 index 00000000..f68e941f --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/fail.c @@ -0,0 +1,59 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdarg.h> +#include <stdlib.h> +#include <stdio.h> +#include "platform.h" +#include "fail.h" + +char *fail_programName = ""; + +void fail( const char *messagePtr, ... ) +{ + va_list varArgs; + + fflush( 0 ); + fprintf( stderr, "%s: ", fail_programName ); + va_start( varArgs, messagePtr ); + vfprintf( stderr, messagePtr, varArgs ); + va_end( varArgs ); + fputs( ".\n", stderr ); + exit( EXIT_FAILURE ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/fail.h b/src/libs/softfloat-3e/testfloat/source/fail.h new file mode 100644 index 00000000..e981473c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/fail.h @@ -0,0 +1,41 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +extern char *fail_programName; + +void fail( const char *, ... ); + diff --git a/src/libs/softfloat-3e/testfloat/source/functionInfos.c b/src/libs/softfloat-3e/testfloat/source/functionInfos.c new file mode 100644 index 00000000..8e401068 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/functionInfos.c @@ -0,0 +1,290 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include "platform.h" +#include "functions.h" + +#define ARG_1 FUNC_ARG_UNARY +#define ARG_2 FUNC_ARG_BINARY +#define ARG_R FUNC_ARG_ROUNDINGMODE +#define ARG_E FUNC_ARG_EXACT +#define EFF_P FUNC_EFF_ROUNDINGPRECISION +#define EFF_R FUNC_EFF_ROUNDINGMODE +#define EFF_T FUNC_EFF_TININESSMODE +#define EFF_T_REDP FUNC_EFF_TININESSMODE_REDUCEDPREC + +/*---------------------------------------------------------------------------- +| Warning: This array must match the list of macros defined in "functions.h". +*----------------------------------------------------------------------------*/ +const struct functionInfo functionInfos[NUM_FUNCTIONS] = { + { 0, 0 }, + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT16 + { "ui32_to_f16", ARG_1 | EFF_R }, +#endif + { "ui32_to_f32", ARG_1 | EFF_R }, +#ifdef FLOAT64 + { "ui32_to_f64", ARG_1 }, +#endif +#ifdef EXTFLOAT80 + { "ui32_to_extF80", ARG_1 }, +#endif +#ifdef FLOAT128 + { "ui32_to_f128", ARG_1 }, +#endif +#ifdef FLOAT16 + { "ui64_to_f16", ARG_1 | EFF_R }, +#endif + { "ui64_to_f32", ARG_1 | EFF_R }, +#ifdef FLOAT64 + { "ui64_to_f64", ARG_1 | EFF_R }, +#endif +#ifdef EXTFLOAT80 + { "ui64_to_extF80", ARG_1 }, +#endif +#ifdef FLOAT128 + { "ui64_to_f128", ARG_1 }, +#endif +#ifdef FLOAT16 + { "i32_to_f16", ARG_1 | EFF_R }, +#endif + { "i32_to_f32", ARG_1 | EFF_R }, +#ifdef FLOAT64 + { "i32_to_f64", ARG_1 }, +#endif +#ifdef EXTFLOAT80 + { "i32_to_extF80", ARG_1 }, +#endif +#ifdef FLOAT128 + { "i32_to_f128", ARG_1 }, +#endif +#ifdef FLOAT16 + { "i64_to_f16", ARG_1 | EFF_R }, +#endif + { "i64_to_f32", ARG_1 | EFF_R }, +#ifdef FLOAT64 + { "i64_to_f64", ARG_1 | EFF_R }, +#endif +#ifdef EXTFLOAT80 + { "i64_to_extF80", ARG_1 }, +#endif +#ifdef FLOAT128 + { "i64_to_f128", ARG_1 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT16 + { "f16_to_ui32", ARG_1 | ARG_R | ARG_E }, + { "f16_to_ui64", ARG_1 | ARG_R | ARG_E }, + { "f16_to_i32", ARG_1 | ARG_R | ARG_E }, + { "f16_to_i64", ARG_1 | ARG_R | ARG_E }, + { "f16_to_ui32_r_minMag", ARG_1 | ARG_E }, + { "f16_to_ui64_r_minMag", ARG_1 | ARG_E }, + { "f16_to_i32_r_minMag", ARG_1 | ARG_E }, + { "f16_to_i64_r_minMag", ARG_1 | ARG_E }, + { "f16_to_f32", ARG_1 }, +#ifdef FLOAT64 + { "f16_to_f64", ARG_1 }, +#endif +#ifdef EXTFLOAT80 + { "f16_to_extF80", ARG_1 }, +#endif +#ifdef FLOAT128 + { "f16_to_f128", ARG_1 }, +#endif + { "f16_roundToInt", ARG_1 | ARG_R | ARG_E }, + { "f16_add", ARG_2 | EFF_R }, + { "f16_sub", ARG_2 | EFF_R }, + { "f16_mul", ARG_2 | EFF_R | EFF_T }, + { "f16_mulAdd", EFF_R | EFF_T }, + { "f16_div", ARG_2 | EFF_R }, + { "f16_rem", ARG_2 }, + { "f16_sqrt", ARG_1 | EFF_R }, + { "f16_eq", ARG_2 }, + { "f16_le", ARG_2 }, + { "f16_lt", ARG_2 }, + { "f16_eq_signaling", ARG_2 }, + { "f16_le_quiet", ARG_2 }, + { "f16_lt_quiet", ARG_2 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + { "f32_to_ui32", ARG_1 | ARG_R | ARG_E }, + { "f32_to_ui64", ARG_1 | ARG_R | ARG_E }, + { "f32_to_i32", ARG_1 | ARG_R | ARG_E }, + { "f32_to_i64", ARG_1 | ARG_R | ARG_E }, + { "f32_to_ui32_r_minMag", ARG_1 | ARG_E }, + { "f32_to_ui64_r_minMag", ARG_1 | ARG_E }, + { "f32_to_i32_r_minMag", ARG_1 | ARG_E }, + { "f32_to_i64_r_minMag", ARG_1 | ARG_E }, +#ifdef FLOAT16 + { "f32_to_f16", ARG_1 | EFF_R | EFF_T }, +#endif +#ifdef FLOAT64 + { "f32_to_f64", ARG_1 }, +#endif +#ifdef EXTFLOAT80 + { "f32_to_extF80", ARG_1 }, +#endif +#ifdef FLOAT128 + { "f32_to_f128", ARG_1 }, +#endif + { "f32_roundToInt", ARG_1 | ARG_R | ARG_E }, + { "f32_add", ARG_2 | EFF_R }, + { "f32_sub", ARG_2 | EFF_R }, + { "f32_mul", ARG_2 | EFF_R | EFF_T }, + { "f32_mulAdd", EFF_R | EFF_T }, + { "f32_div", ARG_2 | EFF_R }, + { "f32_rem", ARG_2 }, + { "f32_sqrt", ARG_1 | EFF_R }, + { "f32_eq", ARG_2 }, + { "f32_le", ARG_2 }, + { "f32_lt", ARG_2 }, + { "f32_eq_signaling", ARG_2 }, + { "f32_le_quiet", ARG_2 }, + { "f32_lt_quiet", ARG_2 }, + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT64 + { "f64_to_ui32", ARG_1 | ARG_R | ARG_E }, + { "f64_to_ui64", ARG_1 | ARG_R | ARG_E }, + { "f64_to_i32", ARG_1 | ARG_R | ARG_E }, + { "f64_to_i64", ARG_1 | ARG_R | ARG_E }, + { "f64_to_ui32_r_minMag", ARG_1 | ARG_E }, + { "f64_to_ui64_r_minMag", ARG_1 | ARG_E }, + { "f64_to_i32_r_minMag", ARG_1 | ARG_E }, + { "f64_to_i64_r_minMag", ARG_1 | ARG_E }, +#ifdef FLOAT16 + { "f64_to_f16", ARG_1 | EFF_R | EFF_T }, +#endif + { "f64_to_f32", ARG_1 | EFF_R | EFF_T }, +#ifdef EXTFLOAT80 + { "f64_to_extF80", ARG_1 }, +#endif +#ifdef FLOAT128 + { "f64_to_f128", ARG_1 }, +#endif + { "f64_roundToInt", ARG_1 | ARG_R | ARG_E }, + { "f64_add", ARG_2 | EFF_R }, + { "f64_sub", ARG_2 | EFF_R }, + { "f64_mul", ARG_2 | EFF_R | EFF_T }, + { "f64_mulAdd", EFF_R | EFF_T }, + { "f64_div", ARG_2 | EFF_R }, + { "f64_rem", ARG_2 }, + { "f64_sqrt", ARG_1 | EFF_R }, + { "f64_eq", ARG_2 }, + { "f64_le", ARG_2 }, + { "f64_lt", ARG_2 }, + { "f64_eq_signaling", ARG_2 }, + { "f64_le_quiet", ARG_2 }, + { "f64_lt_quiet", ARG_2 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + { "extF80_to_ui32", ARG_1 | ARG_R | ARG_E }, + { "extF80_to_ui64", ARG_1 | ARG_R | ARG_E }, + { "extF80_to_i32", ARG_1 | ARG_R | ARG_E }, + { "extF80_to_i64", ARG_1 | ARG_R | ARG_E }, + { "extF80_to_ui32_r_minMag", ARG_1 | ARG_E }, + { "extF80_to_ui64_r_minMag", ARG_1 | ARG_E }, + { "extF80_to_i32_r_minMag", ARG_1 | ARG_E }, + { "extF80_to_i64_r_minMag", ARG_1 | ARG_E }, +#ifdef FLOAT16 + { "extF80_to_f16", ARG_1 | EFF_R | EFF_T }, +#endif + { "extF80_to_f32", ARG_1 | EFF_R | EFF_T }, +#ifdef FLOAT64 + { "extF80_to_f64", ARG_1 | EFF_R | EFF_T }, +#endif +#ifdef FLOAT128 + { "extF80_to_f128", ARG_1 }, +#endif + { "extF80_roundToInt", ARG_1 | ARG_R | ARG_E }, + { "extF80_add", ARG_2 | EFF_P | EFF_R | EFF_T_REDP }, + { "extF80_sub", ARG_2 | EFF_P | EFF_R | EFF_T_REDP }, + { "extF80_mul", ARG_2 | EFF_P | EFF_R | EFF_T | EFF_T_REDP }, + { "extF80_div", ARG_2 | EFF_P | EFF_R | EFF_T_REDP }, + { "extF80_rem", ARG_2 }, + { "extF80_sqrt", ARG_1 | EFF_P | EFF_R }, + { "extF80_eq", ARG_2 }, + { "extF80_le", ARG_2 }, + { "extF80_lt", ARG_2 }, + { "extF80_eq_signaling", ARG_2 }, + { "extF80_le_quiet", ARG_2 }, + { "extF80_lt_quiet", ARG_2 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT128 + { "f128_to_ui32", ARG_1 | ARG_R | ARG_E }, + { "f128_to_ui64", ARG_1 | ARG_R | ARG_E }, + { "f128_to_i32", ARG_1 | ARG_R | ARG_E }, + { "f128_to_i64", ARG_1 | ARG_R | ARG_E }, + { "f128_to_ui32_r_minMag", ARG_1 | ARG_E }, + { "f128_to_ui64_r_minMag", ARG_1 | ARG_E }, + { "f128_to_i32_r_minMag", ARG_1 | ARG_E }, + { "f128_to_i64_r_minMag", ARG_1 | ARG_E }, +#ifdef FLOAT16 + { "f128_to_f16", ARG_1 | EFF_R | EFF_T }, +#endif + { "f128_to_f32", ARG_1 | EFF_R | EFF_T }, +#ifdef FLOAT64 + { "f128_to_f64", ARG_1 | EFF_R | EFF_T }, +#endif +#ifdef EXTFLOAT80 + { "f128_to_extF80", ARG_1 | EFF_R | EFF_T }, +#endif + { "f128_roundToInt", ARG_1 | ARG_R | ARG_E }, + { "f128_add", ARG_2 | EFF_R }, + { "f128_sub", ARG_2 | EFF_R }, + { "f128_mul", ARG_2 | EFF_R | EFF_T }, + { "f128_mulAdd", EFF_R | EFF_T }, + { "f128_div", ARG_2 | EFF_R }, + { "f128_rem", ARG_2 }, + { "f128_sqrt", ARG_1 | EFF_R }, + { "f128_eq", ARG_2 }, + { "f128_le", ARG_2 }, + { "f128_lt", ARG_2 }, + { "f128_eq_signaling", ARG_2 }, + { "f128_le_quiet", ARG_2 }, + { "f128_lt_quiet", ARG_2 }, +#endif +}; + diff --git a/src/libs/softfloat-3e/testfloat/source/functions.h b/src/libs/softfloat-3e/testfloat/source/functions.h new file mode 100644 index 00000000..ee66bbd2 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/functions.h @@ -0,0 +1,324 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> + +/*---------------------------------------------------------------------------- +| Warning: This list must match the contents of "functionInfos.c". +*----------------------------------------------------------------------------*/ +enum { + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT16 + UI32_TO_F16 = 1, + UI32_TO_F32, +#else + UI32_TO_F32 = 1, +#endif +#ifdef FLOAT64 + UI32_TO_F64, +#endif +#ifdef EXTFLOAT80 + UI32_TO_EXTF80, +#endif +#ifdef FLOAT128 + UI32_TO_F128, +#endif +#ifdef FLOAT16 + UI64_TO_F16, +#endif + UI64_TO_F32, +#ifdef FLOAT64 + UI64_TO_F64, +#endif +#ifdef EXTFLOAT80 + UI64_TO_EXTF80, +#endif +#ifdef FLOAT128 + UI64_TO_F128, +#endif +#ifdef FLOAT16 + I32_TO_F16, +#endif + I32_TO_F32, +#ifdef FLOAT64 + I32_TO_F64, +#endif +#ifdef EXTFLOAT80 + I32_TO_EXTF80, +#endif +#ifdef FLOAT128 + I32_TO_F128, +#endif +#ifdef FLOAT16 + I64_TO_F16, +#endif + I64_TO_F32, +#ifdef FLOAT64 + I64_TO_F64, +#endif +#ifdef EXTFLOAT80 + I64_TO_EXTF80, +#endif +#ifdef FLOAT128 + I64_TO_F128, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT16 + F16_TO_UI32, + F16_TO_UI64, + F16_TO_I32, + F16_TO_I64, + F16_TO_UI32_R_MINMAG, + F16_TO_UI64_R_MINMAG, + F16_TO_I32_R_MINMAG, + F16_TO_I64_R_MINMAG, + F16_TO_F32, +#ifdef FLOAT64 + F16_TO_F64, +#endif +#ifdef EXTFLOAT80 + F16_TO_EXTF80, +#endif +#ifdef FLOAT128 + F16_TO_F128, +#endif + F16_ROUNDTOINT, + F16_ADD, + F16_SUB, + F16_MUL, + F16_MULADD, + F16_DIV, + F16_REM, + F16_SQRT, + F16_EQ, + F16_LE, + F16_LT, + F16_EQ_SIGNALING, + F16_LE_QUIET, + F16_LT_QUIET, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + F32_TO_UI32, + F32_TO_UI64, + F32_TO_I32, + F32_TO_I64, + F32_TO_UI32_R_MINMAG, + F32_TO_UI64_R_MINMAG, + F32_TO_I32_R_MINMAG, + F32_TO_I64_R_MINMAG, +#ifdef FLOAT16 + F32_TO_F16, +#endif +#ifdef FLOAT64 + F32_TO_F64, +#endif +#ifdef EXTFLOAT80 + F32_TO_EXTF80, +#endif +#ifdef FLOAT128 + F32_TO_F128, +#endif + F32_ROUNDTOINT, + F32_ADD, + F32_SUB, + F32_MUL, + F32_MULADD, + F32_DIV, + F32_REM, + F32_SQRT, + F32_EQ, + F32_LE, + F32_LT, + F32_EQ_SIGNALING, + F32_LE_QUIET, + F32_LT_QUIET, + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT64 + F64_TO_UI32, + F64_TO_UI64, + F64_TO_I32, + F64_TO_I64, + F64_TO_UI32_R_MINMAG, + F64_TO_UI64_R_MINMAG, + F64_TO_I32_R_MINMAG, + F64_TO_I64_R_MINMAG, +#ifdef FLOAT16 + F64_TO_F16, +#endif + F64_TO_F32, +#ifdef EXTFLOAT80 + F64_TO_EXTF80, +#endif +#ifdef FLOAT128 + F64_TO_F128, +#endif + F64_ROUNDTOINT, + F64_ADD, + F64_SUB, + F64_MUL, + F64_MULADD, + F64_DIV, + F64_REM, + F64_SQRT, + F64_EQ, + F64_LE, + F64_LT, + F64_EQ_SIGNALING, + F64_LE_QUIET, + F64_LT_QUIET, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + EXTF80_TO_UI32, + EXTF80_TO_UI64, + EXTF80_TO_I32, + EXTF80_TO_I64, + EXTF80_TO_UI32_R_MINMAG, + EXTF80_TO_UI64_R_MINMAG, + EXTF80_TO_I32_R_MINMAG, + EXTF80_TO_I64_R_MINMAG, +#ifdef FLOAT16 + EXTF80_TO_F16, +#endif + EXTF80_TO_F32, +#ifdef FLOAT64 + EXTF80_TO_F64, +#endif +#ifdef FLOAT128 + EXTF80_TO_F128, +#endif + EXTF80_ROUNDTOINT, + EXTF80_ADD, + EXTF80_SUB, + EXTF80_MUL, + EXTF80_DIV, + EXTF80_REM, + EXTF80_SQRT, + EXTF80_EQ, + EXTF80_LE, + EXTF80_LT, + EXTF80_EQ_SIGNALING, + EXTF80_LE_QUIET, + EXTF80_LT_QUIET, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT128 + F128_TO_UI32, + F128_TO_UI64, + F128_TO_I32, + F128_TO_I64, + F128_TO_UI32_R_MINMAG, + F128_TO_UI64_R_MINMAG, + F128_TO_I32_R_MINMAG, + F128_TO_I64_R_MINMAG, +#ifdef FLOAT16 + F128_TO_F16, +#endif + F128_TO_F32, +#ifdef FLOAT64 + F128_TO_F64, +#endif +#ifdef EXTFLOAT80 + F128_TO_EXTF80, +#endif + F128_ROUNDTOINT, + F128_ADD, + F128_SUB, + F128_MUL, + F128_MULADD, + F128_DIV, + F128_REM, + F128_SQRT, + F128_EQ, + F128_LE, + F128_LT, + F128_EQ_SIGNALING, + F128_LE_QUIET, + F128_LT_QUIET, +#endif + NUM_FUNCTIONS +}; + +enum { + ROUND_NEAR_EVEN = 1, + ROUND_MINMAG, + ROUND_MIN, + ROUND_MAX, + ROUND_NEAR_MAXMAG, +#ifdef FLOAT_ROUND_ODD + ROUND_ODD, +#endif + NUM_ROUNDINGMODES +}; +enum { + TININESS_BEFORE_ROUNDING = 1, + TININESS_AFTER_ROUNDING, + NUM_TININESSMODES +}; + +extern const uint_fast8_t roundingModes[NUM_ROUNDINGMODES]; +extern const uint_fast8_t tininessModes[NUM_TININESSMODES]; + +enum { + FUNC_ARG_UNARY = 0x01, + FUNC_ARG_BINARY = 0x02, + FUNC_ARG_ROUNDINGMODE = 0x04, + FUNC_ARG_EXACT = 0x08, + FUNC_EFF_ROUNDINGPRECISION = 0x10, + FUNC_EFF_ROUNDINGMODE = 0x20, + FUNC_EFF_TININESSMODE = 0x40, + FUNC_EFF_TININESSMODE_REDUCEDPREC = 0x80 +}; +struct functionInfo { + const char *namePtr; + unsigned char attribs; +}; +extern const struct functionInfo functionInfos[NUM_FUNCTIONS]; + +struct standardFunctionInfo { + const char *namePtr; + unsigned char functionCode; + char roundingCode, exact; +}; +extern const struct standardFunctionInfo standardFunctionInfos[]; + diff --git a/src/libs/softfloat-3e/testfloat/source/functions_common.c b/src/libs/softfloat-3e/testfloat/source/functions_common.c new file mode 100644 index 00000000..71bcde3a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/functions_common.c @@ -0,0 +1,60 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "functions.h" + +const uint_fast8_t roundingModes[NUM_ROUNDINGMODES] = { + 0, + softfloat_round_near_even, + softfloat_round_minMag, + softfloat_round_min, + softfloat_round_max, + softfloat_round_near_maxMag, +#ifdef FLOAT_ROUND_ODD + softfloat_round_odd +#endif +}; + +const uint_fast8_t tininessModes[NUM_TININESSMODES] = { + 0, + softfloat_tininess_beforeRounding, + softfloat_tininess_afterRounding +}; + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases.h b/src/libs/softfloat-3e/testfloat/source/genCases.h new file mode 100644 index 00000000..e7100918 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases.h @@ -0,0 +1,114 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "softfloat.h" + +extern int genCases_level; + +void genCases_setLevel( int ); + +extern uint_fast64_t genCases_total; +extern bool genCases_done; + +void genCases_ui32_a_init( void ); +void genCases_ui32_a_next( void ); +extern uint32_t genCases_ui32_a; + +void genCases_ui64_a_init( void ); +void genCases_ui64_a_next( void ); +extern uint64_t genCases_ui64_a; + +void genCases_i32_a_init( void ); +void genCases_i32_a_next( void ); +extern int32_t genCases_i32_a; + +void genCases_i64_a_init( void ); +void genCases_i64_a_next( void ); +extern int64_t genCases_i64_a; + +#ifdef FLOAT16 +void genCases_f16_a_init( void ); +void genCases_f16_a_next( void ); +void genCases_f16_ab_init( void ); +void genCases_f16_ab_next( void ); +void genCases_f16_abc_init( void ); +void genCases_f16_abc_next( void ); +extern float16_t genCases_f16_a, genCases_f16_b, genCases_f16_c; +#endif + +void genCases_f32_a_init( void ); +void genCases_f32_a_next( void ); +void genCases_f32_ab_init( void ); +void genCases_f32_ab_next( void ); +void genCases_f32_abc_init( void ); +void genCases_f32_abc_next( void ); +extern float32_t genCases_f32_a, genCases_f32_b, genCases_f32_c; + +#ifdef FLOAT64 +void genCases_f64_a_init( void ); +void genCases_f64_a_next( void ); +void genCases_f64_ab_init( void ); +void genCases_f64_ab_next( void ); +void genCases_f64_abc_init( void ); +void genCases_f64_abc_next( void ); +extern float64_t genCases_f64_a, genCases_f64_b, genCases_f64_c; +#endif + +#ifdef EXTFLOAT80 +void genCases_extF80_a_init( void ); +void genCases_extF80_a_next( void ); +void genCases_extF80_ab_init( void ); +void genCases_extF80_ab_next( void ); +void genCases_extF80_abc_init( void ); +void genCases_extF80_abc_next( void ); +extern extFloat80_t genCases_extF80_a, genCases_extF80_b, genCases_extF80_c; +#endif + +#ifdef FLOAT128 +void genCases_f128_a_init( void ); +void genCases_f128_a_next( void ); +void genCases_f128_ab_init( void ); +void genCases_f128_ab_next( void ); +void genCases_f128_abc_init( void ); +void genCases_f128_abc_next( void ); +extern float128_t genCases_f128_a, genCases_f128_b, genCases_f128_c; +#endif + +void genCases_writeTestsTotal( bool ); + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_common.c b/src/libs/softfloat-3e/testfloat/source/genCases_common.c new file mode 100644 index 00000000..b358b498 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_common.c @@ -0,0 +1,58 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "fail.h" +#include "genCases.h" + +int genCases_level = 0; + +void genCases_setLevel( int newLevel ) +{ + + if ( (newLevel < 1) || (2 < newLevel) ) { + fail( "Invalid testing level %d", newLevel ); + } + genCases_level = newLevel; + +} + +uint_fast64_t genCases_total; +bool genCases_done; + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_extF80.c b/src/libs/softfloat-3e/testfloat/source/genCases_extF80.c new file mode 100644 index 00000000..0e0109d1 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_extF80.c @@ -0,0 +1,920 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "random.h" +#include "softfloat.h" +#include "genCases.h" + +#ifdef EXTFLOAT80 + +struct sequence { + int expNum, term1Num, term2Num; + bool done; +}; + +enum { + extF80NumQIn = 22, + extF80NumQOut = 76, + extF80NumP1 = 4, + extF80NumP2 = 248 +}; +static const uint16_t extF80QIn[extF80NumQIn] = { + 0x0000, /* positive, subnormal */ + 0x0001, /* positive, -16382 */ + 0x3FBF, /* positive, -64 */ + 0x3FFD, /* positive, -2 */ + 0x3FFE, /* positive, -1 */ + 0x3FFF, /* positive, 0 */ + 0x4000, /* positive, 1 */ + 0x4001, /* positive, 2 */ + 0x403F, /* positive, 64 */ + 0x7FFE, /* positive, 16383 */ + 0x7FFF, /* positive, infinity or NaN */ + 0x8000, /* negative, subnormal */ + 0x8001, /* negative, -16382 */ + 0xBFBF, /* negative, -64 */ + 0xBFFD, /* negative, -2 */ + 0xBFFE, /* negative, -1 */ + 0xBFFF, /* negative, 0 */ + 0xC000, /* negative, 1 */ + 0xC001, /* negative, 2 */ + 0xC03F, /* negative, 64 */ + 0xFFFE, /* negative, 16383 */ + 0xFFFF /* negative, infinity or NaN */ +}; +static const uint16_t extF80QOut[extF80NumQOut] = { + 0x0000, /* positive, subnormal */ + 0x0001, /* positive, -16382 */ + 0x0002, /* positive, -16381 */ + 0x3BFE, /* positive, -1025 */ + 0x3BFF, /* positive, -1024 */ + 0x3C00, /* positive, -1023 */ + 0x3C01, /* positive, -1022 */ + 0x3F7E, /* positive, -129 */ + 0x3F7F, /* positive, -128 */ + 0x3F80, /* positive, -127 */ + 0x3F81, /* positive, -126 */ + 0x3FBF, /* positive, -64 */ + 0x3FFB, /* positive, -4 */ + 0x3FFC, /* positive, -3 */ + 0x3FFD, /* positive, -2 */ + 0x3FFE, /* positive, -1 */ + 0x3FFF, /* positive, 0 */ + 0x4000, /* positive, 1 */ + 0x4001, /* positive, 2 */ + 0x4002, /* positive, 3 */ + 0x4003, /* positive, 4 */ + 0x401C, /* positive, 29 */ + 0x401D, /* positive, 30 */ + 0x401E, /* positive, 31 */ + 0x401F, /* positive, 32 */ + 0x403C, /* positive, 61 */ + 0x403D, /* positive, 62 */ + 0x403E, /* positive, 63 */ + 0x403F, /* positive, 64 */ + 0x407E, /* positive, 127 */ + 0x407F, /* positive, 128 */ + 0x4080, /* positive, 129 */ + 0x43FE, /* positive, 1023 */ + 0x43FF, /* positive, 1024 */ + 0x4400, /* positive, 1025 */ + 0x7FFD, /* positive, 16382 */ + 0x7FFE, /* positive, 16383 */ + 0x7FFF, /* positive, infinity or NaN */ + 0x8000, /* negative, subnormal */ + 0x8001, /* negative, -16382 */ + 0x8002, /* negative, -16381 */ + 0xBBFE, /* negative, -1025 */ + 0xBBFF, /* negative, -1024 */ + 0xBC00, /* negative, -1023 */ + 0xBC01, /* negative, -1022 */ + 0xBF7E, /* negative, -129 */ + 0xBF7F, /* negative, -128 */ + 0xBF80, /* negative, -127 */ + 0xBF81, /* negative, -126 */ + 0xBFBF, /* negative, -64 */ + 0xBFFB, /* negative, -4 */ + 0xBFFC, /* negative, -3 */ + 0xBFFD, /* negative, -2 */ + 0xBFFE, /* negative, -1 */ + 0xBFFF, /* negative, 0 */ + 0xC000, /* negative, 1 */ + 0xC001, /* negative, 2 */ + 0xC002, /* negative, 3 */ + 0xC003, /* negative, 4 */ + 0xC01C, /* negative, 29 */ + 0xC01D, /* negative, 30 */ + 0xC01E, /* negative, 31 */ + 0xC01F, /* negative, 32 */ + 0xC03C, /* negative, 61 */ + 0xC03D, /* negative, 62 */ + 0xC03E, /* negative, 63 */ + 0xC03F, /* negative, 64 */ + 0xC07E, /* negative, 127 */ + 0xC07F, /* negative, 128 */ + 0xC080, /* negative, 129 */ + 0xC3FE, /* negative, 1023 */ + 0xC3FF, /* negative, 1024 */ + 0xC400, /* negative, 1025 */ + 0xFFFD, /* negative, 16382 */ + 0xFFFE, /* negative, 16383 */ + 0xFFFF /* negative, infinity or NaN */ +}; +static const uint64_t extF80P1[extF80NumP1] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x0000000000000001 ), + UINT64_C( 0x7FFFFFFFFFFFFFFF ), + UINT64_C( 0x7FFFFFFFFFFFFFFE ) +}; +static const uint64_t extF80P2[extF80NumP2] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x0000000000000001 ), + UINT64_C( 0x0000000000000002 ), + UINT64_C( 0x0000000000000004 ), + UINT64_C( 0x0000000000000008 ), + UINT64_C( 0x0000000000000010 ), + UINT64_C( 0x0000000000000020 ), + UINT64_C( 0x0000000000000040 ), + UINT64_C( 0x0000000000000080 ), + UINT64_C( 0x0000000000000100 ), + UINT64_C( 0x0000000000000200 ), + UINT64_C( 0x0000000000000400 ), + UINT64_C( 0x0000000000000800 ), + UINT64_C( 0x0000000000001000 ), + UINT64_C( 0x0000000000002000 ), + UINT64_C( 0x0000000000004000 ), + UINT64_C( 0x0000000000008000 ), + UINT64_C( 0x0000000000010000 ), + UINT64_C( 0x0000000000020000 ), + UINT64_C( 0x0000000000040000 ), + UINT64_C( 0x0000000000080000 ), + UINT64_C( 0x0000000000100000 ), + UINT64_C( 0x0000000000200000 ), + UINT64_C( 0x0000000000400000 ), + UINT64_C( 0x0000000000800000 ), + UINT64_C( 0x0000000001000000 ), + UINT64_C( 0x0000000002000000 ), + UINT64_C( 0x0000000004000000 ), + UINT64_C( 0x0000000008000000 ), + UINT64_C( 0x0000000010000000 ), + UINT64_C( 0x0000000020000000 ), + UINT64_C( 0x0000000040000000 ), + UINT64_C( 0x0000000080000000 ), + UINT64_C( 0x0000000100000000 ), + UINT64_C( 0x0000000200000000 ), + UINT64_C( 0x0000000400000000 ), + UINT64_C( 0x0000000800000000 ), + UINT64_C( 0x0000001000000000 ), + UINT64_C( 0x0000002000000000 ), + UINT64_C( 0x0000004000000000 ), + UINT64_C( 0x0000008000000000 ), + UINT64_C( 0x0000010000000000 ), + UINT64_C( 0x0000020000000000 ), + UINT64_C( 0x0000040000000000 ), + UINT64_C( 0x0000080000000000 ), + UINT64_C( 0x0000100000000000 ), + UINT64_C( 0x0000200000000000 ), + UINT64_C( 0x0000400000000000 ), + UINT64_C( 0x0000800000000000 ), + UINT64_C( 0x0001000000000000 ), + UINT64_C( 0x0002000000000000 ), + UINT64_C( 0x0004000000000000 ), + UINT64_C( 0x0008000000000000 ), + UINT64_C( 0x0010000000000000 ), + UINT64_C( 0x0020000000000000 ), + UINT64_C( 0x0040000000000000 ), + UINT64_C( 0x0080000000000000 ), + UINT64_C( 0x0100000000000000 ), + UINT64_C( 0x0200000000000000 ), + UINT64_C( 0x0400000000000000 ), + UINT64_C( 0x0800000000000000 ), + UINT64_C( 0x1000000000000000 ), + UINT64_C( 0x2000000000000000 ), + UINT64_C( 0x4000000000000000 ), + UINT64_C( 0x6000000000000000 ), + UINT64_C( 0x7000000000000000 ), + UINT64_C( 0x7800000000000000 ), + UINT64_C( 0x7C00000000000000 ), + UINT64_C( 0x7E00000000000000 ), + UINT64_C( 0x7F00000000000000 ), + UINT64_C( 0x7F80000000000000 ), + UINT64_C( 0x7FC0000000000000 ), + UINT64_C( 0x7FE0000000000000 ), + UINT64_C( 0x7FF0000000000000 ), + UINT64_C( 0x7FF8000000000000 ), + UINT64_C( 0x7FFC000000000000 ), + UINT64_C( 0x7FFE000000000000 ), + UINT64_C( 0x7FFF000000000000 ), + UINT64_C( 0x7FFF800000000000 ), + UINT64_C( 0x7FFFC00000000000 ), + UINT64_C( 0x7FFFE00000000000 ), + UINT64_C( 0x7FFFF00000000000 ), + UINT64_C( 0x7FFFF80000000000 ), + UINT64_C( 0x7FFFFC0000000000 ), + UINT64_C( 0x7FFFFE0000000000 ), + UINT64_C( 0x7FFFFF0000000000 ), + UINT64_C( 0x7FFFFF8000000000 ), + UINT64_C( 0x7FFFFFC000000000 ), + UINT64_C( 0x7FFFFFE000000000 ), + UINT64_C( 0x7FFFFFF000000000 ), + UINT64_C( 0x7FFFFFF800000000 ), + UINT64_C( 0x7FFFFFFC00000000 ), + UINT64_C( 0x7FFFFFFE00000000 ), + UINT64_C( 0x7FFFFFFF00000000 ), + UINT64_C( 0x7FFFFFFF80000000 ), + UINT64_C( 0x7FFFFFFFC0000000 ), + UINT64_C( 0x7FFFFFFFE0000000 ), + UINT64_C( 0x7FFFFFFFF0000000 ), + UINT64_C( 0x7FFFFFFFF8000000 ), + UINT64_C( 0x7FFFFFFFFC000000 ), + UINT64_C( 0x7FFFFFFFFE000000 ), + UINT64_C( 0x7FFFFFFFFF000000 ), + UINT64_C( 0x7FFFFFFFFF800000 ), + UINT64_C( 0x7FFFFFFFFFC00000 ), + UINT64_C( 0x7FFFFFFFFFE00000 ), + UINT64_C( 0x7FFFFFFFFFF00000 ), + UINT64_C( 0x7FFFFFFFFFF80000 ), + UINT64_C( 0x7FFFFFFFFFFC0000 ), + UINT64_C( 0x7FFFFFFFFFFE0000 ), + UINT64_C( 0x7FFFFFFFFFFF0000 ), + UINT64_C( 0x7FFFFFFFFFFF8000 ), + UINT64_C( 0x7FFFFFFFFFFFC000 ), + UINT64_C( 0x7FFFFFFFFFFFE000 ), + UINT64_C( 0x7FFFFFFFFFFFF000 ), + UINT64_C( 0x7FFFFFFFFFFFF800 ), + UINT64_C( 0x7FFFFFFFFFFFFC00 ), + UINT64_C( 0x7FFFFFFFFFFFFE00 ), + UINT64_C( 0x7FFFFFFFFFFFFF00 ), + UINT64_C( 0x7FFFFFFFFFFFFF80 ), + UINT64_C( 0x7FFFFFFFFFFFFFC0 ), + UINT64_C( 0x7FFFFFFFFFFFFFE0 ), + UINT64_C( 0x7FFFFFFFFFFFFFF0 ), + UINT64_C( 0x7FFFFFFFFFFFFFF8 ), + UINT64_C( 0x7FFFFFFFFFFFFFFC ), + UINT64_C( 0x7FFFFFFFFFFFFFFE ), + UINT64_C( 0x7FFFFFFFFFFFFFFF ), + UINT64_C( 0x7FFFFFFFFFFFFFFD ), + UINT64_C( 0x7FFFFFFFFFFFFFFB ), + UINT64_C( 0x7FFFFFFFFFFFFFF7 ), + UINT64_C( 0x7FFFFFFFFFFFFFEF ), + UINT64_C( 0x7FFFFFFFFFFFFFDF ), + UINT64_C( 0x7FFFFFFFFFFFFFBF ), + UINT64_C( 0x7FFFFFFFFFFFFF7F ), + UINT64_C( 0x7FFFFFFFFFFFFEFF ), + UINT64_C( 0x7FFFFFFFFFFFFDFF ), + UINT64_C( 0x7FFFFFFFFFFFFBFF ), + UINT64_C( 0x7FFFFFFFFFFFF7FF ), + UINT64_C( 0x7FFFFFFFFFFFEFFF ), + UINT64_C( 0x7FFFFFFFFFFFDFFF ), + UINT64_C( 0x7FFFFFFFFFFFBFFF ), + UINT64_C( 0x7FFFFFFFFFFF7FFF ), + UINT64_C( 0x7FFFFFFFFFFEFFFF ), + UINT64_C( 0x7FFFFFFFFFFDFFFF ), + UINT64_C( 0x7FFFFFFFFFFBFFFF ), + UINT64_C( 0x7FFFFFFFFFF7FFFF ), + UINT64_C( 0x7FFFFFFFFFEFFFFF ), + UINT64_C( 0x7FFFFFFFFFDFFFFF ), + UINT64_C( 0x7FFFFFFFFFBFFFFF ), + UINT64_C( 0x7FFFFFFFFF7FFFFF ), + UINT64_C( 0x7FFFFFFFFEFFFFFF ), + UINT64_C( 0x7FFFFFFFFDFFFFFF ), + UINT64_C( 0x7FFFFFFFFBFFFFFF ), + UINT64_C( 0x7FFFFFFFF7FFFFFF ), + UINT64_C( 0x7FFFFFFFEFFFFFFF ), + UINT64_C( 0x7FFFFFFFDFFFFFFF ), + UINT64_C( 0x7FFFFFFFBFFFFFFF ), + UINT64_C( 0x7FFFFFFF7FFFFFFF ), + UINT64_C( 0x7FFFFFFEFFFFFFFF ), + UINT64_C( 0x7FFFFFFDFFFFFFFF ), + UINT64_C( 0x7FFFFFFBFFFFFFFF ), + UINT64_C( 0x7FFFFFF7FFFFFFFF ), + UINT64_C( 0x7FFFFFEFFFFFFFFF ), + UINT64_C( 0x7FFFFFDFFFFFFFFF ), + UINT64_C( 0x7FFFFFBFFFFFFFFF ), + UINT64_C( 0x7FFFFF7FFFFFFFFF ), + UINT64_C( 0x7FFFFEFFFFFFFFFF ), + UINT64_C( 0x7FFFFDFFFFFFFFFF ), + UINT64_C( 0x7FFFFBFFFFFFFFFF ), + UINT64_C( 0x7FFFF7FFFFFFFFFF ), + UINT64_C( 0x7FFFEFFFFFFFFFFF ), + UINT64_C( 0x7FFFDFFFFFFFFFFF ), + UINT64_C( 0x7FFFBFFFFFFFFFFF ), + UINT64_C( 0x7FFF7FFFFFFFFFFF ), + UINT64_C( 0x7FFEFFFFFFFFFFFF ), + UINT64_C( 0x7FFDFFFFFFFFFFFF ), + UINT64_C( 0x7FFBFFFFFFFFFFFF ), + UINT64_C( 0x7FF7FFFFFFFFFFFF ), + UINT64_C( 0x7FEFFFFFFFFFFFFF ), + UINT64_C( 0x7FDFFFFFFFFFFFFF ), + UINT64_C( 0x7FBFFFFFFFFFFFFF ), + UINT64_C( 0x7F7FFFFFFFFFFFFF ), + UINT64_C( 0x7EFFFFFFFFFFFFFF ), + UINT64_C( 0x7DFFFFFFFFFFFFFF ), + UINT64_C( 0x7BFFFFFFFFFFFFFF ), + UINT64_C( 0x77FFFFFFFFFFFFFF ), + UINT64_C( 0x6FFFFFFFFFFFFFFF ), + UINT64_C( 0x5FFFFFFFFFFFFFFF ), + UINT64_C( 0x3FFFFFFFFFFFFFFF ), + UINT64_C( 0x1FFFFFFFFFFFFFFF ), + UINT64_C( 0x0FFFFFFFFFFFFFFF ), + UINT64_C( 0x07FFFFFFFFFFFFFF ), + UINT64_C( 0x03FFFFFFFFFFFFFF ), + UINT64_C( 0x01FFFFFFFFFFFFFF ), + UINT64_C( 0x00FFFFFFFFFFFFFF ), + UINT64_C( 0x007FFFFFFFFFFFFF ), + UINT64_C( 0x003FFFFFFFFFFFFF ), + UINT64_C( 0x001FFFFFFFFFFFFF ), + UINT64_C( 0x000FFFFFFFFFFFFF ), + UINT64_C( 0x0007FFFFFFFFFFFF ), + UINT64_C( 0x0003FFFFFFFFFFFF ), + UINT64_C( 0x0001FFFFFFFFFFFF ), + UINT64_C( 0x0000FFFFFFFFFFFF ), + UINT64_C( 0x00007FFFFFFFFFFF ), + UINT64_C( 0x00003FFFFFFFFFFF ), + UINT64_C( 0x00001FFFFFFFFFFF ), + UINT64_C( 0x00000FFFFFFFFFFF ), + UINT64_C( 0x000007FFFFFFFFFF ), + UINT64_C( 0x000003FFFFFFFFFF ), + UINT64_C( 0x000001FFFFFFFFFF ), + UINT64_C( 0x000000FFFFFFFFFF ), + UINT64_C( 0x0000007FFFFFFFFF ), + UINT64_C( 0x0000003FFFFFFFFF ), + UINT64_C( 0x0000001FFFFFFFFF ), + UINT64_C( 0x0000000FFFFFFFFF ), + UINT64_C( 0x00000007FFFFFFFF ), + UINT64_C( 0x00000003FFFFFFFF ), + UINT64_C( 0x00000001FFFFFFFF ), + UINT64_C( 0x00000000FFFFFFFF ), + UINT64_C( 0x000000007FFFFFFF ), + UINT64_C( 0x000000003FFFFFFF ), + UINT64_C( 0x000000001FFFFFFF ), + UINT64_C( 0x000000000FFFFFFF ), + UINT64_C( 0x0000000007FFFFFF ), + UINT64_C( 0x0000000003FFFFFF ), + UINT64_C( 0x0000000001FFFFFF ), + UINT64_C( 0x0000000000FFFFFF ), + UINT64_C( 0x00000000007FFFFF ), + UINT64_C( 0x00000000003FFFFF ), + UINT64_C( 0x00000000001FFFFF ), + UINT64_C( 0x00000000000FFFFF ), + UINT64_C( 0x000000000007FFFF ), + UINT64_C( 0x000000000003FFFF ), + UINT64_C( 0x000000000001FFFF ), + UINT64_C( 0x000000000000FFFF ), + UINT64_C( 0x0000000000007FFF ), + UINT64_C( 0x0000000000003FFF ), + UINT64_C( 0x0000000000001FFF ), + UINT64_C( 0x0000000000000FFF ), + UINT64_C( 0x00000000000007FF ), + UINT64_C( 0x00000000000003FF ), + UINT64_C( 0x00000000000001FF ), + UINT64_C( 0x00000000000000FF ), + UINT64_C( 0x000000000000007F ), + UINT64_C( 0x000000000000003F ), + UINT64_C( 0x000000000000001F ), + UINT64_C( 0x000000000000000F ), + UINT64_C( 0x0000000000000007 ), + UINT64_C( 0x0000000000000003 ) +}; + +static const uint_fast32_t extF80NumQInP1 = extF80NumQIn * extF80NumP1; +static const uint_fast32_t extF80NumQOutP1 = extF80NumQOut * extF80NumP1; + +static void extF80NextQInP1( struct sequence *sequencePtr, extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + int expNum, sigNum; + uint_fast16_t uiZ64; + uint_fast64_t uiZ0; + + zSPtr = (struct extFloat80M *) zPtr; + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uiZ64 = extF80QIn[expNum]; + uiZ0 = extF80P1[sigNum]; + if ( uiZ64 & 0x7FFF ) uiZ0 |= UINT64_C( 0x8000000000000000 ); + zSPtr->signExp = uiZ64; + zSPtr->signif = uiZ0; + ++sigNum; + if ( extF80NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( extF80NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + +} + +static + void extF80NextQOutP1( struct sequence *sequencePtr, extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + int expNum, sigNum; + uint_fast16_t uiZ64; + uint_fast64_t uiZ0; + + zSPtr = (struct extFloat80M *) zPtr; + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uiZ64 = extF80QOut[expNum]; + uiZ0 = extF80P1[sigNum]; + if ( uiZ64 & 0x7FFF ) uiZ0 |= UINT64_C( 0x8000000000000000 ); + zSPtr->signExp = uiZ64; + zSPtr->signif = uiZ0; + ++sigNum; + if ( extF80NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( extF80NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + +} + +static const uint_fast32_t extF80NumQInP2 = extF80NumQIn * extF80NumP2; +static const uint_fast32_t extF80NumQOutP2 = extF80NumQOut * extF80NumP2; + +static void extF80NextQInP2( struct sequence *sequencePtr, extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + int expNum, sigNum; + uint_fast16_t uiZ64; + uint_fast64_t uiZ0; + + zSPtr = (struct extFloat80M *) zPtr; + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uiZ64 = extF80QIn[expNum]; + uiZ0 = extF80P2[sigNum]; + if ( uiZ64 & 0x7FFF ) uiZ0 |= UINT64_C( 0x8000000000000000 ); + zSPtr->signExp = uiZ64; + zSPtr->signif = uiZ0; + ++sigNum; + if ( extF80NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( extF80NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + +} + +static + void extF80NextQOutP2( struct sequence *sequencePtr, extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + int expNum, sigNum; + uint_fast16_t uiZ64; + uint_fast64_t uiZ0; + + zSPtr = (struct extFloat80M *) zPtr; + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uiZ64 = extF80QOut[expNum]; + uiZ0 = extF80P2[sigNum]; + if ( uiZ64 & 0x7FFF ) uiZ0 |= UINT64_C( 0x8000000000000000 ); + zSPtr->signExp = uiZ64; + zSPtr->signif = uiZ0; + ++sigNum; + if ( extF80NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( extF80NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + +} + +static void extF80RandomQOutP3( extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + uint_fast16_t uiZ64; + uint_fast64_t uiZ0; + + zSPtr = (struct extFloat80M *) zPtr; + uiZ64 = extF80QOut[randomN_ui8( extF80NumQOut )]; + uiZ0 = + (extF80P2[randomN_ui8( extF80NumP2 )] + + extF80P2[randomN_ui8( extF80NumP2 )]) + & UINT64_C( 0x7FFFFFFFFFFFFFFF ); + if ( uiZ64 & 0x7FFF ) uiZ0 |= UINT64_C( 0x8000000000000000 ); + zSPtr->signExp = uiZ64; + zSPtr->signif = uiZ0; + +} + +static void extF80RandomQOutPInf( extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + uint_fast16_t uiZ64; + uint_fast64_t uiZ0; + + zSPtr = (struct extFloat80M *) zPtr; + uiZ64 = extF80QOut[randomN_ui8( extF80NumQOut )]; + uiZ0 = random_ui64() & UINT64_C( 0x7FFFFFFFFFFFFFFF ); + if ( uiZ64 & 0x7FFF ) uiZ0 |= UINT64_C( 0x8000000000000000 ); + zSPtr->signExp = uiZ64; + zSPtr->signif = uiZ0; + +} + +enum { extF80NumQInfWeightMasks = 14 }; +static const uint16_t extF80QInfWeightMasks[extF80NumQInfWeightMasks] = { + 0xFFFF, + 0xFFFF, + 0xBFFF, + 0x9FFF, + 0x87FF, + 0x87FF, + 0x83FF, + 0x81FF, + 0x80FF, + 0x807F, + 0x803F, + 0x801F, + 0x800F, + 0x8007 +}; +static const uint16_t extF80QInfWeightOffsets[extF80NumQInfWeightMasks] = { + 0x0000, + 0x0000, + 0x2000, + 0x3000, + 0x3800, + 0x3C00, + 0x3E00, + 0x3F00, + 0x3F80, + 0x3FC0, + 0x3FE0, + 0x3FF0, + 0x3FF8, + 0x3FFC +}; + +static void extF80RandomQInfP3( extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + int weightMaskNum; + uint_fast16_t uiZ64; + uint_fast64_t uiZ0; + + zSPtr = (struct extFloat80M *) zPtr; + weightMaskNum = randomN_ui8( extF80NumQInfWeightMasks ); + uiZ64 = + (random_ui16() & extF80QInfWeightMasks[weightMaskNum]) + + extF80QInfWeightOffsets[weightMaskNum]; + uiZ0 = + (extF80P2[randomN_ui8( extF80NumP2 )] + + extF80P2[randomN_ui8( extF80NumP2 )]) + & UINT64_C( 0x7FFFFFFFFFFFFFFF ); + if ( uiZ64 & 0x7FFF ) uiZ0 |= UINT64_C( 0x8000000000000000 ); + zSPtr->signExp = uiZ64; + zSPtr->signif = uiZ0; + +} + +static void extF80RandomQInfPInf( extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + int weightMaskNum; + uint_fast16_t uiZ64; + uint_fast64_t uiZ0; + + zSPtr = (struct extFloat80M *) zPtr; + weightMaskNum = randomN_ui8( extF80NumQInfWeightMasks ); + uiZ64 = + (random_ui16() & extF80QInfWeightMasks[weightMaskNum]) + + extF80QInfWeightOffsets[weightMaskNum]; + uiZ0 = random_ui64() & UINT64_C( 0x7FFFFFFFFFFFFFFF ); + if ( uiZ64 & 0x7FFF ) uiZ0 |= UINT64_C( 0x8000000000000000 ); + zSPtr->signExp = uiZ64; + zSPtr->signif = uiZ0; + +} + +static void extF80Random( extFloat80_t *zPtr ) +{ + + switch ( random_ui8() & 7 ) { + case 0: + case 1: + case 2: + extF80RandomQOutP3( zPtr ); + break; + case 3: + extF80RandomQOutPInf( zPtr ); + break; + case 4: + case 5: + case 6: + extF80RandomQInfP3( zPtr ); + break; + case 7: + extF80RandomQInfPInf( zPtr ); + break; + } + +} + +static struct sequence sequenceA, sequenceB, sequenceC; +static extFloat80_t currentA, currentB, currentC; +static int subcase; + +extFloat80_t genCases_extF80_a, genCases_extF80_b, genCases_extF80_c; + +void genCases_extF80_a_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = + (genCases_level == 1) ? 3 * extF80NumQOutP1 : 2 * extF80NumQOutP2; + genCases_done = false; + +} + +void genCases_extF80_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + case 1: + extF80Random( &genCases_extF80_a ); + break; + case 2: + extF80NextQOutP1( &sequenceA, &genCases_extF80_a ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + extF80Random( &genCases_extF80_a ); + break; + case 1: + extF80NextQOutP2( &sequenceA, &genCases_extF80_a ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_extF80_ab_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 6 * extF80NumQInP1 * extF80NumQInP1; + extF80NextQInP1( &sequenceA, ¤tA ); + } else { + genCases_total = 2 * extF80NumQInP2 * extF80NumQInP2; + extF80NextQInP2( &sequenceA, ¤tA ); + } + genCases_done = false; + +} + +void genCases_extF80_ab_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceB.done ) { + sequenceB.done = false; + extF80NextQInP1( &sequenceA, ¤tA ); + } + extF80NextQInP1( &sequenceB, ¤tB ); + case 2: + case 4: + extF80Random( &genCases_extF80_a ); + extF80Random( &genCases_extF80_b ); + break; + case 1: + genCases_extF80_a = currentA; + extF80Random( &genCases_extF80_b ); + break; + case 3: + extF80Random( &genCases_extF80_a ); + genCases_extF80_b = currentB; + break; + case 5: + genCases_extF80_a = currentA; + genCases_extF80_b = currentB; + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + extF80Random( &genCases_extF80_a ); + extF80Random( &genCases_extF80_b ); + break; + case 1: + if ( sequenceB.done ) { + sequenceB.done = false; + extF80NextQInP2( &sequenceA, ¤tA ); + } + genCases_extF80_a = currentA; + extF80NextQInP2( &sequenceB, &genCases_extF80_b ); + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_extF80_abc_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + sequenceC.expNum = 0; + sequenceC.term1Num = 0; + sequenceC.term2Num = 0; + sequenceC.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 9 * extF80NumQInP1 * extF80NumQInP1 * extF80NumQInP1; + extF80NextQInP1( &sequenceA, ¤tA ); + extF80NextQInP1( &sequenceB, ¤tB ); + } else { + genCases_total = 2 * extF80NumQInP2 * extF80NumQInP2 * extF80NumQInP2; + extF80NextQInP2( &sequenceA, ¤tA ); + extF80NextQInP2( &sequenceB, ¤tB ); + } + genCases_done = false; + +} + +void genCases_extF80_abc_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + extF80NextQInP1( &sequenceA, ¤tA ); + } + extF80NextQInP1( &sequenceB, ¤tB ); + } + extF80NextQInP1( &sequenceC, ¤tC ); + extF80Random( &genCases_extF80_a ); + extF80Random( &genCases_extF80_b ); + genCases_extF80_c = currentC; + break; + case 1: + genCases_extF80_a = currentA; + genCases_extF80_b = currentB; + extF80Random( &genCases_extF80_c ); + break; + case 2: + extF80Random( &genCases_extF80_a ); + extF80Random( &genCases_extF80_b ); + extF80Random( &genCases_extF80_c ); + break; + case 3: + extF80Random( &genCases_extF80_a ); + genCases_extF80_b = currentB; + genCases_extF80_c = currentC; + break; + case 4: + genCases_extF80_a = currentA; + extF80Random( &genCases_extF80_b ); + extF80Random( &genCases_extF80_c ); + break; + case 5: + extF80Random( &genCases_extF80_a ); + genCases_extF80_b = currentB; + extF80Random( &genCases_extF80_c ); + break; + case 6: + genCases_extF80_a = currentA; + extF80Random( &genCases_extF80_b ); + genCases_extF80_c = currentC; + break; + case 7: + extF80Random( &genCases_extF80_a ); + extF80Random( &genCases_extF80_b ); + extF80Random( &genCases_extF80_c ); + break; + case 8: + genCases_extF80_a = currentA; + genCases_extF80_b = currentB; + genCases_extF80_c = currentC; + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + extF80Random( &genCases_extF80_a ); + extF80Random( &genCases_extF80_b ); + extF80Random( &genCases_extF80_c ); + break; + case 1: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + extF80NextQInP2( &sequenceA, ¤tA ); + } + extF80NextQInP2( &sequenceB, ¤tB ); + } + genCases_extF80_a = currentA; + genCases_extF80_b = currentB; + extF80NextQInP2( &sequenceC, &genCases_extF80_c ); + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_f128.c b/src/libs/softfloat-3e/testfloat/source/genCases_f128.c new file mode 100644 index 00000000..839da228 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_f128.c @@ -0,0 +1,1090 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "uint128.h" +#include "random.h" +#include "softfloat.h" +#include "genCases.h" + +#ifdef FLOAT128 + +struct sequence { + int expNum, term1Num, term2Num; + bool done; +}; + +enum { + f128NumQIn = 22, + f128NumQOut = 78, + f128NumP1 = 4, + f128NumP2 = 443 +}; +static const uint64_t f128QIn[f128NumQIn] = { + UINT64_C( 0x0000000000000000 ), /* positive, subnormal */ + UINT64_C( 0x0001000000000000 ), /* positive, -16382 */ + UINT64_C( 0x3F8E000000000000 ), /* positive, -113 */ + UINT64_C( 0x3FFD000000000000 ), /* positive, -2 */ + UINT64_C( 0x3FFE000000000000 ), /* positive, -1 */ + UINT64_C( 0x3FFF000000000000 ), /* positive, 0 */ + UINT64_C( 0x4000000000000000 ), /* positive, 1 */ + UINT64_C( 0x4001000000000000 ), /* positive, 2 */ + UINT64_C( 0x4070000000000000 ), /* positive, 113 */ + UINT64_C( 0x7FFE000000000000 ), /* positive, 16383 */ + UINT64_C( 0x7FFF000000000000 ), /* positive, infinity or NaN */ + UINT64_C( 0x8000000000000000 ), /* negative, subnormal */ + UINT64_C( 0x8001000000000000 ), /* negative, -16382 */ + UINT64_C( 0xBF8E000000000000 ), /* negative, -113 */ + UINT64_C( 0xBFFD000000000000 ), /* negative, -2 */ + UINT64_C( 0xBFFE000000000000 ), /* negative, -1 */ + UINT64_C( 0xBFFF000000000000 ), /* negative, 0 */ + UINT64_C( 0xC000000000000000 ), /* negative, 1 */ + UINT64_C( 0xC001000000000000 ), /* negative, 2 */ + UINT64_C( 0xC070000000000000 ), /* negative, 113 */ + UINT64_C( 0xFFFE000000000000 ), /* negative, 16383 */ + UINT64_C( 0xFFFF000000000000 ) /* negative, infinity or NaN */ +}; +static const uint64_t f128QOut[f128NumQOut] = { + UINT64_C( 0x0000000000000000 ), /* positive, subnormal */ + UINT64_C( 0x0001000000000000 ), /* positive, -16382 */ + UINT64_C( 0x0002000000000000 ), /* positive, -16381 */ + UINT64_C( 0x3BFE000000000000 ), /* positive, -1025 */ + UINT64_C( 0x3BFF000000000000 ), /* positive, -1024 */ + UINT64_C( 0x3C00000000000000 ), /* positive, -1023 */ + UINT64_C( 0x3C01000000000000 ), /* positive, -1022 */ + UINT64_C( 0x3F7E000000000000 ), /* positive, -129 */ + UINT64_C( 0x3F7F000000000000 ), /* positive, -128 */ + UINT64_C( 0x3F80000000000000 ), /* positive, -127 */ + UINT64_C( 0x3F81000000000000 ), /* positive, -126 */ + UINT64_C( 0x3F8E000000000000 ), /* positive, -113 */ + UINT64_C( 0x3FFB000000000000 ), /* positive, -4 */ + UINT64_C( 0x3FFC000000000000 ), /* positive, -3 */ + UINT64_C( 0x3FFD000000000000 ), /* positive, -2 */ + UINT64_C( 0x3FFE000000000000 ), /* positive, -1 */ + UINT64_C( 0x3FFF000000000000 ), /* positive, 0 */ + UINT64_C( 0x4000000000000000 ), /* positive, 1 */ + UINT64_C( 0x4001000000000000 ), /* positive, 2 */ + UINT64_C( 0x4002000000000000 ), /* positive, 3 */ + UINT64_C( 0x4003000000000000 ), /* positive, 4 */ + UINT64_C( 0x401C000000000000 ), /* positive, 29 */ + UINT64_C( 0x401D000000000000 ), /* positive, 30 */ + UINT64_C( 0x401E000000000000 ), /* positive, 31 */ + UINT64_C( 0x401F000000000000 ), /* positive, 32 */ + UINT64_C( 0x403C000000000000 ), /* positive, 61 */ + UINT64_C( 0x403D000000000000 ), /* positive, 62 */ + UINT64_C( 0x403E000000000000 ), /* positive, 63 */ + UINT64_C( 0x403F000000000000 ), /* positive, 64 */ + UINT64_C( 0x4070000000000000 ), /* positive, 113 */ + UINT64_C( 0x407E000000000000 ), /* positive, 127 */ + UINT64_C( 0x407F000000000000 ), /* positive, 128 */ + UINT64_C( 0x4080000000000000 ), /* positive, 129 */ + UINT64_C( 0x43FE000000000000 ), /* positive, 1023 */ + UINT64_C( 0x43FF000000000000 ), /* positive, 1024 */ + UINT64_C( 0x4400000000000000 ), /* positive, 1025 */ + UINT64_C( 0x7FFD000000000000 ), /* positive, 16382 */ + UINT64_C( 0x7FFE000000000000 ), /* positive, 16383 */ + UINT64_C( 0x7FFF000000000000 ), /* positive, infinity or NaN */ + UINT64_C( 0x8000000000000000 ), /* negative, subnormal */ + UINT64_C( 0x8001000000000000 ), /* negative, -16382 */ + UINT64_C( 0x8002000000000000 ), /* negative, -16381 */ + UINT64_C( 0xBBFE000000000000 ), /* negative, -1025 */ + UINT64_C( 0xBBFF000000000000 ), /* negative, -1024 */ + UINT64_C( 0xBC00000000000000 ), /* negative, -1023 */ + UINT64_C( 0xBC01000000000000 ), /* negative, -1022 */ + UINT64_C( 0xBF7E000000000000 ), /* negative, -129 */ + UINT64_C( 0xBF7F000000000000 ), /* negative, -128 */ + UINT64_C( 0xBF80000000000000 ), /* negative, -127 */ + UINT64_C( 0xBF81000000000000 ), /* negative, -126 */ + UINT64_C( 0xBF8E000000000000 ), /* negative, -113 */ + UINT64_C( 0xBFFB000000000000 ), /* negative, -4 */ + UINT64_C( 0xBFFC000000000000 ), /* negative, -3 */ + UINT64_C( 0xBFFD000000000000 ), /* negative, -2 */ + UINT64_C( 0xBFFE000000000000 ), /* negative, -1 */ + UINT64_C( 0xBFFF000000000000 ), /* negative, 0 */ + UINT64_C( 0xC000000000000000 ), /* negative, 1 */ + UINT64_C( 0xC001000000000000 ), /* negative, 2 */ + UINT64_C( 0xC002000000000000 ), /* negative, 3 */ + UINT64_C( 0xC003000000000000 ), /* negative, 4 */ + UINT64_C( 0xC01C000000000000 ), /* negative, 29 */ + UINT64_C( 0xC01D000000000000 ), /* negative, 30 */ + UINT64_C( 0xC01E000000000000 ), /* negative, 31 */ + UINT64_C( 0xC01F000000000000 ), /* negative, 32 */ + UINT64_C( 0xC03C000000000000 ), /* negative, 61 */ + UINT64_C( 0xC03D000000000000 ), /* negative, 62 */ + UINT64_C( 0xC03E000000000000 ), /* negative, 63 */ + UINT64_C( 0xC03F000000000000 ), /* negative, 64 */ + UINT64_C( 0xC070000000000000 ), /* negative, 113 */ + UINT64_C( 0xC07E000000000000 ), /* negative, 127 */ + UINT64_C( 0xC07F000000000000 ), /* negative, 128 */ + UINT64_C( 0xC080000000000000 ), /* negative, 129 */ + UINT64_C( 0xC3FE000000000000 ), /* negative, 1023 */ + UINT64_C( 0xC3FF000000000000 ), /* negative, 1024 */ + UINT64_C( 0xC400000000000000 ), /* negative, 1025 */ + UINT64_C( 0xFFFD000000000000 ), /* negative, 16382 */ + UINT64_C( 0xFFFE000000000000 ), /* negative, 16383 */ + UINT64_C( 0xFFFF000000000000 ) /* negative, infinity or NaN */ +}; +static const struct { uint64_t v64, v0; } f128P1[f128NumP1] = { + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000001 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFE ) } +}; +static const struct { uint64_t v64, v0; } f128P2[f128NumP2] = { + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000001 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000002 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000004 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000008 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000010 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000020 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000040 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000080 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000100 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000200 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000400 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000800 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000001000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000002000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000004000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000008000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000010000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000020000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000040000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000080000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000100000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000200000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000400000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000800000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000001000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000002000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000004000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000008000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000010000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000020000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000040000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000080000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000100000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000200000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000400000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000800000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000001000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000002000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000004000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000008000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000010000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000020000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000040000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000080000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000100000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000200000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000400000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000800000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0001000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0002000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0004000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0008000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0010000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0020000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0040000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0080000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0100000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0200000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0400000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0800000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x1000000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x2000000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x4000000000000000 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x8000000000000000 ) }, + { UINT64_C( 0x0000000000000001 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000002 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000004 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000008 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000010 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000020 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000040 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000080 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000100 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000200 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000400 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000000800 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000001000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000002000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000004000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000008000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000010000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000020000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000040000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000080000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000100000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000200000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000400000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000000800000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000001000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000002000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000004000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000008000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000010000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000020000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000040000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000080000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000100000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000200000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000400000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000000800000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000001000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000002000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000004000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000008000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000010000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000020000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000040000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000080000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000100000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000200000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000400000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000800000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000C00000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000E00000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000F00000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000F80000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FC0000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FE0000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FF0000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FF8000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFC000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFE000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFF000000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFF800000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFC00000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFE00000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFF00000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFF80000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFC0000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFE0000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFF0000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFF8000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFC000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFE000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFF000000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFF800000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFC00000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFE00000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFF00000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFF80000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFC0000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFE0000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFF0000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFF8000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFC000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFE000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFF000 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFF800 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFC00 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFE00 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFF00 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFF80 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFC0 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFE0 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFF0 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFF8 ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFC ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFE ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0x0000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0x8000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xC000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xE000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xF000000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xF800000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFC00000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFE00000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFF00000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFF80000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFC0000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFE0000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFF0000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFF8000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFC000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFE000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFF000000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFF800000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFC00000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFE00000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFF00000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFF80000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFC0000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFE0000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFF0000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFF8000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFC000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFE000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFF000000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFF800000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFC00000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFE00000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFF00000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFF80000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFC0000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFE0000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFF0000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFF8000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFC000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFE000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFF000000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFF800000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFC00000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFE00000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFF00000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFF80000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFC0000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFE0000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFF0000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFF8000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFC000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFE000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFF000 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFF800 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFC00 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFE00 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFF00 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFF80 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFC0 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFE0 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFF0 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFF8 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFC ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFE ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFD ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFB ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFF7 ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFEF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFDF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFBF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFF7F ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFEFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFDFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFBFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFF7FF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFEFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFDFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFBFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFF7FFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFEFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFDFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFBFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFF7FFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFEFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFDFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFBFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFF7FFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFEFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFDFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFBFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFF7FFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFEFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFDFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFBFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFF7FFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFEFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFDFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFBFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFF7FFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFEFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFDFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFFBFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFF7FFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFEFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFDFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFFBFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFF7FFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFEFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFDFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFFBFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFF7FFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFEFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFDFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFFBFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFF7FFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFEFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFDFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFFBFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFF7FFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFEFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFDFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xFBFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xF7FFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xEFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xDFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0xBFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFF ), UINT64_C( 0x7FFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFD ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFFB ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFF7 ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFEF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFDF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFFBF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFF7F ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFEFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFDFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFFBFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFF7FF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFEFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFDFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFFBFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFF7FFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFEFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFDFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFFBFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFF7FFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFEFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFDFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFFBFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFF7FFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFEFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFDFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFFBFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFF7FFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFEFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFDFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFFBFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFF7FFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFEFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFDFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFFBFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFF7FFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFEFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFDFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FFBFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FF7FFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FEFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FDFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000FBFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000F7FFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000EFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000DFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000BFFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00007FFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00003FFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00001FFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000FFFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000007FFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000003FFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000001FFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000FFFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000007FFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000003FFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000001FFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000FFFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000007FFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000003FFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000001FFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000FFFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000007FFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000003FFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000001FFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000FFFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000007FFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000003FFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000001FFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000FFFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000007FFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000003FFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000001FFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000000FFFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000007FFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000003FFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000001FFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000000FFFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000007FFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000003FFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000001FFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000FFF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000000007FF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000000003FF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000000001FF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x00000000000000FF ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000000007F ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000000003F ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000000001F ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x000000000000000F ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000007 ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000003 ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000001 ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0xFFFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x7FFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x3FFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x1FFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0FFFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x07FFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x03FFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x01FFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00FFFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x007FFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x003FFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x001FFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000FFFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0007FFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0003FFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0001FFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000FFFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00007FFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00003FFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00001FFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000FFFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000007FFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000003FFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000001FFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000FFFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000007FFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000003FFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000001FFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000FFFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000007FFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000003FFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000001FFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000FFFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000007FFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000003FFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000001FFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000FFFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000007FFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000003FFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000001FFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000FFFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000007FFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000003FFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000001FFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000000FFFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000007FFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000003FFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000001FFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000000FFFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000007FFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000003FFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000001FFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000FFF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000000007FF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000000003FF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000000001FF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x00000000000000FF ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000000007F ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000000003F ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000000001F ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x000000000000000F ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000007 ) }, + { UINT64_C( 0x0000000000000000 ), UINT64_C( 0x0000000000000003 ) } +}; + +static const uint_fast64_t f128NumQInP1 = f128NumQIn * f128NumP1; +static const uint_fast64_t f128NumQOutP1 = f128NumQOut * f128NumP1; + +static void f128NextQInP1( struct sequence *sequencePtr, float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + int expNum, sigNum; + + uiZPtr = (struct uint128 *) zPtr; + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uiZPtr->v64 = f128QIn[expNum] | f128P1[sigNum].v64; + uiZPtr->v0 = f128P1[sigNum].v0; + ++sigNum; + if ( f128NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f128NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + +} + +static void f128NextQOutP1( struct sequence *sequencePtr, float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + int expNum, sigNum; + + uiZPtr = (struct uint128 *) zPtr; + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uiZPtr->v64 = f128QOut[expNum] | f128P1[sigNum].v64; + uiZPtr->v0 = f128P1[sigNum].v0; + ++sigNum; + if ( f128NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f128NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + +} + +static const uint_fast64_t f128NumQInP2 = f128NumQIn * f128NumP2; +static const uint_fast64_t f128NumQOutP2 = f128NumQOut * f128NumP2; + +static void f128NextQInP2( struct sequence *sequencePtr, float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + int expNum, sigNum; + + uiZPtr = (struct uint128 *) zPtr; + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uiZPtr->v64 = f128QIn[expNum] | f128P2[sigNum].v64; + uiZPtr->v0 = f128P2[sigNum].v0; + ++sigNum; + if ( f128NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f128NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + +} + +static void f128NextQOutP2( struct sequence *sequencePtr, float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + int expNum, sigNum; + + uiZPtr = (struct uint128 *) zPtr; + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uiZPtr->v64 = f128QOut[expNum] | f128P2[sigNum].v64; + uiZPtr->v0 = f128P2[sigNum].v0; + ++sigNum; + if ( f128NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f128NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + +} + +static void f128RandomQOutP3( float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + int sigNum1, sigNum2; + uint_fast64_t sig1_0; + + uiZPtr = (struct uint128 *) zPtr; + sigNum1 = randomN_ui16( f128NumP2 ); + sigNum2 = randomN_ui16( f128NumP2 ); + sig1_0 = f128P2[sigNum1].v0; + uiZPtr->v0 = sig1_0 + f128P2[sigNum2].v0; + uiZPtr->v64 = + f128QOut[randomN_ui8( f128NumQOut )] + | ((f128P2[sigNum1].v64 + f128P2[sigNum2].v64 + (uiZPtr->v0 < sig1_0)) + & UINT64_C( 0x0000FFFFFFFFFFFF )); + +} + +static void f128RandomQOutPInf( float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + + uiZPtr = (struct uint128 *) zPtr; + uiZPtr->v64 = + f128QOut[randomN_ui8( f128NumQOut )] + | (random_ui64() & UINT64_C( 0x0000FFFFFFFFFFFF )); + uiZPtr->v0 = random_ui64(); + +} + +enum { f128NumQInfWeightMasks = 14 }; +static const uint64_t f128QInfWeightMasks[f128NumQInfWeightMasks] = { + UINT64_C( 0xFFFF000000000000 ), + UINT64_C( 0xFFFF000000000000 ), + UINT64_C( 0xBFFF000000000000 ), + UINT64_C( 0x9FFF000000000000 ), + UINT64_C( 0x87FF000000000000 ), + UINT64_C( 0x87FF000000000000 ), + UINT64_C( 0x83FF000000000000 ), + UINT64_C( 0x81FF000000000000 ), + UINT64_C( 0x80FF000000000000 ), + UINT64_C( 0x807F000000000000 ), + UINT64_C( 0x803F000000000000 ), + UINT64_C( 0x801F000000000000 ), + UINT64_C( 0x800F000000000000 ), + UINT64_C( 0x8007000000000000 ) +}; +static const uint64_t f128QInfWeightOffsets[f128NumQInfWeightMasks] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x2000000000000000 ), + UINT64_C( 0x3000000000000000 ), + UINT64_C( 0x3800000000000000 ), + UINT64_C( 0x3C00000000000000 ), + UINT64_C( 0x3E00000000000000 ), + UINT64_C( 0x3F00000000000000 ), + UINT64_C( 0x3F80000000000000 ), + UINT64_C( 0x3FC0000000000000 ), + UINT64_C( 0x3FE0000000000000 ), + UINT64_C( 0x3FF0000000000000 ), + UINT64_C( 0x3FF8000000000000 ), + UINT64_C( 0x3FFC000000000000 ) +}; + +static void f128RandomQInfP3( float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + int sigNum1, sigNum2; + uint_fast64_t sig1_0; + int weightMaskNum; + + uiZPtr = (struct uint128 *) zPtr; + sigNum1 = randomN_ui16( f128NumP2 ); + sigNum2 = randomN_ui16( f128NumP2 ); + sig1_0 = f128P2[sigNum1].v0; + uiZPtr->v0 = sig1_0 + f128P2[sigNum2].v0; + weightMaskNum = randomN_ui8( f128NumQInfWeightMasks ); + uiZPtr->v64 = + (((uint_fast64_t) random_ui16()<<48 + & f128QInfWeightMasks[weightMaskNum]) + + f128QInfWeightOffsets[weightMaskNum]) + | ((f128P2[sigNum1].v64 + f128P2[sigNum2].v64 + (uiZPtr->v0 < sig1_0)) + & UINT64_C( 0x0000FFFFFFFFFFFF )); + +} + +static void f128RandomQInfPInf( float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + int weightMaskNum; + + uiZPtr = (struct uint128 *) zPtr; + weightMaskNum = randomN_ui8( f128NumQInfWeightMasks ); + uiZPtr->v64 = + (random_ui64() + & (f128QInfWeightMasks[weightMaskNum] + | UINT64_C( 0x0000FFFFFFFFFFFF ))) + + f128QInfWeightOffsets[weightMaskNum]; + uiZPtr->v0 = random_ui64(); + +} + +static void f128Random( float128_t *zPtr ) +{ + + switch ( random_ui8() & 7 ) { + case 0: + case 1: + case 2: + f128RandomQOutP3( zPtr ); + break; + case 3: + f128RandomQOutPInf( zPtr ); + break; + case 4: + case 5: + case 6: + f128RandomQInfP3( zPtr ); + break; + case 7: + f128RandomQInfPInf( zPtr ); + break; + } + +} + +static struct sequence sequenceA, sequenceB, sequenceC; +static float128_t currentA, currentB, currentC; +static int subcase; + +float128_t genCases_f128_a, genCases_f128_b, genCases_f128_c; + +void genCases_f128_a_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = + (genCases_level == 1) ? 3 * f128NumQOutP1 : 2 * f128NumQOutP2; + genCases_done = false; + +} + +void genCases_f128_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + case 1: + f128Random( &genCases_f128_a ); + break; + case 2: + f128NextQOutP1( &sequenceA, &genCases_f128_a ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + f128Random( &genCases_f128_a ); + break; + case 1: + f128NextQOutP2( &sequenceA, &genCases_f128_a ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_f128_ab_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 6 * f128NumQInP1 * f128NumQInP1; + f128NextQInP1( &sequenceA, ¤tA ); + } else { + genCases_total = 2 * f128NumQInP2 * f128NumQInP2; + f128NextQInP2( &sequenceA, ¤tA ); + } + genCases_done = false; + +} + +void genCases_f128_ab_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceB.done ) { + sequenceB.done = false; + f128NextQInP1( &sequenceA, ¤tA ); + } + f128NextQInP1( &sequenceB, ¤tB ); + case 2: + case 4: + f128Random( &genCases_f128_a ); + f128Random( &genCases_f128_b ); + break; + case 1: + genCases_f128_a = currentA; + f128Random( &genCases_f128_b ); + break; + case 3: + f128Random( &genCases_f128_a ); + genCases_f128_b = currentB; + break; + case 5: + genCases_f128_a = currentA; + genCases_f128_b = currentB; + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + f128Random( &genCases_f128_a ); + f128Random( &genCases_f128_b ); + break; + case 1: + if ( sequenceB.done ) { + sequenceB.done = false; + f128NextQInP2( &sequenceA, ¤tA ); + } + genCases_f128_a = currentA; + f128NextQInP2( &sequenceB, &genCases_f128_b ); + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_f128_abc_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + sequenceC.expNum = 0; + sequenceC.term1Num = 0; + sequenceC.term2Num = 0; + sequenceC.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 9 * f128NumQInP1 * f128NumQInP1 * f128NumQInP1; + f128NextQInP1( &sequenceA, ¤tA ); + f128NextQInP1( &sequenceB, ¤tB ); + } else { + genCases_total = 2 * f128NumQInP2 * f128NumQInP2 * f128NumQInP2; + f128NextQInP2( &sequenceA, ¤tA ); + f128NextQInP2( &sequenceB, ¤tB ); + } + genCases_done = false; + +} + +void genCases_f128_abc_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + f128NextQInP1( &sequenceA, ¤tA ); + } + f128NextQInP1( &sequenceB, ¤tB ); + } + f128NextQInP1( &sequenceC, ¤tC ); + f128Random( &genCases_f128_a ); + f128Random( &genCases_f128_b ); + genCases_f128_c = currentC; + break; + case 1: + genCases_f128_a = currentA; + genCases_f128_b = currentB; + f128Random( &genCases_f128_c ); + break; + case 2: + f128Random( &genCases_f128_a ); + f128Random( &genCases_f128_b ); + f128Random( &genCases_f128_c ); + break; + case 3: + f128Random( &genCases_f128_a ); + genCases_f128_b = currentB; + genCases_f128_c = currentC; + break; + case 4: + genCases_f128_a = currentA; + f128Random( &genCases_f128_b ); + f128Random( &genCases_f128_c ); + break; + case 5: + f128Random( &genCases_f128_a ); + genCases_f128_b = currentB; + f128Random( &genCases_f128_c ); + break; + case 6: + genCases_f128_a = currentA; + f128Random( &genCases_f128_b ); + genCases_f128_c = currentC; + break; + case 7: + f128Random( &genCases_f128_a ); + f128Random( &genCases_f128_b ); + f128Random( &genCases_f128_c ); + break; + case 8: + genCases_f128_a = currentA; + genCases_f128_b = currentB; + genCases_f128_c = currentC; + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + f128Random( &genCases_f128_a ); + f128Random( &genCases_f128_b ); + f128Random( &genCases_f128_c ); + break; + case 1: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + f128NextQInP2( &sequenceA, ¤tA ); + } + f128NextQInP2( &sequenceB, ¤tB ); + } + genCases_f128_a = currentA; + genCases_f128_b = currentB; + f128NextQInP2( &sequenceC, &genCases_f128_c ); + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_f16.c b/src/libs/softfloat-3e/testfloat/source/genCases_f16.c new file mode 100644 index 00000000..ea4c0253 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_f16.c @@ -0,0 +1,585 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "random.h" +#include "softfloat.h" +#include "genCases.h" + +#ifdef FLOAT16 + +struct sequence { + int expNum, term1Num, term2Num; + bool done; +}; + +union ui16_f16 { uint16_t ui; float16_t f; }; + +enum { + f16NumQIn = 22, + f16NumQOut = 34, + f16NumP1 = 4, + f16NumP2 = 36 +}; +static const uint16_t f16QIn[f16NumQIn] = { + 0x0000, /* positive, subnormal */ + 0x0400, /* positive, -14 */ + 0x1000, /* positive, -11 */ + 0x3400, /* positive, -2 */ + 0x3800, /* positive, -1 */ + 0x3C00, /* positive, 0 */ + 0x4000, /* positive, 1 */ + 0x4400, /* positive, 2 */ + 0x6800, /* positive, 11 */ + 0x7800, /* positive, 15 */ + 0x7C00, /* positive, infinity or NaN */ + 0x8000, /* negative, subnormal */ + 0x8400, /* negative, -14 */ + 0x9000, /* negative, -11 */ + 0xB400, /* negative, -2 */ + 0xB800, /* negative, -1 */ + 0xBC00, /* negative, 0 */ + 0xC000, /* negative, 1 */ + 0xC400, /* negative, 2 */ + 0xE800, /* negative, 11 */ + 0xF800, /* negative, 15 */ + 0xFC00 /* negative, infinity or NaN */ +}; +static const uint16_t f16QOut[f16NumQOut] = { + 0x0000, /* positive, subnormal */ + 0x0400, /* positive, -14 */ + 0x0800, /* positive, -13 */ + 0x1000, /* positive, -11 */ + 0x2C00, /* positive, -4 */ + 0x3000, /* positive, -3 */ + 0x3400, /* positive, -2 */ + 0x3800, /* positive, -1 */ + 0x3C00, /* positive, 0 */ + 0x4000, /* positive, 1 */ + 0x4400, /* positive, 2 */ + 0x4800, /* positive, 3 */ + 0x4C00, /* positive, 4 */ + 0x6800, /* positive, 11 */ + 0x7400, /* positive, 14 */ + 0x7800, /* positive, 15 */ + 0x7C00, /* positive, infinity or NaN */ + 0x8000, /* negative, subnormal */ + 0x8400, /* negative, -14 */ + 0x8800, /* negative, -13 */ + 0x9000, /* negative, -11 */ + 0xAC00, /* negative, -4 */ + 0xB000, /* negative, -3 */ + 0xB400, /* negative, -2 */ + 0xB800, /* negative, -1 */ + 0xBC00, /* negative, 0 */ + 0xC000, /* negative, 1 */ + 0xC400, /* negative, 2 */ + 0xC800, /* negative, 3 */ + 0xCC00, /* negative, 4 */ + 0xE800, /* negative, 11 */ + 0xF400, /* negative, 14 */ + 0xF800, /* negative, 15 */ + 0xFC00 /* negative, infinity or NaN */ +}; +static const uint16_t f16P1[f16NumP1] = { + 0x0000, + 0x0001, + 0x03FF, + 0x03FE +}; +static const uint16_t f16P2[f16NumP2] = { + 0x0000, + 0x0001, + 0x0002, + 0x0004, + 0x0008, + 0x0010, + 0x0020, + 0x0040, + 0x0080, + 0x0100, + 0x0200, + 0x0300, + 0x0380, + 0x03C0, + 0x03E0, + 0x03F0, + 0x03F8, + 0x03FC, + 0x03FE, + 0x03FF, + 0x03FD, + 0x03FB, + 0x03F7, + 0x03EF, + 0x03DF, + 0x03BF, + 0x037F, + 0x02FF, + 0x01FF, + 0x00FF, + 0x007F, + 0x003F, + 0x001F, + 0x000F, + 0x0007, + 0x0003 +}; + +static const uint_fast64_t f16NumQInP1 = f16NumQIn * f16NumP1; +static const uint_fast64_t f16NumQOutP1 = f16NumQOut * f16NumP1; + +static float16_t f16NextQInP1( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui16_f16 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f16QIn[expNum] | f16P1[sigNum]; + ++sigNum; + if ( f16NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f16NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float16_t f16NextQOutP1( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui16_f16 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f16QOut[expNum] | f16P1[sigNum]; + ++sigNum; + if ( f16NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f16NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static const uint_fast64_t f16NumQInP2 = f16NumQIn * f16NumP2; +static const uint_fast64_t f16NumQOutP2 = f16NumQOut * f16NumP2; + +static float16_t f16NextQInP2( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui16_f16 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f16QIn[expNum] | f16P2[sigNum]; + ++sigNum; + if ( f16NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f16NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float16_t f16NextQOutP2( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui16_f16 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f16QOut[expNum] | f16P2[sigNum]; + ++sigNum; + if ( f16NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f16NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float16_t f16RandomQOutP3( void ) +{ + union ui16_f16 uZ; + + uZ.ui = + f16QOut[randomN_ui8( f16NumQOut )] + | ((f16P2[randomN_ui8( f16NumP2 )] + f16P2[randomN_ui8( f16NumP2 )]) + & 0x03FF); + return uZ.f; + +} + +static float16_t f16RandomQOutPInf( void ) +{ + union ui16_f16 uZ; + + uZ.ui = f16QOut[randomN_ui8( f16NumQOut )] | (random_ui16() & 0x03FF); + return uZ.f; + +} + +enum { f16NumQInfWeightMasks = 4 }; +static const uint16_t f16QInfWeightMasks[f16NumQInfWeightMasks] = + { 0xFC00, 0xFC00, 0xBC00, 0x9C00 }; +static const uint16_t f16QInfWeightOffsets[f16NumQInfWeightMasks] = + { 0x0000, 0x0000, 0x2000, 0x3000 }; + +static float16_t f16RandomQInfP3( void ) +{ + int weightMaskNum; + union ui16_f16 uZ; + + weightMaskNum = randomN_ui8( f16NumQInfWeightMasks ); + uZ.ui = + ((random_ui16() & f16QInfWeightMasks[weightMaskNum]) + + f16QInfWeightOffsets[weightMaskNum]) + | ((f16P2[randomN_ui8( f16NumP2 )] + f16P2[randomN_ui8( f16NumP2 )]) + & 0x03FF); + return uZ.f; + +} + +static float16_t f16RandomQInfPInf( void ) +{ + int weightMaskNum; + union ui16_f16 uZ; + + weightMaskNum = randomN_ui8( f16NumQInfWeightMasks ); + uZ.ui = + (random_ui16() & (f16QInfWeightMasks[weightMaskNum] | 0x03FF)) + + f16QInfWeightOffsets[weightMaskNum]; + return uZ.f; + +} + +static float16_t f16Random( void ) +{ + + switch ( random_ui8() & 7 ) { + case 0: + case 1: + case 2: + return f16RandomQOutP3(); + case 3: + return f16RandomQOutPInf(); + case 4: + case 5: + case 6: + return f16RandomQInfP3(); + case 7: + return f16RandomQInfPInf(); + } + +} + +static struct sequence sequenceA, sequenceB, sequenceC; +static float16_t currentA, currentB, currentC; +static int subcase; + +float16_t genCases_f16_a, genCases_f16_b, genCases_f16_c; + +void genCases_f16_a_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = + (genCases_level == 1) ? 3 * f16NumQOutP1 : 2 * f16NumQOutP2; + genCases_done = false; + +} + +void genCases_f16_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + case 1: + genCases_f16_a = f16Random(); + break; + case 2: + genCases_f16_a = f16NextQOutP1( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f16_a = f16Random(); + break; + case 1: + genCases_f16_a = f16NextQOutP2( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_f16_ab_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 6 * f16NumQInP1 * f16NumQInP1; + currentA = f16NextQInP1( &sequenceA ); + } else { + genCases_total = 2 * f16NumQInP2 * f16NumQInP2; + currentA = f16NextQInP2( &sequenceA ); + } + genCases_done = false; + +} + +void genCases_f16_ab_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f16NextQInP1( &sequenceA ); + } + currentB = f16NextQInP1( &sequenceB ); + case 2: + case 4: + genCases_f16_a = f16Random(); + genCases_f16_b = f16Random(); + break; + case 1: + genCases_f16_a = currentA; + genCases_f16_b = f16Random(); + break; + case 3: + genCases_f16_a = f16Random(); + genCases_f16_b = currentB; + break; + case 5: + genCases_f16_a = currentA; + genCases_f16_b = currentB; + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f16_a = f16Random(); + genCases_f16_b = f16Random(); + break; + case 1: + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f16NextQInP2( &sequenceA ); + } + genCases_f16_a = currentA; + genCases_f16_b = f16NextQInP2( &sequenceB ); + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_f16_abc_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + sequenceC.expNum = 0; + sequenceC.term1Num = 0; + sequenceC.term2Num = 0; + sequenceC.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 9 * f16NumQInP1 * f16NumQInP1 * f16NumQInP1; + currentA = f16NextQInP1( &sequenceA ); + currentB = f16NextQInP1( &sequenceB ); + } else { + genCases_total = 2 * f16NumQInP2 * f16NumQInP2 * f16NumQInP2; + currentA = f16NextQInP2( &sequenceA ); + currentB = f16NextQInP2( &sequenceB ); + } + genCases_done = false; + +} + +void genCases_f16_abc_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f16NextQInP1( &sequenceA ); + } + currentB = f16NextQInP1( &sequenceB ); + } + currentC = f16NextQInP1( &sequenceC ); + genCases_f16_a = f16Random(); + genCases_f16_b = f16Random(); + genCases_f16_c = currentC; + break; + case 1: + genCases_f16_a = currentA; + genCases_f16_b = currentB; + genCases_f16_c = f16Random(); + break; + case 2: + genCases_f16_a = f16Random(); + genCases_f16_b = f16Random(); + genCases_f16_c = f16Random(); + break; + case 3: + genCases_f16_a = f16Random(); + genCases_f16_b = currentB; + genCases_f16_c = currentC; + break; + case 4: + genCases_f16_a = currentA; + genCases_f16_b = f16Random(); + genCases_f16_c = f16Random(); + break; + case 5: + genCases_f16_a = f16Random(); + genCases_f16_b = currentB; + genCases_f16_c = f16Random(); + break; + case 6: + genCases_f16_a = currentA; + genCases_f16_b = f16Random(); + genCases_f16_c = currentC; + break; + case 7: + genCases_f16_a = f16Random(); + genCases_f16_b = f16Random(); + genCases_f16_c = f16Random(); + break; + case 8: + genCases_f16_a = currentA; + genCases_f16_b = currentB; + genCases_f16_c = currentC; + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f16_a = f16Random(); + genCases_f16_b = f16Random(); + genCases_f16_c = f16Random(); + break; + case 1: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f16NextQInP2( &sequenceA ); + } + currentB = f16NextQInP2( &sequenceB ); + } + genCases_f16_a = currentA; + genCases_f16_b = currentB; + genCases_f16_c = f16NextQInP2( &sequenceC ); + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_f32.c b/src/libs/softfloat-3e/testfloat/source/genCases_f32.c new file mode 100644 index 00000000..3da3a298 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_f32.c @@ -0,0 +1,664 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "random.h" +#include "softfloat.h" +#include "genCases.h" + +struct sequence { + int expNum, term1Num, term2Num; + bool done; +}; + +union ui32_f32 { uint32_t ui; float32_t f; }; + +enum { + f32NumQIn = 22, + f32NumQOut = 50, + f32NumP1 = 4, + f32NumP2 = 88 +}; +static const uint32_t f32QIn[f32NumQIn] = { + 0x00000000, /* positive, subnormal */ + 0x00800000, /* positive, -126 */ + 0x33800000, /* positive, -24 */ + 0x3E800000, /* positive, -2 */ + 0x3F000000, /* positive, -1 */ + 0x3F800000, /* positive, 0 */ + 0x40000000, /* positive, 1 */ + 0x40800000, /* positive, 2 */ + 0x4B800000, /* positive, 24 */ + 0x7F000000, /* positive, 127 */ + 0x7F800000, /* positive, infinity or NaN */ + 0x80000000, /* negative, subnormal */ + 0x80800000, /* negative, -126 */ + 0xB3800000, /* negative, -24 */ + 0xBE800000, /* negative, -2 */ + 0xBF000000, /* negative, -1 */ + 0xBF800000, /* negative, 0 */ + 0xC0000000, /* negative, 1 */ + 0xC0800000, /* negative, 2 */ + 0xCB800000, /* negative, 24 */ + 0xFE800000, /* negative, 126 */ + 0xFF800000 /* negative, infinity or NaN */ +}; +static const uint32_t f32QOut[f32NumQOut] = { + 0x00000000, /* positive, subnormal */ + 0x00800000, /* positive, -126 */ + 0x01000000, /* positive, -125 */ + 0x33800000, /* positive, -24 */ + 0x3D800000, /* positive, -4 */ + 0x3E000000, /* positive, -3 */ + 0x3E800000, /* positive, -2 */ + 0x3F000000, /* positive, -1 */ + 0x3F800000, /* positive, 0 */ + 0x40000000, /* positive, 1 */ + 0x40800000, /* positive, 2 */ + 0x41000000, /* positive, 3 */ + 0x41800000, /* positive, 4 */ + 0x4B800000, /* positive, 24 */ + 0x4E000000, /* positive, 29 */ + 0x4E800000, /* positive, 30 */ + 0x4F000000, /* positive, 31 */ + 0x4F800000, /* positive, 32 */ + 0x5E000000, /* positive, 61 */ + 0x5E800000, /* positive, 62 */ + 0x5F000000, /* positive, 63 */ + 0x5F800000, /* positive, 64 */ + 0x7E800000, /* positive, 126 */ + 0x7F000000, /* positive, 127 */ + 0x7F800000, /* positive, infinity or NaN */ + 0x80000000, /* negative, subnormal */ + 0x80800000, /* negative, -126 */ + 0x81000000, /* negative, -125 */ + 0xB3800000, /* negative, -24 */ + 0xBD800000, /* negative, -4 */ + 0xBE000000, /* negative, -3 */ + 0xBE800000, /* negative, -2 */ + 0xBF000000, /* negative, -1 */ + 0xBF800000, /* negative, 0 */ + 0xC0000000, /* negative, 1 */ + 0xC0800000, /* negative, 2 */ + 0xC1000000, /* negative, 3 */ + 0xC1800000, /* negative, 4 */ + 0xCB800000, /* negative, 24 */ + 0xCE000000, /* negative, 29 */ + 0xCE800000, /* negative, 30 */ + 0xCF000000, /* negative, 31 */ + 0xCF800000, /* negative, 32 */ + 0xDE000000, /* negative, 61 */ + 0xDE800000, /* negative, 62 */ + 0xDF000000, /* negative, 63 */ + 0xDF800000, /* negative, 64 */ + 0xFE800000, /* negative, 126 */ + 0xFF000000, /* negative, 127 */ + 0xFF800000 /* negative, infinity or NaN */ +}; +static const uint32_t f32P1[f32NumP1] = { + 0x00000000, + 0x00000001, + 0x007FFFFF, + 0x007FFFFE +}; +static const uint32_t f32P2[f32NumP2] = { + 0x00000000, + 0x00000001, + 0x00000002, + 0x00000004, + 0x00000008, + 0x00000010, + 0x00000020, + 0x00000040, + 0x00000080, + 0x00000100, + 0x00000200, + 0x00000400, + 0x00000800, + 0x00001000, + 0x00002000, + 0x00004000, + 0x00008000, + 0x00010000, + 0x00020000, + 0x00040000, + 0x00080000, + 0x00100000, + 0x00200000, + 0x00400000, + 0x00600000, + 0x00700000, + 0x00780000, + 0x007C0000, + 0x007E0000, + 0x007F0000, + 0x007F8000, + 0x007FC000, + 0x007FE000, + 0x007FF000, + 0x007FF800, + 0x007FFC00, + 0x007FFE00, + 0x007FFF00, + 0x007FFF80, + 0x007FFFC0, + 0x007FFFE0, + 0x007FFFF0, + 0x007FFFF8, + 0x007FFFFC, + 0x007FFFFE, + 0x007FFFFF, + 0x007FFFFD, + 0x007FFFFB, + 0x007FFFF7, + 0x007FFFEF, + 0x007FFFDF, + 0x007FFFBF, + 0x007FFF7F, + 0x007FFEFF, + 0x007FFDFF, + 0x007FFBFF, + 0x007FF7FF, + 0x007FEFFF, + 0x007FDFFF, + 0x007FBFFF, + 0x007F7FFF, + 0x007EFFFF, + 0x007DFFFF, + 0x007BFFFF, + 0x0077FFFF, + 0x006FFFFF, + 0x005FFFFF, + 0x003FFFFF, + 0x001FFFFF, + 0x000FFFFF, + 0x0007FFFF, + 0x0003FFFF, + 0x0001FFFF, + 0x0000FFFF, + 0x00007FFF, + 0x00003FFF, + 0x00001FFF, + 0x00000FFF, + 0x000007FF, + 0x000003FF, + 0x000001FF, + 0x000000FF, + 0x0000007F, + 0x0000003F, + 0x0000001F, + 0x0000000F, + 0x00000007, + 0x00000003 +}; + +static const uint_fast64_t f32NumQInP1 = f32NumQIn * f32NumP1; +static const uint_fast64_t f32NumQOutP1 = f32NumQOut * f32NumP1; + +static float32_t f32NextQInP1( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui32_f32 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f32QIn[expNum] | f32P1[sigNum]; + ++sigNum; + if ( f32NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f32NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float32_t f32NextQOutP1( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui32_f32 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f32QOut[expNum] | f32P1[sigNum]; + ++sigNum; + if ( f32NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f32NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static const uint_fast64_t f32NumQInP2 = f32NumQIn * f32NumP2; +static const uint_fast64_t f32NumQOutP2 = f32NumQOut * f32NumP2; + +static float32_t f32NextQInP2( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui32_f32 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f32QIn[expNum] | f32P2[sigNum]; + ++sigNum; + if ( f32NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f32NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float32_t f32NextQOutP2( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui32_f32 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f32QOut[expNum] | f32P2[sigNum]; + ++sigNum; + if ( f32NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f32NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float32_t f32RandomQOutP3( void ) +{ + union ui32_f32 uZ; + + uZ.ui = + f32QOut[randomN_ui8( f32NumQOut )] + | ((f32P2[randomN_ui8( f32NumP2 )] + f32P2[randomN_ui8( f32NumP2 )]) + & 0x007FFFFF); + return uZ.f; + +} + +static float32_t f32RandomQOutPInf( void ) +{ + union ui32_f32 uZ; + + uZ.ui = f32QOut[randomN_ui8( f32NumQOut )] | (random_ui32() & 0x007FFFFF); + return uZ.f; + +} + +enum { f32NumQInfWeightMasks = 7 }; +static const uint32_t f32QInfWeightMasks[f32NumQInfWeightMasks] = { + 0xFF800000, + 0xFF800000, + 0xBF800000, + 0x9F800000, + 0x8F800000, + 0x87800000, + 0x83800000 +}; +static const uint32_t f32QInfWeightOffsets[f32NumQInfWeightMasks] = { + 0x00000000, + 0x00000000, + 0x20000000, + 0x30000000, + 0x38000000, + 0x3C000000, + 0x3E000000 +}; + +static float32_t f32RandomQInfP3( void ) +{ + int weightMaskNum; + union ui32_f32 uZ; + + weightMaskNum = randomN_ui8( f32NumQInfWeightMasks ); + uZ.ui = + (((uint_fast32_t) random_ui16()<<16 + & f32QInfWeightMasks[weightMaskNum]) + + f32QInfWeightOffsets[weightMaskNum]) + | ((f32P2[randomN_ui8( f32NumP2 )] + f32P2[randomN_ui8( f32NumP2 )]) + & 0x007FFFFF); + return uZ.f; + +} + +static float32_t f32RandomQInfPInf( void ) +{ + int weightMaskNum; + union ui32_f32 uZ; + + weightMaskNum = randomN_ui8( f32NumQInfWeightMasks ); + uZ.ui = + (random_ui32() & (f32QInfWeightMasks[weightMaskNum] | 0x007FFFFF)) + + f32QInfWeightOffsets[weightMaskNum]; + return uZ.f; + +} + +static float32_t f32Random( void ) +{ + + switch ( random_ui8() & 7 ) { + case 0: + case 1: + case 2: + return f32RandomQOutP3(); + case 3: + return f32RandomQOutPInf(); + case 4: + case 5: + case 6: + return f32RandomQInfP3(); + case 7: + return f32RandomQInfPInf(); + } + +} + +static struct sequence sequenceA, sequenceB, sequenceC; +static float32_t currentA, currentB, currentC; +static int subcase; + +float32_t genCases_f32_a, genCases_f32_b, genCases_f32_c; + +void genCases_f32_a_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = + (genCases_level == 1) ? 3 * f32NumQOutP1 : 2 * f32NumQOutP2; + genCases_done = false; + +} + +void genCases_f32_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + case 1: + genCases_f32_a = f32Random(); + break; + case 2: + genCases_f32_a = f32NextQOutP1( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f32_a = f32Random(); + break; + case 1: + genCases_f32_a = f32NextQOutP2( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_f32_ab_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 6 * f32NumQInP1 * f32NumQInP1; + currentA = f32NextQInP1( &sequenceA ); + } else { + genCases_total = 2 * f32NumQInP2 * f32NumQInP2; + currentA = f32NextQInP2( &sequenceA ); + } + genCases_done = false; + +} + +void genCases_f32_ab_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f32NextQInP1( &sequenceA ); + } + currentB = f32NextQInP1( &sequenceB ); + case 2: + case 4: + genCases_f32_a = f32Random(); + genCases_f32_b = f32Random(); + break; + case 1: + genCases_f32_a = currentA; + genCases_f32_b = f32Random(); + break; + case 3: + genCases_f32_a = f32Random(); + genCases_f32_b = currentB; + break; + case 5: + genCases_f32_a = currentA; + genCases_f32_b = currentB; + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f32_a = f32Random(); + genCases_f32_b = f32Random(); + break; + case 1: + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f32NextQInP2( &sequenceA ); + } + genCases_f32_a = currentA; + genCases_f32_b = f32NextQInP2( &sequenceB ); + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_f32_abc_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + sequenceC.expNum = 0; + sequenceC.term1Num = 0; + sequenceC.term2Num = 0; + sequenceC.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 9 * f32NumQInP1 * f32NumQInP1 * f32NumQInP1; + currentA = f32NextQInP1( &sequenceA ); + currentB = f32NextQInP1( &sequenceB ); + } else { + genCases_total = 2 * f32NumQInP2 * f32NumQInP2 * f32NumQInP2; + currentA = f32NextQInP2( &sequenceA ); + currentB = f32NextQInP2( &sequenceB ); + } + genCases_done = false; + +} + +void genCases_f32_abc_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f32NextQInP1( &sequenceA ); + } + currentB = f32NextQInP1( &sequenceB ); + } + currentC = f32NextQInP1( &sequenceC ); + genCases_f32_a = f32Random(); + genCases_f32_b = f32Random(); + genCases_f32_c = currentC; + break; + case 1: + genCases_f32_a = currentA; + genCases_f32_b = currentB; + genCases_f32_c = f32Random(); + break; + case 2: + genCases_f32_a = f32Random(); + genCases_f32_b = f32Random(); + genCases_f32_c = f32Random(); + break; + case 3: + genCases_f32_a = f32Random(); + genCases_f32_b = currentB; + genCases_f32_c = currentC; + break; + case 4: + genCases_f32_a = currentA; + genCases_f32_b = f32Random(); + genCases_f32_c = f32Random(); + break; + case 5: + genCases_f32_a = f32Random(); + genCases_f32_b = currentB; + genCases_f32_c = f32Random(); + break; + case 6: + genCases_f32_a = currentA; + genCases_f32_b = f32Random(); + genCases_f32_c = currentC; + break; + case 7: + genCases_f32_a = f32Random(); + genCases_f32_b = f32Random(); + genCases_f32_c = f32Random(); + break; + case 8: + genCases_f32_a = currentA; + genCases_f32_b = currentB; + genCases_f32_c = currentC; + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f32_a = f32Random(); + genCases_f32_b = f32Random(); + genCases_f32_c = f32Random(); + break; + case 1: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f32NextQInP2( &sequenceA ); + } + currentB = f32NextQInP2( &sequenceB ); + } + genCases_f32_a = currentA; + genCases_f32_b = currentB; + genCases_f32_c = f32NextQInP2( &sequenceC ); + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } + ++subcase; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_f64.c b/src/libs/softfloat-3e/testfloat/source/genCases_f64.c new file mode 100644 index 00000000..5229e894 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_f64.c @@ -0,0 +1,808 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "random.h" +#include "softfloat.h" +#include "genCases.h" + +#ifdef FLOAT64 + +struct sequence { + int expNum, term1Num, term2Num; + bool done; +}; + +union ui64_f64 { uint64_t ui; float64_t f; }; + +enum { + f64NumQIn = 22, + f64NumQOut = 64, + f64NumP1 = 4, + f64NumP2 = 204 +}; +static const uint64_t f64QIn[f64NumQIn] = { + UINT64_C( 0x0000000000000000 ), /* positive, subnormal */ + UINT64_C( 0x0010000000000000 ), /* positive, -1022 */ + UINT64_C( 0x3CA0000000000000 ), /* positive, -53 */ + UINT64_C( 0x3FD0000000000000 ), /* positive, -2 */ + UINT64_C( 0x3FE0000000000000 ), /* positive, -1 */ + UINT64_C( 0x3FF0000000000000 ), /* positive, 0 */ + UINT64_C( 0x4000000000000000 ), /* positive, 1 */ + UINT64_C( 0x4010000000000000 ), /* positive, 2 */ + UINT64_C( 0x4340000000000000 ), /* positive, 53 */ + UINT64_C( 0x7FE0000000000000 ), /* positive, 1023 */ + UINT64_C( 0x7FF0000000000000 ), /* positive, infinity or NaN */ + UINT64_C( 0x8000000000000000 ), /* negative, subnormal */ + UINT64_C( 0x8010000000000000 ), /* negative, -1022 */ + UINT64_C( 0xBCA0000000000000 ), /* negative, -53 */ + UINT64_C( 0xBFD0000000000000 ), /* negative, -2 */ + UINT64_C( 0xBFE0000000000000 ), /* negative, -1 */ + UINT64_C( 0xBFF0000000000000 ), /* negative, 0 */ + UINT64_C( 0xC000000000000000 ), /* negative, 1 */ + UINT64_C( 0xC010000000000000 ), /* negative, 2 */ + UINT64_C( 0xC340000000000000 ), /* negative, 53 */ + UINT64_C( 0xFFE0000000000000 ), /* negative, 1023 */ + UINT64_C( 0xFFF0000000000000 ) /* negative, infinity or NaN */ +}; +static const uint64_t f64QOut[f64NumQOut] = { + UINT64_C( 0x0000000000000000 ), /* positive, subnormal */ + UINT64_C( 0x0010000000000000 ), /* positive, -1022 */ + UINT64_C( 0x0020000000000000 ), /* positive, -1021 */ + UINT64_C( 0x37E0000000000000 ), /* positive, -129 */ + UINT64_C( 0x37F0000000000000 ), /* positive, -128 */ + UINT64_C( 0x3800000000000000 ), /* positive, -127 */ + UINT64_C( 0x3810000000000000 ), /* positive, -126 */ + UINT64_C( 0x3CA0000000000000 ), /* positive, -53 */ + UINT64_C( 0x3FB0000000000000 ), /* positive, -4 */ + UINT64_C( 0x3FC0000000000000 ), /* positive, -3 */ + UINT64_C( 0x3FD0000000000000 ), /* positive, -2 */ + UINT64_C( 0x3FE0000000000000 ), /* positive, -1 */ + UINT64_C( 0x3FF0000000000000 ), /* positive, 0 */ + UINT64_C( 0x4000000000000000 ), /* positive, 1 */ + UINT64_C( 0x4010000000000000 ), /* positive, 2 */ + UINT64_C( 0x4020000000000000 ), /* positive, 3 */ + UINT64_C( 0x4030000000000000 ), /* positive, 4 */ + UINT64_C( 0x41C0000000000000 ), /* positive, 29 */ + UINT64_C( 0x41D0000000000000 ), /* positive, 30 */ + UINT64_C( 0x41E0000000000000 ), /* positive, 31 */ + UINT64_C( 0x41F0000000000000 ), /* positive, 32 */ + UINT64_C( 0x4340000000000000 ), /* positive, 53 */ + UINT64_C( 0x43C0000000000000 ), /* positive, 61 */ + UINT64_C( 0x43D0000000000000 ), /* positive, 62 */ + UINT64_C( 0x43E0000000000000 ), /* positive, 63 */ + UINT64_C( 0x43F0000000000000 ), /* positive, 64 */ + UINT64_C( 0x47E0000000000000 ), /* positive, 127 */ + UINT64_C( 0x47F0000000000000 ), /* positive, 128 */ + UINT64_C( 0x4800000000000000 ), /* positive, 129 */ + UINT64_C( 0x7FD0000000000000 ), /* positive, 1022 */ + UINT64_C( 0x7FE0000000000000 ), /* positive, 1023 */ + UINT64_C( 0x7FF0000000000000 ), /* positive, infinity or NaN */ + UINT64_C( 0x8000000000000000 ), /* negative, subnormal */ + UINT64_C( 0x8010000000000000 ), /* negative, -1022 */ + UINT64_C( 0x8020000000000000 ), /* negative, -1021 */ + UINT64_C( 0xB7E0000000000000 ), /* negative, -129 */ + UINT64_C( 0xB7F0000000000000 ), /* negative, -128 */ + UINT64_C( 0xB800000000000000 ), /* negative, -127 */ + UINT64_C( 0xB810000000000000 ), /* negative, -126 */ + UINT64_C( 0xBCA0000000000000 ), /* negative, -53 */ + UINT64_C( 0xBFB0000000000000 ), /* negative, -4 */ + UINT64_C( 0xBFC0000000000000 ), /* negative, -3 */ + UINT64_C( 0xBFD0000000000000 ), /* negative, -2 */ + UINT64_C( 0xBFE0000000000000 ), /* negative, -1 */ + UINT64_C( 0xBFF0000000000000 ), /* negative, 0 */ + UINT64_C( 0xC000000000000000 ), /* negative, 1 */ + UINT64_C( 0xC010000000000000 ), /* negative, 2 */ + UINT64_C( 0xC020000000000000 ), /* negative, 3 */ + UINT64_C( 0xC030000000000000 ), /* negative, 4 */ + UINT64_C( 0xC1C0000000000000 ), /* negative, 29 */ + UINT64_C( 0xC1D0000000000000 ), /* negative, 30 */ + UINT64_C( 0xC1E0000000000000 ), /* negative, 31 */ + UINT64_C( 0xC1F0000000000000 ), /* negative, 32 */ + UINT64_C( 0xC340000000000000 ), /* negative, 53 */ + UINT64_C( 0xC3C0000000000000 ), /* negative, 61 */ + UINT64_C( 0xC3D0000000000000 ), /* negative, 62 */ + UINT64_C( 0xC3E0000000000000 ), /* negative, 63 */ + UINT64_C( 0xC3F0000000000000 ), /* negative, 64 */ + UINT64_C( 0xC7E0000000000000 ), /* negative, 127 */ + UINT64_C( 0xC7F0000000000000 ), /* negative, 128 */ + UINT64_C( 0xC800000000000000 ), /* negative, 129 */ + UINT64_C( 0xFFD0000000000000 ), /* negative, 1022 */ + UINT64_C( 0xFFE0000000000000 ), /* negative, 1023 */ + UINT64_C( 0xFFF0000000000000 ) /* negative, infinity or NaN */ +}; +static const uint64_t f64P1[f64NumP1] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x0000000000000001 ), + UINT64_C( 0x000FFFFFFFFFFFFF ), + UINT64_C( 0x000FFFFFFFFFFFFE ) +}; +static const uint64_t f64P2[f64NumP2] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x0000000000000001 ), + UINT64_C( 0x0000000000000002 ), + UINT64_C( 0x0000000000000004 ), + UINT64_C( 0x0000000000000008 ), + UINT64_C( 0x0000000000000010 ), + UINT64_C( 0x0000000000000020 ), + UINT64_C( 0x0000000000000040 ), + UINT64_C( 0x0000000000000080 ), + UINT64_C( 0x0000000000000100 ), + UINT64_C( 0x0000000000000200 ), + UINT64_C( 0x0000000000000400 ), + UINT64_C( 0x0000000000000800 ), + UINT64_C( 0x0000000000001000 ), + UINT64_C( 0x0000000000002000 ), + UINT64_C( 0x0000000000004000 ), + UINT64_C( 0x0000000000008000 ), + UINT64_C( 0x0000000000010000 ), + UINT64_C( 0x0000000000020000 ), + UINT64_C( 0x0000000000040000 ), + UINT64_C( 0x0000000000080000 ), + UINT64_C( 0x0000000000100000 ), + UINT64_C( 0x0000000000200000 ), + UINT64_C( 0x0000000000400000 ), + UINT64_C( 0x0000000000800000 ), + UINT64_C( 0x0000000001000000 ), + UINT64_C( 0x0000000002000000 ), + UINT64_C( 0x0000000004000000 ), + UINT64_C( 0x0000000008000000 ), + UINT64_C( 0x0000000010000000 ), + UINT64_C( 0x0000000020000000 ), + UINT64_C( 0x0000000040000000 ), + UINT64_C( 0x0000000080000000 ), + UINT64_C( 0x0000000100000000 ), + UINT64_C( 0x0000000200000000 ), + UINT64_C( 0x0000000400000000 ), + UINT64_C( 0x0000000800000000 ), + UINT64_C( 0x0000001000000000 ), + UINT64_C( 0x0000002000000000 ), + UINT64_C( 0x0000004000000000 ), + UINT64_C( 0x0000008000000000 ), + UINT64_C( 0x0000010000000000 ), + UINT64_C( 0x0000020000000000 ), + UINT64_C( 0x0000040000000000 ), + UINT64_C( 0x0000080000000000 ), + UINT64_C( 0x0000100000000000 ), + UINT64_C( 0x0000200000000000 ), + UINT64_C( 0x0000400000000000 ), + UINT64_C( 0x0000800000000000 ), + UINT64_C( 0x0001000000000000 ), + UINT64_C( 0x0002000000000000 ), + UINT64_C( 0x0004000000000000 ), + UINT64_C( 0x0008000000000000 ), + UINT64_C( 0x000C000000000000 ), + UINT64_C( 0x000E000000000000 ), + UINT64_C( 0x000F000000000000 ), + UINT64_C( 0x000F800000000000 ), + UINT64_C( 0x000FC00000000000 ), + UINT64_C( 0x000FE00000000000 ), + UINT64_C( 0x000FF00000000000 ), + UINT64_C( 0x000FF80000000000 ), + UINT64_C( 0x000FFC0000000000 ), + UINT64_C( 0x000FFE0000000000 ), + UINT64_C( 0x000FFF0000000000 ), + UINT64_C( 0x000FFF8000000000 ), + UINT64_C( 0x000FFFC000000000 ), + UINT64_C( 0x000FFFE000000000 ), + UINT64_C( 0x000FFFF000000000 ), + UINT64_C( 0x000FFFF800000000 ), + UINT64_C( 0x000FFFFC00000000 ), + UINT64_C( 0x000FFFFE00000000 ), + UINT64_C( 0x000FFFFF00000000 ), + UINT64_C( 0x000FFFFF80000000 ), + UINT64_C( 0x000FFFFFC0000000 ), + UINT64_C( 0x000FFFFFE0000000 ), + UINT64_C( 0x000FFFFFF0000000 ), + UINT64_C( 0x000FFFFFF8000000 ), + UINT64_C( 0x000FFFFFFC000000 ), + UINT64_C( 0x000FFFFFFE000000 ), + UINT64_C( 0x000FFFFFFF000000 ), + UINT64_C( 0x000FFFFFFF800000 ), + UINT64_C( 0x000FFFFFFFC00000 ), + UINT64_C( 0x000FFFFFFFE00000 ), + UINT64_C( 0x000FFFFFFFF00000 ), + UINT64_C( 0x000FFFFFFFF80000 ), + UINT64_C( 0x000FFFFFFFFC0000 ), + UINT64_C( 0x000FFFFFFFFE0000 ), + UINT64_C( 0x000FFFFFFFFF0000 ), + UINT64_C( 0x000FFFFFFFFF8000 ), + UINT64_C( 0x000FFFFFFFFFC000 ), + UINT64_C( 0x000FFFFFFFFFE000 ), + UINT64_C( 0x000FFFFFFFFFF000 ), + UINT64_C( 0x000FFFFFFFFFF800 ), + UINT64_C( 0x000FFFFFFFFFFC00 ), + UINT64_C( 0x000FFFFFFFFFFE00 ), + UINT64_C( 0x000FFFFFFFFFFF00 ), + UINT64_C( 0x000FFFFFFFFFFF80 ), + UINT64_C( 0x000FFFFFFFFFFFC0 ), + UINT64_C( 0x000FFFFFFFFFFFE0 ), + UINT64_C( 0x000FFFFFFFFFFFF0 ), + UINT64_C( 0x000FFFFFFFFFFFF8 ), + UINT64_C( 0x000FFFFFFFFFFFFC ), + UINT64_C( 0x000FFFFFFFFFFFFE ), + UINT64_C( 0x000FFFFFFFFFFFFF ), + UINT64_C( 0x000FFFFFFFFFFFFD ), + UINT64_C( 0x000FFFFFFFFFFFFB ), + UINT64_C( 0x000FFFFFFFFFFFF7 ), + UINT64_C( 0x000FFFFFFFFFFFEF ), + UINT64_C( 0x000FFFFFFFFFFFDF ), + UINT64_C( 0x000FFFFFFFFFFFBF ), + UINT64_C( 0x000FFFFFFFFFFF7F ), + UINT64_C( 0x000FFFFFFFFFFEFF ), + UINT64_C( 0x000FFFFFFFFFFDFF ), + UINT64_C( 0x000FFFFFFFFFFBFF ), + UINT64_C( 0x000FFFFFFFFFF7FF ), + UINT64_C( 0x000FFFFFFFFFEFFF ), + UINT64_C( 0x000FFFFFFFFFDFFF ), + UINT64_C( 0x000FFFFFFFFFBFFF ), + UINT64_C( 0x000FFFFFFFFF7FFF ), + UINT64_C( 0x000FFFFFFFFEFFFF ), + UINT64_C( 0x000FFFFFFFFDFFFF ), + UINT64_C( 0x000FFFFFFFFBFFFF ), + UINT64_C( 0x000FFFFFFFF7FFFF ), + UINT64_C( 0x000FFFFFFFEFFFFF ), + UINT64_C( 0x000FFFFFFFDFFFFF ), + UINT64_C( 0x000FFFFFFFBFFFFF ), + UINT64_C( 0x000FFFFFFF7FFFFF ), + UINT64_C( 0x000FFFFFFEFFFFFF ), + UINT64_C( 0x000FFFFFFDFFFFFF ), + UINT64_C( 0x000FFFFFFBFFFFFF ), + UINT64_C( 0x000FFFFFF7FFFFFF ), + UINT64_C( 0x000FFFFFEFFFFFFF ), + UINT64_C( 0x000FFFFFDFFFFFFF ), + UINT64_C( 0x000FFFFFBFFFFFFF ), + UINT64_C( 0x000FFFFF7FFFFFFF ), + UINT64_C( 0x000FFFFEFFFFFFFF ), + UINT64_C( 0x000FFFFDFFFFFFFF ), + UINT64_C( 0x000FFFFBFFFFFFFF ), + UINT64_C( 0x000FFFF7FFFFFFFF ), + UINT64_C( 0x000FFFEFFFFFFFFF ), + UINT64_C( 0x000FFFDFFFFFFFFF ), + UINT64_C( 0x000FFFBFFFFFFFFF ), + UINT64_C( 0x000FFF7FFFFFFFFF ), + UINT64_C( 0x000FFEFFFFFFFFFF ), + UINT64_C( 0x000FFDFFFFFFFFFF ), + UINT64_C( 0x000FFBFFFFFFFFFF ), + UINT64_C( 0x000FF7FFFFFFFFFF ), + UINT64_C( 0x000FEFFFFFFFFFFF ), + UINT64_C( 0x000FDFFFFFFFFFFF ), + UINT64_C( 0x000FBFFFFFFFFFFF ), + UINT64_C( 0x000F7FFFFFFFFFFF ), + UINT64_C( 0x000EFFFFFFFFFFFF ), + UINT64_C( 0x000DFFFFFFFFFFFF ), + UINT64_C( 0x000BFFFFFFFFFFFF ), + UINT64_C( 0x0007FFFFFFFFFFFF ), + UINT64_C( 0x0003FFFFFFFFFFFF ), + UINT64_C( 0x0001FFFFFFFFFFFF ), + UINT64_C( 0x0000FFFFFFFFFFFF ), + UINT64_C( 0x00007FFFFFFFFFFF ), + UINT64_C( 0x00003FFFFFFFFFFF ), + UINT64_C( 0x00001FFFFFFFFFFF ), + UINT64_C( 0x00000FFFFFFFFFFF ), + UINT64_C( 0x000007FFFFFFFFFF ), + UINT64_C( 0x000003FFFFFFFFFF ), + UINT64_C( 0x000001FFFFFFFFFF ), + UINT64_C( 0x000000FFFFFFFFFF ), + UINT64_C( 0x0000007FFFFFFFFF ), + UINT64_C( 0x0000003FFFFFFFFF ), + UINT64_C( 0x0000001FFFFFFFFF ), + UINT64_C( 0x0000000FFFFFFFFF ), + UINT64_C( 0x00000007FFFFFFFF ), + UINT64_C( 0x00000003FFFFFFFF ), + UINT64_C( 0x00000001FFFFFFFF ), + UINT64_C( 0x00000000FFFFFFFF ), + UINT64_C( 0x000000007FFFFFFF ), + UINT64_C( 0x000000003FFFFFFF ), + UINT64_C( 0x000000001FFFFFFF ), + UINT64_C( 0x000000000FFFFFFF ), + UINT64_C( 0x0000000007FFFFFF ), + UINT64_C( 0x0000000003FFFFFF ), + UINT64_C( 0x0000000001FFFFFF ), + UINT64_C( 0x0000000000FFFFFF ), + UINT64_C( 0x00000000007FFFFF ), + UINT64_C( 0x00000000003FFFFF ), + UINT64_C( 0x00000000001FFFFF ), + UINT64_C( 0x00000000000FFFFF ), + UINT64_C( 0x000000000007FFFF ), + UINT64_C( 0x000000000003FFFF ), + UINT64_C( 0x000000000001FFFF ), + UINT64_C( 0x000000000000FFFF ), + UINT64_C( 0x0000000000007FFF ), + UINT64_C( 0x0000000000003FFF ), + UINT64_C( 0x0000000000001FFF ), + UINT64_C( 0x0000000000000FFF ), + UINT64_C( 0x00000000000007FF ), + UINT64_C( 0x00000000000003FF ), + UINT64_C( 0x00000000000001FF ), + UINT64_C( 0x00000000000000FF ), + UINT64_C( 0x000000000000007F ), + UINT64_C( 0x000000000000003F ), + UINT64_C( 0x000000000000001F ), + UINT64_C( 0x000000000000000F ), + UINT64_C( 0x0000000000000007 ), + UINT64_C( 0x0000000000000003 ) +}; + +static const uint_fast64_t f64NumQInP1 = f64NumQIn * f64NumP1; +static const uint_fast64_t f64NumQOutP1 = f64NumQOut * f64NumP1; + +static float64_t f64NextQInP1( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui64_f64 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f64QIn[expNum] | f64P1[sigNum]; + ++sigNum; + if ( f64NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f64NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float64_t f64NextQOutP1( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui64_f64 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f64QOut[expNum] | f64P1[sigNum]; + ++sigNum; + if ( f64NumP1 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f64NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static const uint_fast64_t f64NumQInP2 = f64NumQIn * f64NumP2; +static const uint_fast64_t f64NumQOutP2 = f64NumQOut * f64NumP2; + +static float64_t f64NextQInP2( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui64_f64 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f64QIn[expNum] | f64P2[sigNum]; + ++sigNum; + if ( f64NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f64NumQIn <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float64_t f64NextQOutP2( struct sequence *sequencePtr ) +{ + int expNum, sigNum; + union ui64_f64 uZ; + + expNum = sequencePtr->expNum; + sigNum = sequencePtr->term1Num; + uZ.ui = f64QOut[expNum] | f64P2[sigNum]; + ++sigNum; + if ( f64NumP2 <= sigNum ) { + sigNum = 0; + ++expNum; + if ( f64NumQOut <= expNum ) { + expNum = 0; + sequencePtr->done = true; + } + sequencePtr->expNum = expNum; + } + sequencePtr->term1Num = sigNum; + return uZ.f; + +} + +static float64_t f64RandomQOutP3( void ) +{ + union ui64_f64 uZ; + + uZ.ui = + f64QOut[randomN_ui8( f64NumQOut )] + | ((f64P2[randomN_ui8( f64NumP2 )] + f64P2[randomN_ui8( f64NumP2 )]) + & UINT64_C( 0x000FFFFFFFFFFFFF )); + return uZ.f; + +} + +static float64_t f64RandomQOutPInf( void ) +{ + union ui64_f64 uZ; + + uZ.ui = + f64QOut[randomN_ui8( f64NumQOut )] + | (random_ui64() & UINT64_C( 0x000FFFFFFFFFFFFF )); + return uZ.f; + +} + +enum { f64NumQInfWeightMasks = 10 }; +static const uint64_t f64QInfWeightMasks[f64NumQInfWeightMasks] = { + UINT64_C( 0xFFF0000000000000 ), + UINT64_C( 0xFFF0000000000000 ), + UINT64_C( 0xBFF0000000000000 ), + UINT64_C( 0x9FF0000000000000 ), + UINT64_C( 0x8FF0000000000000 ), + UINT64_C( 0x87F0000000000000 ), + UINT64_C( 0x83F0000000000000 ), + UINT64_C( 0x81F0000000000000 ), + UINT64_C( 0x80F0000000000000 ), + UINT64_C( 0x8070000000000000 ) +}; +static const uint64_t f64QInfWeightOffsets[f64NumQInfWeightMasks] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x2000000000000000 ), + UINT64_C( 0x3000000000000000 ), + UINT64_C( 0x3800000000000000 ), + UINT64_C( 0x3C00000000000000 ), + UINT64_C( 0x3E00000000000000 ), + UINT64_C( 0x3F00000000000000 ), + UINT64_C( 0x3F80000000000000 ), + UINT64_C( 0x3FC0000000000000 ) +}; + +static float64_t f64RandomQInfP3( void ) +{ + int weightMaskNum; + union ui64_f64 uZ; + + weightMaskNum = randomN_ui8( f64NumQInfWeightMasks ); + uZ.ui = + (((uint_fast64_t) random_ui16()<<48 + & f64QInfWeightMasks[weightMaskNum]) + + f64QInfWeightOffsets[weightMaskNum]) + | ((f64P2[randomN_ui8( f64NumP2 )] + f64P2[randomN_ui8( f64NumP2 )]) + & UINT64_C( 0x000FFFFFFFFFFFFF )); + return uZ.f; + +} + +static float64_t f64RandomQInfPInf( void ) +{ + int weightMaskNum; + union ui64_f64 uZ; + + weightMaskNum = randomN_ui8( f64NumQInfWeightMasks ); + uZ.ui = + (random_ui64() + & (f64QInfWeightMasks[weightMaskNum] + | UINT64_C( 0x000FFFFFFFFFFFFF ))) + + f64QInfWeightOffsets[weightMaskNum]; + return uZ.f; + +} + +static float64_t f64Random( void ) +{ + + switch ( random_ui8() & 7 ) { + case 0: + case 1: + case 2: + return f64RandomQOutP3(); + case 3: + return f64RandomQOutPInf(); + case 4: + case 5: + case 6: + return f64RandomQInfP3(); + case 7: + return f64RandomQInfPInf(); + } + +} + +static struct sequence sequenceA, sequenceB, sequenceC; +static float64_t currentA, currentB, currentC; +static int subcase; + +float64_t genCases_f64_a, genCases_f64_b, genCases_f64_c; + +void genCases_f64_a_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = + (genCases_level == 1) ? 3 * f64NumQOutP1 : 2 * f64NumQOutP2; + genCases_done = false; + +} + +void genCases_f64_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + case 1: + genCases_f64_a = f64Random(); + break; + case 2: + genCases_f64_a = f64NextQOutP1( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f64_a = f64Random(); + break; + case 1: + genCases_f64_a = f64NextQOutP2( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_f64_ab_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 6 * f64NumQInP1 * f64NumQInP1; + currentA = f64NextQInP1( &sequenceA ); + } else { + genCases_total = 2 * f64NumQInP2 * f64NumQInP2; + currentA = f64NextQInP2( &sequenceA ); + } + genCases_done = false; + +} + +void genCases_f64_ab_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f64NextQInP1( &sequenceA ); + } + currentB = f64NextQInP1( &sequenceB ); + case 2: + case 4: + genCases_f64_a = f64Random(); + genCases_f64_b = f64Random(); + break; + case 1: + genCases_f64_a = currentA; + genCases_f64_b = f64Random(); + break; + case 3: + genCases_f64_a = f64Random(); + genCases_f64_b = currentB; + break; + case 5: + genCases_f64_a = currentA; + genCases_f64_b = currentB; + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f64_a = f64Random(); + genCases_f64_b = f64Random(); + break; + case 1: + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f64NextQInP2( &sequenceA ); + } + genCases_f64_a = currentA; + genCases_f64_b = f64NextQInP2( &sequenceB ); + genCases_done = sequenceA.done & sequenceB.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +void genCases_f64_abc_init( void ) +{ + + sequenceA.expNum = 0; + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + sequenceB.expNum = 0; + sequenceB.term1Num = 0; + sequenceB.term2Num = 0; + sequenceB.done = false; + sequenceC.expNum = 0; + sequenceC.term1Num = 0; + sequenceC.term2Num = 0; + sequenceC.done = false; + subcase = 0; + if ( genCases_level == 1 ) { + genCases_total = 9 * f64NumQInP1 * f64NumQInP1 * f64NumQInP1; + currentA = f64NextQInP1( &sequenceA ); + currentB = f64NextQInP1( &sequenceB ); + } else { + genCases_total = 2 * f64NumQInP2 * f64NumQInP2 * f64NumQInP2; + currentA = f64NextQInP2( &sequenceA ); + currentB = f64NextQInP2( &sequenceB ); + } + genCases_done = false; + +} + +void genCases_f64_abc_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f64NextQInP1( &sequenceA ); + } + currentB = f64NextQInP1( &sequenceB ); + } + currentC = f64NextQInP1( &sequenceC ); + genCases_f64_a = f64Random(); + genCases_f64_b = f64Random(); + genCases_f64_c = currentC; + break; + case 1: + genCases_f64_a = currentA; + genCases_f64_b = currentB; + genCases_f64_c = f64Random(); + break; + case 2: + genCases_f64_a = f64Random(); + genCases_f64_b = f64Random(); + genCases_f64_c = f64Random(); + break; + case 3: + genCases_f64_a = f64Random(); + genCases_f64_b = currentB; + genCases_f64_c = currentC; + break; + case 4: + genCases_f64_a = currentA; + genCases_f64_b = f64Random(); + genCases_f64_c = f64Random(); + break; + case 5: + genCases_f64_a = f64Random(); + genCases_f64_b = currentB; + genCases_f64_c = f64Random(); + break; + case 6: + genCases_f64_a = currentA; + genCases_f64_b = f64Random(); + genCases_f64_c = currentC; + break; + case 7: + genCases_f64_a = f64Random(); + genCases_f64_b = f64Random(); + genCases_f64_c = f64Random(); + break; + case 8: + genCases_f64_a = currentA; + genCases_f64_b = currentB; + genCases_f64_c = currentC; + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_f64_a = f64Random(); + genCases_f64_b = f64Random(); + genCases_f64_c = f64Random(); + break; + case 1: + if ( sequenceC.done ) { + sequenceC.done = false; + if ( sequenceB.done ) { + sequenceB.done = false; + currentA = f64NextQInP2( &sequenceA ); + } + currentB = f64NextQInP2( &sequenceB ); + } + genCases_f64_a = currentA; + genCases_f64_b = currentB; + genCases_f64_c = f64NextQInP2( &sequenceC ); + genCases_done = sequenceA.done & sequenceB.done & sequenceC.done; + subcase = -1; + break; + } + } + ++subcase; + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_i32.c b/src/libs/softfloat-3e/testfloat/source/genCases_i32.c new file mode 100644 index 00000000..94c4db02 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_i32.c @@ -0,0 +1,362 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "random.h" +#include "genCases.h" + +struct sequence { + int term1Num, term2Num; + bool done; +}; + +union ui32_i32 { uint32_t ui; int32_t i; }; + +enum { i32NumP1 = 124 }; +static const uint32_t i32P1[i32NumP1] = { + 0x00000000, + 0x00000001, + 0x00000002, + 0x00000004, + 0x00000008, + 0x00000010, + 0x00000020, + 0x00000040, + 0x00000080, + 0x00000100, + 0x00000200, + 0x00000400, + 0x00000800, + 0x00001000, + 0x00002000, + 0x00004000, + 0x00008000, + 0x00010000, + 0x00020000, + 0x00040000, + 0x00080000, + 0x00100000, + 0x00200000, + 0x00400000, + 0x00800000, + 0x01000000, + 0x02000000, + 0x04000000, + 0x08000000, + 0x10000000, + 0x20000000, + 0x40000000, + 0x80000000, + 0xC0000000, + 0xE0000000, + 0xF0000000, + 0xF8000000, + 0xFC000000, + 0xFE000000, + 0xFF000000, + 0xFF800000, + 0xFFC00000, + 0xFFE00000, + 0xFFF00000, + 0xFFF80000, + 0xFFFC0000, + 0xFFFE0000, + 0xFFFF0000, + 0xFFFF8000, + 0xFFFFC000, + 0xFFFFE000, + 0xFFFFF000, + 0xFFFFF800, + 0xFFFFFC00, + 0xFFFFFE00, + 0xFFFFFF00, + 0xFFFFFF80, + 0xFFFFFFC0, + 0xFFFFFFE0, + 0xFFFFFFF0, + 0xFFFFFFF8, + 0xFFFFFFFC, + 0xFFFFFFFE, + 0xFFFFFFFF, + 0xFFFFFFFD, + 0xFFFFFFFB, + 0xFFFFFFF7, + 0xFFFFFFEF, + 0xFFFFFFDF, + 0xFFFFFFBF, + 0xFFFFFF7F, + 0xFFFFFEFF, + 0xFFFFFDFF, + 0xFFFFFBFF, + 0xFFFFF7FF, + 0xFFFFEFFF, + 0xFFFFDFFF, + 0xFFFFBFFF, + 0xFFFF7FFF, + 0xFFFEFFFF, + 0xFFFDFFFF, + 0xFFFBFFFF, + 0xFFF7FFFF, + 0xFFEFFFFF, + 0xFFDFFFFF, + 0xFFBFFFFF, + 0xFF7FFFFF, + 0xFEFFFFFF, + 0xFDFFFFFF, + 0xFBFFFFFF, + 0xF7FFFFFF, + 0xEFFFFFFF, + 0xDFFFFFFF, + 0xBFFFFFFF, + 0x7FFFFFFF, + 0x3FFFFFFF, + 0x1FFFFFFF, + 0x0FFFFFFF, + 0x07FFFFFF, + 0x03FFFFFF, + 0x01FFFFFF, + 0x00FFFFFF, + 0x007FFFFF, + 0x003FFFFF, + 0x001FFFFF, + 0x000FFFFF, + 0x0007FFFF, + 0x0003FFFF, + 0x0001FFFF, + 0x0000FFFF, + 0x00007FFF, + 0x00003FFF, + 0x00001FFF, + 0x00000FFF, + 0x000007FF, + 0x000003FF, + 0x000001FF, + 0x000000FF, + 0x0000007F, + 0x0000003F, + 0x0000001F, + 0x0000000F, + 0x00000007, + 0x00000003 +}; + +static int32_t i32NextP1( struct sequence *sequencePtr ) +{ + int termNum; + union ui32_i32 uZ; + + termNum = sequencePtr->term1Num; + uZ.ui = i32P1[termNum]; + ++termNum; + if ( i32NumP1 <= termNum ) { + termNum = 0; + sequencePtr->done = true; + } + sequencePtr->term1Num = termNum; + return uZ.i; + +} + +static const int_fast32_t i32NumP2 = (i32NumP1 * i32NumP1 + i32NumP1) / 2; + +static int32_t i32NextP2( struct sequence *sequencePtr ) +{ + int term1Num, term2Num; + union ui32_i32 uZ; + + term2Num = sequencePtr->term2Num; + term1Num = sequencePtr->term1Num; + uZ.ui = i32P1[term1Num] + i32P1[term2Num]; + ++term2Num; + if ( i32NumP1 <= term2Num ) { + ++term1Num; + if ( i32NumP1 <= term1Num ) { + term1Num = 0; + sequencePtr->done = true; + } + term2Num = term1Num; + sequencePtr->term1Num = term1Num; + } + sequencePtr->term2Num = term2Num; + return uZ.i; + +} + +static int32_t i32RandomP3( void ) +{ + union ui32_i32 uZ; + + uZ.ui = + i32P1[randomN_ui8( i32NumP1 )] + i32P1[randomN_ui8( i32NumP1 )] + + i32P1[randomN_ui8( i32NumP1 )]; + return uZ.i; + +} + +enum { i32NumPInfWeightMasks = 29 }; +static const uint32_t i32PInfWeightMasks[i32NumPInfWeightMasks] = { + 0xFFFFFFFF, + 0x7FFFFFFF, + 0x3FFFFFFF, + 0x1FFFFFFF, + 0x0FFFFFFF, + 0x07FFFFFF, + 0x03FFFFFF, + 0x01FFFFFF, + 0x00FFFFFF, + 0x007FFFFF, + 0x003FFFFF, + 0x001FFFFF, + 0x000FFFFF, + 0x0007FFFF, + 0x0003FFFF, + 0x0001FFFF, + 0x0000FFFF, + 0x00007FFF, + 0x00003FFF, + 0x00001FFF, + 0x00000FFF, + 0x000007FF, + 0x000003FF, + 0x000001FF, + 0x000000FF, + 0x0000007F, + 0x0000003F, + 0x0000001F, + 0x0000000F +}; +static const uint32_t i32PInfWeightOffsets[i32NumPInfWeightMasks] = { + 0x00000000, + 0xC0000000, + 0xE0000000, + 0xF0000000, + 0xF8000000, + 0xFC000000, + 0xFE000000, + 0xFF000000, + 0xFF800000, + 0xFFC00000, + 0xFFE00000, + 0xFFF00000, + 0xFFF80000, + 0xFFFC0000, + 0xFFFE0000, + 0xFFFF0000, + 0xFFFF8000, + 0xFFFFC000, + 0xFFFFE000, + 0xFFFFF000, + 0xFFFFF800, + 0xFFFFFC00, + 0xFFFFFE00, + 0xFFFFFF00, + 0xFFFFFF80, + 0xFFFFFFC0, + 0xFFFFFFE0, + 0xFFFFFFF0, + 0xFFFFFFF8 +}; + +static int32_t i32RandomPInf( void ) +{ + int weightMaskNum; + union ui32_i32 uZ; + + weightMaskNum = randomN_ui8( i32NumPInfWeightMasks ); + uZ.ui = + (random_ui32() & i32PInfWeightMasks[weightMaskNum]) + + i32PInfWeightOffsets[weightMaskNum]; + return uZ.i; + +} + +static struct sequence sequenceA; +static int subcase; + +int32_t genCases_i32_a; + +void genCases_i32_a_init( void ) +{ + + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = (genCases_level == 1) ? 3 * i32NumP1 : 2 * i32NumP2; + genCases_done = false; + +} + +void genCases_i32_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + genCases_i32_a = i32RandomP3(); + break; + case 1: + genCases_i32_a = i32RandomPInf(); + break; + case 2: + genCases_i32_a = i32NextP1( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_i32_a = i32RandomP3(); + break; + case 2: + genCases_i32_a = i32RandomPInf(); + break; + case 3: + subcase = -1; + case 1: + genCases_i32_a = i32NextP2( &sequenceA ); + genCases_done = sequenceA.done; + break; + } + } + ++subcase; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_i64.c b/src/libs/softfloat-3e/testfloat/source/genCases_i64.c new file mode 100644 index 00000000..10f0716a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_i64.c @@ -0,0 +1,554 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "random.h" +#include "genCases.h" + +struct sequence { + int term1Num, term2Num; + bool done; +}; + +union ui64_i64 { uint64_t ui; int64_t i; }; + +enum { i64NumP1 = 252 }; +static const uint64_t i64P1[i64NumP1] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x0000000000000001 ), + UINT64_C( 0x0000000000000002 ), + UINT64_C( 0x0000000000000004 ), + UINT64_C( 0x0000000000000008 ), + UINT64_C( 0x0000000000000010 ), + UINT64_C( 0x0000000000000020 ), + UINT64_C( 0x0000000000000040 ), + UINT64_C( 0x0000000000000080 ), + UINT64_C( 0x0000000000000100 ), + UINT64_C( 0x0000000000000200 ), + UINT64_C( 0x0000000000000400 ), + UINT64_C( 0x0000000000000800 ), + UINT64_C( 0x0000000000001000 ), + UINT64_C( 0x0000000000002000 ), + UINT64_C( 0x0000000000004000 ), + UINT64_C( 0x0000000000008000 ), + UINT64_C( 0x0000000000010000 ), + UINT64_C( 0x0000000000020000 ), + UINT64_C( 0x0000000000040000 ), + UINT64_C( 0x0000000000080000 ), + UINT64_C( 0x0000000000100000 ), + UINT64_C( 0x0000000000200000 ), + UINT64_C( 0x0000000000400000 ), + UINT64_C( 0x0000000000800000 ), + UINT64_C( 0x0000000001000000 ), + UINT64_C( 0x0000000002000000 ), + UINT64_C( 0x0000000004000000 ), + UINT64_C( 0x0000000008000000 ), + UINT64_C( 0x0000000010000000 ), + UINT64_C( 0x0000000020000000 ), + UINT64_C( 0x0000000040000000 ), + UINT64_C( 0x0000000080000000 ), + UINT64_C( 0x0000000100000000 ), + UINT64_C( 0x0000000200000000 ), + UINT64_C( 0x0000000400000000 ), + UINT64_C( 0x0000000800000000 ), + UINT64_C( 0x0000001000000000 ), + UINT64_C( 0x0000002000000000 ), + UINT64_C( 0x0000004000000000 ), + UINT64_C( 0x0000008000000000 ), + UINT64_C( 0x0000010000000000 ), + UINT64_C( 0x0000020000000000 ), + UINT64_C( 0x0000040000000000 ), + UINT64_C( 0x0000080000000000 ), + UINT64_C( 0x0000100000000000 ), + UINT64_C( 0x0000200000000000 ), + UINT64_C( 0x0000400000000000 ), + UINT64_C( 0x0000800000000000 ), + UINT64_C( 0x0001000000000000 ), + UINT64_C( 0x0002000000000000 ), + UINT64_C( 0x0004000000000000 ), + UINT64_C( 0x0008000000000000 ), + UINT64_C( 0x0010000000000000 ), + UINT64_C( 0x0020000000000000 ), + UINT64_C( 0x0040000000000000 ), + UINT64_C( 0x0080000000000000 ), + UINT64_C( 0x0100000000000000 ), + UINT64_C( 0x0200000000000000 ), + UINT64_C( 0x0400000000000000 ), + UINT64_C( 0x0800000000000000 ), + UINT64_C( 0x1000000000000000 ), + UINT64_C( 0x2000000000000000 ), + UINT64_C( 0x4000000000000000 ), + UINT64_C( 0x8000000000000000 ), + UINT64_C( 0xC000000000000000 ), + UINT64_C( 0xE000000000000000 ), + UINT64_C( 0xF000000000000000 ), + UINT64_C( 0xF800000000000000 ), + UINT64_C( 0xFC00000000000000 ), + UINT64_C( 0xFE00000000000000 ), + UINT64_C( 0xFF00000000000000 ), + UINT64_C( 0xFF80000000000000 ), + UINT64_C( 0xFFC0000000000000 ), + UINT64_C( 0xFFE0000000000000 ), + UINT64_C( 0xFFF0000000000000 ), + UINT64_C( 0xFFF8000000000000 ), + UINT64_C( 0xFFFC000000000000 ), + UINT64_C( 0xFFFE000000000000 ), + UINT64_C( 0xFFFF000000000000 ), + UINT64_C( 0xFFFF800000000000 ), + UINT64_C( 0xFFFFC00000000000 ), + UINT64_C( 0xFFFFE00000000000 ), + UINT64_C( 0xFFFFF00000000000 ), + UINT64_C( 0xFFFFF80000000000 ), + UINT64_C( 0xFFFFFC0000000000 ), + UINT64_C( 0xFFFFFE0000000000 ), + UINT64_C( 0xFFFFFF0000000000 ), + UINT64_C( 0xFFFFFF8000000000 ), + UINT64_C( 0xFFFFFFC000000000 ), + UINT64_C( 0xFFFFFFE000000000 ), + UINT64_C( 0xFFFFFFF000000000 ), + UINT64_C( 0xFFFFFFF800000000 ), + UINT64_C( 0xFFFFFFFC00000000 ), + UINT64_C( 0xFFFFFFFE00000000 ), + UINT64_C( 0xFFFFFFFF00000000 ), + UINT64_C( 0xFFFFFFFF80000000 ), + UINT64_C( 0xFFFFFFFFC0000000 ), + UINT64_C( 0xFFFFFFFFE0000000 ), + UINT64_C( 0xFFFFFFFFF0000000 ), + UINT64_C( 0xFFFFFFFFF8000000 ), + UINT64_C( 0xFFFFFFFFFC000000 ), + UINT64_C( 0xFFFFFFFFFE000000 ), + UINT64_C( 0xFFFFFFFFFF000000 ), + UINT64_C( 0xFFFFFFFFFF800000 ), + UINT64_C( 0xFFFFFFFFFFC00000 ), + UINT64_C( 0xFFFFFFFFFFE00000 ), + UINT64_C( 0xFFFFFFFFFFF00000 ), + UINT64_C( 0xFFFFFFFFFFF80000 ), + UINT64_C( 0xFFFFFFFFFFFC0000 ), + UINT64_C( 0xFFFFFFFFFFFE0000 ), + UINT64_C( 0xFFFFFFFFFFFF0000 ), + UINT64_C( 0xFFFFFFFFFFFF8000 ), + UINT64_C( 0xFFFFFFFFFFFFC000 ), + UINT64_C( 0xFFFFFFFFFFFFE000 ), + UINT64_C( 0xFFFFFFFFFFFFF000 ), + UINT64_C( 0xFFFFFFFFFFFFF800 ), + UINT64_C( 0xFFFFFFFFFFFFFC00 ), + UINT64_C( 0xFFFFFFFFFFFFFE00 ), + UINT64_C( 0xFFFFFFFFFFFFFF00 ), + UINT64_C( 0xFFFFFFFFFFFFFF80 ), + UINT64_C( 0xFFFFFFFFFFFFFFC0 ), + UINT64_C( 0xFFFFFFFFFFFFFFE0 ), + UINT64_C( 0xFFFFFFFFFFFFFFF0 ), + UINT64_C( 0xFFFFFFFFFFFFFFF8 ), + UINT64_C( 0xFFFFFFFFFFFFFFFC ), + UINT64_C( 0xFFFFFFFFFFFFFFFE ), + UINT64_C( 0xFFFFFFFFFFFFFFFF ), + UINT64_C( 0xFFFFFFFFFFFFFFFD ), + UINT64_C( 0xFFFFFFFFFFFFFFFB ), + UINT64_C( 0xFFFFFFFFFFFFFFF7 ), + UINT64_C( 0xFFFFFFFFFFFFFFEF ), + UINT64_C( 0xFFFFFFFFFFFFFFDF ), + UINT64_C( 0xFFFFFFFFFFFFFFBF ), + UINT64_C( 0xFFFFFFFFFFFFFF7F ), + UINT64_C( 0xFFFFFFFFFFFFFEFF ), + UINT64_C( 0xFFFFFFFFFFFFFDFF ), + UINT64_C( 0xFFFFFFFFFFFFFBFF ), + UINT64_C( 0xFFFFFFFFFFFFF7FF ), + UINT64_C( 0xFFFFFFFFFFFFEFFF ), + UINT64_C( 0xFFFFFFFFFFFFDFFF ), + UINT64_C( 0xFFFFFFFFFFFFBFFF ), + UINT64_C( 0xFFFFFFFFFFFF7FFF ), + UINT64_C( 0xFFFFFFFFFFFEFFFF ), + UINT64_C( 0xFFFFFFFFFFFDFFFF ), + UINT64_C( 0xFFFFFFFFFFFBFFFF ), + UINT64_C( 0xFFFFFFFFFFF7FFFF ), + UINT64_C( 0xFFFFFFFFFFEFFFFF ), + UINT64_C( 0xFFFFFFFFFFDFFFFF ), + UINT64_C( 0xFFFFFFFFFFBFFFFF ), + UINT64_C( 0xFFFFFFFFFF7FFFFF ), + UINT64_C( 0xFFFFFFFFFEFFFFFF ), + UINT64_C( 0xFFFFFFFFFDFFFFFF ), + UINT64_C( 0xFFFFFFFFFBFFFFFF ), + UINT64_C( 0xFFFFFFFFF7FFFFFF ), + UINT64_C( 0xFFFFFFFFEFFFFFFF ), + UINT64_C( 0xFFFFFFFFDFFFFFFF ), + UINT64_C( 0xFFFFFFFFBFFFFFFF ), + UINT64_C( 0xFFFFFFFF7FFFFFFF ), + UINT64_C( 0xFFFFFFFEFFFFFFFF ), + UINT64_C( 0xFFFFFFFDFFFFFFFF ), + UINT64_C( 0xFFFFFFFBFFFFFFFF ), + UINT64_C( 0xFFFFFFF7FFFFFFFF ), + UINT64_C( 0xFFFFFFEFFFFFFFFF ), + UINT64_C( 0xFFFFFFDFFFFFFFFF ), + UINT64_C( 0xFFFFFFBFFFFFFFFF ), + UINT64_C( 0xFFFFFF7FFFFFFFFF ), + UINT64_C( 0xFFFFFEFFFFFFFFFF ), + UINT64_C( 0xFFFFFDFFFFFFFFFF ), + UINT64_C( 0xFFFFFBFFFFFFFFFF ), + UINT64_C( 0xFFFFF7FFFFFFFFFF ), + UINT64_C( 0xFFFFEFFFFFFFFFFF ), + UINT64_C( 0xFFFFDFFFFFFFFFFF ), + UINT64_C( 0xFFFFBFFFFFFFFFFF ), + UINT64_C( 0xFFFF7FFFFFFFFFFF ), + UINT64_C( 0xFFFEFFFFFFFFFFFF ), + UINT64_C( 0xFFFDFFFFFFFFFFFF ), + UINT64_C( 0xFFFBFFFFFFFFFFFF ), + UINT64_C( 0xFFF7FFFFFFFFFFFF ), + UINT64_C( 0xFFEFFFFFFFFFFFFF ), + UINT64_C( 0xFFDFFFFFFFFFFFFF ), + UINT64_C( 0xFFBFFFFFFFFFFFFF ), + UINT64_C( 0xFF7FFFFFFFFFFFFF ), + UINT64_C( 0xFEFFFFFFFFFFFFFF ), + UINT64_C( 0xFDFFFFFFFFFFFFFF ), + UINT64_C( 0xFBFFFFFFFFFFFFFF ), + UINT64_C( 0xF7FFFFFFFFFFFFFF ), + UINT64_C( 0xEFFFFFFFFFFFFFFF ), + UINT64_C( 0xDFFFFFFFFFFFFFFF ), + UINT64_C( 0xBFFFFFFFFFFFFFFF ), + UINT64_C( 0x7FFFFFFFFFFFFFFF ), + UINT64_C( 0x3FFFFFFFFFFFFFFF ), + UINT64_C( 0x1FFFFFFFFFFFFFFF ), + UINT64_C( 0x0FFFFFFFFFFFFFFF ), + UINT64_C( 0x07FFFFFFFFFFFFFF ), + UINT64_C( 0x03FFFFFFFFFFFFFF ), + UINT64_C( 0x01FFFFFFFFFFFFFF ), + UINT64_C( 0x00FFFFFFFFFFFFFF ), + UINT64_C( 0x007FFFFFFFFFFFFF ), + UINT64_C( 0x003FFFFFFFFFFFFF ), + UINT64_C( 0x001FFFFFFFFFFFFF ), + UINT64_C( 0x000FFFFFFFFFFFFF ), + UINT64_C( 0x0007FFFFFFFFFFFF ), + UINT64_C( 0x0003FFFFFFFFFFFF ), + UINT64_C( 0x0001FFFFFFFFFFFF ), + UINT64_C( 0x0000FFFFFFFFFFFF ), + UINT64_C( 0x00007FFFFFFFFFFF ), + UINT64_C( 0x00003FFFFFFFFFFF ), + UINT64_C( 0x00001FFFFFFFFFFF ), + UINT64_C( 0x00000FFFFFFFFFFF ), + UINT64_C( 0x000007FFFFFFFFFF ), + UINT64_C( 0x000003FFFFFFFFFF ), + UINT64_C( 0x000001FFFFFFFFFF ), + UINT64_C( 0x000000FFFFFFFFFF ), + UINT64_C( 0x0000007FFFFFFFFF ), + UINT64_C( 0x0000003FFFFFFFFF ), + UINT64_C( 0x0000001FFFFFFFFF ), + UINT64_C( 0x0000000FFFFFFFFF ), + UINT64_C( 0x00000007FFFFFFFF ), + UINT64_C( 0x00000003FFFFFFFF ), + UINT64_C( 0x00000001FFFFFFFF ), + UINT64_C( 0x00000000FFFFFFFF ), + UINT64_C( 0x000000007FFFFFFF ), + UINT64_C( 0x000000003FFFFFFF ), + UINT64_C( 0x000000001FFFFFFF ), + UINT64_C( 0x000000000FFFFFFF ), + UINT64_C( 0x0000000007FFFFFF ), + UINT64_C( 0x0000000003FFFFFF ), + UINT64_C( 0x0000000001FFFFFF ), + UINT64_C( 0x0000000000FFFFFF ), + UINT64_C( 0x00000000007FFFFF ), + UINT64_C( 0x00000000003FFFFF ), + UINT64_C( 0x00000000001FFFFF ), + UINT64_C( 0x00000000000FFFFF ), + UINT64_C( 0x000000000007FFFF ), + UINT64_C( 0x000000000003FFFF ), + UINT64_C( 0x000000000001FFFF ), + UINT64_C( 0x000000000000FFFF ), + UINT64_C( 0x0000000000007FFF ), + UINT64_C( 0x0000000000003FFF ), + UINT64_C( 0x0000000000001FFF ), + UINT64_C( 0x0000000000000FFF ), + UINT64_C( 0x00000000000007FF ), + UINT64_C( 0x00000000000003FF ), + UINT64_C( 0x00000000000001FF ), + UINT64_C( 0x00000000000000FF ), + UINT64_C( 0x000000000000007F ), + UINT64_C( 0x000000000000003F ), + UINT64_C( 0x000000000000001F ), + UINT64_C( 0x000000000000000F ), + UINT64_C( 0x0000000000000007 ), + UINT64_C( 0x0000000000000003 ) +}; + +static int64_t i64NextP1( struct sequence *sequencePtr ) +{ + int termNum; + union ui64_i64 uZ; + + termNum = sequencePtr->term1Num; + uZ.ui = i64P1[termNum]; + ++termNum; + if ( i64NumP1 <= termNum ) { + termNum = 0; + sequencePtr->done = true; + } + sequencePtr->term1Num = termNum; + return uZ.i; + +} + +static const int_fast64_t i64NumP2 = (i64NumP1 * i64NumP1 + i64NumP1) / 2; + +static int64_t i64NextP2( struct sequence *sequencePtr ) +{ + int term1Num, term2Num; + union ui64_i64 uZ; + + term2Num = sequencePtr->term2Num; + term1Num = sequencePtr->term1Num; + uZ.ui = i64P1[term1Num] + i64P1[term2Num]; + ++term2Num; + if ( i64NumP1 <= term2Num ) { + ++term1Num; + if ( i64NumP1 <= term1Num ) { + term1Num = 0; + sequencePtr->done = true; + } + term2Num = term1Num; + sequencePtr->term1Num = term1Num; + } + sequencePtr->term2Num = term2Num; + return uZ.i; + +} + +static int64_t i64RandomP3( void ) +{ + union ui64_i64 uZ; + + uZ.ui = + i64P1[randomN_ui8( i64NumP1 )] + i64P1[randomN_ui8( i64NumP1 )] + + i64P1[randomN_ui8( i64NumP1 )]; + return uZ.i; + +} + +enum { i64NumPInfWeightMasks = 61 }; +static const uint64_t i64PInfWeightMasks[i64NumPInfWeightMasks] = { + UINT64_C( 0xFFFFFFFFFFFFFFFF ), + UINT64_C( 0x7FFFFFFFFFFFFFFF ), + UINT64_C( 0x3FFFFFFFFFFFFFFF ), + UINT64_C( 0x1FFFFFFFFFFFFFFF ), + UINT64_C( 0x0FFFFFFFFFFFFFFF ), + UINT64_C( 0x07FFFFFFFFFFFFFF ), + UINT64_C( 0x03FFFFFFFFFFFFFF ), + UINT64_C( 0x01FFFFFFFFFFFFFF ), + UINT64_C( 0x00FFFFFFFFFFFFFF ), + UINT64_C( 0x007FFFFFFFFFFFFF ), + UINT64_C( 0x003FFFFFFFFFFFFF ), + UINT64_C( 0x001FFFFFFFFFFFFF ), + UINT64_C( 0x000FFFFFFFFFFFFF ), + UINT64_C( 0x0007FFFFFFFFFFFF ), + UINT64_C( 0x0003FFFFFFFFFFFF ), + UINT64_C( 0x0001FFFFFFFFFFFF ), + UINT64_C( 0x0000FFFFFFFFFFFF ), + UINT64_C( 0x00007FFFFFFFFFFF ), + UINT64_C( 0x00003FFFFFFFFFFF ), + UINT64_C( 0x00001FFFFFFFFFFF ), + UINT64_C( 0x00000FFFFFFFFFFF ), + UINT64_C( 0x000007FFFFFFFFFF ), + UINT64_C( 0x000003FFFFFFFFFF ), + UINT64_C( 0x000001FFFFFFFFFF ), + UINT64_C( 0x000000FFFFFFFFFF ), + UINT64_C( 0x0000007FFFFFFFFF ), + UINT64_C( 0x0000003FFFFFFFFF ), + UINT64_C( 0x0000001FFFFFFFFF ), + UINT64_C( 0x0000000FFFFFFFFF ), + UINT64_C( 0x00000007FFFFFFFF ), + UINT64_C( 0x00000003FFFFFFFF ), + UINT64_C( 0x00000001FFFFFFFF ), + UINT64_C( 0x00000000FFFFFFFF ), + UINT64_C( 0x000000007FFFFFFF ), + UINT64_C( 0x000000003FFFFFFF ), + UINT64_C( 0x000000001FFFFFFF ), + UINT64_C( 0x000000000FFFFFFF ), + UINT64_C( 0x0000000007FFFFFF ), + UINT64_C( 0x0000000003FFFFFF ), + UINT64_C( 0x0000000001FFFFFF ), + UINT64_C( 0x0000000000FFFFFF ), + UINT64_C( 0x00000000007FFFFF ), + UINT64_C( 0x00000000003FFFFF ), + UINT64_C( 0x00000000001FFFFF ), + UINT64_C( 0x00000000000FFFFF ), + UINT64_C( 0x000000000007FFFF ), + UINT64_C( 0x000000000003FFFF ), + UINT64_C( 0x000000000001FFFF ), + UINT64_C( 0x000000000000FFFF ), + UINT64_C( 0x0000000000007FFF ), + UINT64_C( 0x0000000000003FFF ), + UINT64_C( 0x0000000000001FFF ), + UINT64_C( 0x0000000000000FFF ), + UINT64_C( 0x00000000000007FF ), + UINT64_C( 0x00000000000003FF ), + UINT64_C( 0x00000000000001FF ), + UINT64_C( 0x00000000000000FF ), + UINT64_C( 0x000000000000007F ), + UINT64_C( 0x000000000000003F ), + UINT64_C( 0x000000000000001F ), + UINT64_C( 0x000000000000000F ) +}; +static const uint64_t i64PInfWeightOffsets[i64NumPInfWeightMasks] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0xC000000000000000 ), + UINT64_C( 0xE000000000000000 ), + UINT64_C( 0xF000000000000000 ), + UINT64_C( 0xF800000000000000 ), + UINT64_C( 0xFC00000000000000 ), + UINT64_C( 0xFE00000000000000 ), + UINT64_C( 0xFF00000000000000 ), + UINT64_C( 0xFF80000000000000 ), + UINT64_C( 0xFFC0000000000000 ), + UINT64_C( 0xFFE0000000000000 ), + UINT64_C( 0xFFF0000000000000 ), + UINT64_C( 0xFFF8000000000000 ), + UINT64_C( 0xFFFC000000000000 ), + UINT64_C( 0xFFFE000000000000 ), + UINT64_C( 0xFFFF000000000000 ), + UINT64_C( 0xFFFF800000000000 ), + UINT64_C( 0xFFFFC00000000000 ), + UINT64_C( 0xFFFFE00000000000 ), + UINT64_C( 0xFFFFF00000000000 ), + UINT64_C( 0xFFFFF80000000000 ), + UINT64_C( 0xFFFFFC0000000000 ), + UINT64_C( 0xFFFFFE0000000000 ), + UINT64_C( 0xFFFFFF0000000000 ), + UINT64_C( 0xFFFFFF8000000000 ), + UINT64_C( 0xFFFFFFC000000000 ), + UINT64_C( 0xFFFFFFE000000000 ), + UINT64_C( 0xFFFFFFF000000000 ), + UINT64_C( 0xFFFFFFF800000000 ), + UINT64_C( 0xFFFFFFFC00000000 ), + UINT64_C( 0xFFFFFFFE00000000 ), + UINT64_C( 0xFFFFFFFF00000000 ), + UINT64_C( 0xFFFFFFFF80000000 ), + UINT64_C( 0xFFFFFFFFC0000000 ), + UINT64_C( 0xFFFFFFFFE0000000 ), + UINT64_C( 0xFFFFFFFFF0000000 ), + UINT64_C( 0xFFFFFFFFF8000000 ), + UINT64_C( 0xFFFFFFFFFC000000 ), + UINT64_C( 0xFFFFFFFFFE000000 ), + UINT64_C( 0xFFFFFFFFFF000000 ), + UINT64_C( 0xFFFFFFFFFF800000 ), + UINT64_C( 0xFFFFFFFFFFC00000 ), + UINT64_C( 0xFFFFFFFFFFE00000 ), + UINT64_C( 0xFFFFFFFFFFF00000 ), + UINT64_C( 0xFFFFFFFFFFF80000 ), + UINT64_C( 0xFFFFFFFFFFFC0000 ), + UINT64_C( 0xFFFFFFFFFFFE0000 ), + UINT64_C( 0xFFFFFFFFFFFF0000 ), + UINT64_C( 0xFFFFFFFFFFFF8000 ), + UINT64_C( 0xFFFFFFFFFFFFC000 ), + UINT64_C( 0xFFFFFFFFFFFFE000 ), + UINT64_C( 0xFFFFFFFFFFFFF000 ), + UINT64_C( 0xFFFFFFFFFFFFF800 ), + UINT64_C( 0xFFFFFFFFFFFFFC00 ), + UINT64_C( 0xFFFFFFFFFFFFFE00 ), + UINT64_C( 0xFFFFFFFFFFFFFF00 ), + UINT64_C( 0xFFFFFFFFFFFFFF80 ), + UINT64_C( 0xFFFFFFFFFFFFFFC0 ), + UINT64_C( 0xFFFFFFFFFFFFFFE0 ), + UINT64_C( 0xFFFFFFFFFFFFFFF0 ), + UINT64_C( 0xFFFFFFFFFFFFFFF8 ) +}; + +static int64_t i64RandomPInf( void ) +{ + int weightMaskNum; + union ui64_i64 uZ; + + weightMaskNum = randomN_ui8( i64NumPInfWeightMasks ); + uZ.ui = + (random_ui64() & i64PInfWeightMasks[weightMaskNum]) + + i64PInfWeightOffsets[weightMaskNum]; + return uZ.i; + +} + +static struct sequence sequenceA; +static int subcase; + +int64_t genCases_i64_a; + +void genCases_i64_a_init( void ) +{ + + sequenceA.term2Num = 0; + sequenceA.term1Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = (genCases_level == 1) ? 3 * i64NumP1 : 2 * i64NumP2; + genCases_done = false; + +} + +void genCases_i64_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + genCases_i64_a = i64RandomP3(); + break; + case 1: + genCases_i64_a = i64RandomPInf(); + break; + case 2: + genCases_i64_a = i64NextP1( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_i64_a = i64RandomP3(); + break; + case 2: + genCases_i64_a = i64RandomPInf(); + break; + case 3: + subcase = -1; + case 1: + genCases_i64_a = i64NextP2( &sequenceA ); + genCases_done = sequenceA.done; + break; + } + } + ++subcase; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_ui32.c b/src/libs/softfloat-3e/testfloat/source/genCases_ui32.c new file mode 100644 index 00000000..bc897827 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_ui32.c @@ -0,0 +1,323 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "random.h" +#include "genCases.h" + +struct sequence { + int term1Num, term2Num; + bool done; +}; + +enum { ui32NumP1 = 124 }; +static const uint32_t ui32P1[ui32NumP1] = { + 0x00000000, + 0x00000001, + 0x00000002, + 0x00000004, + 0x00000008, + 0x00000010, + 0x00000020, + 0x00000040, + 0x00000080, + 0x00000100, + 0x00000200, + 0x00000400, + 0x00000800, + 0x00001000, + 0x00002000, + 0x00004000, + 0x00008000, + 0x00010000, + 0x00020000, + 0x00040000, + 0x00080000, + 0x00100000, + 0x00200000, + 0x00400000, + 0x00800000, + 0x01000000, + 0x02000000, + 0x04000000, + 0x08000000, + 0x10000000, + 0x20000000, + 0x40000000, + 0x80000000, + 0xC0000000, + 0xE0000000, + 0xF0000000, + 0xF8000000, + 0xFC000000, + 0xFE000000, + 0xFF000000, + 0xFF800000, + 0xFFC00000, + 0xFFE00000, + 0xFFF00000, + 0xFFF80000, + 0xFFFC0000, + 0xFFFE0000, + 0xFFFF0000, + 0xFFFF8000, + 0xFFFFC000, + 0xFFFFE000, + 0xFFFFF000, + 0xFFFFF800, + 0xFFFFFC00, + 0xFFFFFE00, + 0xFFFFFF00, + 0xFFFFFF80, + 0xFFFFFFC0, + 0xFFFFFFE0, + 0xFFFFFFF0, + 0xFFFFFFF8, + 0xFFFFFFFC, + 0xFFFFFFFE, + 0xFFFFFFFF, + 0xFFFFFFFD, + 0xFFFFFFFB, + 0xFFFFFFF7, + 0xFFFFFFEF, + 0xFFFFFFDF, + 0xFFFFFFBF, + 0xFFFFFF7F, + 0xFFFFFEFF, + 0xFFFFFDFF, + 0xFFFFFBFF, + 0xFFFFF7FF, + 0xFFFFEFFF, + 0xFFFFDFFF, + 0xFFFFBFFF, + 0xFFFF7FFF, + 0xFFFEFFFF, + 0xFFFDFFFF, + 0xFFFBFFFF, + 0xFFF7FFFF, + 0xFFEFFFFF, + 0xFFDFFFFF, + 0xFFBFFFFF, + 0xFF7FFFFF, + 0xFEFFFFFF, + 0xFDFFFFFF, + 0xFBFFFFFF, + 0xF7FFFFFF, + 0xEFFFFFFF, + 0xDFFFFFFF, + 0xBFFFFFFF, + 0x7FFFFFFF, + 0x3FFFFFFF, + 0x1FFFFFFF, + 0x0FFFFFFF, + 0x07FFFFFF, + 0x03FFFFFF, + 0x01FFFFFF, + 0x00FFFFFF, + 0x007FFFFF, + 0x003FFFFF, + 0x001FFFFF, + 0x000FFFFF, + 0x0007FFFF, + 0x0003FFFF, + 0x0001FFFF, + 0x0000FFFF, + 0x00007FFF, + 0x00003FFF, + 0x00001FFF, + 0x00000FFF, + 0x000007FF, + 0x000003FF, + 0x000001FF, + 0x000000FF, + 0x0000007F, + 0x0000003F, + 0x0000001F, + 0x0000000F, + 0x00000007, + 0x00000003 +}; + +static uint32_t ui32NextP1( struct sequence *sequencePtr ) +{ + int termNum; + uint32_t z; + + termNum = sequencePtr->term1Num; + z = ui32P1[termNum]; + ++termNum; + if ( ui32NumP1 <= termNum ) { + termNum = 0; + sequencePtr->done = true; + } + sequencePtr->term1Num = termNum; + return z; + +} + +static const uint_fast32_t ui32NumP2 = (ui32NumP1 * ui32NumP1 + ui32NumP1) / 2; + +static uint32_t ui32NextP2( struct sequence *sequencePtr ) +{ + int term1Num, term2Num; + uint32_t z; + + term2Num = sequencePtr->term2Num; + term1Num = sequencePtr->term1Num; + z = ui32P1[term1Num] + ui32P1[term2Num]; + ++term2Num; + if ( ui32NumP1 <= term2Num ) { + ++term1Num; + if ( ui32NumP1 <= term1Num ) { + term1Num = 0; + sequencePtr->done = true; + } + term2Num = term1Num; + sequencePtr->term1Num = term1Num; + } + sequencePtr->term2Num = term2Num; + return z; + +} + +static uint32_t ui32RandomP3( void ) +{ + + return + ui32P1[randomN_ui8( ui32NumP1 )] + ui32P1[randomN_ui8( ui32NumP1 )] + + ui32P1[randomN_ui8( ui32NumP1 )]; + +} + +enum { ui32NumPInfWeightMasks = 29 }; +static const uint32_t ui32PInfWeightMasks[ui32NumPInfWeightMasks] = { + 0xFFFFFFFF, + 0x7FFFFFFF, + 0x3FFFFFFF, + 0x1FFFFFFF, + 0x0FFFFFFF, + 0x07FFFFFF, + 0x03FFFFFF, + 0x01FFFFFF, + 0x00FFFFFF, + 0x007FFFFF, + 0x003FFFFF, + 0x001FFFFF, + 0x000FFFFF, + 0x0007FFFF, + 0x0003FFFF, + 0x0001FFFF, + 0x0000FFFF, + 0x00007FFF, + 0x00003FFF, + 0x00001FFF, + 0x00000FFF, + 0x000007FF, + 0x000003FF, + 0x000001FF, + 0x000000FF, + 0x0000007F, + 0x0000003F, + 0x0000001F, + 0x0000000F +}; + +static uint32_t ui32RandomPInf( void ) +{ + int weightMaskNum; + + weightMaskNum = randomN_ui8( ui32NumPInfWeightMasks ); + return random_ui32() & ui32PInfWeightMasks[weightMaskNum]; + +} + +static struct sequence sequenceA; +static int subcase; + +uint32_t genCases_ui32_a; + +void genCases_ui32_a_init( void ) +{ + + sequenceA.term1Num = 0; + sequenceA.term2Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = (genCases_level == 1) ? 3 * ui32NumP1 : 2 * ui32NumP2; + genCases_done = false; + +} + +void genCases_ui32_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + genCases_ui32_a = ui32RandomP3(); + break; + case 1: + genCases_ui32_a = ui32RandomPInf(); + break; + case 2: + genCases_ui32_a = ui32NextP1( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_ui32_a = ui32RandomP3(); + break; + case 2: + genCases_ui32_a = ui32RandomPInf(); + break; + case 3: + subcase = -1; + case 1: + genCases_ui32_a = ui32NextP2( &sequenceA ); + genCases_done = sequenceA.done; + break; + } + } + ++subcase; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_ui64.c b/src/libs/softfloat-3e/testfloat/source/genCases_ui64.c new file mode 100644 index 00000000..915df78f --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_ui64.c @@ -0,0 +1,483 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "random.h" +#include "genCases.h" + +struct sequence { + int term1Num, term2Num; + bool done; +}; + +enum { ui64NumP1 = 252 }; +static const uint64_t ui64P1[ui64NumP1] = { + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x0000000000000001 ), + UINT64_C( 0x0000000000000002 ), + UINT64_C( 0x0000000000000004 ), + UINT64_C( 0x0000000000000008 ), + UINT64_C( 0x0000000000000010 ), + UINT64_C( 0x0000000000000020 ), + UINT64_C( 0x0000000000000040 ), + UINT64_C( 0x0000000000000080 ), + UINT64_C( 0x0000000000000100 ), + UINT64_C( 0x0000000000000200 ), + UINT64_C( 0x0000000000000400 ), + UINT64_C( 0x0000000000000800 ), + UINT64_C( 0x0000000000001000 ), + UINT64_C( 0x0000000000002000 ), + UINT64_C( 0x0000000000004000 ), + UINT64_C( 0x0000000000008000 ), + UINT64_C( 0x0000000000010000 ), + UINT64_C( 0x0000000000020000 ), + UINT64_C( 0x0000000000040000 ), + UINT64_C( 0x0000000000080000 ), + UINT64_C( 0x0000000000100000 ), + UINT64_C( 0x0000000000200000 ), + UINT64_C( 0x0000000000400000 ), + UINT64_C( 0x0000000000800000 ), + UINT64_C( 0x0000000001000000 ), + UINT64_C( 0x0000000002000000 ), + UINT64_C( 0x0000000004000000 ), + UINT64_C( 0x0000000008000000 ), + UINT64_C( 0x0000000010000000 ), + UINT64_C( 0x0000000020000000 ), + UINT64_C( 0x0000000040000000 ), + UINT64_C( 0x0000000080000000 ), + UINT64_C( 0x0000000100000000 ), + UINT64_C( 0x0000000200000000 ), + UINT64_C( 0x0000000400000000 ), + UINT64_C( 0x0000000800000000 ), + UINT64_C( 0x0000001000000000 ), + UINT64_C( 0x0000002000000000 ), + UINT64_C( 0x0000004000000000 ), + UINT64_C( 0x0000008000000000 ), + UINT64_C( 0x0000010000000000 ), + UINT64_C( 0x0000020000000000 ), + UINT64_C( 0x0000040000000000 ), + UINT64_C( 0x0000080000000000 ), + UINT64_C( 0x0000100000000000 ), + UINT64_C( 0x0000200000000000 ), + UINT64_C( 0x0000400000000000 ), + UINT64_C( 0x0000800000000000 ), + UINT64_C( 0x0001000000000000 ), + UINT64_C( 0x0002000000000000 ), + UINT64_C( 0x0004000000000000 ), + UINT64_C( 0x0008000000000000 ), + UINT64_C( 0x0010000000000000 ), + UINT64_C( 0x0020000000000000 ), + UINT64_C( 0x0040000000000000 ), + UINT64_C( 0x0080000000000000 ), + UINT64_C( 0x0100000000000000 ), + UINT64_C( 0x0200000000000000 ), + UINT64_C( 0x0400000000000000 ), + UINT64_C( 0x0800000000000000 ), + UINT64_C( 0x1000000000000000 ), + UINT64_C( 0x2000000000000000 ), + UINT64_C( 0x4000000000000000 ), + UINT64_C( 0x8000000000000000 ), + UINT64_C( 0xC000000000000000 ), + UINT64_C( 0xE000000000000000 ), + UINT64_C( 0xF000000000000000 ), + UINT64_C( 0xF800000000000000 ), + UINT64_C( 0xFC00000000000000 ), + UINT64_C( 0xFE00000000000000 ), + UINT64_C( 0xFF00000000000000 ), + UINT64_C( 0xFF80000000000000 ), + UINT64_C( 0xFFC0000000000000 ), + UINT64_C( 0xFFE0000000000000 ), + UINT64_C( 0xFFF0000000000000 ), + UINT64_C( 0xFFF8000000000000 ), + UINT64_C( 0xFFFC000000000000 ), + UINT64_C( 0xFFFE000000000000 ), + UINT64_C( 0xFFFF000000000000 ), + UINT64_C( 0xFFFF800000000000 ), + UINT64_C( 0xFFFFC00000000000 ), + UINT64_C( 0xFFFFE00000000000 ), + UINT64_C( 0xFFFFF00000000000 ), + UINT64_C( 0xFFFFF80000000000 ), + UINT64_C( 0xFFFFFC0000000000 ), + UINT64_C( 0xFFFFFE0000000000 ), + UINT64_C( 0xFFFFFF0000000000 ), + UINT64_C( 0xFFFFFF8000000000 ), + UINT64_C( 0xFFFFFFC000000000 ), + UINT64_C( 0xFFFFFFE000000000 ), + UINT64_C( 0xFFFFFFF000000000 ), + UINT64_C( 0xFFFFFFF800000000 ), + UINT64_C( 0xFFFFFFFC00000000 ), + UINT64_C( 0xFFFFFFFE00000000 ), + UINT64_C( 0xFFFFFFFF00000000 ), + UINT64_C( 0xFFFFFFFF80000000 ), + UINT64_C( 0xFFFFFFFFC0000000 ), + UINT64_C( 0xFFFFFFFFE0000000 ), + UINT64_C( 0xFFFFFFFFF0000000 ), + UINT64_C( 0xFFFFFFFFF8000000 ), + UINT64_C( 0xFFFFFFFFFC000000 ), + UINT64_C( 0xFFFFFFFFFE000000 ), + UINT64_C( 0xFFFFFFFFFF000000 ), + UINT64_C( 0xFFFFFFFFFF800000 ), + UINT64_C( 0xFFFFFFFFFFC00000 ), + UINT64_C( 0xFFFFFFFFFFE00000 ), + UINT64_C( 0xFFFFFFFFFFF00000 ), + UINT64_C( 0xFFFFFFFFFFF80000 ), + UINT64_C( 0xFFFFFFFFFFFC0000 ), + UINT64_C( 0xFFFFFFFFFFFE0000 ), + UINT64_C( 0xFFFFFFFFFFFF0000 ), + UINT64_C( 0xFFFFFFFFFFFF8000 ), + UINT64_C( 0xFFFFFFFFFFFFC000 ), + UINT64_C( 0xFFFFFFFFFFFFE000 ), + UINT64_C( 0xFFFFFFFFFFFFF000 ), + UINT64_C( 0xFFFFFFFFFFFFF800 ), + UINT64_C( 0xFFFFFFFFFFFFFC00 ), + UINT64_C( 0xFFFFFFFFFFFFFE00 ), + UINT64_C( 0xFFFFFFFFFFFFFF00 ), + UINT64_C( 0xFFFFFFFFFFFFFF80 ), + UINT64_C( 0xFFFFFFFFFFFFFFC0 ), + UINT64_C( 0xFFFFFFFFFFFFFFE0 ), + UINT64_C( 0xFFFFFFFFFFFFFFF0 ), + UINT64_C( 0xFFFFFFFFFFFFFFF8 ), + UINT64_C( 0xFFFFFFFFFFFFFFFC ), + UINT64_C( 0xFFFFFFFFFFFFFFFE ), + UINT64_C( 0xFFFFFFFFFFFFFFFF ), + UINT64_C( 0xFFFFFFFFFFFFFFFD ), + UINT64_C( 0xFFFFFFFFFFFFFFFB ), + UINT64_C( 0xFFFFFFFFFFFFFFF7 ), + UINT64_C( 0xFFFFFFFFFFFFFFEF ), + UINT64_C( 0xFFFFFFFFFFFFFFDF ), + UINT64_C( 0xFFFFFFFFFFFFFFBF ), + UINT64_C( 0xFFFFFFFFFFFFFF7F ), + UINT64_C( 0xFFFFFFFFFFFFFEFF ), + UINT64_C( 0xFFFFFFFFFFFFFDFF ), + UINT64_C( 0xFFFFFFFFFFFFFBFF ), + UINT64_C( 0xFFFFFFFFFFFFF7FF ), + UINT64_C( 0xFFFFFFFFFFFFEFFF ), + UINT64_C( 0xFFFFFFFFFFFFDFFF ), + UINT64_C( 0xFFFFFFFFFFFFBFFF ), + UINT64_C( 0xFFFFFFFFFFFF7FFF ), + UINT64_C( 0xFFFFFFFFFFFEFFFF ), + UINT64_C( 0xFFFFFFFFFFFDFFFF ), + UINT64_C( 0xFFFFFFFFFFFBFFFF ), + UINT64_C( 0xFFFFFFFFFFF7FFFF ), + UINT64_C( 0xFFFFFFFFFFEFFFFF ), + UINT64_C( 0xFFFFFFFFFFDFFFFF ), + UINT64_C( 0xFFFFFFFFFFBFFFFF ), + UINT64_C( 0xFFFFFFFFFF7FFFFF ), + UINT64_C( 0xFFFFFFFFFEFFFFFF ), + UINT64_C( 0xFFFFFFFFFDFFFFFF ), + UINT64_C( 0xFFFFFFFFFBFFFFFF ), + UINT64_C( 0xFFFFFFFFF7FFFFFF ), + UINT64_C( 0xFFFFFFFFEFFFFFFF ), + UINT64_C( 0xFFFFFFFFDFFFFFFF ), + UINT64_C( 0xFFFFFFFFBFFFFFFF ), + UINT64_C( 0xFFFFFFFF7FFFFFFF ), + UINT64_C( 0xFFFFFFFEFFFFFFFF ), + UINT64_C( 0xFFFFFFFDFFFFFFFF ), + UINT64_C( 0xFFFFFFFBFFFFFFFF ), + UINT64_C( 0xFFFFFFF7FFFFFFFF ), + UINT64_C( 0xFFFFFFEFFFFFFFFF ), + UINT64_C( 0xFFFFFFDFFFFFFFFF ), + UINT64_C( 0xFFFFFFBFFFFFFFFF ), + UINT64_C( 0xFFFFFF7FFFFFFFFF ), + UINT64_C( 0xFFFFFEFFFFFFFFFF ), + UINT64_C( 0xFFFFFDFFFFFFFFFF ), + UINT64_C( 0xFFFFFBFFFFFFFFFF ), + UINT64_C( 0xFFFFF7FFFFFFFFFF ), + UINT64_C( 0xFFFFEFFFFFFFFFFF ), + UINT64_C( 0xFFFFDFFFFFFFFFFF ), + UINT64_C( 0xFFFFBFFFFFFFFFFF ), + UINT64_C( 0xFFFF7FFFFFFFFFFF ), + UINT64_C( 0xFFFEFFFFFFFFFFFF ), + UINT64_C( 0xFFFDFFFFFFFFFFFF ), + UINT64_C( 0xFFFBFFFFFFFFFFFF ), + UINT64_C( 0xFFF7FFFFFFFFFFFF ), + UINT64_C( 0xFFEFFFFFFFFFFFFF ), + UINT64_C( 0xFFDFFFFFFFFFFFFF ), + UINT64_C( 0xFFBFFFFFFFFFFFFF ), + UINT64_C( 0xFF7FFFFFFFFFFFFF ), + UINT64_C( 0xFEFFFFFFFFFFFFFF ), + UINT64_C( 0xFDFFFFFFFFFFFFFF ), + UINT64_C( 0xFBFFFFFFFFFFFFFF ), + UINT64_C( 0xF7FFFFFFFFFFFFFF ), + UINT64_C( 0xEFFFFFFFFFFFFFFF ), + UINT64_C( 0xDFFFFFFFFFFFFFFF ), + UINT64_C( 0xBFFFFFFFFFFFFFFF ), + UINT64_C( 0x7FFFFFFFFFFFFFFF ), + UINT64_C( 0x3FFFFFFFFFFFFFFF ), + UINT64_C( 0x1FFFFFFFFFFFFFFF ), + UINT64_C( 0x0FFFFFFFFFFFFFFF ), + UINT64_C( 0x07FFFFFFFFFFFFFF ), + UINT64_C( 0x03FFFFFFFFFFFFFF ), + UINT64_C( 0x01FFFFFFFFFFFFFF ), + UINT64_C( 0x00FFFFFFFFFFFFFF ), + UINT64_C( 0x007FFFFFFFFFFFFF ), + UINT64_C( 0x003FFFFFFFFFFFFF ), + UINT64_C( 0x001FFFFFFFFFFFFF ), + UINT64_C( 0x000FFFFFFFFFFFFF ), + UINT64_C( 0x0007FFFFFFFFFFFF ), + UINT64_C( 0x0003FFFFFFFFFFFF ), + UINT64_C( 0x0001FFFFFFFFFFFF ), + UINT64_C( 0x0000FFFFFFFFFFFF ), + UINT64_C( 0x00007FFFFFFFFFFF ), + UINT64_C( 0x00003FFFFFFFFFFF ), + UINT64_C( 0x00001FFFFFFFFFFF ), + UINT64_C( 0x00000FFFFFFFFFFF ), + UINT64_C( 0x000007FFFFFFFFFF ), + UINT64_C( 0x000003FFFFFFFFFF ), + UINT64_C( 0x000001FFFFFFFFFF ), + UINT64_C( 0x000000FFFFFFFFFF ), + UINT64_C( 0x0000007FFFFFFFFF ), + UINT64_C( 0x0000003FFFFFFFFF ), + UINT64_C( 0x0000001FFFFFFFFF ), + UINT64_C( 0x0000000FFFFFFFFF ), + UINT64_C( 0x00000007FFFFFFFF ), + UINT64_C( 0x00000003FFFFFFFF ), + UINT64_C( 0x00000001FFFFFFFF ), + UINT64_C( 0x00000000FFFFFFFF ), + UINT64_C( 0x000000007FFFFFFF ), + UINT64_C( 0x000000003FFFFFFF ), + UINT64_C( 0x000000001FFFFFFF ), + UINT64_C( 0x000000000FFFFFFF ), + UINT64_C( 0x0000000007FFFFFF ), + UINT64_C( 0x0000000003FFFFFF ), + UINT64_C( 0x0000000001FFFFFF ), + UINT64_C( 0x0000000000FFFFFF ), + UINT64_C( 0x00000000007FFFFF ), + UINT64_C( 0x00000000003FFFFF ), + UINT64_C( 0x00000000001FFFFF ), + UINT64_C( 0x00000000000FFFFF ), + UINT64_C( 0x000000000007FFFF ), + UINT64_C( 0x000000000003FFFF ), + UINT64_C( 0x000000000001FFFF ), + UINT64_C( 0x000000000000FFFF ), + UINT64_C( 0x0000000000007FFF ), + UINT64_C( 0x0000000000003FFF ), + UINT64_C( 0x0000000000001FFF ), + UINT64_C( 0x0000000000000FFF ), + UINT64_C( 0x00000000000007FF ), + UINT64_C( 0x00000000000003FF ), + UINT64_C( 0x00000000000001FF ), + UINT64_C( 0x00000000000000FF ), + UINT64_C( 0x000000000000007F ), + UINT64_C( 0x000000000000003F ), + UINT64_C( 0x000000000000001F ), + UINT64_C( 0x000000000000000F ), + UINT64_C( 0x0000000000000007 ), + UINT64_C( 0x0000000000000003 ) +}; + +static uint64_t ui64NextP1( struct sequence *sequencePtr ) +{ + int termNum; + uint64_t z; + + termNum = sequencePtr->term1Num; + z = ui64P1[termNum]; + ++termNum; + if ( ui64NumP1 <= termNum ) { + termNum = 0; + sequencePtr->done = true; + } + sequencePtr->term1Num = termNum; + return z; + +} + +static const uint_fast64_t ui64NumP2 = (ui64NumP1 * ui64NumP1 + ui64NumP1) / 2; + +static uint64_t ui64NextP2( struct sequence *sequencePtr ) +{ + int term1Num, term2Num; + uint64_t z; + + term2Num = sequencePtr->term2Num; + term1Num = sequencePtr->term1Num; + z = ui64P1[term1Num] + ui64P1[term2Num]; + ++term2Num; + if ( ui64NumP1 <= term2Num ) { + ++term1Num; + if ( ui64NumP1 <= term1Num ) { + term1Num = 0; + sequencePtr->done = true; + } + term2Num = term1Num; + sequencePtr->term1Num = term1Num; + } + sequencePtr->term2Num = term2Num; + return z; + +} + +static uint64_t ui64RandomP3( void ) +{ + + return + ui64P1[randomN_ui8( ui64NumP1 )] + ui64P1[randomN_ui8( ui64NumP1 )] + + ui64P1[randomN_ui8( ui64NumP1 )]; + +} + +enum { ui64NumPInfWeightMasks = 61 }; +static const uint64_t ui64PInfWeightMasks[ui64NumPInfWeightMasks] = { + UINT64_C( 0xFFFFFFFFFFFFFFFF ), + UINT64_C( 0x7FFFFFFFFFFFFFFF ), + UINT64_C( 0x3FFFFFFFFFFFFFFF ), + UINT64_C( 0x1FFFFFFFFFFFFFFF ), + UINT64_C( 0x0FFFFFFFFFFFFFFF ), + UINT64_C( 0x07FFFFFFFFFFFFFF ), + UINT64_C( 0x03FFFFFFFFFFFFFF ), + UINT64_C( 0x01FFFFFFFFFFFFFF ), + UINT64_C( 0x00FFFFFFFFFFFFFF ), + UINT64_C( 0x007FFFFFFFFFFFFF ), + UINT64_C( 0x003FFFFFFFFFFFFF ), + UINT64_C( 0x001FFFFFFFFFFFFF ), + UINT64_C( 0x000FFFFFFFFFFFFF ), + UINT64_C( 0x0007FFFFFFFFFFFF ), + UINT64_C( 0x0003FFFFFFFFFFFF ), + UINT64_C( 0x0001FFFFFFFFFFFF ), + UINT64_C( 0x0000FFFFFFFFFFFF ), + UINT64_C( 0x00007FFFFFFFFFFF ), + UINT64_C( 0x00003FFFFFFFFFFF ), + UINT64_C( 0x00001FFFFFFFFFFF ), + UINT64_C( 0x00000FFFFFFFFFFF ), + UINT64_C( 0x000007FFFFFFFFFF ), + UINT64_C( 0x000003FFFFFFFFFF ), + UINT64_C( 0x000001FFFFFFFFFF ), + UINT64_C( 0x000000FFFFFFFFFF ), + UINT64_C( 0x0000007FFFFFFFFF ), + UINT64_C( 0x0000003FFFFFFFFF ), + UINT64_C( 0x0000001FFFFFFFFF ), + UINT64_C( 0x0000000FFFFFFFFF ), + UINT64_C( 0x00000007FFFFFFFF ), + UINT64_C( 0x00000003FFFFFFFF ), + UINT64_C( 0x00000001FFFFFFFF ), + UINT64_C( 0x00000000FFFFFFFF ), + UINT64_C( 0x000000007FFFFFFF ), + UINT64_C( 0x000000003FFFFFFF ), + UINT64_C( 0x000000001FFFFFFF ), + UINT64_C( 0x000000000FFFFFFF ), + UINT64_C( 0x0000000007FFFFFF ), + UINT64_C( 0x0000000003FFFFFF ), + UINT64_C( 0x0000000001FFFFFF ), + UINT64_C( 0x0000000000FFFFFF ), + UINT64_C( 0x00000000007FFFFF ), + UINT64_C( 0x00000000003FFFFF ), + UINT64_C( 0x00000000001FFFFF ), + UINT64_C( 0x00000000000FFFFF ), + UINT64_C( 0x000000000007FFFF ), + UINT64_C( 0x000000000003FFFF ), + UINT64_C( 0x000000000001FFFF ), + UINT64_C( 0x000000000000FFFF ), + UINT64_C( 0x0000000000007FFF ), + UINT64_C( 0x0000000000003FFF ), + UINT64_C( 0x0000000000001FFF ), + UINT64_C( 0x0000000000000FFF ), + UINT64_C( 0x00000000000007FF ), + UINT64_C( 0x00000000000003FF ), + UINT64_C( 0x00000000000001FF ), + UINT64_C( 0x00000000000000FF ), + UINT64_C( 0x000000000000007F ), + UINT64_C( 0x000000000000003F ), + UINT64_C( 0x000000000000001F ), + UINT64_C( 0x000000000000000F ) +}; + +static uint64_t ui64RandomPInf( void ) +{ + int weightMaskNum; + + weightMaskNum = randomN_ui8( ui64NumPInfWeightMasks ); + return random_ui64() & ui64PInfWeightMasks[weightMaskNum]; + +} + +static struct sequence sequenceA; +static int subcase; + +uint64_t genCases_ui64_a; + +void genCases_ui64_a_init( void ) +{ + + sequenceA.term2Num = 0; + sequenceA.term1Num = 0; + sequenceA.done = false; + subcase = 0; + genCases_total = (genCases_level == 1) ? 3 * ui64NumP1 : 2 * ui64NumP2; + genCases_done = false; + +} + +void genCases_ui64_a_next( void ) +{ + + if ( genCases_level == 1 ) { + switch ( subcase ) { + case 0: + genCases_ui64_a = ui64RandomP3(); + break; + case 1: + genCases_ui64_a = ui64RandomPInf(); + break; + case 2: + genCases_ui64_a = ui64NextP1( &sequenceA ); + genCases_done = sequenceA.done; + subcase = -1; + break; + } + } else { + switch ( subcase ) { + case 0: + genCases_ui64_a = ui64RandomP3(); + break; + case 2: + genCases_ui64_a = ui64RandomPInf(); + break; + case 3: + subcase = -1; + case 1: + genCases_ui64_a = ui64NextP2( &sequenceA ); + genCases_done = sequenceA.done; + break; + } + } + ++subcase; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/genCases_writeTestsTotal.c b/src/libs/softfloat-3e/testfloat/source/genCases_writeTestsTotal.c new file mode 100644 index 00000000..8ad6f91e --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genCases_writeTestsTotal.c @@ -0,0 +1,63 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdio.h> +#include "platform.h" +#include "genCases.h" + +void genCases_writeTestsTotal( bool forever ) +{ + + if ( forever ) { + fputs( "Unbounded tests.\n", stderr ); + } else { + if ( 2000000000 <= genCases_total ) { + fprintf( + stderr, + "\r%lu%09lu tests total.\n", + (long unsigned) (genCases_total / 1000000000), + (long unsigned) (genCases_total % 1000000000) + ); + } else { + fprintf( + stderr, "\r%lu tests total.\n", (long unsigned) genCases_total + ); + } + } + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/genLoops.c b/src/libs/softfloat-3e/testfloat/source/genLoops.c new file mode 100644 index 00000000..913391a0 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genLoops.c @@ -0,0 +1,2890 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <signal.h> +#include "platform.h" +#include "uint128.h" +#include "fail.h" +#include "softfloat.h" +#include "genCases.h" +#include "writeHex.h" +#include "genLoops.h" + +volatile sig_atomic_t genLoops_stop = false; + +bool genLoops_forever; +bool genLoops_givenCount; +uint_fast64_t genLoops_count; +uint_fast8_t *genLoops_trueFlagsPtr; + +#ifdef FLOAT16 +union ui16_f16 { uint16_t ui; float16_t f; }; +#endif +union ui32_f32 { uint32_t ui; float32_t f; }; +#ifdef FLOAT64 +union ui64_f64 { uint64_t ui; float64_t f; }; +#endif + +static void checkEnoughCases( void ) +{ + + if ( genLoops_givenCount && (genLoops_count < genCases_total) ) { + if ( 2000000000 <= genCases_total ) { + fail( + "Too few cases; minimum is %lu%09lu", + (unsigned long) (genCases_total / 1000000000), + (unsigned long) (genCases_total % 1000000000) + ); + } else { + fail( + "Too few cases; minimum is %lu", (unsigned long) genCases_total + ); + } + } + +} + +static void writeGenOutput_flags( uint_fast8_t flags ) +{ + uint_fast8_t commonFlags; + + commonFlags = 0; + if ( flags & softfloat_flag_invalid ) commonFlags |= 0x10; + if ( flags & softfloat_flag_infinite ) commonFlags |= 0x08; + if ( flags & softfloat_flag_overflow ) commonFlags |= 0x04; + if ( flags & softfloat_flag_underflow ) commonFlags |= 0x02; + if ( flags & softfloat_flag_inexact ) commonFlags |= 0x01; + writeHex_ui8( commonFlags, '\n' ); + +} + +static bool writeGenOutputs_bool( bool z, uint_fast8_t flags ) +{ + + writeHex_bool( z, ' ' ); + writeGenOutput_flags( flags ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) return true; + } + return false; + +} + +#ifdef FLOAT16 + +static bool writeGenOutputs_ui16( uint_fast16_t z, uint_fast8_t flags ) +{ + + writeHex_ui16( z, ' ' ); + writeGenOutput_flags( flags ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) return true; + } + return false; + +} + +#endif + +static bool writeGenOutputs_ui32( uint_fast32_t z, uint_fast8_t flags ) +{ + + writeHex_ui32( z, ' ' ); + writeGenOutput_flags( flags ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) return true; + } + return false; + +} + +static bool writeGenOutputs_ui64( uint_fast64_t z, uint_fast8_t flags ) +{ + + writeHex_ui64( z, ' ' ); + writeGenOutput_flags( flags ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) return true; + } + return false; + +} + +#ifdef EXTFLOAT80 + +static void writeHex_uiExtF80M( const extFloat80_t *aPtr, char sepChar ) +{ + const struct extFloat80M *aSPtr; + + aSPtr = (const struct extFloat80M *) aPtr; + writeHex_ui16( aSPtr->signExp, 0 ); + writeHex_ui64( aSPtr->signif, sepChar ); + +} + +static +bool writeGenOutputs_extF80M( const extFloat80_t *aPtr, uint_fast8_t flags ) +{ + + writeHex_uiExtF80M( aPtr, ' ' ); + writeGenOutput_flags( flags ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) return true; + } + return false; + +} + +#endif + +#ifdef FLOAT128 + +static void writeHex_uiF128M( const float128_t *aPtr, char sepChar ) +{ + const struct uint128 *uiAPtr; + + uiAPtr = (const struct uint128 *) aPtr; + writeHex_ui64( uiAPtr->v64, 0 ); + writeHex_ui64( uiAPtr->v0, sepChar ); + +} + +static bool writeGenOutputs_f128M( const float128_t *aPtr, uint_fast8_t flags ) +{ + + writeHex_uiF128M( aPtr, ' ' ); + writeGenOutput_flags( flags ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) return true; + } + return false; + +} + +#endif + +void gen_a_ui32( void ) +{ + + genCases_ui32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui32_a_next(); + writeHex_ui32( genCases_ui32_a, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_a_ui64( void ) +{ + + genCases_ui64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui64_a_next(); + writeHex_ui64( genCases_ui64_a, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_a_i32( void ) +{ + + genCases_i32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i32_a_next(); + writeHex_ui32( genCases_i32_a, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_a_i64( void ) +{ + + genCases_i64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i64_a_next(); + writeHex_ui64( genCases_i64_a, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +#ifdef FLOAT16 + +void gen_a_f16( void ) +{ + union ui16_f16 uA; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_ab_f16( void ) +{ + union ui16_f16 u; + + genCases_f16_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_ab_next(); + u.f = genCases_f16_a; + writeHex_ui16( u.ui, ' ' ); + u.f = genCases_f16_b; + writeHex_ui16( u.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_abc_f16( void ) +{ + union ui16_f16 u; + + genCases_f16_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_abc_next(); + u.f = genCases_f16_a; + writeHex_ui16( u.ui, ' ' ); + u.f = genCases_f16_b; + writeHex_ui16( u.ui, ' ' ); + u.f = genCases_f16_c; + writeHex_ui16( u.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +#endif + +void gen_a_f32( void ) +{ + union ui32_f32 uA; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_ab_f32( void ) +{ + union ui32_f32 u; + + genCases_f32_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_ab_next(); + u.f = genCases_f32_a; + writeHex_ui32( u.ui, ' ' ); + u.f = genCases_f32_b; + writeHex_ui32( u.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_abc_f32( void ) +{ + union ui32_f32 u; + + genCases_f32_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_abc_next(); + u.f = genCases_f32_a; + writeHex_ui32( u.ui, ' ' ); + u.f = genCases_f32_b; + writeHex_ui32( u.ui, ' ' ); + u.f = genCases_f32_c; + writeHex_ui32( u.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +#ifdef FLOAT64 + +void gen_a_f64( void ) +{ + union ui64_f64 uA; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_ab_f64( void ) +{ + union ui64_f64 u; + + genCases_f64_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_ab_next(); + u.f = genCases_f64_a; + writeHex_ui64( u.ui, ' ' ); + u.f = genCases_f64_b; + writeHex_ui64( u.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_abc_f64( void ) +{ + union ui64_f64 u; + + genCases_f64_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_abc_next(); + u.f = genCases_f64_a; + writeHex_ui64( u.ui, ' ' ); + u.f = genCases_f64_b; + writeHex_ui64( u.ui, ' ' ); + u.f = genCases_f64_c; + writeHex_ui64( u.ui, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void gen_a_extF80( void ) +{ + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_ab_extF80( void ) +{ + + genCases_extF80_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_ab_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + writeHex_uiExtF80M( &genCases_extF80_b, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_abc_extF80( void ) +{ + + genCases_extF80_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_abc_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + writeHex_uiExtF80M( &genCases_extF80_b, ' ' ); + writeHex_uiExtF80M( &genCases_extF80_c, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +#endif + +#ifdef FLOAT128 + +void gen_a_f128( void ) +{ + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_ab_f128( void ) +{ + + genCases_f128_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_ab_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + writeHex_uiF128M( &genCases_f128_b, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +void gen_abc_f128( void ) +{ + + genCases_f128_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_abc_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + writeHex_uiF128M( &genCases_f128_b, ' ' ); + writeHex_uiF128M( &genCases_f128_c, '\n' ); + if ( genLoops_givenCount ) { + --genLoops_count; + if ( ! genLoops_count ) break; + } + } + +} + +#endif + +#ifdef FLOAT16 + +void gen_a_ui32_z_f16( float16_t trueFunction( uint32_t ) ) +{ + union ui16_f16 uTrueZ; + uint_fast8_t trueFlags; + + genCases_ui32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui32_a_next(); + writeHex_ui32( genCases_ui32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_ui32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +void gen_a_ui32_z_f32( float32_t trueFunction( uint32_t ) ) +{ + union ui32_f32 uTrueZ; + uint_fast8_t trueFlags; + + genCases_ui32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui32_a_next(); + writeHex_ui32( genCases_ui32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_ui32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#ifdef FLOAT64 + +void gen_a_ui32_z_f64( float64_t trueFunction( uint32_t ) ) +{ + union ui64_f64 uTrueZ; + uint_fast8_t trueFlags; + + genCases_ui32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui32_a_next(); + writeHex_ui32( genCases_ui32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_ui32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void gen_a_ui32_z_extF80( void trueFunction( uint32_t, extFloat80_t * ) ) +{ + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_ui32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui32_a_next(); + writeHex_ui32( genCases_ui32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_ui32_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void gen_a_ui32_z_f128( void trueFunction( uint32_t, float128_t * ) ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_ui32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui32_a_next(); + writeHex_ui32( genCases_ui32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_ui32_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT16 + +void gen_a_ui64_z_f16( float16_t trueFunction( uint64_t ) ) +{ + union ui16_f16 uTrueZ; + uint_fast8_t trueFlags; + + genCases_ui64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui64_a_next(); + writeHex_ui64( genCases_ui64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_ui64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +void gen_a_ui64_z_f32( float32_t trueFunction( uint64_t ) ) +{ + union ui32_f32 uTrueZ; + uint_fast8_t trueFlags; + + genCases_ui64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui64_a_next(); + writeHex_ui64( genCases_ui64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_ui64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#ifdef FLOAT64 + +void gen_a_ui64_z_f64( float64_t trueFunction( uint64_t ) ) +{ + union ui64_f64 uTrueZ; + uint_fast8_t trueFlags; + + genCases_ui64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui64_a_next(); + writeHex_ui64( genCases_ui64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_ui64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void gen_a_ui64_z_extF80( void trueFunction( uint64_t, extFloat80_t * ) ) +{ + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_ui64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui64_a_next(); + writeHex_ui64( genCases_ui64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_ui64_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void gen_a_ui64_z_f128( void trueFunction( uint64_t, float128_t * ) ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_ui64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_ui64_a_next(); + writeHex_ui64( genCases_ui64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_ui64_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT16 + +void gen_a_i32_z_f16( float16_t trueFunction( int32_t ) ) +{ + union ui16_f16 uTrueZ; + uint_fast8_t trueFlags; + + genCases_i32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i32_a_next(); + writeHex_ui32( genCases_i32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_i32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +void gen_a_i32_z_f32( float32_t trueFunction( int32_t ) ) +{ + union ui32_f32 uTrueZ; + uint_fast8_t trueFlags; + + genCases_i32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i32_a_next(); + writeHex_ui32( genCases_i32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_i32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#ifdef FLOAT64 + +void gen_a_i32_z_f64( float64_t trueFunction( int32_t ) ) +{ + union ui64_f64 uTrueZ; + uint_fast8_t trueFlags; + + genCases_i32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i32_a_next(); + writeHex_ui32( genCases_i32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_i32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void gen_a_i32_z_extF80( void trueFunction( int32_t, extFloat80_t * ) ) +{ + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_i32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i32_a_next(); + writeHex_ui32( genCases_i32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_i32_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void gen_a_i32_z_f128( void trueFunction( int32_t, float128_t * ) ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_i32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i32_a_next(); + writeHex_ui32( genCases_i32_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_i32_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT16 + +void gen_a_i64_z_f16( float16_t trueFunction( int64_t ) ) +{ + union ui16_f16 uTrueZ; + uint_fast8_t trueFlags; + + genCases_i64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i64_a_next(); + writeHex_ui64( genCases_i64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_i64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +void gen_a_i64_z_f32( float32_t trueFunction( int64_t ) ) +{ + union ui32_f32 uTrueZ; + uint_fast8_t trueFlags; + + genCases_i64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i64_a_next(); + writeHex_ui64( genCases_i64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_i64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#ifdef FLOAT64 + +void gen_a_i64_z_f64( float64_t trueFunction( int64_t ) ) +{ + union ui64_f64 uTrueZ; + uint_fast8_t trueFlags; + + genCases_i64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i64_a_next(); + writeHex_ui64( genCases_i64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_i64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void gen_a_i64_z_extF80( void trueFunction( int64_t, extFloat80_t * ) ) +{ + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_i64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i64_a_next(); + writeHex_ui64( genCases_i64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_i64_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void gen_a_i64_z_f128( void trueFunction( int64_t, float128_t * ) ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_i64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_i64_a_next(); + writeHex_ui64( genCases_i64_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_i64_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT16 + +void + gen_a_f16_z_ui32_rx( + uint_fast32_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui16_f16 uA; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f16_z_ui64_rx( + uint_fast64_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui16_f16 uA; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f16_z_i32_rx( + int_fast32_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui16_f16 uA; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f16_z_i64_rx( + int_fast64_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui16_f16 uA; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f16_z_ui32_x( + uint_fast32_t trueFunction( float16_t, bool ), bool exact ) +{ + union ui16_f16 uA; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f16_z_ui64_x( + uint_fast64_t trueFunction( float16_t, bool ), bool exact ) +{ + union ui16_f16 uA; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f16_z_i32_x( int_fast32_t trueFunction( float16_t, bool ), bool exact ) +{ + union ui16_f16 uA; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f16_z_i64_x( int_fast64_t trueFunction( float16_t, bool ), bool exact ) +{ + union ui16_f16 uA; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void gen_a_f16_z_f32( float32_t trueFunction( float16_t ) ) +{ + union ui16_f16 uA; + union ui32_f32 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_f16_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#ifdef FLOAT64 + +void gen_a_f16_z_f64( float64_t trueFunction( float16_t ) ) +{ + union ui16_f16 uA; + union ui64_f64 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_f16_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void gen_a_f16_z_extF80( void trueFunction( float16_t, extFloat80_t * ) ) +{ + union ui16_f16 uA; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_f16_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void gen_a_f16_z_f128( void trueFunction( float16_t, float128_t * ) ) +{ + union ui16_f16 uA; + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + uA.f = genCases_f16_a; + writeHex_ui16( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_f16_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +void gen_az_f16( float16_t trueFunction( float16_t ) ) +{ + union ui16_f16 u; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + u.f = genCases_f16_a; + writeHex_ui16( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f16_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( u.ui, trueFlags ) ) break; + } + +} + +void + gen_az_f16_rx( + float16_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui16_f16 u; + uint_fast8_t trueFlags; + + genCases_f16_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_a_next(); + u.f = genCases_f16_a; + writeHex_ui16( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( u.ui, trueFlags ) ) break; + } + +} + +void gen_abz_f16( float16_t trueFunction( float16_t, float16_t ) ) +{ + union ui16_f16 u; + uint_fast8_t trueFlags; + + genCases_f16_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_ab_next(); + u.f = genCases_f16_a; + writeHex_ui16( u.ui, ' ' ); + u.f = genCases_f16_b; + writeHex_ui16( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f16_a, genCases_f16_b ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( u.ui, trueFlags ) ) break; + } + +} + +void gen_abcz_f16( float16_t trueFunction( float16_t, float16_t, float16_t ) ) +{ + union ui16_f16 u; + uint_fast8_t trueFlags; + + genCases_f16_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_abc_next(); + u.f = genCases_f16_a; + writeHex_ui16( u.ui, ' ' ); + u.f = genCases_f16_b; + writeHex_ui16( u.ui, ' ' ); + u.f = genCases_f16_c; + writeHex_ui16( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f16_a, genCases_f16_b, genCases_f16_c ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( u.ui, trueFlags ) ) break; + } + +} + +void gen_ab_f16_z_bool( bool trueFunction( float16_t, float16_t ) ) +{ + union ui16_f16 u; + bool trueZ; + uint_fast8_t trueFlags; + + genCases_f16_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f16_ab_next(); + u.f = genCases_f16_a; + writeHex_ui16( u.ui, ' ' ); + u.f = genCases_f16_b; + writeHex_ui16( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, genCases_f16_b ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_bool( trueZ, trueFlags ) ) break; + } + +} + +#endif + +void + gen_a_f32_z_ui32_rx( + uint_fast32_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui32_f32 uA; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f32_z_ui64_rx( + uint_fast64_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui32_f32 uA; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f32_z_i32_rx( + int_fast32_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui32_f32 uA; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f32_z_i64_rx( + int_fast64_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui32_f32 uA; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f32_z_ui32_x( + uint_fast32_t trueFunction( float32_t, bool ), bool exact ) +{ + union ui32_f32 uA; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f32_z_ui64_x( + uint_fast64_t trueFunction( float32_t, bool ), bool exact ) +{ + union ui32_f32 uA; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f32_z_i32_x( int_fast32_t trueFunction( float32_t, bool ), bool exact ) +{ + union ui32_f32 uA; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f32_z_i64_x( int_fast64_t trueFunction( float32_t, bool ), bool exact ) +{ + union ui32_f32 uA; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +#ifdef FLOAT16 + +void gen_a_f32_z_f16( float16_t trueFunction( float32_t ) ) +{ + union ui32_f32 uA; + union ui16_f16 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_f32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT64 + +void gen_a_f32_z_f64( float64_t trueFunction( float32_t ) ) +{ + union ui32_f32 uA; + union ui64_f64 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_f32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void gen_a_f32_z_extF80( void trueFunction( float32_t, extFloat80_t * ) ) +{ + union ui32_f32 uA; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_f32_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void gen_a_f32_z_f128( void trueFunction( float32_t, float128_t * ) ) +{ + union ui32_f32 uA; + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + uA.f = genCases_f32_a; + writeHex_ui32( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_f32_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +void gen_az_f32( float32_t trueFunction( float32_t ) ) +{ + union ui32_f32 u; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + u.f = genCases_f32_a; + writeHex_ui32( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f32_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( u.ui, trueFlags ) ) break; + } + +} + +void + gen_az_f32_rx( + float32_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui32_f32 u; + uint_fast8_t trueFlags; + + genCases_f32_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_a_next(); + u.f = genCases_f32_a; + writeHex_ui32( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( u.ui, trueFlags ) ) break; + } + +} + +void gen_abz_f32( float32_t trueFunction( float32_t, float32_t ) ) +{ + union ui32_f32 u; + uint_fast8_t trueFlags; + + genCases_f32_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_ab_next(); + u.f = genCases_f32_a; + writeHex_ui32( u.ui, ' ' ); + u.f = genCases_f32_b; + writeHex_ui32( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f32_a, genCases_f32_b ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( u.ui, trueFlags ) ) break; + } + +} + +void gen_abcz_f32( float32_t trueFunction( float32_t, float32_t, float32_t ) ) +{ + union ui32_f32 u; + uint_fast8_t trueFlags; + + genCases_f32_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_abc_next(); + u.f = genCases_f32_a; + writeHex_ui32( u.ui, ' ' ); + u.f = genCases_f32_b; + writeHex_ui32( u.ui, ' ' ); + u.f = genCases_f32_c; + writeHex_ui32( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f32_a, genCases_f32_b, genCases_f32_c ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( u.ui, trueFlags ) ) break; + } + +} + +void gen_ab_f32_z_bool( bool trueFunction( float32_t, float32_t ) ) +{ + union ui32_f32 u; + bool trueZ; + uint_fast8_t trueFlags; + + genCases_f32_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f32_ab_next(); + u.f = genCases_f32_a; + writeHex_ui32( u.ui, ' ' ); + u.f = genCases_f32_b; + writeHex_ui32( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, genCases_f32_b ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_bool( trueZ, trueFlags ) ) break; + } + +} + +#ifdef FLOAT64 + +void + gen_a_f64_z_ui32_rx( + uint_fast32_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui64_f64 uA; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f64_z_ui64_rx( + uint_fast64_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui64_f64 uA; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f64_z_i32_rx( + int_fast32_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui64_f64 uA; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f64_z_i64_rx( + int_fast64_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui64_f64 uA; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f64_z_ui32_x( + uint_fast32_t trueFunction( float64_t, bool ), bool exact ) +{ + union ui64_f64 uA; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f64_z_ui64_x( + uint_fast64_t trueFunction( float64_t, bool ), bool exact ) +{ + union ui64_f64 uA; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f64_z_i32_x( int_fast32_t trueFunction( float64_t, bool ), bool exact ) +{ + union ui64_f64 uA; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f64_z_i64_x( int_fast64_t trueFunction( float64_t, bool ), bool exact ) +{ + union ui64_f64 uA; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +#ifdef FLOAT16 + +void gen_a_f64_z_f16( float16_t trueFunction( float64_t ) ) +{ + union ui64_f64 uA; + union ui16_f16 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_f64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +void gen_a_f64_z_f32( float32_t trueFunction( float64_t ) ) +{ + union ui64_f64 uA; + union ui32_f32 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( genCases_f64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#ifdef EXTFLOAT80 + +void gen_a_f64_z_extF80( void trueFunction( float64_t, extFloat80_t * ) ) +{ + union ui64_f64 uA; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_f64_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void gen_a_f64_z_f128( void trueFunction( float64_t, float128_t * ) ) +{ + union ui64_f64 uA; + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + uA.f = genCases_f64_a; + writeHex_ui64( uA.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( genCases_f64_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +void gen_az_f64( float64_t trueFunction( float64_t ) ) +{ + union ui64_f64 u; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + u.f = genCases_f64_a; + writeHex_ui64( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f64_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( u.ui, trueFlags ) ) break; + } + +} + +void + gen_az_f64_rx( + float64_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + union ui64_f64 u; + uint_fast8_t trueFlags; + + genCases_f64_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_a_next(); + u.f = genCases_f64_a; + writeHex_ui64( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( u.ui, trueFlags ) ) break; + } + +} + +void gen_abz_f64( float64_t trueFunction( float64_t, float64_t ) ) +{ + union ui64_f64 u; + uint_fast8_t trueFlags; + + genCases_f64_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_ab_next(); + u.f = genCases_f64_a; + writeHex_ui64( u.ui, ' ' ); + u.f = genCases_f64_b; + writeHex_ui64( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f64_a, genCases_f64_b ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( u.ui, trueFlags ) ) break; + } + +} + +void gen_abcz_f64( float64_t trueFunction( float64_t, float64_t, float64_t ) ) +{ + union ui64_f64 u; + uint_fast8_t trueFlags; + + genCases_f64_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_abc_next(); + u.f = genCases_f64_a; + writeHex_ui64( u.ui, ' ' ); + u.f = genCases_f64_b; + writeHex_ui64( u.ui, ' ' ); + u.f = genCases_f64_c; + writeHex_ui64( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + u.f = trueFunction( genCases_f64_a, genCases_f64_b, genCases_f64_c ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( u.ui, trueFlags ) ) break; + } + +} + +void gen_ab_f64_z_bool( bool trueFunction( float64_t, float64_t ) ) +{ + union ui64_f64 u; + bool trueZ; + uint_fast8_t trueFlags; + + genCases_f64_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f64_ab_next(); + u.f = genCases_f64_a; + writeHex_ui64( u.ui, ' ' ); + u.f = genCases_f64_b; + writeHex_ui64( u.ui, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, genCases_f64_b ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_bool( trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void + gen_a_extF80_z_ui32_rx( + uint_fast32_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_extF80_z_ui64_rx( + uint_fast64_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_extF80_z_i32_rx( + int_fast32_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_extF80_z_i64_rx( + int_fast64_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_extF80_z_ui32_x( + uint_fast32_t trueFunction( const extFloat80_t *, bool ), bool exact ) +{ + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_extF80_z_ui64_x( + uint_fast64_t trueFunction( const extFloat80_t *, bool ), bool exact ) +{ + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_extF80_z_i32_x( + int_fast32_t trueFunction( const extFloat80_t *, bool ), bool exact ) +{ + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_extF80_z_i64_x( + int_fast64_t trueFunction( const extFloat80_t *, bool ), bool exact ) +{ + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +#ifdef FLOAT16 + +void gen_a_extF80_z_f16( float16_t trueFunction( const extFloat80_t * ) ) +{ + union ui16_f16 uTrueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( &genCases_extF80_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +void gen_a_extF80_z_f32( float32_t trueFunction( const extFloat80_t * ) ) +{ + union ui32_f32 uTrueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( &genCases_extF80_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#ifdef FLOAT64 + +void gen_a_extF80_z_f64( float64_t trueFunction( const extFloat80_t * ) ) +{ + union ui64_f64 uTrueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( &genCases_extF80_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void + gen_a_extF80_z_f128( void trueFunction( const extFloat80_t *, float128_t * ) ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( &genCases_extF80_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +void gen_az_extF80( void trueFunction( const extFloat80_t *, extFloat80_t * ) ) +{ + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( &genCases_extF80_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +void + gen_az_extF80_rx( + void + trueFunction( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + uint_fast8_t roundingMode, + bool exact + ) +{ + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_a_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( &genCases_extF80_a, roundingMode, exact, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +void + gen_abz_extF80( + void + trueFunction( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ) + ) +{ + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_ab_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + writeHex_uiExtF80M( &genCases_extF80_b, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( &genCases_extF80_a, &genCases_extF80_b, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +void + gen_ab_extF80_z_bool( + bool trueFunction( const extFloat80_t *, const extFloat80_t * ) ) +{ + bool trueZ; + uint_fast8_t trueFlags; + + genCases_extF80_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_extF80_ab_next(); + writeHex_uiExtF80M( &genCases_extF80_a, ' ' ); + writeHex_uiExtF80M( &genCases_extF80_b, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, &genCases_extF80_b ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_bool( trueZ, trueFlags ) ) break; + } + +} + +#endif + +#ifdef FLOAT128 + +void + gen_a_f128_z_ui32_rx( + uint_fast32_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f128_z_ui64_rx( + uint_fast64_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f128_z_i32_rx( + int_fast32_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f128_z_i64_rx( + int_fast64_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, roundingMode, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f128_z_ui32_x( + uint_fast32_t trueFunction( const float128_t *, bool ), bool exact ) +{ + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f128_z_ui64_x( + uint_fast64_t trueFunction( const float128_t *, bool ), bool exact ) +{ + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f128_z_i32_x( + int_fast32_t trueFunction( const float128_t *, bool ), bool exact ) +{ + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( trueZ, trueFlags ) ) break; + } + +} + +void + gen_a_f128_z_i64_x( + int_fast64_t trueFunction( const float128_t *, bool ), bool exact ) +{ + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, exact ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( trueZ, trueFlags ) ) break; + } + +} + +#ifdef FLOAT16 + +void gen_a_f128_z_f16( float16_t trueFunction( const float128_t * ) ) +{ + union ui16_f16 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( &genCases_f128_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui16( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +void gen_a_f128_z_f32( float32_t trueFunction( const float128_t * ) ) +{ + union ui32_f32 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( &genCases_f128_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui32( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#ifdef FLOAT64 + +void gen_a_f128_z_f64( float64_t trueFunction( const float128_t * ) ) +{ + union ui64_f64 uTrueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + uTrueZ.f = trueFunction( &genCases_f128_a ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_ui64( uTrueZ.ui, trueFlags ) ) break; + } + +} + +#endif + +#ifdef EXTFLOAT80 + +void + gen_a_f128_z_extF80( void trueFunction( const float128_t *, extFloat80_t * ) ) +{ + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( &genCases_f128_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_extF80M( &trueZ, trueFlags ) ) break; + } + +} + +#endif + +void gen_az_f128( void trueFunction( const float128_t *, float128_t * ) ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( &genCases_f128_a, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +void + gen_az_f128_rx( + void trueFunction( const float128_t *, uint_fast8_t, bool, float128_t * ), + uint_fast8_t roundingMode, + bool exact + ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_a_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_a_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( &genCases_f128_a, roundingMode, exact, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +void + gen_abz_f128( + void trueFunction( const float128_t *, const float128_t *, float128_t * ) + ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_ab_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + writeHex_uiF128M( &genCases_f128_b, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( &genCases_f128_a, &genCases_f128_b, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +void + gen_abcz_f128( + void + trueFunction( + const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ) + ) +{ + float128_t trueZ; + uint_fast8_t trueFlags; + + genCases_f128_abc_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_abc_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + writeHex_uiF128M( &genCases_f128_b, ' ' ); + writeHex_uiF128M( &genCases_f128_c, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueFunction( + &genCases_f128_a, &genCases_f128_b, &genCases_f128_c, &trueZ ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_f128M( &trueZ, trueFlags ) ) break; + } + +} + +void + gen_ab_f128_z_bool( + bool trueFunction( const float128_t *, const float128_t * ) ) +{ + bool trueZ; + uint_fast8_t trueFlags; + + genCases_f128_ab_init(); + checkEnoughCases(); + while ( ! genLoops_stop && (! genCases_done || genLoops_forever) ) { + genCases_f128_ab_next(); + writeHex_uiF128M( &genCases_f128_a, ' ' ); + writeHex_uiF128M( &genCases_f128_b, ' ' ); + *genLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, &genCases_f128_b ); + trueFlags = *genLoops_trueFlagsPtr; + if ( writeGenOutputs_bool( trueZ, trueFlags ) ) break; + } + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/genLoops.h b/src/libs/softfloat-3e/testfloat/source/genLoops.h new file mode 100644 index 00000000..2ca88c7b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/genLoops.h @@ -0,0 +1,354 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <signal.h> +#include "softfloat.h" + +extern volatile sig_atomic_t genLoops_stop; + +extern bool genLoops_forever; +extern bool genLoops_givenCount; +extern uint_fast64_t genLoops_count; +extern uint_fast8_t *genLoops_trueFlagsPtr; + +void gen_a_ui32( void ); +void gen_a_ui64( void ); +void gen_a_i32( void ); +void gen_a_i64( void ); +#ifdef FLOAT16 +void gen_a_f16( void ); +void gen_ab_f16( void ); +void gen_abc_f16( void ); +#endif +void gen_a_f32( void ); +void gen_ab_f32( void ); +void gen_abc_f32( void ); +#ifdef FLOAT64 +void gen_a_f64( void ); +void gen_ab_f64( void ); +void gen_abc_f64( void ); +#endif +#ifdef EXTFLOAT80 +void gen_a_extF80( void ); +void gen_ab_extF80( void ); +void gen_abc_extF80( void ); +#endif +#ifdef FLOAT128 +void gen_a_f128( void ); +void gen_ab_f128( void ); +void gen_abc_f128( void ); +#endif + +#ifdef FLOAT16 +void gen_a_ui32_z_f16( float16_t ( uint32_t ) ); +#endif +void gen_a_ui32_z_f32( float32_t ( uint32_t ) ); +#ifdef FLOAT64 +void gen_a_ui32_z_f64( float64_t ( uint32_t ) ); +#endif +#ifdef EXTFLOAT80 +void gen_a_ui32_z_extF80( void ( uint32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void gen_a_ui32_z_f128( void ( uint32_t, float128_t * ) ); +#endif +#ifdef FLOAT16 +void gen_a_ui64_z_f16( float16_t ( uint64_t ) ); +#endif +void gen_a_ui64_z_f32( float32_t ( uint64_t ) ); +#ifdef FLOAT64 +void gen_a_ui64_z_f64( float64_t ( uint64_t ) ); +#endif +#ifdef EXTFLOAT80 +void gen_a_ui64_z_extF80( void ( uint64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void gen_a_ui64_z_f128( void ( uint64_t, float128_t * ) ); +#endif +#ifdef FLOAT16 +void gen_a_i32_z_f16( float16_t ( int32_t ) ); +#endif +void gen_a_i32_z_f32( float32_t ( int32_t ) ); +#ifdef FLOAT64 +void gen_a_i32_z_f64( float64_t ( int32_t ) ); +#endif +#ifdef EXTFLOAT80 +void gen_a_i32_z_extF80( void ( int32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void gen_a_i32_z_f128( void ( int32_t, float128_t * ) ); +#endif +#ifdef FLOAT16 +void gen_a_i64_z_f16( float16_t ( int64_t ) ); +#endif +void gen_a_i64_z_f32( float32_t ( int64_t ) ); +#ifdef FLOAT64 +void gen_a_i64_z_f64( float64_t ( int64_t ) ); +#endif +#ifdef EXTFLOAT80 +void gen_a_i64_z_extF80( void ( int64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void gen_a_i64_z_f128( void ( int64_t, float128_t * ) ); +#endif + +#ifdef FLOAT16 +void + gen_a_f16_z_ui32_rx( + uint_fast32_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f16_z_ui64_rx( + uint_fast64_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f16_z_i32_rx( + int_fast32_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f16_z_i64_rx( + int_fast64_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void gen_a_f16_z_ui32_x( uint_fast32_t ( float16_t, bool ), bool ); +void gen_a_f16_z_ui64_x( uint_fast64_t ( float16_t, bool ), bool ); +void gen_a_f16_z_i32_x( int_fast32_t ( float16_t, bool ), bool ); +void gen_a_f16_z_i64_x( int_fast64_t ( float16_t, bool ), bool ); +void gen_a_f16_z_f32( float32_t ( float16_t ) ); +#ifdef FLOAT64 +void gen_a_f16_z_f64( float64_t ( float16_t ) ); +#endif +#ifdef EXTFLOAT80 +void gen_a_f16_z_extF80( void ( float16_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void gen_a_f16_z_f128( void ( float16_t, float128_t * ) ); +#endif +void gen_az_f16( float16_t ( float16_t ) ); +void + gen_az_f16_rx( + float16_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void gen_abz_f16( float16_t ( float16_t, float16_t ) ); +void gen_abcz_f16( float16_t ( float16_t, float16_t, float16_t ) ); +void gen_ab_f16_z_bool( bool ( float16_t, float16_t ) ); +#endif + +void + gen_a_f32_z_ui32_rx( + uint_fast32_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f32_z_ui64_rx( + uint_fast64_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f32_z_i32_rx( + int_fast32_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f32_z_i64_rx( + int_fast64_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void gen_a_f32_z_ui32_x( uint_fast32_t ( float32_t, bool ), bool ); +void gen_a_f32_z_ui64_x( uint_fast64_t ( float32_t, bool ), bool ); +void gen_a_f32_z_i32_x( int_fast32_t ( float32_t, bool ), bool ); +void gen_a_f32_z_i64_x( int_fast64_t ( float32_t, bool ), bool ); +#ifdef FLOAT16 +void gen_a_f32_z_f16( float16_t ( float32_t ) ); +#endif +#ifdef FLOAT64 +void gen_a_f32_z_f64( float64_t ( float32_t ) ); +#endif +#ifdef EXTFLOAT80 +void gen_a_f32_z_extF80( void ( float32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void gen_a_f32_z_f128( void ( float32_t, float128_t * ) ); +#endif +void gen_az_f32( float32_t ( float32_t ) ); +void + gen_az_f32_rx( + float32_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void gen_abz_f32( float32_t ( float32_t, float32_t ) ); +void gen_abcz_f32( float32_t ( float32_t, float32_t, float32_t ) ); +void gen_ab_f32_z_bool( bool ( float32_t, float32_t ) ); + +#ifdef FLOAT64 +void + gen_a_f64_z_ui32_rx( + uint_fast32_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f64_z_ui64_rx( + uint_fast64_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f64_z_i32_rx( + int_fast32_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + gen_a_f64_z_i64_rx( + int_fast64_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void gen_a_f64_z_ui32_x( uint_fast32_t ( float64_t, bool ), bool ); +void gen_a_f64_z_ui64_x( uint_fast64_t ( float64_t, bool ), bool ); +void gen_a_f64_z_i32_x( int_fast32_t ( float64_t, bool ), bool ); +void gen_a_f64_z_i64_x( int_fast64_t ( float64_t, bool ), bool ); +#ifdef FLOAT16 +void gen_a_f64_z_f16( float16_t ( float64_t ) ); +#endif +void gen_a_f64_z_f32( float32_t ( float64_t ) ); +#ifdef EXTFLOAT80 +void gen_a_f64_z_extF80( void ( float64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void gen_a_f64_z_f128( void ( float64_t, float128_t * ) ); +#endif +void gen_az_f64( float64_t ( float64_t ) ); +void + gen_az_f64_rx( + float64_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void gen_abz_f64( float64_t ( float64_t, float64_t ) ); +void gen_abcz_f64( float64_t ( float64_t, float64_t, float64_t ) ); +void gen_ab_f64_z_bool( bool ( float64_t, float64_t ) ); +#endif + +#ifdef EXTFLOAT80 +void + gen_a_extF80_z_ui32_rx( + uint_fast32_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + gen_a_extF80_z_ui64_rx( + uint_fast64_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + gen_a_extF80_z_i32_rx( + int_fast32_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + gen_a_extF80_z_i64_rx( + int_fast64_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + gen_a_extF80_z_ui32_x( uint_fast32_t ( const extFloat80_t *, bool ), bool ); +void + gen_a_extF80_z_ui64_x( uint_fast64_t ( const extFloat80_t *, bool ), bool ); +void gen_a_extF80_z_i32_x( int_fast32_t ( const extFloat80_t *, bool ), bool ); +void gen_a_extF80_z_i64_x( int_fast64_t ( const extFloat80_t *, bool ), bool ); +#ifdef FLOAT16 +void gen_a_extF80_z_f16( float16_t ( const extFloat80_t * ) ); +#endif +void gen_a_extF80_z_f32( float32_t ( const extFloat80_t * ) ); +#ifdef FLOAT64 +void gen_a_extF80_z_f64( float64_t ( const extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void gen_a_extF80_z_f128( void ( const extFloat80_t *, float128_t * ) ); +#endif +void gen_az_extF80( void ( const extFloat80_t *, extFloat80_t * ) ); +void + gen_az_extF80_rx( + void ( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + uint_fast8_t, + bool + ); +void + gen_abz_extF80( + void ( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ) ); +void + gen_ab_extF80_z_bool( bool ( const extFloat80_t *, const extFloat80_t * ) ); +#endif + +#ifdef FLOAT128 +void + gen_a_f128_z_ui32_rx( + uint_fast32_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + gen_a_f128_z_ui64_rx( + uint_fast64_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + gen_a_f128_z_i32_rx( + int_fast32_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + gen_a_f128_z_i64_rx( + int_fast64_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void gen_a_f128_z_ui32_x( uint_fast32_t ( const float128_t *, bool ), bool ); +void gen_a_f128_z_ui64_x( uint_fast64_t ( const float128_t *, bool ), bool ); +void gen_a_f128_z_i32_x( int_fast32_t ( const float128_t *, bool ), bool ); +void gen_a_f128_z_i64_x( int_fast64_t ( const float128_t *, bool ), bool ); +#ifdef FLOAT16 +void gen_a_f128_z_f16( float16_t ( const float128_t * ) ); +#endif +void gen_a_f128_z_f32( float32_t ( const float128_t * ) ); +#ifdef FLOAT64 +void gen_a_f128_z_f64( float64_t ( const float128_t * ) ); +#endif +#ifdef EXTFLOAT80 +void gen_a_f128_z_extF80( void ( const float128_t *, extFloat80_t * ) ); +#endif +void gen_az_f128( void ( const float128_t *, float128_t * ) ); +void + gen_az_f128_rx( + void ( const float128_t *, uint_fast8_t, bool, float128_t * ), + uint_fast8_t, + bool + ); +void + gen_abz_f128( void ( const float128_t *, const float128_t *, float128_t * ) ); +void + gen_abcz_f128( + void + ( + const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ) + ); +void gen_ab_f128_z_bool( bool ( const float128_t *, const float128_t * ) ); +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/random.c b/src/libs/softfloat-3e/testfloat/source/random.c new file mode 100644 index 00000000..715c8cc1 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/random.c @@ -0,0 +1,138 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdlib.h> +#include "platform.h" +#include "random.h" + +uint_fast8_t random_ui8( void ) +{ + + return rand()>>4 & 0xFF; + +} + +uint_fast16_t random_ui16( void ) +{ + + return (rand() & 0x0FF0)<<4 | (rand()>>4 & 0xFF); + +} + +uint_fast32_t random_ui32( void ) +{ + + return + (uint_fast32_t) (rand() & 0x0FF0)<<20 + | (uint_fast32_t) (rand() & 0x0FF0)<<12 + | (rand() & 0x0FF0)<<4 + | (rand()>>4 & 0xFF); + +} + +uint_fast64_t random_ui64( void ) +{ + + return (uint_fast64_t) random_ui32()<<32 | random_ui32(); + +} + +uint_fast8_t randomN_ui8( uint_fast8_t N ) +{ + uint_fast8_t scale, z; + + scale = 0; + while ( N < 0x80 ) { + ++scale; + N <<= 1; + } + do { + z = random_ui8(); + } while ( N <= z ); + return z>>scale; + +} + +uint_fast16_t randomN_ui16( uint_fast16_t N ) +{ + uint_fast16_t scale, z; + + scale = 0; + while ( N < 0x8000 ) { + ++scale; + N <<= 1; + } + do { + z = random_ui16(); + } while ( N <= z ); + return z>>scale; + +} + +uint_fast32_t randomN_ui32( uint_fast32_t N ) +{ + uint_fast32_t scale, z; + + scale = 0; + while ( N < 0x8000 ) { + ++scale; + N <<= 1; + } + do { + z = random_ui32(); + } while ( N <= z ); + return z>>scale; + +} + +uint_fast64_t randomN_ui64( uint_fast64_t N ) +{ + uint_fast64_t scale, z; + + scale = 0; + while ( N < 0x8000 ) { + ++scale; + N <<= 1; + } + do { + z = random_ui64(); + } while ( N <= z ); + return z>>scale; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/random.h b/src/libs/softfloat-3e/testfloat/source/random.h new file mode 100644 index 00000000..08c8cd27 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/random.h @@ -0,0 +1,49 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> + +uint_fast8_t random_ui8( void ); +uint_fast16_t random_ui16( void ); +uint_fast32_t random_ui32( void ); +uint_fast64_t random_ui64( void ); + +uint_fast8_t randomN_ui8( uint_fast8_t ); +uint_fast16_t randomN_ui16( uint_fast16_t ); +uint_fast32_t randomN_ui32( uint_fast32_t ); +uint_fast64_t randomN_ui64( uint_fast64_t ); + diff --git a/src/libs/softfloat-3e/testfloat/source/readHex.c b/src/libs/softfloat-3e/testfloat/source/readHex.c new file mode 100644 index 00000000..0e1b50c7 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/readHex.c @@ -0,0 +1,190 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "readHex.h" + +bool readHex_bool( bool *aPtr, char sepChar ) +{ + int i; + bool a; + + i = fgetc( stdin ); + if ( (i == EOF) || (i < '0') || ('1' < i) ) return false; + a = i - '0'; + if ( sepChar ) { + i = fgetc( stdin ); + if ( (sepChar != '\n') || (i != '\r') ) { + if ( i != sepChar ) return false; + } + } + *aPtr = a; + return true; + +} + +bool readHex_ui8( uint_least8_t *aPtr, char sepChar ) +{ + int i; + uint_fast8_t a; + + i = fgetc( stdin ); + if ( i == EOF ) return false; + if ( ('0' <= i) && (i <= '9') ) { + i -= '0'; + } else if ( ('A' <= i) && (i <= 'F') ) { + i -= 'A' - 10; + } else if ( ('a' <= i) && (i <= 'f') ) { + i -= 'a' - 10; + } else { + return false; + } + a = i<<4; + i = fgetc( stdin ); + if ( i == EOF ) return false; + if ( ('0' <= i) && (i <= '9') ) { + i -= '0'; + } else if ( ('A' <= i) && (i <= 'F') ) { + i -= 'A' - 10; + } else if ( ('a' <= i) && (i <= 'f') ) { + i -= 'a' - 10; + } else { + return false; + } + a |= i; + if ( sepChar ) { + i = fgetc( stdin ); + if ( (sepChar != '\n') || (i != '\r') ) { + if ( i != sepChar ) return false; + } + } + *aPtr = a; + return true; + +} + +bool readHex_ui16( uint16_t *aPtr, char sepChar ) +{ + int i; + uint_fast16_t a; + + i = fgetc( stdin ); + if ( i == EOF ) return false; + if ( ('0' <= i) && (i <= '9') ) { + i -= '0'; + } else if ( ('A' <= i) && (i <= 'F') ) { + i -= 'A' - 10; + } else if ( ('a' <= i) && (i <= 'f') ) { + i -= 'a' - 10; + } else { + return false; + } + a = (uint_fast16_t) i<<12; + i = fgetc( stdin ); + if ( i == EOF ) return false; + if ( ('0' <= i) && (i <= '9') ) { + i -= '0'; + } else if ( ('A' <= i) && (i <= 'F') ) { + i -= 'A' - 10; + } else if ( ('a' <= i) && (i <= 'f') ) { + i -= 'a' - 10; + } else { + return false; + } + a |= (uint_fast16_t) i<<8; + i = fgetc( stdin ); + if ( i == EOF ) return false; + if ( ('0' <= i) && (i <= '9') ) { + i -= '0'; + } else if ( ('A' <= i) && (i <= 'F') ) { + i -= 'A' - 10; + } else if ( ('a' <= i) && (i <= 'f') ) { + i -= 'a' - 10; + } else { + return false; + } + a |= (uint_fast16_t) i<<4; + i = fgetc( stdin ); + if ( i == EOF ) return false; + if ( ('0' <= i) && (i <= '9') ) { + i -= '0'; + } else if ( ('A' <= i) && (i <= 'F') ) { + i -= 'A' - 10; + } else if ( ('a' <= i) && (i <= 'f') ) { + i -= 'a' - 10; + } else { + return false; + } + a |= i; + if ( sepChar ) { + i = fgetc( stdin ); + if ( (sepChar != '\n') || (i != '\r') ) { + if ( i != sepChar ) return false; + } + } + *aPtr = a; + return true; + +} + +bool readHex_ui32( uint32_t *aPtr, char sepChar ) +{ + uint16_t v16, v0; + + if ( ! readHex_ui16( &v16, 0 ) || ! readHex_ui16( &v0, sepChar ) ) { + return false; + } + *aPtr = (uint_fast32_t) v16<<16 | v0; + return true; + +} + +bool readHex_ui64( uint64_t *aPtr, char sepChar ) +{ + uint32_t v32, v0; + + if ( ! readHex_ui32( &v32, 0 ) || ! readHex_ui32( &v0, sepChar ) ) { + return false; + } + *aPtr = (uint_fast64_t) v32<<32 | v0; + return true; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/readHex.h b/src/libs/softfloat-3e/testfloat/source/readHex.h new file mode 100644 index 00000000..ff323812 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/readHex.h @@ -0,0 +1,46 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> + +bool readHex_bool( bool *, char ); +bool readHex_ui8( uint_least8_t *, char ); +bool readHex_ui16( uint16_t *, char ); +bool readHex_ui32( uint32_t *, char ); +bool readHex_ui64( uint64_t *, char ); + diff --git a/src/libs/softfloat-3e/testfloat/source/slowfloat.c b/src/libs/softfloat-3e/testfloat/source/slowfloat.c new file mode 100644 index 00000000..4e84656b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/slowfloat.c @@ -0,0 +1,3749 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "uint128.h" +#include "softfloat.h" +#include "slowfloat.h" + +uint_fast8_t slowfloat_roundingMode; +uint_fast8_t slowfloat_detectTininess; +uint_fast8_t slowfloat_exceptionFlags; +#ifdef EXTFLOAT80 +uint_fast8_t slow_extF80_roundingPrecision; +#endif + +#ifdef FLOAT16 +union ui16_f16 { uint16_t ui; float16_t f; }; +#endif +union ui32_f32 { uint32_t ui; float32_t f; }; +#ifdef FLOAT64 +union ui64_f64 { uint64_t ui; float64_t f; }; +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +struct floatX { + bool isNaN; + bool isInf; + bool isZero; + bool sign; + int_fast32_t exp; + struct uint128 sig; +}; + +static const struct floatX floatXNaN = + { true, false, false, false, 0, { 0, 0 } }; +static const struct floatX floatXPositiveZero = + { false, false, true, false, 0, { 0, 0 } }; +static const struct floatX floatXNegativeZero = + { false, false, true, true, 0, { 0, 0 } }; + +static +void + roundFloatXTo11( + bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast64_t roundBits, sigX64; + + sigX64 = xPtr->sig.v64; + roundBits = (sigX64 & UINT64_C( 0x1FFFFFFFFFFF )) | (xPtr->sig.v0 != 0); + if ( roundBits ) { + sigX64 &= UINT64_C( 0xFFFFE00000000000 ); + if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact; + if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow; + switch ( roundingMode ) { + case softfloat_round_near_even: + if ( roundBits < UINT64_C( 0x100000000000 ) ) goto noIncrement; + if ( + (roundBits == UINT64_C( 0x100000000000 )) + && !(sigX64 & UINT64_C( 0x200000000000 )) + ) { + goto noIncrement; + } + break; + case softfloat_round_minMag: + goto noIncrement; + case softfloat_round_min: + if ( !xPtr->sign ) goto noIncrement; + break; + case softfloat_round_max: + if ( xPtr->sign ) goto noIncrement; + break; + case softfloat_round_near_maxMag: + if ( roundBits < UINT64_C( 0x100000000000 ) ) goto noIncrement; + break; +#ifdef FLOAT_ROUND_ODD + case softfloat_round_odd: + sigX64 |= UINT64_C( 0x200000000000 ); + goto noIncrement; +#endif + } + sigX64 += UINT64_C( 0x200000000000 ); + if ( sigX64 == UINT64_C( 0x0100000000000000 ) ) { + ++xPtr->exp; + sigX64 = UINT64_C( 0x0080000000000000 ); + } + noIncrement: + xPtr->sig.v64 = sigX64; + xPtr->sig.v0 = 0; + } + +} + +static +void + roundFloatXTo24( + bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast64_t sigX64; + uint_fast32_t roundBits; + + sigX64 = xPtr->sig.v64; + roundBits = (uint32_t) sigX64 | (xPtr->sig.v0 != 0); + if ( roundBits ) { + sigX64 &= UINT64_C( 0xFFFFFFFF00000000 ); + if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact; + if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow; + switch ( roundingMode ) { + case softfloat_round_near_even: + if ( roundBits < 0x80000000 ) goto noIncrement; + if ( + (roundBits == 0x80000000) + && !(sigX64 & UINT64_C( 0x100000000 )) + ) { + goto noIncrement; + } + break; + case softfloat_round_minMag: + goto noIncrement; + case softfloat_round_min: + if ( !xPtr->sign ) goto noIncrement; + break; + case softfloat_round_max: + if ( xPtr->sign ) goto noIncrement; + break; + case softfloat_round_near_maxMag: + if ( roundBits < 0x80000000 ) goto noIncrement; + break; +#ifdef FLOAT_ROUND_ODD + case softfloat_round_odd: + sigX64 |= UINT64_C( 0x100000000 ); + goto noIncrement; +#endif + } + sigX64 += UINT64_C( 0x100000000 ); + if ( sigX64 == UINT64_C( 0x0100000000000000 ) ) { + ++xPtr->exp; + sigX64 = UINT64_C( 0x0080000000000000 ); + } + noIncrement: + xPtr->sig.v64 = sigX64; + xPtr->sig.v0 = 0; + } + +} + +static +void + roundFloatXTo53( + bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast64_t sigX64; + uint_fast8_t roundBits; + + sigX64 = xPtr->sig.v64; + roundBits = (sigX64 & 7) | (xPtr->sig.v0 != 0); + if ( roundBits ) { + sigX64 &= UINT64_C( 0xFFFFFFFFFFFFFFF8 ); + if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact; + if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow; + switch ( roundingMode ) { + case softfloat_round_near_even: + if ( roundBits < 4 ) goto noIncrement; + if ( (roundBits == 4) && !(sigX64 & 8) ) goto noIncrement; + break; + case softfloat_round_minMag: + goto noIncrement; + case softfloat_round_min: + if ( !xPtr->sign ) goto noIncrement; + break; + case softfloat_round_max: + if ( xPtr->sign ) goto noIncrement; + break; + case softfloat_round_near_maxMag: + if ( roundBits < 4 ) goto noIncrement; + break; +#ifdef FLOAT_ROUND_ODD + case softfloat_round_odd: + sigX64 |= 8; + goto noIncrement; +#endif + } + sigX64 += 8; + if ( sigX64 == UINT64_C( 0x0100000000000000 ) ) { + ++xPtr->exp; + sigX64 = UINT64_C( 0x0080000000000000 ); + } + noIncrement: + xPtr->sig.v64 = sigX64; + xPtr->sig.v0 = 0; + } + +} + +static +void + roundFloatXTo64( + bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast64_t sigX0, roundBits, sigX64; + + sigX0 = xPtr->sig.v0; + roundBits = sigX0 & UINT64_C( 0x00FFFFFFFFFFFFFF ); + if ( roundBits ) { + sigX0 &= UINT64_C( 0xFF00000000000000 ); + if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact; + if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow; + switch ( roundingMode ) { + case softfloat_round_near_even: + if ( roundBits < UINT64_C( 0x0080000000000000 ) ) goto noIncrement; + if ( + (roundBits == UINT64_C( 0x0080000000000000 )) + && !(sigX0 & UINT64_C( 0x0100000000000000 )) + ) { + goto noIncrement; + } + break; + case softfloat_round_minMag: + goto noIncrement; + case softfloat_round_min: + if ( !xPtr->sign ) goto noIncrement; + break; + case softfloat_round_max: + if ( xPtr->sign ) goto noIncrement; + break; + case softfloat_round_near_maxMag: + if ( roundBits < UINT64_C( 0x0080000000000000 ) ) goto noIncrement; + break; +#ifdef FLOAT_ROUND_ODD + case softfloat_round_odd: + sigX0 |= UINT64_C( 0x100000000000000 ); + goto noIncrement; +#endif + } + sigX0 += UINT64_C( 0x100000000000000 ); + sigX64 = xPtr->sig.v64 + !sigX0; + if ( sigX64 == UINT64_C( 0x0100000000000000 ) ) { + ++xPtr->exp; + sigX64 = UINT64_C( 0x0080000000000000 ); + } + xPtr->sig.v64 = sigX64; + noIncrement: + xPtr->sig.v0 = sigX0; + } + +} + +static +void + roundFloatXTo113( + bool isTiny, struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast64_t sigX0; + uint_fast8_t roundBits; + uint_fast64_t sigX64; + + sigX0 = xPtr->sig.v0; + roundBits = sigX0 & 0x7F; + if ( roundBits ) { + sigX0 &= UINT64_C( 0xFFFFFFFFFFFFFF80 ); + if ( exact ) slowfloat_exceptionFlags |= softfloat_flag_inexact; + if ( isTiny ) slowfloat_exceptionFlags |= softfloat_flag_underflow; + switch ( roundingMode ) { + case softfloat_round_near_even: + if ( roundBits < 0x40 ) goto noIncrement; + if ( (roundBits == 0x40) && !(sigX0 & 0x80) ) goto noIncrement; + break; + case softfloat_round_minMag: + goto noIncrement; + case softfloat_round_min: + if ( !xPtr->sign ) goto noIncrement; + break; + case softfloat_round_max: + if ( xPtr->sign ) goto noIncrement; + break; + case softfloat_round_near_maxMag: + if ( roundBits < 0x40 ) goto noIncrement; + break; +#ifdef FLOAT_ROUND_ODD + case softfloat_round_odd: + sigX0 |= 0x80; + goto noIncrement; +#endif + } + sigX0 += 0x80; + sigX64 = xPtr->sig.v64 + !sigX0; + if ( sigX64 == UINT64_C( 0x0100000000000000 ) ) { + ++xPtr->exp; + sigX64 = UINT64_C( 0x0080000000000000 ); + } + xPtr->sig.v64 = sigX64; + noIncrement: + xPtr->sig.v0 = sigX0; + } + +} + +static void ui32ToFloatX( uint_fast32_t a, struct floatX *xPtr ) +{ + uint_fast64_t sig64; + int_fast32_t exp; + + xPtr->isNaN = false; + xPtr->isInf = false; + xPtr->sign = false; + sig64 = a; + if ( a ) { + xPtr->isZero = false; + exp = 31; + sig64 <<= 24; + while ( sig64 < UINT64_C( 0x0080000000000000 ) ) { + --exp; + sig64 <<= 1; + } + xPtr->exp = exp; + } else { + xPtr->isZero = true; + } + xPtr->sig.v64 = sig64; + xPtr->sig.v0 = 0; + +} + +static +uint_fast32_t + floatXToUI32( + const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast8_t savedExceptionFlags; + struct floatX x; + int_fast32_t shiftDist; + uint_fast32_t z; + + if ( xPtr->isInf || xPtr->isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + return (xPtr->isInf && xPtr->sign) ? 0 : 0xFFFFFFFF; + } + if ( xPtr->isZero ) return 0; + savedExceptionFlags = slowfloat_exceptionFlags; + x = *xPtr; + shiftDist = 52 - x.exp; + if ( 56 < shiftDist ) { + x.sig.v64 = 0; + x.sig.v0 = 1; + } else { + while ( 0 < shiftDist ) { + x.sig = shortShiftRightJam128( x.sig, 1 ); + --shiftDist; + } + } + roundFloatXTo53( false, &x, roundingMode, exact ); + x.sig = shortShiftRightJam128( x.sig, 3 ); + z = x.sig.v64; + if ( (shiftDist < 0) || x.sig.v64>>32 || (x.sign && z) ) { + slowfloat_exceptionFlags = + savedExceptionFlags | softfloat_flag_invalid; + return x.sign ? 0 : 0xFFFFFFFF; + } + return z; + +} + +static void ui64ToFloatX( uint_fast64_t a, struct floatX *xPtr ) +{ + struct uint128 sig; + int_fast32_t exp; + + xPtr->isNaN = false; + xPtr->isInf = false; + xPtr->sign = false; + sig.v64 = 0; + sig.v0 = a; + if ( a ) { + xPtr->isZero = false; + exp = 63; + sig = shortShiftLeft128( sig, 56 ); + while ( sig.v64 < UINT64_C( 0x0080000000000000 ) ) { + --exp; + sig = shortShiftLeft128( sig, 1 ); + } + xPtr->exp = exp; + } else { + xPtr->isZero = true; + } + xPtr->sig = sig; + +} + +static +uint_fast64_t + floatXToUI64( + const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast8_t savedExceptionFlags; + struct floatX x; + int_fast32_t shiftDist; + uint_fast64_t z; + + if ( xPtr->isInf || xPtr->isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + return + (xPtr->isInf && xPtr->sign) ? 0 : UINT64_C( 0xFFFFFFFFFFFFFFFF ); + } + if ( xPtr->isZero ) return 0; + savedExceptionFlags = slowfloat_exceptionFlags; + x = *xPtr; + shiftDist = 112 - x.exp; + if ( 116 < shiftDist ) { + x.sig.v64 = 0; + x.sig.v0 = 1; + } else { + while ( 0 < shiftDist ) { + x.sig = shortShiftRightJam128( x.sig, 1 ); + --shiftDist; + } + } + roundFloatXTo113( false, &x, roundingMode, exact ); + x.sig = shortShiftRightJam128( x.sig, 7 ); + z = x.sig.v0; + if ( (shiftDist < 0) || x.sig.v64 || (x.sign && z) ) { + slowfloat_exceptionFlags = + savedExceptionFlags | softfloat_flag_invalid; + return x.sign ? 0 : UINT64_C( 0xFFFFFFFFFFFFFFFF ); + } + return z; + +} + +static void i32ToFloatX( int_fast32_t a, struct floatX *xPtr ) +{ + bool sign; + uint_fast64_t sig64; + int_fast32_t exp; + + xPtr->isNaN = false; + xPtr->isInf = false; + sign = (a < 0); + xPtr->sign = sign; + sig64 = sign ? -(uint64_t) a : a; + if ( a ) { + xPtr->isZero = false; + exp = 31; + sig64 <<= 24; + while ( sig64 < UINT64_C( 0x0080000000000000 ) ) { + --exp; + sig64 <<= 1; + } + xPtr->exp = exp; + } else { + xPtr->isZero = true; + } + xPtr->sig.v64 = sig64; + xPtr->sig.v0 = 0; + +} + +static +int_fast32_t + floatXToI32( + const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast8_t savedExceptionFlags; + struct floatX x; + int_fast32_t shiftDist; + union { uint32_t ui; int32_t i; } uZ; + + if ( xPtr->isInf || xPtr->isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + return (xPtr->isInf && xPtr->sign) ? -0x7FFFFFFF - 1 : 0x7FFFFFFF; + } + if ( xPtr->isZero ) return 0; + savedExceptionFlags = slowfloat_exceptionFlags; + x = *xPtr; + shiftDist = 52 - x.exp; + if ( 56 < shiftDist ) { + x.sig.v64 = 0; + x.sig.v0 = 1; + } else { + while ( 0 < shiftDist ) { + x.sig = shortShiftRightJam128( x.sig, 1 ); + --shiftDist; + } + } + roundFloatXTo53( false, &x, roundingMode, exact ); + x.sig = shortShiftRightJam128( x.sig, 3 ); + uZ.ui = x.sig.v64; + if ( x.sign ) uZ.ui = -uZ.ui; + if ( + (shiftDist < 0) || x.sig.v64>>32 + || ((uZ.i != 0) && (x.sign != (uZ.i < 0))) + ) { + slowfloat_exceptionFlags = + savedExceptionFlags | softfloat_flag_invalid; + return x.sign ? -0x7FFFFFFF - 1 : 0x7FFFFFFF; + } + return uZ.i; + +} + +static void i64ToFloatX( int_fast64_t a, struct floatX *xPtr ) +{ + bool sign; + struct uint128 sig; + int_fast32_t exp; + + xPtr->isNaN = false; + xPtr->isInf = false; + sign = (a < 0); + xPtr->sign = sign; + sig.v64 = 0; + sig.v0 = sign ? -(uint_fast64_t) a : a; + if ( a ) { + xPtr->isZero = false; + exp = 63; + sig = shortShiftLeft128( sig, 56 ); + while ( sig.v64 < UINT64_C( 0x0080000000000000 ) ) { + --exp; + sig = shortShiftLeft128( sig, 1 ); + } + xPtr->exp = exp; + } else { + xPtr->isZero = true; + } + xPtr->sig = sig; + +} + +static +int_fast64_t + floatXToI64( + const struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + uint_fast8_t savedExceptionFlags; + struct floatX x; + int_fast32_t shiftDist; + union { uint64_t ui; int64_t i; } uZ; + + if ( xPtr->isInf || xPtr->isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + return + (xPtr->isInf && xPtr->sign) ? -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1 + : INT64_C( 0x7FFFFFFFFFFFFFFF ); + } + if ( xPtr->isZero ) return 0; + savedExceptionFlags = slowfloat_exceptionFlags; + x = *xPtr; + shiftDist = 112 - x.exp; + if ( 116 < shiftDist ) { + x.sig.v64 = 0; + x.sig.v0 = 1; + } else { + while ( 0 < shiftDist ) { + x.sig = shortShiftRightJam128( x.sig, 1 ); + --shiftDist; + } + } + roundFloatXTo113( false, &x, roundingMode, exact ); + x.sig = shortShiftRightJam128( x.sig, 7 ); + uZ.ui = x.sig.v0; + if ( x.sign ) uZ.ui = -uZ.ui; + if ( + (shiftDist < 0) || x.sig.v64 || ((uZ.i != 0) && (x.sign != (uZ.i < 0))) + ) { + slowfloat_exceptionFlags = + savedExceptionFlags | softfloat_flag_invalid; + return + x.sign ? -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1 + : INT64_C( 0x7FFFFFFFFFFFFFFF ); + } + return uZ.i; + +} + +#ifdef FLOAT16 + +static void f16ToFloatX( float16_t a, struct floatX *xPtr ) +{ + union ui16_f16 uA; + uint_fast16_t uiA; + int_fast8_t exp; + uint_fast64_t sig64; + + uA.f = a; + uiA = uA.ui; + xPtr->isNaN = false; + xPtr->isInf = false; + xPtr->isZero = false; + xPtr->sign = ((uiA & 0x8000) != 0); + exp = uiA>>10 & 0x1F; + sig64 = uiA & 0x03FF; + sig64 <<= 45; + if ( exp == 0x1F ) { + if ( sig64 ) { + xPtr->isNaN = true; + } else { + xPtr->isInf = true; + } + } else if ( !exp ) { + if ( !sig64 ) { + xPtr->isZero = true; + } else { + exp = 1 - 0xF; + do { + --exp; + sig64 <<= 1; + } while ( sig64 < UINT64_C( 0x0080000000000000 ) ); + xPtr->exp = exp; + } + } else { + xPtr->exp = exp - 0xF; + sig64 |= UINT64_C( 0x0080000000000000 ); + } + xPtr->sig.v64 = sig64; + xPtr->sig.v0 = 0; + +} + +static float16_t floatXToF16( const struct floatX *xPtr ) +{ + uint_fast16_t uiZ; + struct floatX x, savedX; + bool isTiny; + int_fast32_t exp; + union ui16_f16 uZ; + + if ( xPtr->isNaN ) { + uiZ = 0xFFFF; + goto uiZ; + } + if ( xPtr->isInf ) { + uiZ = xPtr->sign ? 0xFC00 : 0x7C00; + goto uiZ; + } + if ( xPtr->isZero ) { + uiZ = xPtr->sign ? 0x8000 : 0; + goto uiZ; + } + x = *xPtr; + while ( UINT64_C( 0x0100000000000000 ) <= x.sig.v64 ) { + ++x.exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + while ( x.sig.v64 < UINT64_C( 0x0080000000000000 ) ) { + --x.exp; + x.sig = shortShiftLeft128( x.sig, 1 ); + } + savedX = x; + isTiny = + (slowfloat_detectTininess == softfloat_tininess_beforeRounding) + && (x.exp + 0xF <= 0); + roundFloatXTo11( isTiny, &x, slowfloat_roundingMode, true ); + exp = x.exp + 0xF; + if ( 0x1F <= exp ) { + slowfloat_exceptionFlags |= + softfloat_flag_overflow | softfloat_flag_inexact; + if ( x.sign ) { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_min: + case softfloat_round_near_maxMag: + uiZ = 0xFC00; + break; + case softfloat_round_minMag: + case softfloat_round_max: + case softfloat_round_odd: + uiZ = 0xFBFF; + break; + } + } else { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_max: + case softfloat_round_near_maxMag: + uiZ = 0x7C00; + break; + case softfloat_round_minMag: + case softfloat_round_min: + case softfloat_round_odd: + uiZ = 0x7BFF; + break; + } + } + goto uiZ; + } + if ( exp <= 0 ) { + isTiny = true; + x = savedX; + exp = x.exp + 0xF; + if ( exp < -14 ) { + x.sig.v0 = (x.sig.v64 != 0) || (x.sig.v0 != 0); + x.sig.v64 = 0; + } else { + while ( exp <= 0 ) { + ++exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + } + roundFloatXTo11( isTiny, &x, slowfloat_roundingMode, true ); + exp = (UINT64_C( 0x0080000000000000 ) <= x.sig.v64) ? 1 : 0; + } + uiZ = (uint_fast16_t) exp<<10; + if ( x.sign ) uiZ |= 0x8000; + uiZ |= x.sig.v64>>45 & 0x03FF; + uiZ: + uZ.ui = uiZ; + return uZ.f; + +} + +#endif + +static void f32ToFloatX( float32_t a, struct floatX *xPtr ) +{ + union ui32_f32 uA; + uint_fast32_t uiA; + int_fast16_t exp; + uint_fast64_t sig64; + + uA.f = a; + uiA = uA.ui; + xPtr->isNaN = false; + xPtr->isInf = false; + xPtr->isZero = false; + xPtr->sign = ((uiA & 0x80000000) != 0); + exp = uiA>>23 & 0xFF; + sig64 = uiA & 0x007FFFFF; + sig64 <<= 32; + if ( exp == 0xFF ) { + if ( sig64 ) { + xPtr->isNaN = true; + } else { + xPtr->isInf = true; + } + } else if ( !exp ) { + if ( !sig64 ) { + xPtr->isZero = true; + } else { + exp = 1 - 0x7F; + do { + --exp; + sig64 <<= 1; + } while ( sig64 < UINT64_C( 0x0080000000000000 ) ); + xPtr->exp = exp; + } + } else { + xPtr->exp = exp - 0x7F; + sig64 |= UINT64_C( 0x0080000000000000 ); + } + xPtr->sig.v64 = sig64; + xPtr->sig.v0 = 0; + +} + +static float32_t floatXToF32( const struct floatX *xPtr ) +{ + uint_fast32_t uiZ; + struct floatX x, savedX; + bool isTiny; + int_fast32_t exp; + union ui32_f32 uZ; + + if ( xPtr->isNaN ) { + uiZ = 0xFFFFFFFF; + goto uiZ; + } + if ( xPtr->isInf ) { + uiZ = xPtr->sign ? 0xFF800000 : 0x7F800000; + goto uiZ; + } + if ( xPtr->isZero ) { + uiZ = xPtr->sign ? 0x80000000 : 0; + goto uiZ; + } + x = *xPtr; + while ( UINT64_C( 0x0100000000000000 ) <= x.sig.v64 ) { + ++x.exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + while ( x.sig.v64 < UINT64_C( 0x0080000000000000 ) ) { + --x.exp; + x.sig = shortShiftLeft128( x.sig, 1 ); + } + savedX = x; + isTiny = + (slowfloat_detectTininess == softfloat_tininess_beforeRounding) + && (x.exp + 0x7F <= 0); + roundFloatXTo24( isTiny, &x, slowfloat_roundingMode, true ); + exp = x.exp + 0x7F; + if ( 0xFF <= exp ) { + slowfloat_exceptionFlags |= + softfloat_flag_overflow | softfloat_flag_inexact; + if ( x.sign ) { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_min: + case softfloat_round_near_maxMag: + uiZ = 0xFF800000; + break; + case softfloat_round_minMag: + case softfloat_round_max: + case softfloat_round_odd: + uiZ = 0xFF7FFFFF; + break; + } + } else { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_max: + case softfloat_round_near_maxMag: + uiZ = 0x7F800000; + break; + case softfloat_round_minMag: + case softfloat_round_min: + case softfloat_round_odd: + uiZ = 0x7F7FFFFF; + break; + } + } + goto uiZ; + } + if ( exp <= 0 ) { + isTiny = true; + x = savedX; + exp = x.exp + 0x7F; + if ( exp < -27 ) { + x.sig.v0 = (x.sig.v64 != 0) || (x.sig.v0 != 0); + x.sig.v64 = 0; + } else { + while ( exp <= 0 ) { + ++exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + } + roundFloatXTo24( isTiny, &x, slowfloat_roundingMode, true ); + exp = (UINT64_C( 0x0080000000000000 ) <= x.sig.v64) ? 1 : 0; + } + uiZ = (uint_fast32_t) exp<<23; + if ( x.sign ) uiZ |= 0x80000000; + uiZ |= x.sig.v64>>32 & 0x007FFFFF; + uiZ: + uZ.ui = uiZ; + return uZ.f; + +} + +#ifdef FLOAT64 + +static void f64ToFloatX( float64_t a, struct floatX *xPtr ) +{ + union ui64_f64 uA; + uint_fast64_t uiA; + int_fast16_t exp; + uint_fast64_t sig64; + + uA.f = a; + uiA = uA.ui; + xPtr->isNaN = false; + xPtr->isInf = false; + xPtr->isZero = false; + xPtr->sign = ((uiA & UINT64_C( 0x8000000000000000 )) != 0); + exp = uiA>>52 & 0x7FF; + sig64 = uiA & UINT64_C( 0x000FFFFFFFFFFFFF ); + if ( exp == 0x7FF ) { + if ( sig64 ) { + xPtr->isNaN = true; + } else { + xPtr->isInf = true; + } + } else if ( !exp ) { + if ( !sig64 ) { + xPtr->isZero = true; + } else { + exp = 1 - 0x3FF; + do { + --exp; + sig64 <<= 1; + } while ( sig64 < UINT64_C( 0x0010000000000000 ) ); + xPtr->exp = exp; + } + } else { + xPtr->exp = exp - 0x3FF; + sig64 |= UINT64_C( 0x0010000000000000 ); + } + xPtr->sig.v64 = sig64<<3; + xPtr->sig.v0 = 0; + +} + +static float64_t floatXToF64( const struct floatX *xPtr ) +{ + uint_fast64_t uiZ; + struct floatX x, savedX; + bool isTiny; + int_fast32_t exp; + union ui64_f64 uZ; + + if ( xPtr->isNaN ) { + uiZ = UINT64_C( 0xFFFFFFFFFFFFFFFF ); + goto uiZ; + } + if ( xPtr->isInf ) { + uiZ = + xPtr->sign ? UINT64_C( 0xFFF0000000000000 ) + : UINT64_C( 0x7FF0000000000000 ); + goto uiZ; + } + if ( xPtr->isZero ) { + uiZ = xPtr->sign ? UINT64_C( 0x8000000000000000 ) : 0; + goto uiZ; + } + x = *xPtr; + while ( UINT64_C( 0x0100000000000000 ) <= x.sig.v64 ) { + ++x.exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + while ( x.sig.v64 < UINT64_C( 0x0080000000000000 ) ) { + --x.exp; + x.sig = shortShiftLeft128( x.sig, 1 ); + } + savedX = x; + isTiny = + (slowfloat_detectTininess == softfloat_tininess_beforeRounding) + && (x.exp + 0x3FF <= 0); + roundFloatXTo53( isTiny, &x, slowfloat_roundingMode, true ); + exp = x.exp + 0x3FF; + if ( 0x7FF <= exp ) { + slowfloat_exceptionFlags |= + softfloat_flag_overflow | softfloat_flag_inexact; + if ( x.sign ) { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_min: + case softfloat_round_near_maxMag: + uiZ = UINT64_C( 0xFFF0000000000000 ); + break; + case softfloat_round_minMag: + case softfloat_round_max: + case softfloat_round_odd: + uiZ = UINT64_C( 0xFFEFFFFFFFFFFFFF ); + break; + } + } else { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_max: + case softfloat_round_near_maxMag: + uiZ = UINT64_C( 0x7FF0000000000000 ); + break; + case softfloat_round_minMag: + case softfloat_round_min: + case softfloat_round_odd: + uiZ = UINT64_C( 0x7FEFFFFFFFFFFFFF ); + break; + } + } + goto uiZ; + } + if ( exp <= 0 ) { + isTiny = true; + x = savedX; + exp = x.exp + 0x3FF; + if ( exp < -56 ) { + x.sig.v0 = (x.sig.v64 != 0) || (x.sig.v0 != 0); + x.sig.v64 = 0; + } else { + while ( exp <= 0 ) { + ++exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + } + roundFloatXTo53( isTiny, &x, slowfloat_roundingMode, true ); + exp = (UINT64_C( 0x0080000000000000 ) <= x.sig.v64) ? 1 : 0; + } + uiZ = (uint_fast64_t) exp<<52; + if ( x.sign ) uiZ |= UINT64_C( 0x8000000000000000 ); + uiZ |= x.sig.v64>>3 & UINT64_C( 0x000FFFFFFFFFFFFF ); + uiZ: + uZ.ui = uiZ; + return uZ.f; + +} + +#endif + +#ifdef EXTFLOAT80 + +static void extF80MToFloatX( const extFloat80_t *aPtr, struct floatX *xPtr ) +{ + const struct extFloat80M *aSPtr; + uint_fast16_t uiA64; + int_fast32_t exp; + struct uint128 sig; + + aSPtr = (const struct extFloat80M *) aPtr; + xPtr->isNaN = false; + xPtr->isInf = false; + xPtr->isZero = false; + uiA64 = aSPtr->signExp; + xPtr->sign = ((uiA64 & 0x8000) != 0); + exp = uiA64 & 0x7FFF; + sig.v64 = 0; + sig.v0 = aSPtr->signif; + if ( exp == 0x7FFF ) { + if ( sig.v0 & UINT64_C( 0x7FFFFFFFFFFFFFFF ) ) { + xPtr->isNaN = true; + } else { + xPtr->isInf = true; + } + } else { + if ( !exp ) ++exp; + exp -= 0x3FFF; + if ( !(sig.v0 & UINT64_C( 0x8000000000000000 )) ) { + if ( !sig.v0 ) { + xPtr->isZero = true; + } else { + do { + --exp; + sig.v0 <<= 1; + } while ( sig.v0 < UINT64_C( 0x8000000000000000 ) ); + } + } + xPtr->exp = exp; + } + xPtr->sig = shortShiftLeft128( sig, 56 ); + +} + +static void floatXToExtF80M( const struct floatX *xPtr, extFloat80_t *zPtr ) +{ + struct extFloat80M *zSPtr; + struct floatX x, savedX; + bool isTiny; + int_fast32_t exp; + uint_fast64_t uiZ0; + uint_fast16_t uiZ64; + + zSPtr = (struct extFloat80M *) zPtr; + if ( xPtr->isNaN ) { + zSPtr->signExp = 0xFFFF; + zSPtr->signif = UINT64_C( 0xFFFFFFFFFFFFFFFF ); + return; + } + if ( xPtr->isInf ) { + zSPtr->signExp = xPtr->sign ? 0xFFFF : 0x7FFF; + zSPtr->signif = UINT64_C( 0x8000000000000000 ); + return; + } + if ( xPtr->isZero ) { + zSPtr->signExp = xPtr->sign ? 0x8000 : 0; + zSPtr->signif = 0; + return; + } + x = *xPtr; + while ( UINT64_C( 0x0100000000000000 ) <= x.sig.v64 ) { + ++x.exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + while ( x.sig.v64 < UINT64_C( 0x0080000000000000 ) ) { + --x.exp; + x.sig = shortShiftLeft128( x.sig, 1 ); + } + savedX = x; + isTiny = + (slowfloat_detectTininess == softfloat_tininess_beforeRounding) + && (x.exp + 0x3FFF <= 0); + switch ( slow_extF80_roundingPrecision ) { + case 32: + roundFloatXTo24( isTiny, &x, slowfloat_roundingMode, true ); + break; + case 64: + roundFloatXTo53( isTiny, &x, slowfloat_roundingMode, true ); + break; + default: + roundFloatXTo64( isTiny, &x, slowfloat_roundingMode, true ); + break; + } + exp = x.exp + 0x3FFF; + if ( 0x7FFF <= exp ) { + slowfloat_exceptionFlags |= + softfloat_flag_overflow | softfloat_flag_inexact; + if ( x.sign ) { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_min: + case softfloat_round_near_maxMag: + zSPtr->signExp = 0xFFFF; + zSPtr->signif = UINT64_C( 0x8000000000000000 ); + break; + case softfloat_round_minMag: + case softfloat_round_max: + case softfloat_round_odd: + switch ( slow_extF80_roundingPrecision ) { + case 32: + uiZ0 = UINT64_C( 0xFFFFFF0000000000 ); + break; + case 64: + uiZ0 = UINT64_C( 0xFFFFFFFFFFFFF800 ); + break; + default: + uiZ0 = UINT64_C( 0xFFFFFFFFFFFFFFFF ); + break; + } + zSPtr->signExp = 0xFFFE; + zSPtr->signif = uiZ0; + break; + } + } else { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_max: + case softfloat_round_near_maxMag: + zSPtr->signExp = 0x7FFF; + zSPtr->signif = UINT64_C( 0x8000000000000000 ); + break; + case softfloat_round_minMag: + case softfloat_round_min: + case softfloat_round_odd: + switch ( slow_extF80_roundingPrecision ) { + case 32: + uiZ0 = UINT64_C( 0xFFFFFF0000000000 ); + break; + case 64: + uiZ0 = UINT64_C( 0xFFFFFFFFFFFFF800 ); + break; + default: + uiZ0 = UINT64_C( 0xFFFFFFFFFFFFFFFF ); + break; + } + zSPtr->signExp = 0x7FFE; + zSPtr->signif = uiZ0; + break; + } + } + return; + } + if ( exp <= 0 ) { + isTiny = true; + x = savedX; + exp = x.exp + 0x3FFF; + if ( exp < -70 ) { + x.sig.v0 = (x.sig.v64 != 0) || (x.sig.v0 != 0); + x.sig.v64 = 0; + } else { + while ( exp <= 0 ) { + ++exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + } + switch ( slow_extF80_roundingPrecision ) { + case 32: + roundFloatXTo24( isTiny, &x, slowfloat_roundingMode, true ); + break; + case 64: + roundFloatXTo53( isTiny, &x, slowfloat_roundingMode, true ); + break; + default: + roundFloatXTo64( isTiny, &x, slowfloat_roundingMode, true ); + break; + } + exp = (UINT64_C( 0x0080000000000000 ) <= x.sig.v64) ? 1 : 0; + } + uiZ64 = exp; + if ( x.sign ) uiZ64 |= 0x8000; + zSPtr->signExp = uiZ64; + zSPtr->signif = shortShiftRightJam128( x.sig, 56 ).v0; + +} + +#endif + +#ifdef FLOAT128 + +static void f128MToFloatX( const float128_t *aPtr, struct floatX *xPtr ) +{ + const struct uint128 *uiAPtr; + uint_fast64_t uiA64; + int_fast32_t exp; + struct uint128 sig; + + uiAPtr = (const struct uint128 *) aPtr; + xPtr->isNaN = false; + xPtr->isInf = false; + xPtr->isZero = false; + uiA64 = uiAPtr->v64; + xPtr->sign = ((uiA64 & UINT64_C( 0x8000000000000000 )) != 0); + exp = uiA64>>48 & 0x7FFF; + sig.v64 = uiA64 & UINT64_C( 0x0000FFFFFFFFFFFF ); + sig.v0 = uiAPtr->v0; + if ( exp == 0x7FFF ) { + if ( sig.v64 || sig.v0 ) { + xPtr->isNaN = true; + } else { + xPtr->isInf = true; + } + } else if ( !exp ) { + if ( !sig.v64 && !sig.v0 ) { + xPtr->isZero = true; + } else { + exp = 1 - 0x3FFF; + do { + --exp; + sig = shortShiftLeft128( sig, 1 ); + } while ( sig.v64 < UINT64_C( 0x0001000000000000 ) ); + xPtr->exp = exp; + } + } else { + xPtr->exp = exp - 0x3FFF; + sig.v64 |= UINT64_C( 0x0001000000000000 ); + } + xPtr->sig = shortShiftLeft128( sig, 7 ); + +} + +static void floatXToF128M( const struct floatX *xPtr, float128_t *zPtr ) +{ + struct uint128 *uiZPtr; + struct floatX x, savedX; + bool isTiny; + int_fast32_t exp; + uint_fast64_t uiZ64; + + uiZPtr = (struct uint128 *) zPtr; + if ( xPtr->isNaN ) { + uiZPtr->v64 = uiZPtr->v0 = UINT64_C( 0xFFFFFFFFFFFFFFFF ); + return; + } + if ( xPtr->isInf ) { + uiZPtr->v64 = + xPtr->sign ? UINT64_C( 0xFFFF000000000000 ) + : UINT64_C( 0x7FFF000000000000 ); + uiZPtr->v0 = 0; + return; + } + if ( xPtr->isZero ) { + uiZPtr->v64 = xPtr->sign ? UINT64_C( 0x8000000000000000 ) : 0; + uiZPtr->v0 = 0; + return; + } + x = *xPtr; + while ( UINT64_C( 0x0100000000000000 ) <= x.sig.v64 ) { + ++x.exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + while ( x.sig.v64 < UINT64_C( 0x0080000000000000 ) ) { + --x.exp; + x.sig = shortShiftLeft128( x.sig, 1 ); + } + savedX = x; + isTiny = + (slowfloat_detectTininess == softfloat_tininess_beforeRounding) + && (x.exp + 0x3FFF <= 0); + roundFloatXTo113( isTiny, &x, slowfloat_roundingMode, true ); + exp = x.exp + 0x3FFF; + if ( 0x7FFF <= exp ) { + slowfloat_exceptionFlags |= + softfloat_flag_overflow | softfloat_flag_inexact; + if ( x.sign ) { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_min: + case softfloat_round_near_maxMag: + uiZPtr->v64 = UINT64_C( 0xFFFF000000000000 ); + uiZPtr->v0 = 0; + break; + case softfloat_round_minMag: + case softfloat_round_max: + case softfloat_round_odd: + uiZPtr->v64 = UINT64_C( 0xFFFEFFFFFFFFFFFF ); + uiZPtr->v0 = UINT64_C( 0xFFFFFFFFFFFFFFFF ); + break; + } + } else { + switch ( slowfloat_roundingMode ) { + case softfloat_round_near_even: + case softfloat_round_max: + case softfloat_round_near_maxMag: + uiZPtr->v64 = UINT64_C( 0x7FFF000000000000 ); + uiZPtr->v0 = 0; + break; + case softfloat_round_minMag: + case softfloat_round_min: + case softfloat_round_odd: + uiZPtr->v64 = UINT64_C( 0x7FFEFFFFFFFFFFFF ); + uiZPtr->v0 = UINT64_C( 0xFFFFFFFFFFFFFFFF ); + break; + } + } + return; + } + if ( exp <= 0 ) { + isTiny = true; + x = savedX; + exp = x.exp + 0x3FFF; + if ( exp < -120 ) { + x.sig.v0 = (x.sig.v64 != 0) || (x.sig.v0 != 0); + x.sig.v64 = 0; + } else { + while ( exp <= 0 ) { + ++exp; + x.sig = shortShiftRightJam128( x.sig, 1 ); + } + } + roundFloatXTo113( isTiny, &x, slowfloat_roundingMode, true ); + exp = (UINT64_C( 0x0080000000000000 ) <= x.sig.v64) ? 1 : 0; + } + uiZ64 = (uint_fast64_t) exp<<48; + if ( x.sign ) uiZ64 |= UINT64_C( 0x8000000000000000 ); + x.sig = shortShiftRightJam128( x.sig, 7 ); + uiZPtr->v64 = uiZ64 | (x.sig.v64 & UINT64_C( 0x0000FFFFFFFFFFFF )); + uiZPtr->v0 = x.sig.v0; + +} + +#endif + +static void floatXInvalid( struct floatX *xPtr ) +{ + + slowfloat_exceptionFlags |= softfloat_flag_invalid; + *xPtr = floatXNaN; + +} + +static +void + floatXRoundToInt( struct floatX *xPtr, uint_fast8_t roundingMode, bool exact ) +{ + int_fast32_t exp, shiftDist; + struct uint128 sig; + + if ( xPtr->isNaN || xPtr->isInf ) return; + exp = xPtr->exp; + shiftDist = 112 - exp; + if ( shiftDist <= 0 ) return; + if ( 119 < shiftDist ) { + xPtr->exp = 112; + xPtr->sig.v64 = 0; + xPtr->sig.v0 = !xPtr->isZero; + } else { + sig = xPtr->sig; + while ( 0 < shiftDist ) { + ++exp; + sig = shortShiftRightJam128( sig, 1 ); + --shiftDist; + } + xPtr->exp = exp; + xPtr->sig = sig; + } + roundFloatXTo113( false, xPtr, roundingMode, exact ); + if ( !xPtr->sig.v64 && !xPtr->sig.v0 ) xPtr->isZero = true; + +} + +static void floatXAdd( struct floatX *xPtr, const struct floatX *yPtr ) +{ + int_fast32_t expX, expY, expDiff; + struct uint128 sigY; + + if ( xPtr->isNaN ) return; + if ( yPtr->isNaN ) goto copyY; + if ( xPtr->isInf && yPtr->isInf ) { + if ( xPtr->sign != yPtr->sign ) floatXInvalid( xPtr ); + return; + } + if ( xPtr->isInf ) return; + if ( yPtr->isInf ) goto copyY; + if ( xPtr->isZero && yPtr->isZero ) { + if ( xPtr->sign == yPtr->sign ) return; + goto completeCancellation; + } + expX = xPtr->exp; + expY = yPtr->exp; + if ( + (xPtr->sign != yPtr->sign) && (expX == expY) + && eq128( xPtr->sig, yPtr->sig ) + ) { + completeCancellation: + if (slowfloat_roundingMode == softfloat_round_min) { + *xPtr = floatXNegativeZero; + } else { + *xPtr = floatXPositiveZero; + } + return; + } + if ( xPtr->isZero ) goto copyY; + if ( yPtr->isZero ) return; + expDiff = expX - expY; + if ( expDiff < 0 ) { + xPtr->exp = expY; + if ( expDiff < -120 ) { + xPtr->sig.v64 = 0; + xPtr->sig.v0 = 1; + } else { + while ( expDiff < 0 ) { + ++expDiff; + xPtr->sig = shortShiftRightJam128( xPtr->sig, 1 ); + } + } + if ( xPtr->sign != yPtr->sign ) xPtr->sig = neg128( xPtr->sig ); + xPtr->sign = yPtr->sign; + xPtr->sig = add128( xPtr->sig, yPtr->sig ); + } else { + sigY = yPtr->sig; + if ( 120 < expDiff ) { + sigY.v64 = 0; + sigY.v0 = 1; + } else { + while ( 0 < expDiff ) { + --expDiff; + sigY = shortShiftRightJam128( sigY, 1 ); + } + } + if ( xPtr->sign != yPtr->sign ) sigY = neg128( sigY ); + xPtr->sig = add128( xPtr->sig, sigY ); + } + if ( xPtr->sig.v64 & UINT64_C( 0x8000000000000000 ) ) { + xPtr->sign = !xPtr->sign; + xPtr->sig = neg128( xPtr->sig ); + } + return; + copyY: + *xPtr = *yPtr; + +} + +static void floatXMul( struct floatX *xPtr, const struct floatX *yPtr ) +{ + struct uint128 sig; + int bitNum; + + if ( xPtr->isNaN ) return; + if ( yPtr->isNaN ) { + xPtr->isNaN = true; + xPtr->isInf = false; + xPtr->isZero = false; + xPtr->sign = yPtr->sign; + return; + } + if ( yPtr->sign ) xPtr->sign = !xPtr->sign; + if ( xPtr->isInf ) { + if ( yPtr->isZero ) floatXInvalid( xPtr ); + return; + } + if ( yPtr->isInf ) { + if ( xPtr->isZero ) { + floatXInvalid( xPtr ); + return; + } + xPtr->isInf = true; + return; + } + if ( xPtr->isZero || yPtr->isZero ) { + if ( xPtr->sign ) { + *xPtr = floatXNegativeZero; + } else { + *xPtr = floatXPositiveZero; + } + return; + } + xPtr->exp += yPtr->exp; + sig.v64 = 0; + sig.v0 = 0; + for ( bitNum = 0; bitNum < 120; ++bitNum ) { + sig = shortShiftRightJam128( sig, 1 ); + if ( xPtr->sig.v0 & 1 ) sig = add128( sig, yPtr->sig ); + xPtr->sig = shortShiftRight128( xPtr->sig, 1 ); + } + if ( UINT64_C( 0x0100000000000000 ) <= sig.v64 ) { + ++xPtr->exp; + sig = shortShiftRightJam128( sig, 1 ); + } + xPtr->sig = sig; + +} + +static void floatXDiv( struct floatX *xPtr, const struct floatX *yPtr ) +{ + struct uint128 sig, negSigY; + int bitNum; + + if ( xPtr->isNaN ) return; + if ( yPtr->isNaN ) { + xPtr->isNaN = true; + xPtr->isInf = false; + xPtr->isZero = false; + xPtr->sign = yPtr->sign; + return; + } + if ( yPtr->sign ) xPtr->sign = !xPtr->sign; + if ( xPtr->isInf ) { + if ( yPtr->isInf ) floatXInvalid( xPtr ); + return; + } + if ( yPtr->isZero ) { + if ( xPtr->isZero ) { + floatXInvalid( xPtr ); + return; + } + slowfloat_exceptionFlags |= softfloat_flag_infinite; + xPtr->isInf = true; + return; + } + if ( xPtr->isZero || yPtr->isInf ) { + if ( xPtr->sign ) { + *xPtr = floatXNegativeZero; + } else { + *xPtr = floatXPositiveZero; + } + return; + } + xPtr->exp -= yPtr->exp + 1; + sig.v64 = 0; + sig.v0 = 0; + negSigY = neg128( yPtr->sig ); + for ( bitNum = 0; bitNum < 120; ++bitNum ) { + if ( le128( yPtr->sig, xPtr->sig ) ) { + sig.v0 |= 1; + xPtr->sig = add128( xPtr->sig, negSigY ); + } + xPtr->sig = shortShiftLeft128( xPtr->sig, 1 ); + sig = shortShiftLeft128( sig, 1 ); + } + if ( xPtr->sig.v64 || xPtr->sig.v0 ) sig.v0 |= 1; + xPtr->sig = sig; + +} + +static void floatXRem( struct floatX *xPtr, const struct floatX *yPtr ) +{ + int_fast32_t expX, expY; + struct uint128 sigY, negSigY; + bool lastQuotientBit; + struct uint128 savedSigX; + + if ( xPtr->isNaN ) return; + if ( yPtr->isNaN ) { + xPtr->isNaN = true; + xPtr->isInf = false; + xPtr->isZero = false; + xPtr->sign = yPtr->sign; + return; + } + if ( xPtr->isInf || yPtr->isZero ) { + floatXInvalid( xPtr ); + return; + } + if ( xPtr->isZero || yPtr->isInf ) return; + expX = xPtr->exp; + expY = yPtr->exp - 1; + if ( expX < expY ) return; + sigY = shortShiftLeft128( yPtr->sig, 1 ); + negSigY = neg128( sigY ); + while ( expY < expX ) { + --expX; + if ( le128( sigY, xPtr->sig ) ) { + xPtr->sig = add128( xPtr->sig, negSigY ); + } + xPtr->sig = shortShiftLeft128( xPtr->sig, 1 ); + } + xPtr->exp = expX; + lastQuotientBit = le128( sigY, xPtr->sig ); + if ( lastQuotientBit ) xPtr->sig = add128( xPtr->sig, negSigY ); + savedSigX = xPtr->sig; + xPtr->sig = neg128( add128( xPtr->sig, negSigY ) ); + if ( lt128( xPtr->sig, savedSigX ) ) { + xPtr->sign = !xPtr->sign; + } else if ( lt128( savedSigX, xPtr->sig ) ) { + goto restoreSavedSigX; + } else { + if ( lastQuotientBit ) { + xPtr->sign = !xPtr->sign; + } else { + restoreSavedSigX: + xPtr->sig = savedSigX; + } + } + if ( !xPtr->sig.v64 && !xPtr->sig.v0 ) xPtr->isZero = true; + +} + +static void floatXSqrt( struct floatX *xPtr ) +{ + struct uint128 sig, bitSig; + int bitNum; + struct uint128 savedSigX; + + if ( xPtr->isNaN || xPtr->isZero ) return; + if ( xPtr->sign ) { + floatXInvalid( xPtr ); + return; + } + if ( xPtr->isInf ) return; + if ( !(xPtr->exp & 1) ) xPtr->sig = shortShiftRightJam128( xPtr->sig, 1 ); + xPtr->exp >>= 1; + sig.v64 = 0; + sig.v0 = 0; + bitSig.v64 = UINT64_C( 0x0080000000000000 ); + bitSig.v0 = 0; + for ( bitNum = 0; bitNum < 120; ++bitNum ) { + savedSigX = xPtr->sig; + xPtr->sig = add128( xPtr->sig, neg128( sig ) ); + xPtr->sig = shortShiftLeft128( xPtr->sig, 1 ); + xPtr->sig = add128( xPtr->sig, neg128( bitSig ) ); + if ( xPtr->sig.v64 & UINT64_C( 0x8000000000000000 ) ) { + xPtr->sig = shortShiftLeft128( savedSigX, 1 ); + } else { + sig.v64 |= bitSig.v64; + sig.v0 |= bitSig.v0; + } + bitSig = shortShiftRightJam128( bitSig, 1 ); + } + if ( xPtr->sig.v64 || xPtr->sig.v0 ) sig.v0 |= 1; + xPtr->sig = sig; + +} + +static bool floatXEq( const struct floatX *xPtr, const struct floatX *yPtr ) +{ + + if ( xPtr->isNaN || yPtr->isNaN ) return false; + if ( xPtr->isZero && yPtr->isZero ) return true; + if ( xPtr->sign != yPtr->sign ) return false; + if ( xPtr->isInf || yPtr->isInf ) return xPtr->isInf && yPtr->isInf; + return ( xPtr->exp == yPtr->exp ) && eq128( xPtr->sig, yPtr->sig ); + +} + +static bool floatXLe( const struct floatX *xPtr, const struct floatX *yPtr ) +{ + + if ( xPtr->isNaN || yPtr->isNaN ) return false; + if ( xPtr->isZero && yPtr->isZero ) return true; + if ( xPtr->sign != yPtr->sign ) return xPtr->sign; + if ( xPtr->sign ) { + if ( xPtr->isInf || yPtr->isZero ) return true; + if ( yPtr->isInf || xPtr->isZero ) return false; + if ( yPtr->exp < xPtr->exp ) return true; + if ( xPtr->exp < yPtr->exp ) return false; + return le128( yPtr->sig, xPtr->sig ); + } else { + if ( yPtr->isInf || xPtr->isZero ) return true; + if ( xPtr->isInf || yPtr->isZero ) return false; + if ( xPtr->exp < yPtr->exp ) return true; + if ( yPtr->exp < xPtr->exp ) return false; + return le128( xPtr->sig, yPtr->sig ); + } + +} + +static bool floatXLt( const struct floatX *xPtr, const struct floatX *yPtr ) +{ + + if ( xPtr->isNaN || yPtr->isNaN ) return false; + if ( xPtr->isZero && yPtr->isZero ) return false; + if ( xPtr->sign != yPtr->sign ) return xPtr->sign; + if ( xPtr->isInf && yPtr->isInf ) return false; + if ( xPtr->sign ) { + if ( xPtr->isInf || yPtr->isZero ) return true; + if ( yPtr->isInf || xPtr->isZero ) return false; + if ( yPtr->exp < xPtr->exp ) return true; + if ( xPtr->exp < yPtr->exp ) return false; + return lt128( yPtr->sig, xPtr->sig ); + } else { + if ( yPtr->isInf || xPtr->isZero ) return true; + if ( xPtr->isInf || yPtr->isZero ) return false; + if ( xPtr->exp < yPtr->exp ) return true; + if ( yPtr->exp < xPtr->exp ) return false; + return lt128( xPtr->sig, yPtr->sig ); + } + +} + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#if defined EXTFLOAT80 || defined FLOAT128 + +#ifdef LITTLEENDIAN +struct uint256 { uint64_t v0, v64, v128, v192; }; +#else +struct uint256 { uint64_t v192, v128, v64, v0; }; +#endif + +static bool eq256M( const struct uint256 *aPtr, const struct uint256 *bPtr ) +{ + + return + (aPtr->v192 == bPtr->v192) && (aPtr->v128 == bPtr->v128) + && (aPtr->v64 == bPtr->v64) && (aPtr->v0 == bPtr->v0); + +} + +static void shiftLeft1256M( struct uint256 *ptr ) +{ + uint64_t dword1, dword2; + + dword1 = ptr->v128; + ptr->v192 = ptr->v192<<1 | dword1>>63; + dword2 = ptr->v64; + ptr->v128 = dword1<<1 | dword2>>63; + dword1 = ptr->v0; + ptr->v64 = dword2<<1 | dword1>>63; + ptr->v0 = dword1<<1; + +} + +static void shiftRight1256M( struct uint256 *ptr ) +{ + uint64_t dword1, dword2; + + dword1 = ptr->v64; + ptr->v0 = dword1<<63 | ptr->v0>>1; + dword2 = ptr->v128; + ptr->v64 = dword2<<63 | dword1>>1; + dword1 = ptr->v192; + ptr->v128 = dword1<<63 | dword2>>1; + ptr->v192 = dword1>>1; + +} + +static void shiftRight1Jam256M( struct uint256 *ptr ) +{ + int extra; + + extra = ptr->v0 & 1; + shiftRight1256M( ptr ); + ptr->v0 |= extra; + +} + +static void neg256M( struct uint256 *ptr ) +{ + uint64_t v64, v0, v128; + + v64 = ptr->v64; + v0 = ptr->v0; + if ( v64 | v0 ) { + ptr->v192 = ~ptr->v192; + ptr->v128 = ~ptr->v128; + if ( v0 ) { + ptr->v64 = ~v64; + ptr->v0 = -v0; + } else { + ptr->v64 = -v64; + } + } else { + v128 = ptr->v128; + if ( v128 ) { + ptr->v192 = ~ptr->v192; + ptr->v128 = -v128; + } else { + ptr->v192 = -ptr->v192; + } + } + +} + +static void add256M( struct uint256 *aPtr, const struct uint256 *bPtr ) +{ + uint64_t dwordA, dwordZ; + unsigned int carry1, carry2; + + dwordA = aPtr->v0; + dwordZ = dwordA + bPtr->v0; + carry1 = (dwordZ < dwordA); + aPtr->v0 = dwordZ; + dwordA = aPtr->v64; + dwordZ = dwordA + bPtr->v64; + carry2 = (dwordZ < dwordA); + dwordZ += carry1; + carry2 += (dwordZ < carry1); + aPtr->v64 = dwordZ; + dwordA = aPtr->v128; + dwordZ = dwordA + bPtr->v128; + carry1 = (dwordZ < dwordA); + dwordZ += carry2; + carry1 += (dwordZ < carry2); + aPtr->v128 = dwordZ; + aPtr->v192 = aPtr->v192 + bPtr->v192 + carry1; + +} + +struct floatX256 { + bool isNaN; + bool isInf; + bool isZero; + bool sign; + int_fast32_t exp; + struct uint256 sig; +}; + +static const struct floatX256 floatX256NaN = + { true, false, false, false, 0, { 0, 0, 0, 0 } }; +static const struct floatX256 floatX256PositiveZero = + { false, false, true, false, 0, { 0, 0, 0, 0 } }; +static const struct floatX256 floatX256NegativeZero = + { false, false, true, true, 0, { 0, 0, 0, 0 } }; + +#ifdef FLOAT128 + +static void f128MToFloatX256( const float128_t *aPtr, struct floatX256 *xPtr ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + xPtr->isNaN = x.isNaN; + xPtr->isInf = x.isInf; + xPtr->isZero = x.isZero; + xPtr->sign = x.sign; + xPtr->exp = x.exp; + xPtr->sig.v192 = x.sig.v64; + xPtr->sig.v128 = x.sig.v0; + xPtr->sig.v64 = 0; + xPtr->sig.v0 = 0; + +} + +static void floatX256ToF128M( const struct floatX256 *xPtr, float128_t *zPtr ) +{ + struct floatX x; + int_fast32_t expZ; + struct uint256 sig; + + x.isNaN = xPtr->isNaN; + x.isInf = xPtr->isInf; + x.isZero = xPtr->isZero; + x.sign = xPtr->sign; + if ( !(x.isNaN | x.isInf | x.isZero) ) { + expZ = xPtr->exp; + sig = xPtr->sig; + while ( !sig.v192 ) { + expZ -= 64; + sig.v192 = sig.v128; + sig.v128 = sig.v64; + sig.v64 = sig.v0; + sig.v0 = 0; + } + while ( sig.v192 < UINT64_C( 0x0100000000000000 ) ) { + --expZ; + shiftLeft1256M( &sig ); + } + x.exp = expZ; + x.sig.v64 = sig.v192; + x.sig.v0 = sig.v128 | ((sig.v64 | sig.v0) != 0); + } + floatXToF128M( &x, zPtr ); + +} + +#endif + +static void floatX256Invalid( struct floatX256 *xPtr ) +{ + + slowfloat_exceptionFlags |= softfloat_flag_invalid; + *xPtr = floatX256NaN; + +} + +static +void floatX256Add( struct floatX256 *xPtr, const struct floatX256 *yPtr ) +{ + int_fast32_t expX, expY, expDiff; + struct uint256 sigY; + + if ( xPtr->isNaN ) return; + if ( yPtr->isNaN ) goto copyY; + if ( xPtr->isInf && yPtr->isInf ) { + if ( xPtr->sign != yPtr->sign ) floatX256Invalid( xPtr ); + return; + } + if ( xPtr->isInf ) return; + if ( yPtr->isInf ) goto copyY; + if ( xPtr->isZero && yPtr->isZero ) { + if ( xPtr->sign == yPtr->sign ) return; + goto completeCancellation; + } + expX = xPtr->exp; + expY = yPtr->exp; + if ( + (xPtr->sign != yPtr->sign) && (expX == expY) + && eq256M( &xPtr->sig, &yPtr->sig ) + ) { + completeCancellation: + if (slowfloat_roundingMode == softfloat_round_min) { + *xPtr = floatX256NegativeZero; + } else { + *xPtr = floatX256PositiveZero; + } + return; + } + if ( xPtr->isZero ) goto copyY; + if ( yPtr->isZero ) return; + expDiff = expX - expY; + if ( expDiff < 0 ) { + xPtr->exp = expY; + if ( expDiff < -248 ) { + xPtr->sig.v192 = 0; + xPtr->sig.v128 = 0; + xPtr->sig.v64 = 0; + xPtr->sig.v0 = 1; + } else { + while ( expDiff < 0 ) { + ++expDiff; + shiftRight1Jam256M( &xPtr->sig ); + } + } + if ( xPtr->sign != yPtr->sign ) neg256M( &xPtr->sig ); + xPtr->sign = yPtr->sign; + add256M( &xPtr->sig, &yPtr->sig ); + } else { + sigY = yPtr->sig; + if ( 248 < expDiff ) { + sigY.v192 = 0; + sigY.v128 = 0; + sigY.v64 = 0; + sigY.v0 = 1; + } else { + while ( 0 < expDiff ) { + --expDiff; + shiftRight1Jam256M( &sigY ); + } + } + if ( xPtr->sign != yPtr->sign ) neg256M( &sigY ); + add256M( &xPtr->sig, &sigY ); + } + if ( xPtr->sig.v192 & UINT64_C( 0x8000000000000000 ) ) { + xPtr->sign = !xPtr->sign; + neg256M( &xPtr->sig ); + } + return; + copyY: + *xPtr = *yPtr; + +} + +static +void floatX256Mul( struct floatX256 *xPtr, const struct floatX256 *yPtr ) +{ + struct uint256 sig; + int bitNum; + + if ( xPtr->isNaN ) return; + if ( yPtr->isNaN ) { + xPtr->isNaN = true; + xPtr->isInf = false; + xPtr->isZero = false; + xPtr->sign = yPtr->sign; + return; + } + if ( yPtr->sign ) xPtr->sign = !xPtr->sign; + if ( xPtr->isInf ) { + if ( yPtr->isZero ) floatX256Invalid( xPtr ); + return; + } + if ( yPtr->isInf ) { + if ( xPtr->isZero ) { + floatX256Invalid( xPtr ); + return; + } + xPtr->isInf = true; + return; + } + if ( xPtr->isZero || yPtr->isZero ) { + if ( xPtr->sign ) { + *xPtr = floatX256NegativeZero; + } else { + *xPtr = floatX256PositiveZero; + } + return; + } + xPtr->exp += yPtr->exp; + sig.v192 = 0; + sig.v128 = 0; + sig.v64 = 0; + sig.v0 = 0; + for ( bitNum = 0; bitNum < 248; ++bitNum ) { + shiftRight1Jam256M( &sig ); + if ( xPtr->sig.v0 & 1 ) add256M( &sig, &yPtr->sig ); + shiftRight1256M( &xPtr->sig ); + } + if ( UINT64_C( 0x0100000000000000 ) <= sig.v192 ) { + ++xPtr->exp; + shiftRight1Jam256M( &sig ); + } + xPtr->sig = sig; + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT16 + +float16_t slow_ui32_to_f16( uint32_t a ) +{ + struct floatX x; + + ui32ToFloatX( a, &x ); + return floatXToF16( &x ); + +} + +#endif + +float32_t slow_ui32_to_f32( uint32_t a ) +{ + struct floatX x; + + ui32ToFloatX( a, &x ); + return floatXToF32( &x ); + +} + +#ifdef FLOAT64 + +float64_t slow_ui32_to_f64( uint32_t a ) +{ + struct floatX x; + + ui32ToFloatX( a, &x ); + return floatXToF64( &x ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void slow_ui32_to_extF80M( uint32_t a, extFloat80_t *zPtr ) +{ + struct floatX x; + + ui32ToFloatX( a, &x ); + floatXToExtF80M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT128 + +void slow_ui32_to_f128M( uint32_t a, float128_t *zPtr ) +{ + struct floatX x; + + ui32ToFloatX( a, &x ); + floatXToF128M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT16 + +float16_t slow_ui64_to_f16( uint64_t a ) +{ + struct floatX x; + + ui64ToFloatX( a, &x ); + return floatXToF16( &x ); + +} + +#endif + +float32_t slow_ui64_to_f32( uint64_t a ) +{ + struct floatX x; + + ui64ToFloatX( a, &x ); + return floatXToF32( &x ); + +} + +#ifdef FLOAT64 + +float64_t slow_ui64_to_f64( uint64_t a ) +{ + struct floatX x; + + ui64ToFloatX( a, &x ); + return floatXToF64( &x ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void slow_ui64_to_extF80M( uint64_t a, extFloat80_t *zPtr ) +{ + struct floatX x; + + ui64ToFloatX( a, &x ); + floatXToExtF80M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT128 + +void slow_ui64_to_f128M( uint64_t a, float128_t *zPtr ) +{ + struct floatX x; + + ui64ToFloatX( a, &x ); + floatXToF128M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT16 + +float16_t slow_i32_to_f16( int32_t a ) +{ + struct floatX x; + + i32ToFloatX( a, &x ); + return floatXToF16( &x ); + +} + +#endif + +float32_t slow_i32_to_f32( int32_t a ) +{ + struct floatX x; + + i32ToFloatX( a, &x ); + return floatXToF32( &x ); + +} + +#ifdef FLOAT64 + +float64_t slow_i32_to_f64( int32_t a ) +{ + struct floatX x; + + i32ToFloatX( a, &x ); + return floatXToF64( &x ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void slow_i32_to_extF80M( int32_t a, extFloat80_t *zPtr ) +{ + struct floatX x; + + i32ToFloatX( a, &x ); + floatXToExtF80M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT128 + +void slow_i32_to_f128M( int32_t a, float128_t *zPtr ) +{ + struct floatX x; + + i32ToFloatX( a, &x ); + floatXToF128M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT16 + +float16_t slow_i64_to_f16( int64_t a ) +{ + struct floatX x; + + i64ToFloatX( a, &x ); + return floatXToF16( &x ); + +} + +#endif + +float32_t slow_i64_to_f32( int64_t a ) +{ + struct floatX x; + + i64ToFloatX( a, &x ); + return floatXToF32( &x ); + +} + +#ifdef FLOAT64 + +float64_t slow_i64_to_f64( int64_t a ) +{ + struct floatX x; + + i64ToFloatX( a, &x ); + return floatXToF64( &x ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void slow_i64_to_extF80M( int64_t a, extFloat80_t *zPtr ) +{ + struct floatX x; + + i64ToFloatX( a, &x ); + floatXToExtF80M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT128 + +void slow_i64_to_f128M( int64_t a, float128_t *zPtr ) +{ + struct floatX x; + + i64ToFloatX( a, &x ); + floatXToF128M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT16 + +uint_fast32_t + slow_f16_to_ui32( float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToUI32( &x, roundingMode, exact ); + +} + +uint_fast64_t + slow_f16_to_ui64( float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToUI64( &x, roundingMode, exact ); + +} + +int_fast32_t + slow_f16_to_i32( float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToI32( &x, roundingMode, exact ); + +} + +int_fast64_t + slow_f16_to_i64( float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToI64( &x, roundingMode, exact ); + +} + +uint_fast32_t slow_f16_to_ui32_r_minMag( float16_t a, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToUI32( &x, softfloat_round_minMag, exact ); + +} + +uint_fast64_t slow_f16_to_ui64_r_minMag( float16_t a, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToUI64( &x, softfloat_round_minMag, exact ); + +} + +int_fast32_t slow_f16_to_i32_r_minMag( float16_t a, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToI32( &x, softfloat_round_minMag, exact ); + +} + +int_fast64_t slow_f16_to_i64_r_minMag( float16_t a, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToI64( &x, softfloat_round_minMag, exact ); + +} + +float32_t slow_f16_to_f32( float16_t a ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToF32( &x ); + +} + +#ifdef FLOAT64 + +float64_t slow_f16_to_f64( float16_t a ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + return floatXToF64( &x ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void slow_f16_to_extF80M( float16_t a, extFloat80_t *zPtr ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + floatXToExtF80M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT128 + +void slow_f16_to_f128M( float16_t a, float128_t *zPtr ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + floatXToF128M( &x, zPtr ); + +} + +#endif + +float16_t + slow_f16_roundToInt( float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + floatXRoundToInt( &x, roundingMode, exact ); + return floatXToF16( &x ); + +} + +float16_t slow_f16_add( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + floatXAdd( &x, &y ); + return floatXToF16( &x ); + +} + +float16_t slow_f16_sub( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + y.sign = !y.sign; + floatXAdd( &x, &y ); + return floatXToF16( &x ); + + +} + +float16_t slow_f16_mul( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + floatXMul( &x, &y ); + return floatXToF16( &x ); + +} + +float16_t slow_f16_mulAdd( float16_t a, float16_t b, float16_t c ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + floatXMul( &x, &y ); + f16ToFloatX( c, &y ); + floatXAdd( &x, &y ); + return floatXToF16( &x ); + +} + +float16_t slow_f16_div( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + floatXDiv( &x, &y ); + return floatXToF16( &x ); + +} + +float16_t slow_f16_rem( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + floatXRem( &x, &y ); + return floatXToF16( &x ); + +} + +float16_t slow_f16_sqrt( float16_t a ) +{ + struct floatX x; + + f16ToFloatX( a, &x ); + floatXSqrt( &x ); + return floatXToF16( &x ); + +} + +bool slow_f16_eq( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + return floatXEq( &x, &y ); + +} + +bool slow_f16_le( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLe( &x, &y ); + +} + +bool slow_f16_lt( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLt( &x, &y ); + +} + +bool slow_f16_eq_signaling( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXEq( &x, &y ); + +} + +bool slow_f16_le_quiet( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + return floatXLe( &x, &y ); + +} + +bool slow_f16_lt_quiet( float16_t a, float16_t b ) +{ + struct floatX x, y; + + f16ToFloatX( a, &x ); + f16ToFloatX( b, &y ); + return floatXLt( &x, &y ); + +} + +#endif + +uint_fast32_t + slow_f32_to_ui32( float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToUI32( &x, roundingMode, exact ); + +} + +uint_fast64_t + slow_f32_to_ui64( float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToUI64( &x, roundingMode, exact ); + +} + +int_fast32_t + slow_f32_to_i32( float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToI32( &x, roundingMode, exact ); + +} + +int_fast64_t + slow_f32_to_i64( float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToI64( &x, roundingMode, exact ); + +} + +uint_fast32_t slow_f32_to_ui32_r_minMag( float32_t a, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToUI32( &x, softfloat_round_minMag, exact ); + +} + +uint_fast64_t slow_f32_to_ui64_r_minMag( float32_t a, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToUI64( &x, softfloat_round_minMag, exact ); + +} + +int_fast32_t slow_f32_to_i32_r_minMag( float32_t a, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToI32( &x, softfloat_round_minMag, exact ); + +} + +int_fast64_t slow_f32_to_i64_r_minMag( float32_t a, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToI64( &x, softfloat_round_minMag, exact ); + +} + +#ifdef FLOAT16 + +float16_t slow_f32_to_f16( float32_t a ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToF16( &x ); + +} + +#endif + +#ifdef FLOAT64 + +float64_t slow_f32_to_f64( float32_t a ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + return floatXToF64( &x ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void slow_f32_to_extF80M( float32_t a, extFloat80_t *zPtr ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + floatXToExtF80M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT128 + +void slow_f32_to_f128M( float32_t a, float128_t *zPtr ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + floatXToF128M( &x, zPtr ); + +} + +#endif + +float32_t + slow_f32_roundToInt( float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + floatXRoundToInt( &x, roundingMode, exact ); + return floatXToF32( &x ); + +} + +float32_t slow_f32_add( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + floatXAdd( &x, &y ); + return floatXToF32( &x ); + +} + +float32_t slow_f32_sub( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + y.sign = !y.sign; + floatXAdd( &x, &y ); + return floatXToF32( &x ); + + +} + +float32_t slow_f32_mul( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + floatXMul( &x, &y ); + return floatXToF32( &x ); + +} + +float32_t slow_f32_mulAdd( float32_t a, float32_t b, float32_t c ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + floatXMul( &x, &y ); + f32ToFloatX( c, &y ); + floatXAdd( &x, &y ); + return floatXToF32( &x ); + +} + +float32_t slow_f32_div( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + floatXDiv( &x, &y ); + return floatXToF32( &x ); + +} + +float32_t slow_f32_rem( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + floatXRem( &x, &y ); + return floatXToF32( &x ); + +} + +float32_t slow_f32_sqrt( float32_t a ) +{ + struct floatX x; + + f32ToFloatX( a, &x ); + floatXSqrt( &x ); + return floatXToF32( &x ); + +} + +bool slow_f32_eq( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + return floatXEq( &x, &y ); + +} + +bool slow_f32_le( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLe( &x, &y ); + +} + +bool slow_f32_lt( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLt( &x, &y ); + +} + +bool slow_f32_eq_signaling( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXEq( &x, &y ); + +} + +bool slow_f32_le_quiet( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + return floatXLe( &x, &y ); + +} + +bool slow_f32_lt_quiet( float32_t a, float32_t b ) +{ + struct floatX x, y; + + f32ToFloatX( a, &x ); + f32ToFloatX( b, &y ); + return floatXLt( &x, &y ); + +} + +#ifdef FLOAT64 + +uint_fast32_t + slow_f64_to_ui32( float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToUI32( &x, roundingMode, exact ); + +} + +uint_fast64_t + slow_f64_to_ui64( float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToUI64( &x, roundingMode, exact ); + +} + +int_fast32_t + slow_f64_to_i32( float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToI32( &x, roundingMode, exact ); + +} + +int_fast64_t + slow_f64_to_i64( float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToI64( &x, roundingMode, exact ); + +} + +uint_fast32_t slow_f64_to_ui32_r_minMag( float64_t a, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToUI32( &x, softfloat_round_minMag, exact ); + +} + +uint_fast64_t slow_f64_to_ui64_r_minMag( float64_t a, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToUI64( &x, softfloat_round_minMag, exact ); + +} + +int_fast32_t slow_f64_to_i32_r_minMag( float64_t a, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToI32( &x, softfloat_round_minMag, exact ); + +} + +int_fast64_t slow_f64_to_i64_r_minMag( float64_t a, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToI64( &x, softfloat_round_minMag, exact ); + +} + +#ifdef FLOAT16 + +float16_t slow_f64_to_f16( float64_t a ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToF16( &x ); + +} + +#endif + +float32_t slow_f64_to_f32( float64_t a ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + return floatXToF32( &x ); + +} + +#ifdef EXTFLOAT80 + +void slow_f64_to_extF80M( float64_t a, extFloat80_t *zPtr ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + floatXToExtF80M( &x, zPtr ); + +} + +#endif + +#ifdef FLOAT128 + +void slow_f64_to_f128M( float64_t a, float128_t *zPtr ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + floatXToF128M( &x, zPtr ); + +} + +#endif + +float64_t + slow_f64_roundToInt( float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + floatXRoundToInt( &x, roundingMode, exact ); + return floatXToF64( &x ); + +} + +float64_t slow_f64_add( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + floatXAdd( &x, &y ); + return floatXToF64( &x ); + +} + +float64_t slow_f64_sub( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + y.sign = !y.sign; + floatXAdd( &x, &y ); + return floatXToF64( &x ); + +} + +float64_t slow_f64_mul( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + floatXMul( &x, &y ); + return floatXToF64( &x ); + +} + +float64_t slow_f64_mulAdd( float64_t a, float64_t b, float64_t c ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + floatXMul( &x, &y ); + f64ToFloatX( c, &y ); + floatXAdd( &x, &y ); + return floatXToF64( &x ); + +} + +float64_t slow_f64_div( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + floatXDiv( &x, &y ); + return floatXToF64( &x ); + +} + +float64_t slow_f64_rem( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + floatXRem( &x, &y ); + return floatXToF64( &x ); + +} + +float64_t slow_f64_sqrt( float64_t a ) +{ + struct floatX x; + + f64ToFloatX( a, &x ); + floatXSqrt( &x ); + return floatXToF64( &x ); + +} + +bool slow_f64_eq( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + return floatXEq( &x, &y ); + +} + +bool slow_f64_le( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLe( &x, &y ); + +} + +bool slow_f64_lt( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLt( &x, &y ); + +} + +bool slow_f64_eq_signaling( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXEq( &x, &y ); + +} + +bool slow_f64_le_quiet( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + return floatXLe( &x, &y ); + +} + +bool slow_f64_lt_quiet( float64_t a, float64_t b ) +{ + struct floatX x, y; + + f64ToFloatX( a, &x ); + f64ToFloatX( b, &y ); + return floatXLt( &x, &y ); + +} + +#endif + +#ifdef EXTFLOAT80 + +uint_fast32_t + slow_extF80M_to_ui32( + const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToUI32( &x, roundingMode, exact ); + +} + +uint_fast64_t + slow_extF80M_to_ui64( + const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToUI64( &x, roundingMode, exact ); + +} + +int_fast32_t + slow_extF80M_to_i32( + const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToI32( &x, roundingMode, exact ); + +} + +int_fast64_t + slow_extF80M_to_i64( + const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToI64( &x, roundingMode, exact ); + +} + +uint_fast32_t + slow_extF80M_to_ui32_r_minMag( const extFloat80_t *aPtr, bool exact ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToUI32( &x, softfloat_round_minMag, exact ); + +} + +uint_fast64_t + slow_extF80M_to_ui64_r_minMag( const extFloat80_t *aPtr, bool exact ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToUI64( &x, softfloat_round_minMag, exact ); + +} + +int_fast32_t + slow_extF80M_to_i32_r_minMag( const extFloat80_t *aPtr, bool exact ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToI32( &x, softfloat_round_minMag, exact ); + +} + +int_fast64_t + slow_extF80M_to_i64_r_minMag( const extFloat80_t *aPtr, bool exact ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToI64( &x, softfloat_round_minMag, exact ); + +} + +#ifdef FLOAT16 + +float16_t slow_extF80M_to_f16( const extFloat80_t *aPtr ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToF16( &x ); + +} + +#endif + +float32_t slow_extF80M_to_f32( const extFloat80_t *aPtr ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToF32( &x ); + +} + +#ifdef FLOAT64 + +float64_t slow_extF80M_to_f64( const extFloat80_t *aPtr ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + return floatXToF64( &x ); + +} + +#endif + +#ifdef FLOAT128 + +void slow_extF80M_to_f128M( const extFloat80_t *aPtr, float128_t *zPtr ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + floatXToF128M( &x, zPtr ); + +} + +#endif + +void + slow_extF80M_roundToInt( + const extFloat80_t *aPtr, + uint_fast8_t roundingMode, + bool exact, + extFloat80_t *zPtr + ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + floatXRoundToInt( &x, roundingMode, exact ); + floatXToExtF80M( &x, zPtr ); + +} + +void + slow_extF80M_add( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + floatXAdd( &x, &y ); + floatXToExtF80M( &x, zPtr ); + +} + +void + slow_extF80M_sub( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + y.sign = !y.sign; + floatXAdd( &x, &y ); + floatXToExtF80M( &x, zPtr ); + +} + +void + slow_extF80M_mul( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + floatXMul( &x, &y ); + floatXToExtF80M( &x, zPtr ); + +} + +void + slow_extF80M_div( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + floatXDiv( &x, &y ); + floatXToExtF80M( &x, zPtr ); + +} + +void + slow_extF80M_rem( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + floatXRem( &x, &y ); + floatXToExtF80M( &x, zPtr ); + +} + +void slow_extF80M_sqrt( const extFloat80_t *aPtr, extFloat80_t *zPtr ) +{ + struct floatX x; + + extF80MToFloatX( aPtr, &x ); + floatXSqrt( &x ); + floatXToExtF80M( &x, zPtr ); + +} + +bool slow_extF80M_eq( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + return floatXEq( &x, &y ); + +} + +bool slow_extF80M_le( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLe( &x, &y ); + +} + +bool slow_extF80M_lt( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLt( &x, &y ); + +} + +bool + slow_extF80M_eq_signaling( + const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXEq( &x, &y ); + +} + +bool slow_extF80M_le_quiet( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + return floatXLe( &x, &y ); + +} + +bool slow_extF80M_lt_quiet( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + struct floatX x, y; + + extF80MToFloatX( aPtr, &x ); + extF80MToFloatX( bPtr, &y ); + return floatXLt( &x, &y ); + +} + +#endif + +#ifdef FLOAT128 + +uint_fast32_t + slow_f128M_to_ui32( + const float128_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToUI32( &x, roundingMode, exact ); + +} + +uint_fast64_t + slow_f128M_to_ui64( + const float128_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToUI64( &x, roundingMode, exact ); + +} + +int_fast32_t + slow_f128M_to_i32( + const float128_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToI32( &x, roundingMode, exact ); + +} + +int_fast64_t + slow_f128M_to_i64( + const float128_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToI64( &x, roundingMode, exact ); + +} + +uint_fast32_t slow_f128M_to_ui32_r_minMag( const float128_t *aPtr, bool exact ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToUI32( &x, softfloat_round_minMag, exact ); + +} + +uint_fast64_t slow_f128M_to_ui64_r_minMag( const float128_t *aPtr, bool exact ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToUI64( &x, softfloat_round_minMag, exact ); + +} + +int_fast32_t slow_f128M_to_i32_r_minMag( const float128_t *aPtr, bool exact ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToI32( &x, softfloat_round_minMag, exact ); + +} + +int_fast64_t slow_f128M_to_i64_r_minMag( const float128_t *aPtr, bool exact ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToI64( &x, softfloat_round_minMag, exact ); + +} + +#ifdef FLOAT16 + +float16_t slow_f128M_to_f16( const float128_t *aPtr ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToF16( &x ); + +} + +#endif + +float32_t slow_f128M_to_f32( const float128_t *aPtr ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToF32( &x ); + +} + +#ifdef FLOAT64 + +float64_t slow_f128M_to_f64( const float128_t *aPtr ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + return floatXToF64( &x ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void slow_f128M_to_extF80M( const float128_t *aPtr, extFloat80_t *zPtr ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + floatXToExtF80M( &x, zPtr ); + +} + +#endif + +void + slow_f128M_roundToInt( + const float128_t *aPtr, + uint_fast8_t roundingMode, + bool exact, + float128_t *zPtr + ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + floatXRoundToInt( &x, roundingMode, exact ); + floatXToF128M( &x, zPtr ); + +} + +void + slow_f128M_add( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + floatXAdd( &x, &y ); + floatXToF128M( &x, zPtr ); + +} + +void + slow_f128M_sub( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + y.sign = !y.sign; + floatXAdd( &x, &y ); + floatXToF128M( &x, zPtr ); + +} + +void + slow_f128M_mul( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + floatXMul( &x, &y ); + floatXToF128M( &x, zPtr ); + +} + +void + slow_f128M_mulAdd( + const float128_t *aPtr, + const float128_t *bPtr, + const float128_t *cPtr, + float128_t *zPtr + ) +{ + struct floatX256 x, y; + + f128MToFloatX256( aPtr, &x ); + f128MToFloatX256( bPtr, &y ); + floatX256Mul( &x, &y ); + f128MToFloatX256( cPtr, &y ); + floatX256Add( &x, &y ); + floatX256ToF128M( &x, zPtr ); + +} + +void + slow_f128M_div( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + floatXDiv( &x, &y ); + floatXToF128M( &x, zPtr ); + +} + +void + slow_f128M_rem( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + floatXRem( &x, &y ); + floatXToF128M( &x, zPtr ); + +} + +void slow_f128M_sqrt( const float128_t *aPtr, float128_t *zPtr ) +{ + struct floatX x; + + f128MToFloatX( aPtr, &x ); + floatXSqrt( &x ); + floatXToF128M( &x, zPtr ); + +} + +bool slow_f128M_eq( const float128_t *aPtr, const float128_t *bPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + return floatXEq( &x, &y ); + +} + +bool slow_f128M_le( const float128_t *aPtr, const float128_t *bPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLe( &x, &y ); + +} + +bool slow_f128M_lt( const float128_t *aPtr, const float128_t *bPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXLt( &x, &y ); + +} + +bool slow_f128M_eq_signaling( const float128_t *aPtr, const float128_t *bPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + if ( x.isNaN || y.isNaN ) { + slowfloat_exceptionFlags |= softfloat_flag_invalid; + } + return floatXEq( &x, &y ); + +} + +bool slow_f128M_le_quiet( const float128_t *aPtr, const float128_t *bPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + return floatXLe( &x, &y ); + +} + +bool slow_f128M_lt_quiet( const float128_t *aPtr, const float128_t *bPtr ) +{ + struct floatX x, y; + + f128MToFloatX( aPtr, &x ); + f128MToFloatX( bPtr, &y ); + return floatXLt( &x, &y ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/slowfloat.h b/src/libs/softfloat-3e/testfloat/source/slowfloat.h new file mode 100644 index 00000000..b2240e77 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/slowfloat.h @@ -0,0 +1,298 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "softfloat.h" + +extern uint_fast8_t slowfloat_roundingMode; +extern uint_fast8_t slowfloat_detectTininess; +extern uint_fast8_t slowfloat_exceptionFlags; +#ifdef EXTFLOAT80 +extern uint_fast8_t slow_extF80_roundingPrecision; +#endif + +#ifdef FLOAT16 +float16_t slow_ui32_to_f16( uint32_t ); +#endif +float32_t slow_ui32_to_f32( uint32_t ); +#ifdef FLOAT64 +float64_t slow_ui32_to_f64( uint32_t ); +#endif +#ifdef EXTFLOAT80 +void slow_ui32_to_extF80M( uint32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void slow_ui32_to_f128M( uint32_t, float128_t * ); +#endif +#ifdef FLOAT16 +float16_t slow_ui64_to_f16( uint64_t ); +#endif +float32_t slow_ui64_to_f32( uint64_t ); +#ifdef FLOAT64 +float64_t slow_ui64_to_f64( uint64_t ); +#endif +#ifdef EXTFLOAT80 +void slow_ui64_to_extF80M( uint64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void slow_ui64_to_f128M( uint64_t, float128_t * ); +#endif +#ifdef FLOAT16 +float16_t slow_i32_to_f16( int32_t ); +#endif +float32_t slow_i32_to_f32( int32_t ); +#ifdef FLOAT64 +float64_t slow_i32_to_f64( int32_t ); +#endif +#ifdef EXTFLOAT80 +void slow_i32_to_extF80M( int32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void slow_i32_to_f128M( int32_t, float128_t * ); +#endif +#ifdef FLOAT16 +float16_t slow_i64_to_f16( int64_t ); +#endif +float32_t slow_i64_to_f32( int64_t ); +#ifdef FLOAT64 +float64_t slow_i64_to_f64( int64_t ); +#endif +#ifdef EXTFLOAT80 +void slow_i64_to_extF80M( int64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void slow_i64_to_f128M( int64_t, float128_t * ); +#endif + +#ifdef FLOAT16 +uint_fast32_t slow_f16_to_ui32( float16_t, uint_fast8_t, bool ); +uint_fast64_t slow_f16_to_ui64( float16_t, uint_fast8_t, bool ); +int_fast32_t slow_f16_to_i32( float16_t, uint_fast8_t, bool ); +int_fast64_t slow_f16_to_i64( float16_t, uint_fast8_t, bool ); +uint_fast32_t slow_f16_to_ui32_r_minMag( float16_t, bool ); +uint_fast64_t slow_f16_to_ui64_r_minMag( float16_t, bool ); +int_fast32_t slow_f16_to_i32_r_minMag( float16_t, bool ); +int_fast64_t slow_f16_to_i64_r_minMag( float16_t, bool ); +float32_t slow_f16_to_f32( float16_t ); +#ifdef FLOAT64 +float64_t slow_f16_to_f64( float16_t ); +#endif +#ifdef EXTFLOAT80 +void slow_f16_to_extF80M( float16_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void slow_f16_to_f128M( float16_t, float128_t * ); +#endif +float16_t slow_f16_roundToInt( float16_t, uint_fast8_t, bool ); +float16_t slow_f16_add( float16_t, float16_t ); +float16_t slow_f16_sub( float16_t, float16_t ); +float16_t slow_f16_mul( float16_t, float16_t ); +float16_t slow_f16_mulAdd( float16_t, float16_t, float16_t ); +float16_t slow_f16_div( float16_t, float16_t ); +float16_t slow_f16_rem( float16_t, float16_t ); +float16_t slow_f16_sqrt( float16_t ); +bool slow_f16_eq( float16_t, float16_t ); +bool slow_f16_le( float16_t, float16_t ); +bool slow_f16_lt( float16_t, float16_t ); +bool slow_f16_eq_signaling( float16_t, float16_t ); +bool slow_f16_le_quiet( float16_t, float16_t ); +bool slow_f16_lt_quiet( float16_t, float16_t ); +#endif + +uint_fast32_t slow_f32_to_ui32( float32_t, uint_fast8_t, bool ); +uint_fast64_t slow_f32_to_ui64( float32_t, uint_fast8_t, bool ); +int_fast32_t slow_f32_to_i32( float32_t, uint_fast8_t, bool ); +int_fast64_t slow_f32_to_i64( float32_t, uint_fast8_t, bool ); +uint_fast32_t slow_f32_to_ui32_r_minMag( float32_t, bool ); +uint_fast64_t slow_f32_to_ui64_r_minMag( float32_t, bool ); +int_fast32_t slow_f32_to_i32_r_minMag( float32_t, bool ); +int_fast64_t slow_f32_to_i64_r_minMag( float32_t, bool ); +#ifdef FLOAT16 +float16_t slow_f32_to_f16( float32_t ); +#endif +#ifdef FLOAT64 +float64_t slow_f32_to_f64( float32_t ); +#endif +#ifdef EXTFLOAT80 +void slow_f32_to_extF80M( float32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void slow_f32_to_f128M( float32_t, float128_t * ); +#endif +float32_t slow_f32_roundToInt( float32_t, uint_fast8_t, bool ); +float32_t slow_f32_add( float32_t, float32_t ); +float32_t slow_f32_sub( float32_t, float32_t ); +float32_t slow_f32_mul( float32_t, float32_t ); +float32_t slow_f32_mulAdd( float32_t, float32_t, float32_t ); +float32_t slow_f32_div( float32_t, float32_t ); +float32_t slow_f32_rem( float32_t, float32_t ); +float32_t slow_f32_sqrt( float32_t ); +bool slow_f32_eq( float32_t, float32_t ); +bool slow_f32_le( float32_t, float32_t ); +bool slow_f32_lt( float32_t, float32_t ); +bool slow_f32_eq_signaling( float32_t, float32_t ); +bool slow_f32_le_quiet( float32_t, float32_t ); +bool slow_f32_lt_quiet( float32_t, float32_t ); + +#ifdef FLOAT64 +uint_fast32_t slow_f64_to_ui32( float64_t, uint_fast8_t, bool ); +uint_fast64_t slow_f64_to_ui64( float64_t, uint_fast8_t, bool ); +int_fast32_t slow_f64_to_i32( float64_t, uint_fast8_t, bool ); +int_fast64_t slow_f64_to_i64( float64_t, uint_fast8_t, bool ); +uint_fast32_t slow_f64_to_ui32_r_minMag( float64_t, bool ); +uint_fast64_t slow_f64_to_ui64_r_minMag( float64_t, bool ); +int_fast32_t slow_f64_to_i32_r_minMag( float64_t, bool ); +int_fast64_t slow_f64_to_i64_r_minMag( float64_t, bool ); +#ifdef FLOAT16 +float16_t slow_f64_to_f16( float64_t ); +#endif +float32_t slow_f64_to_f32( float64_t ); +#ifdef EXTFLOAT80 +void slow_f64_to_extF80M( float64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void slow_f64_to_f128M( float64_t, float128_t * ); +#endif +float64_t slow_f64_roundToInt( float64_t, uint_fast8_t, bool ); +float64_t slow_f64_add( float64_t, float64_t ); +float64_t slow_f64_sub( float64_t, float64_t ); +float64_t slow_f64_mul( float64_t, float64_t ); +float64_t slow_f64_mulAdd( float64_t, float64_t, float64_t ); +float64_t slow_f64_div( float64_t, float64_t ); +float64_t slow_f64_rem( float64_t, float64_t ); +float64_t slow_f64_sqrt( float64_t ); +bool slow_f64_eq( float64_t, float64_t ); +bool slow_f64_le( float64_t, float64_t ); +bool slow_f64_lt( float64_t, float64_t ); +bool slow_f64_eq_signaling( float64_t, float64_t ); +bool slow_f64_le_quiet( float64_t, float64_t ); +bool slow_f64_lt_quiet( float64_t, float64_t ); +#endif + +#ifdef EXTFLOAT80 +uint_fast32_t slow_extF80M_to_ui32( const extFloat80_t *, uint_fast8_t, bool ); +uint_fast64_t slow_extF80M_to_ui64( const extFloat80_t *, uint_fast8_t, bool ); +int_fast32_t slow_extF80M_to_i32( const extFloat80_t *, uint_fast8_t, bool ); +int_fast64_t slow_extF80M_to_i64( const extFloat80_t *, uint_fast8_t, bool ); +uint_fast32_t slow_extF80M_to_ui32_r_minMag( const extFloat80_t *, bool ); +uint_fast64_t slow_extF80M_to_ui64_r_minMag( const extFloat80_t *, bool ); +int_fast32_t slow_extF80M_to_i32_r_minMag( const extFloat80_t *, bool ); +int_fast64_t slow_extF80M_to_i64_r_minMag( const extFloat80_t *, bool ); +#ifdef FLOAT16 +float16_t slow_extF80M_to_f16( const extFloat80_t * ); +#endif +float32_t slow_extF80M_to_f32( const extFloat80_t * ); +#ifdef FLOAT64 +float64_t slow_extF80M_to_f64( const extFloat80_t * ); +#endif +#ifdef FLOAT128 +void slow_extF80M_to_f128M( const extFloat80_t *, float128_t * ); +#endif +void + slow_extF80M_roundToInt( + const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ); +void + slow_extF80M_add( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void + slow_extF80M_sub( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void + slow_extF80M_mul( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void + slow_extF80M_mulAdd( + const extFloat80_t *, + const extFloat80_t *, + const extFloat80_t *, + extFloat80_t * + ); +void + slow_extF80M_div( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void + slow_extF80M_rem( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void slow_extF80M_sqrt( const extFloat80_t *, extFloat80_t * ); +bool slow_extF80M_eq( const extFloat80_t *, const extFloat80_t * ); +bool slow_extF80M_le( const extFloat80_t *, const extFloat80_t * ); +bool slow_extF80M_lt( const extFloat80_t *, const extFloat80_t * ); +bool slow_extF80M_eq_signaling( const extFloat80_t *, const extFloat80_t * ); +bool slow_extF80M_le_quiet( const extFloat80_t *, const extFloat80_t * ); +bool slow_extF80M_lt_quiet( const extFloat80_t *, const extFloat80_t * ); +#endif + +#ifdef FLOAT128 +uint_fast32_t slow_f128M_to_ui32( const float128_t *, uint_fast8_t, bool ); +uint_fast64_t slow_f128M_to_ui64( const float128_t *, uint_fast8_t, bool ); +int_fast32_t slow_f128M_to_i32( const float128_t *, uint_fast8_t, bool ); +int_fast64_t slow_f128M_to_i64( const float128_t *, uint_fast8_t, bool ); +uint_fast32_t slow_f128M_to_ui32_r_minMag( const float128_t *, bool ); +uint_fast64_t slow_f128M_to_ui64_r_minMag( const float128_t *, bool ); +int_fast32_t slow_f128M_to_i32_r_minMag( const float128_t *, bool ); +int_fast64_t slow_f128M_to_i64_r_minMag( const float128_t *, bool ); +#ifdef FLOAT16 +float16_t slow_f128M_to_f16( const float128_t * ); +#endif +float32_t slow_f128M_to_f32( const float128_t * ); +#ifdef FLOAT64 +float64_t slow_f128M_to_f64( const float128_t * ); +#endif +#ifdef EXTFLOAT80 +void slow_f128M_to_extF80M( const float128_t *, extFloat80_t * ); +#endif +void + slow_f128M_roundToInt( const float128_t *, uint_fast8_t, bool, float128_t * ); +void slow_f128M_add( const float128_t *, const float128_t *, float128_t * ); +void slow_f128M_sub( const float128_t *, const float128_t *, float128_t * ); +void slow_f128M_mul( const float128_t *, const float128_t *, float128_t * ); +void + slow_f128M_mulAdd( + const float128_t *, const float128_t *, const float128_t *, float128_t * + ); +void slow_f128M_div( const float128_t *, const float128_t *, float128_t * ); +void slow_f128M_rem( const float128_t *, const float128_t *, float128_t * ); +void slow_f128M_sqrt( const float128_t *, float128_t * ); +bool slow_f128M_eq( const float128_t *, const float128_t * ); +bool slow_f128M_le( const float128_t *, const float128_t * ); +bool slow_f128M_lt( const float128_t *, const float128_t * ); +bool slow_f128M_eq_signaling( const float128_t *, const float128_t * ); +bool slow_f128M_le_quiet( const float128_t *, const float128_t * ); +bool slow_f128M_lt_quiet( const float128_t *, const float128_t * ); +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/standardFunctionInfos.c b/src/libs/softfloat-3e/testfloat/source/standardFunctionInfos.c new file mode 100644 index 00000000..2ccc0011 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/standardFunctionInfos.c @@ -0,0 +1,471 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include "platform.h" +#include "functions.h" + +#define RNEVEN ROUND_NEAR_EVEN +#define RMINM ROUND_MINMAG +#define RMIN ROUND_MIN +#define RMAX ROUND_MAX +#define RNMAXM ROUND_NEAR_MAXMAG + +const struct standardFunctionInfo standardFunctionInfos[] = { + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT16 + { "ui32_to_f16", UI32_TO_F16, 0, 0 }, +#endif + { "ui32_to_f32", UI32_TO_F32, 0, 0 }, +#ifdef FLOAT64 + { "ui32_to_f64", UI32_TO_F64, 0, 0 }, +#endif +#ifdef EXTFLOAT80 + { "ui32_to_extF80", UI32_TO_EXTF80, 0, 0 }, +#endif +#ifdef FLOAT128 + { "ui32_to_f128", UI32_TO_F128, 0, 0 }, +#endif +#ifdef FLOAT16 + { "ui64_to_f16", UI64_TO_F16, 0, 0 }, +#endif + { "ui64_to_f32", UI64_TO_F32, 0, 0 }, +#ifdef FLOAT64 + { "ui64_to_f64", UI64_TO_F64, 0, 0 }, +#endif +#ifdef EXTFLOAT80 + { "ui64_to_extF80", UI64_TO_EXTF80, 0, 0 }, +#endif +#ifdef FLOAT128 + { "ui64_to_f128", UI64_TO_F128, 0, 0 }, +#endif +#ifdef FLOAT16 + { "i32_to_f16", I32_TO_F16, 0, 0 }, +#endif + { "i32_to_f32", I32_TO_F32, 0, 0 }, +#ifdef FLOAT64 + { "i32_to_f64", I32_TO_F64, 0, 0 }, +#endif +#ifdef EXTFLOAT80 + { "i32_to_extF80", I32_TO_EXTF80, 0, 0 }, +#endif +#ifdef FLOAT128 + { "i32_to_f128", I32_TO_F128, 0, 0 }, +#endif +#ifdef FLOAT16 + { "i64_to_f16", I64_TO_F16, 0, 0 }, +#endif + { "i64_to_f32", I64_TO_F32, 0, 0 }, +#ifdef FLOAT64 + { "i64_to_f64", I64_TO_F64, 0, 0 }, +#endif +#ifdef EXTFLOAT80 + { "i64_to_extF80", I64_TO_EXTF80, 0, 0 }, +#endif +#ifdef FLOAT128 + { "i64_to_f128", I64_TO_F128, 0, 0 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT16 + { "f16_to_ui32_r_near_even", F16_TO_UI32, RNEVEN, false }, + { "f16_to_ui32_r_minMag", F16_TO_UI32, RMINM, false }, + { "f16_to_ui32_r_min", F16_TO_UI32, RMIN, false }, + { "f16_to_ui32_r_max", F16_TO_UI32, RMAX, false }, + { "f16_to_ui32_r_near_maxMag", F16_TO_UI32, RNMAXM, false }, + { "f16_to_ui64_r_near_even", F16_TO_UI64, RNEVEN, false }, + { "f16_to_ui64_r_minMag", F16_TO_UI64, RMINM, false }, + { "f16_to_ui64_r_min", F16_TO_UI64, RMIN, false }, + { "f16_to_ui64_r_max", F16_TO_UI64, RMAX, false }, + { "f16_to_ui64_r_near_maxMag", F16_TO_UI64, RNMAXM, false }, + { "f16_to_i32_r_near_even", F16_TO_I32, RNEVEN, false }, + { "f16_to_i32_r_minMag", F16_TO_I32, RMINM, false }, + { "f16_to_i32_r_min", F16_TO_I32, RMIN, false }, + { "f16_to_i32_r_max", F16_TO_I32, RMAX, false }, + { "f16_to_i32_r_near_maxMag", F16_TO_I32, RNMAXM, false }, + { "f16_to_i64_r_near_even", F16_TO_I64, RNEVEN, false }, + { "f16_to_i64_r_minMag", F16_TO_I64, RMINM, false }, + { "f16_to_i64_r_min", F16_TO_I64, RMIN, false }, + { "f16_to_i64_r_max", F16_TO_I64, RMAX, false }, + { "f16_to_i64_r_near_maxMag", F16_TO_I64, RNMAXM, false }, + { "f16_to_ui32_rx_near_even", F16_TO_UI32, RNEVEN, true }, + { "f16_to_ui32_rx_minMag", F16_TO_UI32, RMINM, true }, + { "f16_to_ui32_rx_min", F16_TO_UI32, RMIN, true }, + { "f16_to_ui32_rx_max", F16_TO_UI32, RMAX, true }, + { "f16_to_ui32_rx_near_maxMag", F16_TO_UI32, RNMAXM, true }, + { "f16_to_ui64_rx_near_even", F16_TO_UI64, RNEVEN, true }, + { "f16_to_ui64_rx_minMag", F16_TO_UI64, RMINM, true }, + { "f16_to_ui64_rx_min", F16_TO_UI64, RMIN, true }, + { "f16_to_ui64_rx_max", F16_TO_UI64, RMAX, true }, + { "f16_to_ui64_rx_near_maxMag", F16_TO_UI64, RNMAXM, true }, + { "f16_to_i32_rx_near_even", F16_TO_I32, RNEVEN, true }, + { "f16_to_i32_rx_minMag", F16_TO_I32, RMINM, true }, + { "f16_to_i32_rx_min", F16_TO_I32, RMIN, true }, + { "f16_to_i32_rx_max", F16_TO_I32, RMAX, true }, + { "f16_to_i32_rx_near_maxMag", F16_TO_I32, RNMAXM, true }, + { "f16_to_i64_rx_near_even", F16_TO_I64, RNEVEN, true }, + { "f16_to_i64_rx_minMag", F16_TO_I64, RMINM, true }, + { "f16_to_i64_rx_min", F16_TO_I64, RMIN, true }, + { "f16_to_i64_rx_max", F16_TO_I64, RMAX, true }, + { "f16_to_i64_rx_near_maxMag", F16_TO_I64, RNMAXM, true }, + { "f16_to_f32", F16_TO_F32, 0, 0 }, +#ifdef FLOAT64 + { "f16_to_f64", F16_TO_F64, 0, 0 }, +#endif +#ifdef EXTFLOAT80 + { "f16_to_extF80", F16_TO_EXTF80, 0, 0 }, +#endif +#ifdef FLOAT128 + { "f16_to_f128", F16_TO_F128, 0, 0 }, +#endif + { "f16_roundToInt_r_near_even", F16_ROUNDTOINT, RNEVEN, false }, + { "f16_roundToInt_r_minMag", F16_ROUNDTOINT, RMINM, false }, + { "f16_roundToInt_r_min", F16_ROUNDTOINT, RMIN, false }, + { "f16_roundToInt_r_max", F16_ROUNDTOINT, RMAX, false }, + { "f16_roundToInt_r_near_maxMag", F16_ROUNDTOINT, RNMAXM, false }, + { "f16_roundToInt_x", F16_ROUNDTOINT, 0, true }, + { "f16_add", F16_ADD, 0, 0 }, + { "f16_sub", F16_SUB, 0, 0 }, + { "f16_mul", F16_MUL, 0, 0 }, + { "f16_mulAdd", F16_MULADD, 0, 0 }, + { "f16_div", F16_DIV, 0, 0 }, + { "f16_rem", F16_REM, 0, 0 }, + { "f16_sqrt", F16_SQRT, 0, 0 }, + { "f16_eq", F16_EQ, 0, 0 }, + { "f16_le", F16_LE, 0, 0 }, + { "f16_lt", F16_LT, 0, 0 }, + { "f16_eq_signaling", F16_EQ_SIGNALING, 0, 0 }, + { "f16_le_quiet", F16_LE_QUIET, 0, 0 }, + { "f16_lt_quiet", F16_LT_QUIET, 0, 0 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + { "f32_to_ui32_r_near_even", F32_TO_UI32, RNEVEN, false }, + { "f32_to_ui32_r_minMag", F32_TO_UI32, RMINM, false }, + { "f32_to_ui32_r_min", F32_TO_UI32, RMIN, false }, + { "f32_to_ui32_r_max", F32_TO_UI32, RMAX, false }, + { "f32_to_ui32_r_near_maxMag", F32_TO_UI32, RNMAXM, false }, + { "f32_to_ui64_r_near_even", F32_TO_UI64, RNEVEN, false }, + { "f32_to_ui64_r_minMag", F32_TO_UI64, RMINM, false }, + { "f32_to_ui64_r_min", F32_TO_UI64, RMIN, false }, + { "f32_to_ui64_r_max", F32_TO_UI64, RMAX, false }, + { "f32_to_ui64_r_near_maxMag", F32_TO_UI64, RNMAXM, false }, + { "f32_to_i32_r_near_even", F32_TO_I32, RNEVEN, false }, + { "f32_to_i32_r_minMag", F32_TO_I32, RMINM, false }, + { "f32_to_i32_r_min", F32_TO_I32, RMIN, false }, + { "f32_to_i32_r_max", F32_TO_I32, RMAX, false }, + { "f32_to_i32_r_near_maxMag", F32_TO_I32, RNMAXM, false }, + { "f32_to_i64_r_near_even", F32_TO_I64, RNEVEN, false }, + { "f32_to_i64_r_minMag", F32_TO_I64, RMINM, false }, + { "f32_to_i64_r_min", F32_TO_I64, RMIN, false }, + { "f32_to_i64_r_max", F32_TO_I64, RMAX, false }, + { "f32_to_i64_r_near_maxMag", F32_TO_I64, RNMAXM, false }, + { "f32_to_ui32_rx_near_even", F32_TO_UI32, RNEVEN, true }, + { "f32_to_ui32_rx_minMag", F32_TO_UI32, RMINM, true }, + { "f32_to_ui32_rx_min", F32_TO_UI32, RMIN, true }, + { "f32_to_ui32_rx_max", F32_TO_UI32, RMAX, true }, + { "f32_to_ui32_rx_near_maxMag", F32_TO_UI32, RNMAXM, true }, + { "f32_to_ui64_rx_near_even", F32_TO_UI64, RNEVEN, true }, + { "f32_to_ui64_rx_minMag", F32_TO_UI64, RMINM, true }, + { "f32_to_ui64_rx_min", F32_TO_UI64, RMIN, true }, + { "f32_to_ui64_rx_max", F32_TO_UI64, RMAX, true }, + { "f32_to_ui64_rx_near_maxMag", F32_TO_UI64, RNMAXM, true }, + { "f32_to_i32_rx_near_even", F32_TO_I32, RNEVEN, true }, + { "f32_to_i32_rx_minMag", F32_TO_I32, RMINM, true }, + { "f32_to_i32_rx_min", F32_TO_I32, RMIN, true }, + { "f32_to_i32_rx_max", F32_TO_I32, RMAX, true }, + { "f32_to_i32_rx_near_maxMag", F32_TO_I32, RNMAXM, true }, + { "f32_to_i64_rx_near_even", F32_TO_I64, RNEVEN, true }, + { "f32_to_i64_rx_minMag", F32_TO_I64, RMINM, true }, + { "f32_to_i64_rx_min", F32_TO_I64, RMIN, true }, + { "f32_to_i64_rx_max", F32_TO_I64, RMAX, true }, + { "f32_to_i64_rx_near_maxMag", F32_TO_I64, RNMAXM, true }, +#ifdef FLOAT16 + { "f32_to_f16", F32_TO_F16, 0, 0 }, +#endif +#ifdef FLOAT64 + { "f32_to_f64", F32_TO_F64, 0, 0 }, +#endif +#ifdef EXTFLOAT80 + { "f32_to_extF80", F32_TO_EXTF80, 0, 0 }, +#endif +#ifdef FLOAT128 + { "f32_to_f128", F32_TO_F128, 0, 0 }, +#endif + { "f32_roundToInt_r_near_even", F32_ROUNDTOINT, RNEVEN, false }, + { "f32_roundToInt_r_minMag", F32_ROUNDTOINT, RMINM, false }, + { "f32_roundToInt_r_min", F32_ROUNDTOINT, RMIN, false }, + { "f32_roundToInt_r_max", F32_ROUNDTOINT, RMAX, false }, + { "f32_roundToInt_r_near_maxMag", F32_ROUNDTOINT, RNMAXM, false }, + { "f32_roundToInt_x", F32_ROUNDTOINT, 0, true }, + { "f32_add", F32_ADD, 0, 0 }, + { "f32_sub", F32_SUB, 0, 0 }, + { "f32_mul", F32_MUL, 0, 0 }, + { "f32_mulAdd", F32_MULADD, 0, 0 }, + { "f32_div", F32_DIV, 0, 0 }, + { "f32_rem", F32_REM, 0, 0 }, + { "f32_sqrt", F32_SQRT, 0, 0 }, + { "f32_eq", F32_EQ, 0, 0 }, + { "f32_le", F32_LE, 0, 0 }, + { "f32_lt", F32_LT, 0, 0 }, + { "f32_eq_signaling", F32_EQ_SIGNALING, 0, 0 }, + { "f32_le_quiet", F32_LE_QUIET, 0, 0 }, + { "f32_lt_quiet", F32_LT_QUIET, 0, 0 }, + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT64 + { "f64_to_ui32_r_near_even", F64_TO_UI32, RNEVEN, false }, + { "f64_to_ui32_r_minMag", F64_TO_UI32, RMINM, false }, + { "f64_to_ui32_r_min", F64_TO_UI32, RMIN, false }, + { "f64_to_ui32_r_max", F64_TO_UI32, RMAX, false }, + { "f64_to_ui32_r_near_maxMag", F64_TO_UI32, RNMAXM, false }, + { "f64_to_ui64_r_near_even", F64_TO_UI64, RNEVEN, false }, + { "f64_to_ui64_r_minMag", F64_TO_UI64, RMINM, false }, + { "f64_to_ui64_r_min", F64_TO_UI64, RMIN, false }, + { "f64_to_ui64_r_max", F64_TO_UI64, RMAX, false }, + { "f64_to_ui64_r_near_maxMag", F64_TO_UI64, RNMAXM, false }, + { "f64_to_i32_r_near_even", F64_TO_I32, RNEVEN, false }, + { "f64_to_i32_r_minMag", F64_TO_I32, RMINM, false }, + { "f64_to_i32_r_min", F64_TO_I32, RMIN, false }, + { "f64_to_i32_r_max", F64_TO_I32, RMAX, false }, + { "f64_to_i32_r_near_maxMag", F64_TO_I32, RNMAXM, false }, + { "f64_to_i64_r_near_even", F64_TO_I64, RNEVEN, false }, + { "f64_to_i64_r_minMag", F64_TO_I64, RMINM, false }, + { "f64_to_i64_r_min", F64_TO_I64, RMIN, false }, + { "f64_to_i64_r_max", F64_TO_I64, RMAX, false }, + { "f64_to_i64_r_near_maxMag", F64_TO_I64, RNMAXM, false }, + { "f64_to_ui32_rx_near_even", F64_TO_UI32, RNEVEN, true }, + { "f64_to_ui32_rx_minMag", F64_TO_UI32, RMINM, true }, + { "f64_to_ui32_rx_min", F64_TO_UI32, RMIN, true }, + { "f64_to_ui32_rx_max", F64_TO_UI32, RMAX, true }, + { "f64_to_ui32_rx_near_maxMag", F64_TO_UI32, RNMAXM, true }, + { "f64_to_ui64_rx_near_even", F64_TO_UI64, RNEVEN, true }, + { "f64_to_ui64_rx_minMag", F64_TO_UI64, RMINM, true }, + { "f64_to_ui64_rx_min", F64_TO_UI64, RMIN, true }, + { "f64_to_ui64_rx_max", F64_TO_UI64, RMAX, true }, + { "f64_to_ui64_rx_near_maxMag", F64_TO_UI64, RNMAXM, true }, + { "f64_to_i32_rx_near_even", F64_TO_I32, RNEVEN, true }, + { "f64_to_i32_rx_minMag", F64_TO_I32, RMINM, true }, + { "f64_to_i32_rx_min", F64_TO_I32, RMIN, true }, + { "f64_to_i32_rx_max", F64_TO_I32, RMAX, true }, + { "f64_to_i32_rx_near_maxMag", F64_TO_I32, RNMAXM, true }, + { "f64_to_i64_rx_near_even", F64_TO_I64, RNEVEN, true }, + { "f64_to_i64_rx_minMag", F64_TO_I64, RMINM, true }, + { "f64_to_i64_rx_min", F64_TO_I64, RMIN, true }, + { "f64_to_i64_rx_max", F64_TO_I64, RMAX, true }, + { "f64_to_i64_rx_near_maxMag", F64_TO_I64, RNMAXM, true }, +#ifdef FLOAT16 + { "f64_to_f16", F64_TO_F16, 0, 0 }, +#endif + { "f64_to_f32", F64_TO_F32, 0, 0 }, +#ifdef EXTFLOAT80 + { "f64_to_extF80", F64_TO_EXTF80, 0, 0 }, +#endif +#ifdef FLOAT128 + { "f64_to_f128", F64_TO_F128, 0, 0 }, +#endif + { "f64_roundToInt_r_near_even", F64_ROUNDTOINT, RNEVEN, false }, + { "f64_roundToInt_r_minMag", F64_ROUNDTOINT, RMINM, false }, + { "f64_roundToInt_r_min", F64_ROUNDTOINT, RMIN, false }, + { "f64_roundToInt_r_max", F64_ROUNDTOINT, RMAX, false }, + { "f64_roundToInt_r_near_maxMag", F64_ROUNDTOINT, RNMAXM, false }, + { "f64_roundToInt_x", F64_ROUNDTOINT, 0, true }, + { "f64_add", F64_ADD, 0, 0 }, + { "f64_sub", F64_SUB, 0, 0 }, + { "f64_mul", F64_MUL, 0, 0 }, + { "f64_mulAdd", F64_MULADD, 0, 0 }, + { "f64_div", F64_DIV, 0, 0 }, + { "f64_rem", F64_REM, 0, 0 }, + { "f64_sqrt", F64_SQRT, 0, 0 }, + { "f64_eq", F64_EQ, 0, 0 }, + { "f64_le", F64_LE, 0, 0 }, + { "f64_lt", F64_LT, 0, 0 }, + { "f64_eq_signaling", F64_EQ_SIGNALING, 0, 0 }, + { "f64_le_quiet", F64_LE_QUIET, 0, 0 }, + { "f64_lt_quiet", F64_LT_QUIET, 0, 0 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + { "extF80_to_ui32_r_near_even", EXTF80_TO_UI32, RNEVEN, false }, + { "extF80_to_ui32_r_minMag", EXTF80_TO_UI32, RMINM, false }, + { "extF80_to_ui32_r_min", EXTF80_TO_UI32, RMIN, false }, + { "extF80_to_ui32_r_max", EXTF80_TO_UI32, RMAX, false }, + { "extF80_to_ui32_r_near_maxMag", EXTF80_TO_UI32, RNMAXM, false }, + { "extF80_to_ui64_r_near_even", EXTF80_TO_UI64, RNEVEN, false }, + { "extF80_to_ui64_r_minMag", EXTF80_TO_UI64, RMINM, false }, + { "extF80_to_ui64_r_min", EXTF80_TO_UI64, RMIN, false }, + { "extF80_to_ui64_r_max", EXTF80_TO_UI64, RMAX, false }, + { "extF80_to_ui64_r_near_maxMag", EXTF80_TO_UI64, RNMAXM, false }, + { "extF80_to_i32_r_near_even", EXTF80_TO_I32, RNEVEN, false }, + { "extF80_to_i32_r_minMag", EXTF80_TO_I32, RMINM, false }, + { "extF80_to_i32_r_min", EXTF80_TO_I32, RMIN, false }, + { "extF80_to_i32_r_max", EXTF80_TO_I32, RMAX, false }, + { "extF80_to_i32_r_near_maxMag", EXTF80_TO_I32, RNMAXM, false }, + { "extF80_to_i64_r_near_even", EXTF80_TO_I64, RNEVEN, false }, + { "extF80_to_i64_r_minMag", EXTF80_TO_I64, RMINM, false }, + { "extF80_to_i64_r_min", EXTF80_TO_I64, RMIN, false }, + { "extF80_to_i64_r_max", EXTF80_TO_I64, RMAX, false }, + { "extF80_to_i64_r_near_maxMag", EXTF80_TO_I64, RNMAXM, false }, + { "extF80_to_ui32_rx_near_even", EXTF80_TO_UI32, RNEVEN, true }, + { "extF80_to_ui32_rx_minMag", EXTF80_TO_UI32, RMINM, true }, + { "extF80_to_ui32_rx_min", EXTF80_TO_UI32, RMIN, true }, + { "extF80_to_ui32_rx_max", EXTF80_TO_UI32, RMAX, true }, + { "extF80_to_ui32_rx_near_maxMag", EXTF80_TO_UI32, RNMAXM, true }, + { "extF80_to_ui64_rx_near_even", EXTF80_TO_UI64, RNEVEN, true }, + { "extF80_to_ui64_rx_minMag", EXTF80_TO_UI64, RMINM, true }, + { "extF80_to_ui64_rx_min", EXTF80_TO_UI64, RMIN, true }, + { "extF80_to_ui64_rx_max", EXTF80_TO_UI64, RMAX, true }, + { "extF80_to_ui64_rx_near_maxMag", EXTF80_TO_UI64, RNMAXM, true }, + { "extF80_to_i32_rx_near_even", EXTF80_TO_I32, RNEVEN, true }, + { "extF80_to_i32_rx_minMag", EXTF80_TO_I32, RMINM, true }, + { "extF80_to_i32_rx_min", EXTF80_TO_I32, RMIN, true }, + { "extF80_to_i32_rx_max", EXTF80_TO_I32, RMAX, true }, + { "extF80_to_i32_rx_near_maxMag", EXTF80_TO_I32, RNMAXM, true }, + { "extF80_to_i64_rx_near_even", EXTF80_TO_I64, RNEVEN, true }, + { "extF80_to_i64_rx_minMag", EXTF80_TO_I64, RMINM, true }, + { "extF80_to_i64_rx_min", EXTF80_TO_I64, RMIN, true }, + { "extF80_to_i64_rx_max", EXTF80_TO_I64, RMAX, true }, + { "extF80_to_i64_rx_near_maxMag", EXTF80_TO_I64, RNMAXM, true }, +#ifdef FLOAT16 + { "extF80_to_f16", EXTF80_TO_F16, 0, 0 }, +#endif + { "extF80_to_f32", EXTF80_TO_F32, 0, 0 }, +#ifdef FLOAT64 + { "extF80_to_f64", EXTF80_TO_F64, 0, 0 }, +#endif +#ifdef FLOAT128 + { "extF80_to_f128", EXTF80_TO_F128, 0, 0 }, +#endif + { "extF80_roundToInt_r_near_even", EXTF80_ROUNDTOINT, RNEVEN, false }, + { "extF80_roundToInt_r_minMag", EXTF80_ROUNDTOINT, RMINM, false }, + { "extF80_roundToInt_r_min", EXTF80_ROUNDTOINT, RMIN, false }, + { "extF80_roundToInt_r_max", EXTF80_ROUNDTOINT, RMAX, false }, + { "extF80_roundToInt_r_near_maxMag", EXTF80_ROUNDTOINT, RNMAXM, false }, + { "extF80_roundToInt_x", EXTF80_ROUNDTOINT, 0, true }, + { "extF80_add", EXTF80_ADD, 0, 0 }, + { "extF80_sub", EXTF80_SUB, 0, 0 }, + { "extF80_mul", EXTF80_MUL, 0, 0 }, + { "extF80_div", EXTF80_DIV, 0, 0 }, + { "extF80_rem", EXTF80_REM, 0, 0 }, + { "extF80_sqrt", EXTF80_SQRT, 0, 0 }, + { "extF80_eq", EXTF80_EQ, 0, 0 }, + { "extF80_le", EXTF80_LE, 0, 0 }, + { "extF80_lt", EXTF80_LT, 0, 0 }, + { "extF80_eq_signaling", EXTF80_EQ_SIGNALING, 0, 0 }, + { "extF80_le_quiet", EXTF80_LE_QUIET, 0, 0 }, + { "extF80_lt_quiet", EXTF80_LT_QUIET, 0, 0 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT128 + { "f128_to_ui32_r_near_even", F128_TO_UI32, RNEVEN, false }, + { "f128_to_ui32_r_minMag", F128_TO_UI32, RMINM, false }, + { "f128_to_ui32_r_min", F128_TO_UI32, RMIN, false }, + { "f128_to_ui32_r_max", F128_TO_UI32, RMAX, false }, + { "f128_to_ui32_r_near_maxMag", F128_TO_UI32, RNMAXM, false }, + { "f128_to_ui64_r_near_even", F128_TO_UI64, RNEVEN, false }, + { "f128_to_ui64_r_minMag", F128_TO_UI64, RMINM, false }, + { "f128_to_ui64_r_min", F128_TO_UI64, RMIN, false }, + { "f128_to_ui64_r_max", F128_TO_UI64, RMAX, false }, + { "f128_to_ui64_r_near_maxMag", F128_TO_UI64, RNMAXM, false }, + { "f128_to_i32_r_near_even", F128_TO_I32, RNEVEN, false }, + { "f128_to_i32_r_minMag", F128_TO_I32, RMINM, false }, + { "f128_to_i32_r_min", F128_TO_I32, RMIN, false }, + { "f128_to_i32_r_max", F128_TO_I32, RMAX, false }, + { "f128_to_i32_r_near_maxMag", F128_TO_I32, RNMAXM, false }, + { "f128_to_i64_r_near_even", F128_TO_I64, RNEVEN, false }, + { "f128_to_i64_r_minMag", F128_TO_I64, RMINM, false }, + { "f128_to_i64_r_min", F128_TO_I64, RMIN, false }, + { "f128_to_i64_r_max", F128_TO_I64, RMAX, false }, + { "f128_to_i64_r_near_maxMag", F128_TO_I64, RNMAXM, false }, + { "f128_to_ui32_rx_near_even", F128_TO_UI32, RNEVEN, true }, + { "f128_to_ui32_rx_minMag", F128_TO_UI32, RMINM, true }, + { "f128_to_ui32_rx_min", F128_TO_UI32, RMIN, true }, + { "f128_to_ui32_rx_max", F128_TO_UI32, RMAX, true }, + { "f128_to_ui32_rx_near_maxMag", F128_TO_UI32, RNMAXM, true }, + { "f128_to_ui64_rx_near_even", F128_TO_UI64, RNEVEN, true }, + { "f128_to_ui64_rx_minMag", F128_TO_UI64, RMINM, true }, + { "f128_to_ui64_rx_min", F128_TO_UI64, RMIN, true }, + { "f128_to_ui64_rx_max", F128_TO_UI64, RMAX, true }, + { "f128_to_ui64_rx_near_maxMag", F128_TO_UI64, RNMAXM, true }, + { "f128_to_i32_rx_near_even", F128_TO_I32, RNEVEN, true }, + { "f128_to_i32_rx_minMag", F128_TO_I32, RMINM, true }, + { "f128_to_i32_rx_min", F128_TO_I32, RMIN, true }, + { "f128_to_i32_rx_max", F128_TO_I32, RMAX, true }, + { "f128_to_i32_rx_near_maxMag", F128_TO_I32, RNMAXM, true }, + { "f128_to_i64_rx_near_even", F128_TO_I64, RNEVEN, true }, + { "f128_to_i64_rx_minMag", F128_TO_I64, RMINM, true }, + { "f128_to_i64_rx_min", F128_TO_I64, RMIN, true }, + { "f128_to_i64_rx_max", F128_TO_I64, RMAX, true }, + { "f128_to_i64_rx_near_maxMag", F128_TO_I64, RNMAXM, true }, +#ifdef FLOAT16 + { "f128_to_f16", F128_TO_F16, 0, 0 }, +#endif + { "f128_to_f32", F128_TO_F32, 0, 0 }, +#ifdef FLOAT64 + { "f128_to_f64", F128_TO_F64, 0, 0 }, +#endif +#ifdef EXTFLOAT80 + { "f128_to_extF80", F128_TO_EXTF80, 0, 0 }, +#endif + { "f128_roundToInt_r_near_even", F128_ROUNDTOINT, RNEVEN, false }, + { "f128_roundToInt_r_minMag", F128_ROUNDTOINT, RMINM, false }, + { "f128_roundToInt_r_min", F128_ROUNDTOINT, RMIN, false }, + { "f128_roundToInt_r_max", F128_ROUNDTOINT, RMAX, false }, + { "f128_roundToInt_r_near_maxMag", F128_ROUNDTOINT, RNMAXM, false }, + { "f128_roundToInt_x", F128_ROUNDTOINT, 0, true }, + { "f128_add", F128_ADD, 0, 0 }, + { "f128_sub", F128_SUB, 0, 0 }, + { "f128_mul", F128_MUL, 0, 0 }, + { "f128_mulAdd", F128_MULADD, 0, 0 }, + { "f128_div", F128_DIV, 0, 0 }, + { "f128_rem", F128_REM, 0, 0 }, + { "f128_sqrt", F128_SQRT, 0, 0 }, + { "f128_eq", F128_EQ, 0, 0 }, + { "f128_le", F128_LE, 0, 0 }, + { "f128_lt", F128_LT, 0, 0 }, + { "f128_eq_signaling", F128_EQ_SIGNALING, 0, 0 }, + { "f128_le_quiet", F128_LE_QUIET, 0, 0 }, + { "f128_lt_quiet", F128_LT_QUIET, 0, 0 }, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + { 0, 0, 0, 0 } +}; + diff --git a/src/libs/softfloat-3e/testfloat/source/subj-C/subjfloat.c b/src/libs/softfloat-3e/testfloat/source/subj-C/subjfloat.c new file mode 100644 index 00000000..f6526d16 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/subj-C/subjfloat.c @@ -0,0 +1,856 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <fenv.h> +#include <math.h> +#include "platform.h" +#include "softfloat.h" +#include "subjfloat_config.h" +#include "subjfloat.h" + +#pragma STDC FENV_ACCESS ON + +void subjfloat_setRoundingMode( uint_fast8_t roundingMode ) +{ + + fesetround( + (roundingMode == softfloat_round_near_even) ? FE_TONEAREST + : (roundingMode == softfloat_round_minMag) ? FE_TOWARDZERO + : (roundingMode == softfloat_round_min) ? FE_DOWNWARD + : FE_UPWARD + ); + +} + +void subjfloat_setExtF80RoundingPrecision( uint_fast8_t roundingPrecision ) +{ + +} + +uint_fast8_t subjfloat_clearExceptionFlags( void ) +{ + int subjExceptionFlags; + uint_fast8_t exceptionFlags; + + subjExceptionFlags = + fetestexcept( + FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT + ); + feclearexcept( + FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT ); + exceptionFlags = 0; + if ( subjExceptionFlags & FE_INVALID ) { + exceptionFlags |= softfloat_flag_invalid; + } + if ( subjExceptionFlags & FE_DIVBYZERO ) { + exceptionFlags |= softfloat_flag_infinite; + } + if ( subjExceptionFlags & FE_OVERFLOW ) { + exceptionFlags |= softfloat_flag_overflow; + } + if ( subjExceptionFlags & FE_UNDERFLOW ) { + exceptionFlags |= softfloat_flag_underflow; + } + if ( subjExceptionFlags & FE_INEXACT ) { + exceptionFlags |= softfloat_flag_inexact; + } + return exceptionFlags; + +} + +union f32_f { float32_t f32; float f; }; + +float32_t subj_ui32_to_f32( uint32_t a ) +{ + union f32_f uZ; + + uZ.f = a; + return uZ.f32; + +} + +float32_t subj_ui64_to_f32( uint64_t a ) +{ + union f32_f uZ; + + uZ.f = a; + return uZ.f32; + +} + +float32_t subj_i32_to_f32( int32_t a ) +{ + union f32_f uZ; + + uZ.f = a; + return uZ.f32; + +} + +float32_t subj_i64_to_f32( int64_t a ) +{ + union f32_f uZ; + + uZ.f = a; + return uZ.f32; + +} + +uint_fast32_t subj_f32_to_ui32_rx_minMag( float32_t a ) +{ + union f32_f uA; + + uA.f32 = a; + return (uint32_t) uA.f; + +} + +uint_fast64_t subj_f32_to_ui64_rx_minMag( float32_t a ) +{ + union f32_f uA; + + uA.f32 = a; + return (uint64_t) uA.f; + +} + +int_fast32_t subj_f32_to_i32_rx_minMag( float32_t a ) +{ + union f32_f uA; + + uA.f32 = a; + return (int32_t) uA.f; + +} + +int_fast64_t subj_f32_to_i64_rx_minMag( float32_t a ) +{ + union f32_f uA; + + uA.f32 = a; + return (int64_t) uA.f; + +} + +float32_t subj_f32_add( float32_t a, float32_t b ) +{ + union f32_f uA, uB, uZ; + + uA.f32 = a; + uB.f32 = b; + uZ.f = uA.f + uB.f; + return uZ.f32; + +} + +float32_t subj_f32_sub( float32_t a, float32_t b ) +{ + union f32_f uA, uB, uZ; + + uA.f32 = a; + uB.f32 = b; + uZ.f = uA.f - uB.f; + return uZ.f32; + +} + +float32_t subj_f32_mul( float32_t a, float32_t b ) +{ + union f32_f uA, uB, uZ; + + uA.f32 = a; + uB.f32 = b; + uZ.f = uA.f * uB.f; + return uZ.f32; + +} + +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ + +float32_t subj_f32_mulAdd( float32_t a, float32_t b, float32_t c ) +{ + union f32_f uA, uB, uC, uZ; + + uA.f32 = a; + uB.f32 = b; + uC.f32 = c; + uZ.f = fmaf( uA.f, uB.f, uC.f ); + return uZ.f32; + +} + +#endif +#endif + +float32_t subj_f32_div( float32_t a, float32_t b ) +{ + union f32_f uA, uB, uZ; + + uA.f32 = a; + uB.f32 = b; + uZ.f = uA.f / uB.f; + return uZ.f32; + +} + +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ + +float32_t subj_f32_sqrt( float32_t a ) +{ + union f32_f uA, uZ; + + uA.f32 = a; + uZ.f = sqrtf( uA.f ); + return uZ.f32; + +} + +#endif +#endif + +bool subj_f32_eq( float32_t a, float32_t b ) +{ + union f32_f uA, uB; + + uA.f32 = a; + uB.f32 = b; + return (uA.f == uB.f); + +} + +bool subj_f32_le( float32_t a, float32_t b ) +{ + union f32_f uA, uB; + + uA.f32 = a; + uB.f32 = b; + return (uA.f <= uB.f); + +} + +bool subj_f32_lt( float32_t a, float32_t b ) +{ + union f32_f uA, uB; + + uA.f32 = a; + uB.f32 = b; + return (uA.f < uB.f); + +} + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT64 + +union f64_d { float64_t f64; double d; }; + +float64_t subj_ui32_to_f64( uint32_t a ) +{ + union f64_d uZ; + + uZ.d = a; + return uZ.f64; + +} + +float64_t subj_ui64_to_f64( uint64_t a ) +{ + union f64_d uZ; + + uZ.d = a; + return uZ.f64; + +} + +float64_t subj_i32_to_f64( int32_t a ) +{ + union f64_d uZ; + + uZ.d = a; + return uZ.f64; + +} + +float64_t subj_i64_to_f64( int64_t a ) +{ + union f64_d uZ; + + uZ.d = a; + return uZ.f64; + +} + +float64_t subj_f32_to_f64( float32_t a ) +{ + union f32_f uA; + union f64_d uZ; + + uA.f32 = a; + uZ.d = uA.f; + return uZ.f64; + +} + +uint_fast32_t subj_f64_to_ui32_rx_minMag( float64_t a ) +{ + union f64_d uA; + + uA.f64 = a; + return (uint32_t) uA.d; + +} + +uint_fast64_t subj_f64_to_ui64_rx_minMag( float64_t a ) +{ + union f64_d uA; + + uA.f64 = a; + return (uint64_t) uA.d; + +} + +int_fast32_t subj_f64_to_i32_rx_minMag( float64_t a ) +{ + union f64_d uA; + + uA.f64 = a; + return (int32_t) uA.d; + +} + +int_fast64_t subj_f64_to_i64_rx_minMag( float64_t a ) +{ + union f64_d uA; + + uA.f64 = a; + return (int64_t) uA.d; + +} + +float32_t subj_f64_to_f32( float64_t a ) +{ + union f64_d uA; + union f32_f uZ; + + uA.f64 = a; + uZ.f = uA.d; + return uZ.f32; + +} + +float64_t subj_f64_add( float64_t a, float64_t b ) +{ + union f64_d uA, uB, uZ; + + uA.f64 = a; + uB.f64 = b; + uZ.d = uA.d + uB.d; + return uZ.f64; + +} + +float64_t subj_f64_sub( float64_t a, float64_t b ) +{ + union f64_d uA, uB, uZ; + + uA.f64 = a; + uB.f64 = b; + uZ.d = uA.d - uB.d; + return uZ.f64; + +} + +float64_t subj_f64_mul( float64_t a, float64_t b ) +{ + union f64_d uA, uB, uZ; + + uA.f64 = a; + uB.f64 = b; + uZ.d = uA.d * uB.d; + return uZ.f64; + +} + +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ + +float64_t subj_f64_mulAdd( float64_t a, float64_t b, float64_t c ) +{ + union f64_d uA, uB, uC, uZ; + + uA.f64 = a; + uB.f64 = b; + uC.f64 = c; + uZ.d = fma( uA.d, uB.d, uC.d ); + return uZ.f64; + +} + +#endif +#endif + +float64_t subj_f64_div( float64_t a, float64_t b ) +{ + union f64_d uA, uB, uZ; + + uA.f64 = a; + uB.f64 = b; + uZ.d = uA.d / uB.d; + return uZ.f64; + +} + +float64_t subj_f64_sqrt( float64_t a ) +{ + union f64_d uA, uZ; + + uA.f64 = a; + uZ.d = sqrt( uA.d ); + return uZ.f64; + +} + +bool subj_f64_eq( float64_t a, float64_t b ) +{ + union f64_d uA, uB; + + uA.f64 = a; + uB.f64 = b; + return (uA.d == uB.d); + +} + +bool subj_f64_le( float64_t a, float64_t b ) +{ + union f64_d uA, uB; + + uA.f64 = a; + uB.f64 = b; + return (uA.d <= uB.d); + +} + +bool subj_f64_lt( float64_t a, float64_t b ) +{ + union f64_d uA, uB; + + uA.f64 = a; + uB.f64 = b; + return (uA.d < uB.d); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#if defined EXTFLOAT80 && defined LONG_DOUBLE_IS_EXTFLOAT80 + +void subj_ui32_to_extF80M( uint32_t a, extFloat80_t *zPtr ) +{ + + *((long double *) zPtr) = a; + +} + +void subj_ui64_to_extF80M( uint64_t a, extFloat80_t *zPtr ) +{ + + *((long double *) zPtr) = a; + +} + +void subj_i32_to_extF80M( int32_t a, extFloat80_t *zPtr ) +{ + + *((long double *) zPtr) = a; + +} + +void subj_i64_to_extF80M( int64_t a, extFloat80_t *zPtr ) +{ + + *((long double *) zPtr) = a; + +} + +void subj_f32_to_extF80M( float32_t a, extFloat80_t *zPtr ) +{ + union f32_f uA; + + uA.f32 = a; + *((long double *) zPtr) = uA.f; + +} + +#ifdef FLOAT64 + +void subj_f64_to_extF80M( float64_t a, extFloat80_t *zPtr ) +{ + union f64_d uA; + + uA.f64 = a; + *((long double *) zPtr) = uA.d; + +} + +#endif + +uint_fast32_t subj_extF80M_to_ui32_rx_minMag( const extFloat80_t *aPtr ) +{ + + return *((const long double *) aPtr); + +} + +uint_fast64_t subj_extF80M_to_ui64_rx_minMag( const extFloat80_t *aPtr ) +{ + + return *((const long double *) aPtr); + +} + +int_fast32_t subj_extF80M_to_i32_rx_minMag( const extFloat80_t *aPtr ) +{ + + return *((const long double *) aPtr); + +} + +int_fast64_t subj_extF80M_to_i64_rx_minMag( const extFloat80_t *aPtr ) +{ + + return *((const long double *) aPtr); + +} + +float32_t subj_extF80M_to_f32( const extFloat80_t *aPtr ) +{ + union f32_f uZ; + + uZ.f = *((const long double *) aPtr); + return uZ.f32; + +} + +#ifdef FLOAT64 + +float64_t subj_extF80M_to_f64( const extFloat80_t *aPtr ) +{ + union f64_d uZ; + + uZ.d = *((const long double *) aPtr); + return uZ.f64; + +} + +#endif + +void + subj_extF80M_add( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + + *((long double *) zPtr) = + *((const long double *) aPtr) + *((const long double *) bPtr); + +} + +void + subj_extF80M_sub( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + + *((long double *) zPtr) = + *((const long double *) aPtr) - *((const long double *) bPtr); + +} + +void + subj_extF80M_mul( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + + *((long double *) zPtr) = + *((const long double *) aPtr) * *((const long double *) bPtr); + +} + +void + subj_extF80M_div( + const extFloat80_t *aPtr, const extFloat80_t *bPtr, extFloat80_t *zPtr ) +{ + + *((long double *) zPtr) = + *((const long double *) aPtr) / *((const long double *) bPtr); + +} + +bool subj_extF80M_eq( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + + return (*((const long double *) aPtr) == *((const long double *) bPtr)); + +} + +bool subj_extF80M_le( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + + return (*((const long double *) aPtr) <= *((const long double *) bPtr)); + +} + +bool subj_extF80M_lt( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + + return (*((const long double *) aPtr) < *((const long double *) bPtr)); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#if defined FLOAT128 && defined LONG_DOUBLE_IS_FLOAT128 + +void subj_ui32_to_f128M( uint32_t a, float128_t *zPtr ) +{ + + *((long double *) zPtr) = a; + +} + +void subj_ui64_to_f128M( uint64_t a, float128_t *zPtr ) +{ + + *((long double *) zPtr) = a; + +} + +void subj_i32_to_f128M( int32_t a, float128_t *zPtr ) +{ + + *((long double *) zPtr) = a; + +} + +void subj_i64_to_f128M( int64_t a, float128_t *zPtr ) +{ + + *((long double *) zPtr) = a; + +} + +void subj_f32_to_f128M( float32_t a, float128_t *zPtr ) +{ + union f32_f uA; + + uA.f32 = a; + *((long double *) zPtr) = uA.f; + +} + +#ifdef FLOAT64 + +void subj_f64_to_f128M( float64_t a, float128_t *zPtr ) +{ + union f64_d uA; + + uA.f64 = a; + *((long double *) zPtr) = uA.d; + +} + +#endif + +uint_fast32_t subj_f128M_to_ui32_rx_minMag( const float128_t *aPtr ) +{ + + return *((const long double *) aPtr); + +} + +uint_fast64_t subj_f128M_to_ui64_rx_minMag( const float128_t *aPtr ) +{ + + return *((const long double *) aPtr); + +} + +int_fast32_t subj_f128M_to_i32_rx_minMag( const float128_t *aPtr ) +{ + + return *((const long double *) aPtr); + +} + +int_fast64_t subj_f128M_to_i64_rx_minMag( const float128_t *aPtr ) +{ + + return *((const long double *) aPtr); + +} + +float32_t subj_f128M_to_f32( const float128_t *aPtr ) +{ + union f32_f uZ; + + uZ.f = *((const long double *) aPtr); + return uZ.f32; + +} + +#ifdef FLOAT64 + +float64_t subj_f128M_to_f64( const float128_t *aPtr ) +{ + union f64_d uZ; + + uZ.d = *((const long double *) aPtr); + return uZ.f64; + +} + +#endif + +void + subj_f128M_add( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + + *((long double *) zPtr) = + *((const long double *) aPtr) + *((const long double *) bPtr); + +} + +void + subj_f128M_sub( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + + *((long double *) zPtr) = + *((const long double *) aPtr) - *((const long double *) bPtr); + +} + +void + subj_f128M_mul( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + + *((long double *) zPtr) = + *((const long double *) aPtr) * *((const long double *) bPtr); + +} + +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ + +void + subj_f128M_mulAdd( + const float128_t *aPtr, + const float128_t *bPtr, + const float128_t *cPtr, + float128_t *zPtr + ) +{ + + *((long double *) zPtr) = + fmal( + *((const long double *) aPtr), + *((const long double *) bPtr), + *((const long double *) cPtr) + ); + +} + +#endif +#endif + +void + subj_f128M_div( + const float128_t *aPtr, const float128_t *bPtr, float128_t *zPtr ) +{ + + *((long double *) zPtr) = + *((const long double *) aPtr) / *((const long double *) bPtr); + +} + +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ + +void subj_f128M_sqrt( const float128_t *aPtr, float128_t *zPtr ) +{ + + *((long double *) zPtr) = sqrtl( *((const long double *) aPtr) ); + +} + +#endif +#endif + +bool subj_f128M_eq( const float128_t *aPtr, const float128_t *bPtr ) +{ + + return (*((const long double *) aPtr) == *((const long double *) bPtr)); + +} + +bool subj_f128M_le( const float128_t *aPtr, const float128_t *bPtr ) +{ + + return (*((const long double *) aPtr) <= *((const long double *) bPtr)); + +} + +bool subj_f128M_lt( const float128_t *aPtr, const float128_t *bPtr ) +{ + + return (*((const long double *) aPtr) < *((const long double *) bPtr)); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/subj-C/subjfloat_config.h b/src/libs/softfloat-3e/testfloat/source/subj-C/subjfloat_config.h new file mode 100644 index 00000000..3c2ed79d --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/subj-C/subjfloat_config.h @@ -0,0 +1,133 @@ + +/*---------------------------------------------------------------------------- +| The following macros are defined to indicate all the subject functions that +| exist. +*----------------------------------------------------------------------------*/ + +#define SUBJ_UI32_TO_F32 +#define SUBJ_UI64_TO_F32 +#define SUBJ_I32_TO_F32 +#define SUBJ_I64_TO_F32 + +#define SUBJ_F32_TO_UI32_RX_MINMAG +#define SUBJ_F32_TO_UI64_RX_MINMAG +#define SUBJ_F32_TO_I32_RX_MINMAG +#define SUBJ_F32_TO_I64_RX_MINMAG +#define SUBJ_F32_ADD +#define SUBJ_F32_SUB +#define SUBJ_F32_MUL +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ +#define SUBJ_F32_MULADD +#endif +#endif +#define SUBJ_F32_DIV +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ +#define SUBJ_F32_SQRT +#endif +#endif +#define SUBJ_F32_EQ +#define SUBJ_F32_LE +#define SUBJ_F32_LT + +#ifdef FLOAT64 + +#define SUBJ_UI32_TO_F64 +#define SUBJ_UI64_TO_F64 +#define SUBJ_I32_TO_F64 +#define SUBJ_I64_TO_F64 + +#define SUBJ_F32_TO_F64 + +#define SUBJ_F64_TO_UI32_RX_MINMAG +#define SUBJ_F64_TO_UI64_RX_MINMAG +#define SUBJ_F64_TO_I32_RX_MINMAG +#define SUBJ_F64_TO_I64_RX_MINMAG +#define SUBJ_F64_TO_F32 +#define SUBJ_F64_ADD +#define SUBJ_F64_SUB +#define SUBJ_F64_MUL +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ +#define SUBJ_F64_MULADD +#endif +#endif +#define SUBJ_F64_DIV +#define SUBJ_F64_SQRT +#define SUBJ_F64_EQ +#define SUBJ_F64_LE +#define SUBJ_F64_LT + +#endif + +#if defined EXTFLOAT80 && defined LONG_DOUBLE_IS_EXTFLOAT80 + +#define SUBJ_UI32_TO_EXTF80 +#define SUBJ_UI64_TO_EXTF80 +#define SUBJ_I32_TO_EXTF80 +#define SUBJ_I64_TO_EXTF80 + +#define SUBJ_F32_TO_EXTF80 +#ifdef FLOAT64 +#define SUBJ_F64_TO_EXTF80 +#endif + +#define SUBJ_EXTF80_TO_UI32_RX_MINMAG +#define SUBJ_EXTF80_TO_UI64_RX_MINMAG +#define SUBJ_EXTF80_TO_I32_RX_MINMAG +#define SUBJ_EXTF80_TO_I64_RX_MINMAG +#define SUBJ_EXTF80_TO_F32 +#ifdef FLOAT64 +#define SUBJ_EXTF80_TO_F64 +#endif +#define SUBJ_EXTF80_ADD +#define SUBJ_EXTF80_SUB +#define SUBJ_EXTF80_MUL +#define SUBJ_EXTF80_DIV +#define SUBJ_EXTF80_EQ +#define SUBJ_EXTF80_LE +#define SUBJ_EXTF80_LT + +#endif + +#if defined FLOAT128 && defined LONG_DOUBLE_IS_FLOAT128 + +#define SUBJ_UI32_TO_F128 +#define SUBJ_UI64_TO_F128 +#define SUBJ_I32_TO_F128 +#define SUBJ_I64_TO_F128 + +#define SUBJ_F32_TO_F128 +#ifdef FLOAT64 +#define SUBJ_F64_TO_F128 +#endif + +#define SUBJ_F128_TO_UI32_RX_MINMAG +#define SUBJ_F128_TO_UI64_RX_MINMAG +#define SUBJ_F128_TO_I32_RX_MINMAG +#define SUBJ_F128_TO_I64_RX_MINMAG +#define SUBJ_F128_TO_F32 +#ifdef FLOAT64 +#define SUBJ_F128_TO_F64 +#endif +#define SUBJ_F128_ADD +#define SUBJ_F128_SUB +#define SUBJ_F128_MUL +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ +#define SUBJ_F128_MULADD +#endif +#endif +#define SUBJ_F128_DIV +#ifdef __STDC_VERSION__ +#if 199901L <= __STDC_VERSION__ +#define SUBJ_F128_SQRT +#endif +#endif +#define SUBJ_F128_EQ +#define SUBJ_F128_LE +#define SUBJ_F128_LT + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/subjfloat.h b/src/libs/softfloat-3e/testfloat/source/subjfloat.h new file mode 100644 index 00000000..aaf9776b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/subjfloat.h @@ -0,0 +1,516 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "softfloat.h" + +extern void (*const subjfloat_functions[])(); + +void subjfloat_setRoundingMode( uint_fast8_t ); +void subjfloat_setExtF80RoundingPrecision( uint_fast8_t ); +uint_fast8_t subjfloat_clearExceptionFlags( void ); + +/*---------------------------------------------------------------------------- +| Subject function declarations. (Many of these functions may not exist.) +| WARNING: +| This file should not normally be modified. Use "subjfloat_config.h" to +| specify which of these functions actually exist. +*----------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef FLOAT16 +float16_t subj_ui32_to_f16( uint32_t ); +#endif +float32_t subj_ui32_to_f32( uint32_t ); +#ifdef FLOAT64 +float64_t subj_ui32_to_f64( uint32_t ); +#endif +#ifdef EXTFLOAT80 +void subj_ui32_to_extF80M( uint32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void subj_ui32_to_f128M( uint32_t, float128_t * ); +#endif +#ifdef FLOAT16 +float16_t subj_ui64_to_f16( uint64_t ); +#endif +float32_t subj_ui64_to_f32( uint64_t ); +#ifdef FLOAT64 +float64_t subj_ui64_to_f64( uint64_t ); +#endif +#ifdef EXTFLOAT80 +void subj_ui64_to_extF80M( uint64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void subj_ui64_to_f128M( uint64_t, float128_t * ); +#endif +#ifdef FLOAT16 +float16_t subj_i32_to_f16( int32_t ); +#endif +float32_t subj_i32_to_f32( int32_t ); +#ifdef FLOAT64 +float64_t subj_i32_to_f64( int32_t ); +#endif +#ifdef EXTFLOAT80 +void subj_i32_to_extF80M( int32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void subj_i32_to_f128M( int32_t, float128_t * ); +#endif +#ifdef FLOAT16 +float16_t subj_i64_to_f16( int64_t ); +#endif +float32_t subj_i64_to_f32( int64_t ); +#ifdef FLOAT64 +float64_t subj_i64_to_f64( int64_t ); +#endif +#ifdef EXTFLOAT80 +void subj_i64_to_extF80M( int64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void subj_i64_to_f128M( int64_t, float128_t * ); +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef FLOAT16 + +uint_fast32_t subj_f16_to_ui32_r_near_even( float16_t ); +uint_fast32_t subj_f16_to_ui32_r_minMag( float16_t ); +uint_fast32_t subj_f16_to_ui32_r_min( float16_t ); +uint_fast32_t subj_f16_to_ui32_r_max( float16_t ); +uint_fast32_t subj_f16_to_ui32_r_near_maxMag( float16_t ); +uint_fast64_t subj_f16_to_ui64_r_near_even( float16_t ); +uint_fast64_t subj_f16_to_ui64_r_minMag( float16_t ); +uint_fast64_t subj_f16_to_ui64_r_min( float16_t ); +uint_fast64_t subj_f16_to_ui64_r_max( float16_t ); +uint_fast64_t subj_f16_to_ui64_r_near_maxMag( float16_t ); +int_fast32_t subj_f16_to_i32_r_near_even( float16_t ); +int_fast32_t subj_f16_to_i32_r_minMag( float16_t ); +int_fast32_t subj_f16_to_i32_r_min( float16_t ); +int_fast32_t subj_f16_to_i32_r_max( float16_t ); +int_fast32_t subj_f16_to_i32_r_near_maxMag( float16_t ); +int_fast64_t subj_f16_to_i64_r_near_even( float16_t ); +int_fast64_t subj_f16_to_i64_r_minMag( float16_t ); +int_fast64_t subj_f16_to_i64_r_min( float16_t ); +int_fast64_t subj_f16_to_i64_r_max( float16_t ); +int_fast64_t subj_f16_to_i64_r_near_maxMag( float16_t ); + +uint_fast32_t subj_f16_to_ui32_rx_near_even( float16_t ); +uint_fast32_t subj_f16_to_ui32_rx_minMag( float16_t ); +uint_fast32_t subj_f16_to_ui32_rx_min( float16_t ); +uint_fast32_t subj_f16_to_ui32_rx_max( float16_t ); +uint_fast32_t subj_f16_to_ui32_rx_near_maxMag( float16_t ); +uint_fast64_t subj_f16_to_ui64_rx_near_even( float16_t ); +uint_fast64_t subj_f16_to_ui64_rx_minMag( float16_t ); +uint_fast64_t subj_f16_to_ui64_rx_min( float16_t ); +uint_fast64_t subj_f16_to_ui64_rx_max( float16_t ); +uint_fast64_t subj_f16_to_ui64_rx_near_maxMag( float16_t ); +int_fast32_t subj_f16_to_i32_rx_near_even( float16_t ); +int_fast32_t subj_f16_to_i32_rx_minMag( float16_t ); +int_fast32_t subj_f16_to_i32_rx_min( float16_t ); +int_fast32_t subj_f16_to_i32_rx_max( float16_t ); +int_fast32_t subj_f16_to_i32_rx_near_maxMag( float16_t ); +int_fast64_t subj_f16_to_i64_rx_near_even( float16_t ); +int_fast64_t subj_f16_to_i64_rx_minMag( float16_t ); +int_fast64_t subj_f16_to_i64_rx_min( float16_t ); +int_fast64_t subj_f16_to_i64_rx_max( float16_t ); +int_fast64_t subj_f16_to_i64_rx_near_maxMag( float16_t ); + +float32_t subj_f16_to_f32( float16_t ); +#ifdef FLOAT64 +float64_t subj_f16_to_f64( float16_t ); +#endif +#ifdef EXTFLOAT80 +void subj_f16_to_extF80M( float16_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void subj_f16_to_f128M( float16_t, float128_t * ); +#endif + +float16_t subj_f16_roundToInt_r_near_even( float16_t ); +float16_t subj_f16_roundToInt_r_minMag( float16_t ); +float16_t subj_f16_roundToInt_r_min( float16_t ); +float16_t subj_f16_roundToInt_r_max( float16_t ); +float16_t subj_f16_roundToInt_r_near_maxMag( float16_t ); +float16_t subj_f16_roundToInt_x( float16_t ); +float16_t subj_f16_add( float16_t, float16_t ); +float16_t subj_f16_sub( float16_t, float16_t ); +float16_t subj_f16_mul( float16_t, float16_t ); +float16_t subj_f16_mulAdd( float16_t, float16_t, float16_t ); +float16_t subj_f16_div( float16_t, float16_t ); +float16_t subj_f16_rem( float16_t, float16_t ); +float16_t subj_f16_sqrt( float16_t ); +bool subj_f16_eq( float16_t, float16_t ); +bool subj_f16_le( float16_t, float16_t ); +bool subj_f16_lt( float16_t, float16_t ); +bool subj_f16_eq_signaling( float16_t, float16_t ); +bool subj_f16_le_quiet( float16_t, float16_t ); +bool subj_f16_lt_quiet( float16_t, float16_t ); + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +uint_fast32_t subj_f32_to_ui32_r_near_even( float32_t ); +uint_fast32_t subj_f32_to_ui32_r_minMag( float32_t ); +uint_fast32_t subj_f32_to_ui32_r_min( float32_t ); +uint_fast32_t subj_f32_to_ui32_r_max( float32_t ); +uint_fast32_t subj_f32_to_ui32_r_near_maxMag( float32_t ); +uint_fast64_t subj_f32_to_ui64_r_near_even( float32_t ); +uint_fast64_t subj_f32_to_ui64_r_minMag( float32_t ); +uint_fast64_t subj_f32_to_ui64_r_min( float32_t ); +uint_fast64_t subj_f32_to_ui64_r_max( float32_t ); +uint_fast64_t subj_f32_to_ui64_r_near_maxMag( float32_t ); +int_fast32_t subj_f32_to_i32_r_near_even( float32_t ); +int_fast32_t subj_f32_to_i32_r_minMag( float32_t ); +int_fast32_t subj_f32_to_i32_r_min( float32_t ); +int_fast32_t subj_f32_to_i32_r_max( float32_t ); +int_fast32_t subj_f32_to_i32_r_near_maxMag( float32_t ); +int_fast64_t subj_f32_to_i64_r_near_even( float32_t ); +int_fast64_t subj_f32_to_i64_r_minMag( float32_t ); +int_fast64_t subj_f32_to_i64_r_min( float32_t ); +int_fast64_t subj_f32_to_i64_r_max( float32_t ); +int_fast64_t subj_f32_to_i64_r_near_maxMag( float32_t ); + +uint_fast32_t subj_f32_to_ui32_rx_near_even( float32_t ); +uint_fast32_t subj_f32_to_ui32_rx_minMag( float32_t ); +uint_fast32_t subj_f32_to_ui32_rx_min( float32_t ); +uint_fast32_t subj_f32_to_ui32_rx_max( float32_t ); +uint_fast32_t subj_f32_to_ui32_rx_near_maxMag( float32_t ); +uint_fast64_t subj_f32_to_ui64_rx_near_even( float32_t ); +uint_fast64_t subj_f32_to_ui64_rx_minMag( float32_t ); +uint_fast64_t subj_f32_to_ui64_rx_min( float32_t ); +uint_fast64_t subj_f32_to_ui64_rx_max( float32_t ); +uint_fast64_t subj_f32_to_ui64_rx_near_maxMag( float32_t ); +int_fast32_t subj_f32_to_i32_rx_near_even( float32_t ); +int_fast32_t subj_f32_to_i32_rx_minMag( float32_t ); +int_fast32_t subj_f32_to_i32_rx_min( float32_t ); +int_fast32_t subj_f32_to_i32_rx_max( float32_t ); +int_fast32_t subj_f32_to_i32_rx_near_maxMag( float32_t ); +int_fast64_t subj_f32_to_i64_rx_near_even( float32_t ); +int_fast64_t subj_f32_to_i64_rx_minMag( float32_t ); +int_fast64_t subj_f32_to_i64_rx_min( float32_t ); +int_fast64_t subj_f32_to_i64_rx_max( float32_t ); +int_fast64_t subj_f32_to_i64_rx_near_maxMag( float32_t ); + +#ifdef FLOAT16 +float16_t subj_f32_to_f16( float32_t ); +#endif +#ifdef FLOAT64 +float64_t subj_f32_to_f64( float32_t ); +#endif +#ifdef EXTFLOAT80 +void subj_f32_to_extF80M( float32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void subj_f32_to_f128M( float32_t, float128_t * ); +#endif + +float32_t subj_f32_roundToInt_r_near_even( float32_t ); +float32_t subj_f32_roundToInt_r_minMag( float32_t ); +float32_t subj_f32_roundToInt_r_min( float32_t ); +float32_t subj_f32_roundToInt_r_max( float32_t ); +float32_t subj_f32_roundToInt_r_near_maxMag( float32_t ); +float32_t subj_f32_roundToInt_x( float32_t ); +float32_t subj_f32_add( float32_t, float32_t ); +float32_t subj_f32_sub( float32_t, float32_t ); +float32_t subj_f32_mul( float32_t, float32_t ); +float32_t subj_f32_mulAdd( float32_t, float32_t, float32_t ); +float32_t subj_f32_div( float32_t, float32_t ); +float32_t subj_f32_rem( float32_t, float32_t ); +float32_t subj_f32_sqrt( float32_t ); +bool subj_f32_eq( float32_t, float32_t ); +bool subj_f32_le( float32_t, float32_t ); +bool subj_f32_lt( float32_t, float32_t ); +bool subj_f32_eq_signaling( float32_t, float32_t ); +bool subj_f32_le_quiet( float32_t, float32_t ); +bool subj_f32_lt_quiet( float32_t, float32_t ); + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef FLOAT64 + +uint_fast32_t subj_f64_to_ui32_r_near_even( float64_t ); +uint_fast32_t subj_f64_to_ui32_r_minMag( float64_t ); +uint_fast32_t subj_f64_to_ui32_r_min( float64_t ); +uint_fast32_t subj_f64_to_ui32_r_max( float64_t ); +uint_fast32_t subj_f64_to_ui32_r_near_maxMag( float64_t ); +uint_fast64_t subj_f64_to_ui64_r_near_even( float64_t ); +uint_fast64_t subj_f64_to_ui64_r_minMag( float64_t ); +uint_fast64_t subj_f64_to_ui64_r_min( float64_t ); +uint_fast64_t subj_f64_to_ui64_r_max( float64_t ); +uint_fast64_t subj_f64_to_ui64_r_near_maxMag( float64_t ); +int_fast32_t subj_f64_to_i32_r_near_even( float64_t ); +int_fast32_t subj_f64_to_i32_r_minMag( float64_t ); +int_fast32_t subj_f64_to_i32_r_min( float64_t ); +int_fast32_t subj_f64_to_i32_r_max( float64_t ); +int_fast32_t subj_f64_to_i32_r_near_maxMag( float64_t ); +int_fast64_t subj_f64_to_i64_r_near_even( float64_t ); +int_fast64_t subj_f64_to_i64_r_minMag( float64_t ); +int_fast64_t subj_f64_to_i64_r_min( float64_t ); +int_fast64_t subj_f64_to_i64_r_max( float64_t ); +int_fast64_t subj_f64_to_i64_r_near_maxMag( float64_t ); + +uint_fast32_t subj_f64_to_ui32_rx_near_even( float64_t ); +uint_fast32_t subj_f64_to_ui32_rx_minMag( float64_t ); +uint_fast32_t subj_f64_to_ui32_rx_min( float64_t ); +uint_fast32_t subj_f64_to_ui32_rx_max( float64_t ); +uint_fast32_t subj_f64_to_ui32_rx_near_maxMag( float64_t ); +uint_fast64_t subj_f64_to_ui64_rx_near_even( float64_t ); +uint_fast64_t subj_f64_to_ui64_rx_minMag( float64_t ); +uint_fast64_t subj_f64_to_ui64_rx_min( float64_t ); +uint_fast64_t subj_f64_to_ui64_rx_max( float64_t ); +uint_fast64_t subj_f64_to_ui64_rx_near_maxMag( float64_t ); +int_fast32_t subj_f64_to_i32_rx_near_even( float64_t ); +int_fast32_t subj_f64_to_i32_rx_minMag( float64_t ); +int_fast32_t subj_f64_to_i32_rx_min( float64_t ); +int_fast32_t subj_f64_to_i32_rx_max( float64_t ); +int_fast32_t subj_f64_to_i32_rx_near_maxMag( float64_t ); +int_fast64_t subj_f64_to_i64_rx_near_even( float64_t ); +int_fast64_t subj_f64_to_i64_rx_minMag( float64_t ); +int_fast64_t subj_f64_to_i64_rx_min( float64_t ); +int_fast64_t subj_f64_to_i64_rx_max( float64_t ); +int_fast64_t subj_f64_to_i64_rx_near_maxMag( float64_t ); + +#ifdef FLOAT16 +float16_t subj_f64_to_f16( float64_t ); +#endif +float32_t subj_f64_to_f32( float64_t ); +#ifdef EXTFLOAT80 +void subj_f64_to_extF80M( float64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +void subj_f64_to_f128M( float64_t, float128_t * ); +#endif + +float64_t subj_f64_roundToInt_r_near_even( float64_t ); +float64_t subj_f64_roundToInt_r_minMag( float64_t ); +float64_t subj_f64_roundToInt_r_min( float64_t ); +float64_t subj_f64_roundToInt_r_max( float64_t ); +float64_t subj_f64_roundToInt_r_near_maxMag( float64_t ); +float64_t subj_f64_roundToInt_x( float64_t ); +float64_t subj_f64_add( float64_t, float64_t ); +float64_t subj_f64_sub( float64_t, float64_t ); +float64_t subj_f64_mul( float64_t, float64_t ); +float64_t subj_f64_mulAdd( float64_t, float64_t, float64_t ); +float64_t subj_f64_div( float64_t, float64_t ); +float64_t subj_f64_rem( float64_t, float64_t ); +float64_t subj_f64_sqrt( float64_t ); +bool subj_f64_eq( float64_t, float64_t ); +bool subj_f64_le( float64_t, float64_t ); +bool subj_f64_lt( float64_t, float64_t ); +bool subj_f64_eq_signaling( float64_t, float64_t ); +bool subj_f64_le_quiet( float64_t, float64_t ); +bool subj_f64_lt_quiet( float64_t, float64_t ); + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + +uint_fast32_t subj_extF80M_to_ui32_r_near_even( const extFloat80_t * ); +uint_fast32_t subj_extF80M_to_ui32_r_minMag( const extFloat80_t * ); +uint_fast32_t subj_extF80M_to_ui32_r_min( const extFloat80_t * ); +uint_fast32_t subj_extF80M_to_ui32_r_max( const extFloat80_t * ); +uint_fast32_t subj_extF80M_to_ui32_r_near_maxMag( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_r_near_even( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_r_minMag( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_r_min( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_r_max( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_r_near_maxMag( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_r_near_even( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_r_minMag( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_r_min( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_r_max( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_r_near_maxMag( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_r_near_even( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_r_minMag( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_r_min( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_r_max( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_r_near_maxMag( const extFloat80_t * ); + +uint_fast32_t subj_extF80M_to_ui32_rx_near_even( const extFloat80_t * ); +uint_fast32_t subj_extF80M_to_ui32_rx_minMag( const extFloat80_t * ); +uint_fast32_t subj_extF80M_to_ui32_rx_min( const extFloat80_t * ); +uint_fast32_t subj_extF80M_to_ui32_rx_max( const extFloat80_t * ); +uint_fast32_t subj_extF80M_to_ui32_rx_near_maxMag( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_rx_near_even( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_rx_minMag( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_rx_min( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_rx_max( const extFloat80_t * ); +uint_fast64_t subj_extF80M_to_ui64_rx_near_maxMag( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_rx_near_even( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_rx_minMag( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_rx_min( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_rx_max( const extFloat80_t * ); +int_fast32_t subj_extF80M_to_i32_rx_near_maxMag( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_rx_near_even( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_rx_minMag( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_rx_min( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_rx_max( const extFloat80_t * ); +int_fast64_t subj_extF80M_to_i64_rx_near_maxMag( const extFloat80_t * ); + +#ifdef FLOAT16 +float16_t subj_extF80M_to_f16( const extFloat80_t * ); +#endif +float32_t subj_extF80M_to_f32( const extFloat80_t * ); +#ifdef FLOAT64 +float64_t subj_extF80M_to_f64( const extFloat80_t * ); +#endif +#ifdef EXTFLOAT80 +void subj_extF80M_to_f128M( const extFloat80_t *, float128_t * ); +#endif + +void + subj_extF80M_roundToInt_r_near_even( const extFloat80_t *, extFloat80_t * ); +void subj_extF80M_roundToInt_r_minMag( const extFloat80_t *, extFloat80_t * ); +void subj_extF80M_roundToInt_r_min( const extFloat80_t *, extFloat80_t * ); +void subj_extF80M_roundToInt_r_max( const extFloat80_t *, extFloat80_t * ); +void + subj_extF80M_roundToInt_r_near_maxMag( const extFloat80_t *, extFloat80_t * ); +void subj_extF80M_roundToInt_x( const extFloat80_t *, extFloat80_t * ); +void + subj_extF80M_add( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void + subj_extF80M_sub( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void + subj_extF80M_mul( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void + subj_extF80M_div( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void + subj_extF80M_rem( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +void subj_extF80M_sqrt( const extFloat80_t *, extFloat80_t * ); +bool subj_extF80M_eq( const extFloat80_t *, const extFloat80_t * ); +bool subj_extF80M_le( const extFloat80_t *, const extFloat80_t * ); +bool subj_extF80M_lt( const extFloat80_t *, const extFloat80_t * ); +bool subj_extF80M_eq_signaling( const extFloat80_t *, const extFloat80_t * ); +bool subj_extF80M_le_quiet( const extFloat80_t *, const extFloat80_t * ); +bool subj_extF80M_lt_quiet( const extFloat80_t *, const extFloat80_t * ); + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef FLOAT128 + +uint_fast32_t subj_f128M_to_ui32_r_near_even( const float128_t * ); +uint_fast32_t subj_f128M_to_ui32_r_minMag( const float128_t * ); +uint_fast32_t subj_f128M_to_ui32_r_min( const float128_t * ); +uint_fast32_t subj_f128M_to_ui32_r_max( const float128_t * ); +uint_fast32_t subj_f128M_to_ui32_r_near_maxMag( extFloat80_t * ); +uint_fast64_t subj_f128M_to_ui64_r_near_even( const float128_t * ); +uint_fast64_t subj_f128M_to_ui64_r_minMag( const float128_t * ); +uint_fast64_t subj_f128M_to_ui64_r_min( const float128_t * ); +uint_fast64_t subj_f128M_to_ui64_r_max( const float128_t * ); +uint_fast64_t subj_f128M_to_ui64_r_near_maxMag( extFloat80_t * ); +int_fast32_t subj_f128M_to_i32_r_near_even( const float128_t * ); +int_fast32_t subj_f128M_to_i32_r_minMag( const float128_t * ); +int_fast32_t subj_f128M_to_i32_r_min( const float128_t * ); +int_fast32_t subj_f128M_to_i32_r_max( const float128_t * ); +int_fast32_t subj_f128M_to_i32_r_near_maxMag( extFloat80_t * ); +int_fast64_t subj_f128M_to_i64_r_near_even( const float128_t * ); +int_fast64_t subj_f128M_to_i64_r_minMag( const float128_t * ); +int_fast64_t subj_f128M_to_i64_r_min( const float128_t * ); +int_fast64_t subj_f128M_to_i64_r_max( const float128_t * ); +int_fast64_t subj_f128M_to_i64_r_near_maxMag( extFloat80_t * ); + +uint_fast32_t subj_f128M_to_ui32_rx_near_even( const float128_t * ); +uint_fast32_t subj_f128M_to_ui32_rx_minMag( const float128_t * ); +uint_fast32_t subj_f128M_to_ui32_rx_min( const float128_t * ); +uint_fast32_t subj_f128M_to_ui32_rx_max( const float128_t * ); +uint_fast32_t subj_f128M_to_ui32_rx_near_maxMag( extFloat80_t * ); +uint_fast64_t subj_f128M_to_ui64_rx_near_even( const float128_t * ); +uint_fast64_t subj_f128M_to_ui64_rx_minMag( const float128_t * ); +uint_fast64_t subj_f128M_to_ui64_rx_min( const float128_t * ); +uint_fast64_t subj_f128M_to_ui64_rx_max( const float128_t * ); +uint_fast64_t subj_f128M_to_ui64_rx_near_maxMag( extFloat80_t * ); +int_fast32_t subj_f128M_to_i32_rx_near_even( const float128_t * ); +int_fast32_t subj_f128M_to_i32_rx_minMag( const float128_t * ); +int_fast32_t subj_f128M_to_i32_rx_min( const float128_t * ); +int_fast32_t subj_f128M_to_i32_rx_max( const float128_t * ); +int_fast32_t subj_f128M_to_i32_rx_near_maxMag( extFloat80_t * ); +int_fast64_t subj_f128M_to_i64_rx_near_even( const float128_t * ); +int_fast64_t subj_f128M_to_i64_rx_minMag( const float128_t * ); +int_fast64_t subj_f128M_to_i64_rx_min( const float128_t * ); +int_fast64_t subj_f128M_to_i64_rx_max( const float128_t * ); +int_fast64_t subj_f128M_to_i64_rx_near_maxMag( extFloat80_t * ); + +#ifdef FLOAT16 +float16_t subj_f128M_to_f16( const float128_t * ); +#endif +float32_t subj_f128M_to_f32( const float128_t * ); +#ifdef FLOAT64 +float64_t subj_f128M_to_f64( const float128_t * ); +#endif +#ifdef FLOAT128 +void subj_f128M_to_extF80M( const float128_t *, extFloat80_t * ); +#endif + +void subj_f128M_roundToInt_r_near_even( const float128_t, float128_t * ); +void subj_f128M_roundToInt_r_minMag( const float128_t, float128_t * ); +void subj_f128M_roundToInt_r_min( const float128_t, float128_t * ); +void subj_f128M_roundToInt_r_max( const float128_t, float128_t * ); +void subj_f128M_roundToInt_r_near_maxMag( const float128_t, float128_t * ); +void subj_f128M_roundToInt_x( const float128_t, float128_t * ); +void subj_f128M_add( const float128_t *, const float128_t *, float128_t * ); +void subj_f128M_sub( const float128_t *, const float128_t *, float128_t * ); +void subj_f128M_mul( const float128_t *, const float128_t *, float128_t * ); +void + subj_f128M_mulAdd( + const float128_t *, const float128_t *, const float128_t *, float128_t * + ); +void subj_f128M_div( const float128_t *, const float128_t *, float128_t * ); +void subj_f128M_rem( const float128_t *, const float128_t *, float128_t * ); +void subj_f128M_sqrt( const float128_t *, float128_t * ); +bool subj_f128M_eq( const float128_t *, const float128_t * ); +bool subj_f128M_le( const float128_t *, const float128_t * ); +bool subj_f128M_lt( const float128_t *, const float128_t * ); +bool subj_f128M_eq_signaling( const float128_t *, const float128_t * ); +bool subj_f128M_le_quiet( const float128_t *, const float128_t * ); +bool subj_f128M_lt_quiet( const float128_t *, const float128_t * ); + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/subjfloat_functions.c b/src/libs/softfloat-3e/testfloat/source/subjfloat_functions.c new file mode 100644 index 00000000..13b28960 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/subjfloat_functions.c @@ -0,0 +1,1810 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include "platform.h" +#include "subjfloat_config.h" +#include "subjfloat.h" +#include "functions.h" + +typedef void genericFuncType(); + +/*---------------------------------------------------------------------------- +| WARNING: +| This file should not normally be modified. See "subjfloat_config.h" +| instead. +| The order of these array entries must match the order in the array +| `standardFunctionInfos'. Be careful about making changes. +*----------------------------------------------------------------------------*/ + +genericFuncType *const subjfloat_functions[] = { + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT16 +#ifdef SUBJ_UI32_TO_F16 + (genericFuncType *) subj_ui32_to_f16, +#else + 0, +#endif +#endif +#ifdef SUBJ_UI32_TO_F32 + (genericFuncType *) subj_ui32_to_f32, +#else + 0, +#endif +#ifdef FLOAT64 +#ifdef SUBJ_UI32_TO_F64 + (genericFuncType *) subj_ui32_to_f64, +#else + 0, +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_UI32_TO_EXTF80 + (genericFuncType *) subj_ui32_to_extF80M, +#else + 0, +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_UI32_TO_F128 + (genericFuncType *) subj_ui32_to_f128M, +#else + 0, +#endif +#endif +#ifdef FLOAT16 +#ifdef SUBJ_UI64_TO_F16 + (genericFuncType *) subj_ui64_to_f16, +#else + 0, +#endif +#endif +#ifdef SUBJ_UI64_TO_F32 + (genericFuncType *) subj_ui64_to_f32, +#else + 0, +#endif +#ifdef FLOAT64 +#ifdef SUBJ_UI64_TO_F64 + (genericFuncType *) subj_ui64_to_f64, +#else + 0, +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_UI64_TO_EXTF80 + (genericFuncType *) subj_ui64_to_extF80M, +#else + 0, +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_UI64_TO_F128 + (genericFuncType *) subj_ui64_to_f128M, +#else + 0, +#endif +#endif +#ifdef FLOAT16 +#ifdef SUBJ_I32_TO_F16 + (genericFuncType *) subj_i32_to_f16, +#else + 0, +#endif +#endif +#ifdef SUBJ_I32_TO_F32 + (genericFuncType *) subj_i32_to_f32, +#else + 0, +#endif +#ifdef FLOAT64 +#ifdef SUBJ_I32_TO_F64 + (genericFuncType *) subj_i32_to_f64, +#else + 0, +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_I32_TO_EXTF80 + (genericFuncType *) subj_i32_to_extF80M, +#else + 0, +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_I32_TO_F128 + (genericFuncType *) subj_i32_to_f128M, +#else + 0, +#endif +#endif +#ifdef FLOAT16 +#ifdef SUBJ_I64_TO_F16 + (genericFuncType *) subj_i64_to_f16, +#else + 0, +#endif +#endif +#ifdef SUBJ_I64_TO_F32 + (genericFuncType *) subj_i64_to_f32, +#else + 0, +#endif +#ifdef FLOAT64 +#ifdef SUBJ_I64_TO_F64 + (genericFuncType *) subj_i64_to_f64, +#else + 0, +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_I64_TO_EXTF80 + (genericFuncType *) subj_i64_to_extF80M, +#else + 0, +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_I64_TO_F128 + (genericFuncType *) subj_i64_to_f128M, +#else + 0, +#endif +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT16 +#ifdef SUBJ_F16_TO_UI32_R_NEAR_EVEN + (genericFuncType *) subj_f16_to_ui32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_R_MINMAG + (genericFuncType *) subj_f16_to_ui32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_R_MIN + (genericFuncType *) subj_f16_to_ui32_r_min, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_R_MAX + (genericFuncType *) subj_f16_to_ui32_r_max, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_R_NEAR_MAXMAG + (genericFuncType *) subj_f16_to_ui32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_R_NEAR_EVEN + (genericFuncType *) subj_f16_to_ui64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_R_MINMAG + (genericFuncType *) subj_f16_to_ui64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_R_MIN + (genericFuncType *) subj_f16_to_ui64_r_min, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_R_MAX + (genericFuncType *) subj_f16_to_ui64_r_max, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_R_NEAR_MAXMAG + (genericFuncType *) subj_f16_to_ui64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_R_NEAR_EVEN + (genericFuncType *) subj_f16_to_i32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_R_MINMAG + (genericFuncType *) subj_f16_to_i32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_R_MIN + (genericFuncType *) subj_f16_to_i32_r_min, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_R_MAX + (genericFuncType *) subj_f16_to_i32_r_max, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_R_NEAR_MAXMAG + (genericFuncType *) subj_f16_to_i32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_R_NEAR_EVEN + (genericFuncType *) subj_f16_to_i64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_R_MINMAG + (genericFuncType *) subj_f16_to_i64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_R_MIN + (genericFuncType *) subj_f16_to_i64_r_min, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_R_MAX + (genericFuncType *) subj_f16_to_i64_r_max, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_R_NEAR_MAXMAG + (genericFuncType *) subj_f16_to_i64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_RX_NEAR_EVEN + (genericFuncType *) subj_f16_to_ui32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_RX_MINMAG + (genericFuncType *) subj_f16_to_ui32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_RX_MIN + (genericFuncType *) subj_f16_to_ui32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_RX_MAX + (genericFuncType *) subj_f16_to_ui32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI32_RX_NEAR_MAXMAG + (genericFuncType *) subj_f16_to_ui32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_RX_NEAR_EVEN + (genericFuncType *) subj_f16_to_ui64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_RX_MINMAG + (genericFuncType *) subj_f16_to_ui64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_RX_MIN + (genericFuncType *) subj_f16_to_ui64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_RX_MAX + (genericFuncType *) subj_f16_to_ui64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_UI64_RX_NEAR_MAXMAG + (genericFuncType *) subj_f16_to_ui64_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_RX_NEAR_EVEN + (genericFuncType *) subj_f16_to_i32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_RX_MINMAG + (genericFuncType *) subj_f16_to_i32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_RX_MIN + (genericFuncType *) subj_f16_to_i32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_RX_MAX + (genericFuncType *) subj_f16_to_i32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I32_RX_NEAR_MAXMAG + (genericFuncType *) subj_f16_to_i32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_RX_NEAR_EVEN + (genericFuncType *) subj_f16_to_i64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_RX_MINMAG + (genericFuncType *) subj_f16_to_i64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_RX_MIN + (genericFuncType *) subj_f16_to_i64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_RX_MAX + (genericFuncType *) subj_f16_to_i64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_I64_RX_NEAR_MAXMAG + (genericFuncType *) subj_f16_to_i64_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_TO_F32 + (genericFuncType *) subj_f16_to_f32, +#else + 0, +#endif +#ifdef FLOAT64 +#ifdef SUBJ_F16_TO_F64 + (genericFuncType *) subj_f16_to_f64, +#else + 0, +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_F16_TO_EXTF80 + (genericFuncType *) subj_f16_to_extF80M, +#else + 0, +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_F16_TO_F128 + (genericFuncType *) subj_f16_to_f128M, +#else + 0, +#endif +#endif +#ifdef SUBJ_F16_ROUNDTOINT_R_NEAR_EVEN + (genericFuncType *) subj_f16_roundToInt_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F16_ROUNDTOINT_R_MINMAG + (genericFuncType *) subj_f16_roundToInt_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F16_ROUNDTOINT_R_MIN + (genericFuncType *) subj_f16_roundToInt_r_min, +#else + 0, +#endif +#ifdef SUBJ_F16_ROUNDTOINT_R_MAX + (genericFuncType *) subj_f16_roundToInt_r_max, +#else + 0, +#endif +#ifdef SUBJ_F16_ROUNDTOINT_R_NEAR_MAXMAG + (genericFuncType *) subj_f16_roundToInt_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F16_ROUNDTOINT_X + (genericFuncType *) subj_f16_roundToInt_x, +#else + 0, +#endif +#ifdef SUBJ_F16_ADD + (genericFuncType *) subj_f16_add, +#else + 0, +#endif +#ifdef SUBJ_F16_SUB + (genericFuncType *) subj_f16_sub, +#else + 0, +#endif +#ifdef SUBJ_F16_MUL + (genericFuncType *) subj_f16_mul, +#else + 0, +#endif +#ifdef SUBJ_F16_MULADD + (genericFuncType *) subj_f16_mulAdd, +#else + 0, +#endif +#ifdef SUBJ_F16_DIV + (genericFuncType *) subj_f16_div, +#else + 0, +#endif +#ifdef SUBJ_F16_REM + (genericFuncType *) subj_f16_rem, +#else + 0, +#endif +#ifdef SUBJ_F16_SQRT + (genericFuncType *) subj_f16_sqrt, +#else + 0, +#endif +#ifdef SUBJ_F16_EQ + (genericFuncType *) subj_f16_eq, +#else + 0, +#endif +#ifdef SUBJ_F16_LE + (genericFuncType *) subj_f16_le, +#else + 0, +#endif +#ifdef SUBJ_F16_LT + (genericFuncType *) subj_f16_lt, +#else + 0, +#endif +#ifdef SUBJ_F16_EQ_SIGNALING + (genericFuncType *) subj_f16_eq_signaling, +#else + 0, +#endif +#ifdef SUBJ_F16_LE_QUIET + (genericFuncType *) subj_f16_le_quiet, +#else + 0, +#endif +#ifdef SUBJ_F16_LT_QUIET + (genericFuncType *) subj_f16_lt_quiet, +#else + 0, +#endif +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef SUBJ_F32_TO_UI32_R_NEAR_EVEN + (genericFuncType *) subj_f32_to_ui32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_R_MINMAG + (genericFuncType *) subj_f32_to_ui32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_R_MIN + (genericFuncType *) subj_f32_to_ui32_r_min, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_R_MAX + (genericFuncType *) subj_f32_to_ui32_r_max, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_R_NEAR_MAXMAG + (genericFuncType *) subj_f32_to_ui32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_R_NEAR_EVEN + (genericFuncType *) subj_f32_to_ui64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_R_MINMAG + (genericFuncType *) subj_f32_to_ui64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_R_MIN + (genericFuncType *) subj_f32_to_ui64_r_min, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_R_MAX + (genericFuncType *) subj_f32_to_ui64_r_max, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_R_NEAR_MAXMAG + (genericFuncType *) subj_f32_to_ui64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_R_NEAR_EVEN + (genericFuncType *) subj_f32_to_i32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_R_MINMAG + (genericFuncType *) subj_f32_to_i32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_R_MIN + (genericFuncType *) subj_f32_to_i32_r_min, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_R_MAX + (genericFuncType *) subj_f32_to_i32_r_max, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_R_NEAR_MAXMAG + (genericFuncType *) subj_f32_to_i32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_R_NEAR_EVEN + (genericFuncType *) subj_f32_to_i64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_R_MINMAG + (genericFuncType *) subj_f32_to_i64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_R_MIN + (genericFuncType *) subj_f32_to_i64_r_min, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_R_MAX + (genericFuncType *) subj_f32_to_i64_r_max, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_R_NEAR_MAXMAG + (genericFuncType *) subj_f32_to_i64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_RX_NEAR_EVEN + (genericFuncType *) subj_f32_to_ui32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_RX_MINMAG + (genericFuncType *) subj_f32_to_ui32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_RX_MIN + (genericFuncType *) subj_f32_to_ui32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_RX_MAX + (genericFuncType *) subj_f32_to_ui32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI32_RX_NEAR_MAXMAG + (genericFuncType *) subj_f32_to_ui32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_RX_NEAR_EVEN + (genericFuncType *) subj_f32_to_ui64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_RX_MINMAG + (genericFuncType *) subj_f32_to_ui64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_RX_MIN + (genericFuncType *) subj_f32_to_ui64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_RX_MAX + (genericFuncType *) subj_f32_to_ui64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_UI64_RX_NEAR_MAXMAG + (genericFuncType *) subj_f32_to_ui64_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_RX_NEAR_EVEN + (genericFuncType *) subj_f32_to_i32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_RX_MINMAG + (genericFuncType *) subj_f32_to_i32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_RX_MIN + (genericFuncType *) subj_f32_to_i32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_RX_MAX + (genericFuncType *) subj_f32_to_i32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I32_RX_NEAR_MAXMAG + (genericFuncType *) subj_f32_to_i32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_RX_NEAR_EVEN + (genericFuncType *) subj_f32_to_i64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_RX_MINMAG + (genericFuncType *) subj_f32_to_i64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_RX_MIN + (genericFuncType *) subj_f32_to_i64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_RX_MAX + (genericFuncType *) subj_f32_to_i64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F32_TO_I64_RX_NEAR_MAXMAG + (genericFuncType *) subj_f32_to_i64_rx_near_maxMag, +#else + 0, +#endif +#ifdef FLOAT16 +#ifdef SUBJ_F32_TO_F16 + (genericFuncType *) subj_f32_to_f16, +#else + 0, +#endif +#endif +#ifdef FLOAT64 +#ifdef SUBJ_F32_TO_F64 + (genericFuncType *) subj_f32_to_f64, +#else + 0, +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_F32_TO_EXTF80 + (genericFuncType *) subj_f32_to_extF80M, +#else + 0, +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_F32_TO_F128 + (genericFuncType *) subj_f32_to_f128M, +#else + 0, +#endif +#endif +#ifdef SUBJ_F32_ROUNDTOINT_R_NEAR_EVEN + (genericFuncType *) subj_f32_roundToInt_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F32_ROUNDTOINT_R_MINMAG + (genericFuncType *) subj_f32_roundToInt_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F32_ROUNDTOINT_R_MIN + (genericFuncType *) subj_f32_roundToInt_r_min, +#else + 0, +#endif +#ifdef SUBJ_F32_ROUNDTOINT_R_MAX + (genericFuncType *) subj_f32_roundToInt_r_max, +#else + 0, +#endif +#ifdef SUBJ_F32_ROUNDTOINT_R_NEAR_MAXMAG + (genericFuncType *) subj_f32_roundToInt_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F32_ROUNDTOINT_X + (genericFuncType *) subj_f32_roundToInt_x, +#else + 0, +#endif +#ifdef SUBJ_F32_ADD + (genericFuncType *) subj_f32_add, +#else + 0, +#endif +#ifdef SUBJ_F32_SUB + (genericFuncType *) subj_f32_sub, +#else + 0, +#endif +#ifdef SUBJ_F32_MUL + (genericFuncType *) subj_f32_mul, +#else + 0, +#endif +#ifdef SUBJ_F32_MULADD + (genericFuncType *) subj_f32_mulAdd, +#else + 0, +#endif +#ifdef SUBJ_F32_DIV + (genericFuncType *) subj_f32_div, +#else + 0, +#endif +#ifdef SUBJ_F32_REM + (genericFuncType *) subj_f32_rem, +#else + 0, +#endif +#ifdef SUBJ_F32_SQRT + (genericFuncType *) subj_f32_sqrt, +#else + 0, +#endif +#ifdef SUBJ_F32_EQ + (genericFuncType *) subj_f32_eq, +#else + 0, +#endif +#ifdef SUBJ_F32_LE + (genericFuncType *) subj_f32_le, +#else + 0, +#endif +#ifdef SUBJ_F32_LT + (genericFuncType *) subj_f32_lt, +#else + 0, +#endif +#ifdef SUBJ_F32_EQ_SIGNALING + (genericFuncType *) subj_f32_eq_signaling, +#else + 0, +#endif +#ifdef SUBJ_F32_LE_QUIET + (genericFuncType *) subj_f32_le_quiet, +#else + 0, +#endif +#ifdef SUBJ_F32_LT_QUIET + (genericFuncType *) subj_f32_lt_quiet, +#else + 0, +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT64 +#ifdef SUBJ_F64_TO_UI32_R_NEAR_EVEN + (genericFuncType *) subj_f64_to_ui32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_R_MINMAG + (genericFuncType *) subj_f64_to_ui32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_R_MIN + (genericFuncType *) subj_f64_to_ui32_r_min, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_R_MAX + (genericFuncType *) subj_f64_to_ui32_r_max, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_R_NEAR_MAXMAG + (genericFuncType *) subj_f64_to_ui32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_R_NEAR_EVEN + (genericFuncType *) subj_f64_to_ui64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_R_MINMAG + (genericFuncType *) subj_f64_to_ui64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_R_MIN + (genericFuncType *) subj_f64_to_ui64_r_min, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_R_MAX + (genericFuncType *) subj_f64_to_ui64_r_max, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_R_NEAR_MAXMAG + (genericFuncType *) subj_f64_to_ui64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_R_NEAR_EVEN + (genericFuncType *) subj_f64_to_i32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_R_MINMAG + (genericFuncType *) subj_f64_to_i32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_R_MIN + (genericFuncType *) subj_f64_to_i32_r_min, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_R_MAX + (genericFuncType *) subj_f64_to_i32_r_max, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_R_NEAR_MAXMAG + (genericFuncType *) subj_f64_to_i32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_R_NEAR_EVEN + (genericFuncType *) subj_f64_to_i64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_R_MINMAG + (genericFuncType *) subj_f64_to_i64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_R_MIN + (genericFuncType *) subj_f64_to_i64_r_min, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_R_MAX + (genericFuncType *) subj_f64_to_i64_r_max, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_R_NEAR_MAXMAG + (genericFuncType *) subj_f64_to_i64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_RX_NEAR_EVEN + (genericFuncType *) subj_f64_to_ui32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_RX_MINMAG + (genericFuncType *) subj_f64_to_ui32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_RX_MIN + (genericFuncType *) subj_f64_to_ui32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_RX_MAX + (genericFuncType *) subj_f64_to_ui32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI32_RX_NEAR_MAXMAG + (genericFuncType *) subj_f64_to_ui32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_RX_NEAR_EVEN + (genericFuncType *) subj_f64_to_ui64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_RX_MINMAG + (genericFuncType *) subj_f64_to_ui64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_RX_MIN + (genericFuncType *) subj_f64_to_ui64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_RX_MAX + (genericFuncType *) subj_f64_to_ui64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_UI64_RX_NEAR_MAXMAG + (genericFuncType *) subj_f64_to_ui64_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_RX_NEAR_EVEN + (genericFuncType *) subj_f64_to_i32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_RX_MINMAG + (genericFuncType *) subj_f64_to_i32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_RX_MIN + (genericFuncType *) subj_f64_to_i32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_RX_MAX + (genericFuncType *) subj_f64_to_i32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I32_RX_NEAR_MAXMAG + (genericFuncType *) subj_f64_to_i32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_RX_NEAR_EVEN + (genericFuncType *) subj_f64_to_i64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_RX_MINMAG + (genericFuncType *) subj_f64_to_i64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_RX_MIN + (genericFuncType *) subj_f64_to_i64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_RX_MAX + (genericFuncType *) subj_f64_to_i64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F64_TO_I64_RX_NEAR_MAXMAG + (genericFuncType *) subj_f64_to_i64_rx_near_maxMag, +#else + 0, +#endif +#ifdef FLOAT16 +#ifdef SUBJ_F64_TO_F16 + (genericFuncType *) subj_f64_to_f16, +#else + 0, +#endif +#endif +#ifdef SUBJ_F64_TO_F32 + (genericFuncType *) subj_f64_to_f32, +#else + 0, +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_F64_TO_EXTF80 + (genericFuncType *) subj_f64_to_extF80M, +#else + 0, +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_F64_TO_F128 + (genericFuncType *) subj_f64_to_f128M, +#else + 0, +#endif +#endif +#ifdef SUBJ_F64_ROUNDTOINT_R_NEAR_EVEN + (genericFuncType *) subj_f64_roundToInt_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F64_ROUNDTOINT_R_MINMAG + (genericFuncType *) subj_f64_roundToInt_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F64_ROUNDTOINT_R_MIN + (genericFuncType *) subj_f64_roundToInt_r_min, +#else + 0, +#endif +#ifdef SUBJ_F64_ROUNDTOINT_R_MAX + (genericFuncType *) subj_f64_roundToInt_r_max, +#else + 0, +#endif +#ifdef SUBJ_F64_ROUNDTOINT_R_NEAR_MAXMAG + (genericFuncType *) subj_f64_roundToInt_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F64_ROUNDTOINT_X + (genericFuncType *) subj_f64_roundToInt_x, +#else + 0, +#endif +#ifdef SUBJ_F64_ADD + (genericFuncType *) subj_f64_add, +#else + 0, +#endif +#ifdef SUBJ_F64_SUB + (genericFuncType *) subj_f64_sub, +#else + 0, +#endif +#ifdef SUBJ_F64_MUL + (genericFuncType *) subj_f64_mul, +#else + 0, +#endif +#ifdef SUBJ_F64_MULADD + (genericFuncType *) subj_f64_mulAdd, +#else + 0, +#endif +#ifdef SUBJ_F64_DIV + (genericFuncType *) subj_f64_div, +#else + 0, +#endif +#ifdef SUBJ_F64_REM + (genericFuncType *) subj_f64_rem, +#else + 0, +#endif +#ifdef SUBJ_F64_SQRT + (genericFuncType *) subj_f64_sqrt, +#else + 0, +#endif +#ifdef SUBJ_F64_EQ + (genericFuncType *) subj_f64_eq, +#else + 0, +#endif +#ifdef SUBJ_F64_LE + (genericFuncType *) subj_f64_le, +#else + 0, +#endif +#ifdef SUBJ_F64_LT + (genericFuncType *) subj_f64_lt, +#else + 0, +#endif +#ifdef SUBJ_F64_EQ_SIGNALING + (genericFuncType *) subj_f64_eq_signaling, +#else + 0, +#endif +#ifdef SUBJ_F64_LE_QUIET + (genericFuncType *) subj_f64_le_quiet, +#else + 0, +#endif +#ifdef SUBJ_F64_LT_QUIET + (genericFuncType *) subj_f64_lt_quiet, +#else + 0, +#endif +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 +#ifdef SUBJ_EXTF80_TO_UI32_R_NEAR_EVEN + (genericFuncType *) subj_extF80M_to_ui32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_R_MINMAG + (genericFuncType *) subj_extF80M_to_ui32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_R_MIN + (genericFuncType *) subj_extF80M_to_ui32_r_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_R_MAX + (genericFuncType *) subj_extF80M_to_ui32_r_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_R_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_to_ui32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_R_NEAR_EVEN + (genericFuncType *) subj_extF80M_to_ui64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_R_MINMAG + (genericFuncType *) subj_extF80M_to_ui64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_R_MIN + (genericFuncType *) subj_extF80M_to_ui64_r_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_R_MAX + (genericFuncType *) subj_extF80M_to_ui64_r_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_R_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_to_ui64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_R_NEAR_EVEN + (genericFuncType *) subj_extF80M_to_i32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_R_MINMAG + (genericFuncType *) subj_extF80M_to_i32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_R_MIN + (genericFuncType *) subj_extF80M_to_i32_r_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_R_MAX + (genericFuncType *) subj_extF80M_to_i32_r_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_R_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_to_i32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_R_NEAR_EVEN + (genericFuncType *) subj_extF80M_to_i64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_R_MINMAG + (genericFuncType *) subj_extF80M_to_i64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_R_MIN + (genericFuncType *) subj_extF80M_to_i64_r_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_R_MAX + (genericFuncType *) subj_extF80M_to_i64_r_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_R_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_to_i64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_RX_NEAR_EVEN + (genericFuncType *) subj_extF80M_to_ui32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_RX_MINMAG + (genericFuncType *) subj_extF80M_to_ui32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_RX_MIN + (genericFuncType *) subj_extF80M_to_ui32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_RX_MAX + (genericFuncType *) subj_extF80M_to_ui32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI32_RX_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_to_ui32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_RX_NEAR_EVEN + (genericFuncType *) subj_extF80M_to_ui64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_RX_MINMAG + (genericFuncType *) subj_extF80M_to_ui64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_RX_MIN + (genericFuncType *) subj_extF80M_to_ui64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_RX_MAX + (genericFuncType *) subj_extF80M_to_ui64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_UI64_RX_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_to_ui64_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_RX_NEAR_EVEN + (genericFuncType *) subj_extF80M_to_i32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_RX_MINMAG + (genericFuncType *) subj_extF80M_to_i32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_RX_MIN + (genericFuncType *) subj_extF80M_to_i32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_RX_MAX + (genericFuncType *) subj_extF80M_to_i32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I32_RX_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_to_i32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_RX_NEAR_EVEN + (genericFuncType *) subj_extF80M_to_i64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_RX_MINMAG + (genericFuncType *) subj_extF80M_to_i64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_RX_MIN + (genericFuncType *) subj_extF80M_to_i64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_RX_MAX + (genericFuncType *) subj_extF80M_to_i64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_TO_I64_RX_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_to_i64_rx_near_maxMag, +#else + 0, +#endif +#ifdef FLOAT16 +#ifdef SUBJ_EXTF80_TO_F16 + (genericFuncType *) subj_extF80M_to_f16, +#else + 0, +#endif +#endif +#ifdef SUBJ_EXTF80_TO_F32 + (genericFuncType *) subj_extF80M_to_f32, +#else + 0, +#endif +#ifdef FLOAT64 +#ifdef SUBJ_EXTF80_TO_F64 + (genericFuncType *) subj_extF80M_to_f64, +#else + 0, +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_EXTF80_TO_F128 + (genericFuncType *) subj_extF80M_to_f128M, +#else + 0, +#endif +#endif +#ifdef SUBJ_EXTF80_ROUNDTOINT_R_NEAR_EVEN + (genericFuncType *) subj_extF80M_roundToInt_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_ROUNDTOINT_R_MINMAG + (genericFuncType *) subj_extF80M_roundToInt_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_ROUNDTOINT_R_MIN + (genericFuncType *) subj_extF80M_roundToInt_r_min, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_ROUNDTOINT_R_MAX + (genericFuncType *) subj_extF80M_roundToInt_r_max, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_ROUNDTOINT_R_NEAR_MAXMAG + (genericFuncType *) subj_extF80M_roundToInt_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_ROUNDTOINT_X + (genericFuncType *) subj_extF80M_roundToInt_x, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_ADD + (genericFuncType *) subj_extF80M_add, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_SUB + (genericFuncType *) subj_extF80M_sub, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_MUL + (genericFuncType *) subj_extF80M_mul, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_DIV + (genericFuncType *) subj_extF80M_div, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_REM + (genericFuncType *) subj_extF80M_rem, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_SQRT + (genericFuncType *) subj_extF80M_sqrt, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_EQ + (genericFuncType *) subj_extF80M_eq, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_LE + (genericFuncType *) subj_extF80M_le, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_LT + (genericFuncType *) subj_extF80M_lt, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_EQ_SIGNALING + (genericFuncType *) subj_extF80M_eq_signaling, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_LE_QUIET + (genericFuncType *) subj_extF80M_le_quiet, +#else + 0, +#endif +#ifdef SUBJ_EXTF80_LT_QUIET + (genericFuncType *) subj_extF80M_lt_quiet, +#else + 0, +#endif +#endif + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ +#ifdef FLOAT128 +#ifdef SUBJ_F128_TO_UI32_R_NEAR_EVEN + (genericFuncType *) subj_f128M_to_ui32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_R_MINMAG + (genericFuncType *) subj_f128M_to_ui32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_R_MIN + (genericFuncType *) subj_f128M_to_ui32_r_min, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_R_MAX + (genericFuncType *) subj_f128M_to_ui32_r_max, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_R_NEAR_MAXMAG + (genericFuncType *) subj_f128M_to_ui32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_R_NEAR_EVEN + (genericFuncType *) subj_f128M_to_ui64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_R_MINMAG + (genericFuncType *) subj_f128M_to_ui64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_R_MIN + (genericFuncType *) subj_f128M_to_ui64_r_min, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_R_MAX + (genericFuncType *) subj_f128M_to_ui64_r_max, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_R_NEAR_MAXMAG + (genericFuncType *) subj_f128M_to_ui64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_R_NEAR_EVEN + (genericFuncType *) subj_f128M_to_i32_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_R_MINMAG + (genericFuncType *) subj_f128M_to_i32_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_R_MIN + (genericFuncType *) subj_f128M_to_i32_r_min, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_R_MAX + (genericFuncType *) subj_f128M_to_i32_r_max, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_R_NEAR_MAXMAG + (genericFuncType *) subj_f128M_to_i32_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_R_NEAR_EVEN + (genericFuncType *) subj_f128M_to_i64_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_R_MINMAG + (genericFuncType *) subj_f128M_to_i64_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_R_MIN + (genericFuncType *) subj_f128M_to_i64_r_min, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_R_MAX + (genericFuncType *) subj_f128M_to_i64_r_max, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_R_NEAR_MAXMAG + (genericFuncType *) subj_f128M_to_i64_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_RX_NEAR_EVEN + (genericFuncType *) subj_f128M_to_ui32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_RX_MINMAG + (genericFuncType *) subj_f128M_to_ui32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_RX_MIN + (genericFuncType *) subj_f128M_to_ui32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_RX_MAX + (genericFuncType *) subj_f128M_to_ui32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI32_RX_NEAR_MAXMAG + (genericFuncType *) subj_f128M_to_ui32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_RX_NEAR_EVEN + (genericFuncType *) subj_f128M_to_ui64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_RX_MINMAG + (genericFuncType *) subj_f128M_to_ui64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_RX_MIN + (genericFuncType *) subj_f128M_to_ui64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_RX_MAX + (genericFuncType *) subj_f128M_to_ui64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_UI64_RX_NEAR_MAXMAG + (genericFuncType *) subj_f128M_to_ui64_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_RX_NEAR_EVEN + (genericFuncType *) subj_f128M_to_i32_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_RX_MINMAG + (genericFuncType *) subj_f128M_to_i32_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_RX_MIN + (genericFuncType *) subj_f128M_to_i32_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_RX_MAX + (genericFuncType *) subj_f128M_to_i32_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I32_RX_NEAR_MAXMAG + (genericFuncType *) subj_f128M_to_i32_rx_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_RX_NEAR_EVEN + (genericFuncType *) subj_f128M_to_i64_rx_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_RX_MINMAG + (genericFuncType *) subj_f128M_to_i64_rx_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_RX_MIN + (genericFuncType *) subj_f128M_to_i64_rx_min, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_RX_MAX + (genericFuncType *) subj_f128M_to_i64_rx_max, +#else + 0, +#endif +#ifdef SUBJ_F128_TO_I64_RX_NEAR_MAXMAG + (genericFuncType *) subj_f128M_to_i64_rx_near_maxMag, +#else + 0, +#endif +#ifdef FLOAT16 +#ifdef SUBJ_F128_TO_F16 + (genericFuncType *) subj_f128M_to_f16, +#else + 0, +#endif +#endif +#ifdef SUBJ_F128_TO_F32 + (genericFuncType *) subj_f128M_to_f32, +#else + 0, +#endif +#ifdef FLOAT64 +#ifdef SUBJ_F128_TO_F64 + (genericFuncType *) subj_f128M_to_f64, +#else + 0, +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_F128_TO_EXTF80 + (genericFuncType *) subj_f128M_to_extF80M, +#else + 0, +#endif +#endif +#ifdef SUBJ_F128_ROUNDTOINT_R_NEAR_EVEN + (genericFuncType *) subj_f128M_roundToInt_r_near_even, +#else + 0, +#endif +#ifdef SUBJ_F128_ROUNDTOINT_R_MINMAG + (genericFuncType *) subj_f128M_roundToInt_r_minMag, +#else + 0, +#endif +#ifdef SUBJ_F128_ROUNDTOINT_R_MIN + (genericFuncType *) subj_f128M_roundToInt_r_min, +#else + 0, +#endif +#ifdef SUBJ_F128_ROUNDTOINT_R_MAX + (genericFuncType *) subj_f128M_roundToInt_r_max, +#else + 0, +#endif +#ifdef SUBJ_F128_ROUNDTOINT_R_NEAR_MAXMAG + (genericFuncType *) subj_f128M_roundToInt_r_near_maxMag, +#else + 0, +#endif +#ifdef SUBJ_F128_ROUNDTOINT_X + (genericFuncType *) subj_f128M_roundToInt_x, +#else + 0, +#endif +#ifdef SUBJ_F128_ADD + (genericFuncType *) subj_f128M_add, +#else + 0, +#endif +#ifdef SUBJ_F128_SUB + (genericFuncType *) subj_f128M_sub, +#else + 0, +#endif +#ifdef SUBJ_F128_MUL + (genericFuncType *) subj_f128M_mul, +#else + 0, +#endif +#ifdef SUBJ_F128_MULADD + (genericFuncType *) subj_f128M_mulAdd, +#else + 0, +#endif +#ifdef SUBJ_F128_DIV + (genericFuncType *) subj_f128M_div, +#else + 0, +#endif +#ifdef SUBJ_F128_REM + (genericFuncType *) subj_f128M_rem, +#else + 0, +#endif +#ifdef SUBJ_F128_SQRT + (genericFuncType *) subj_f128M_sqrt, +#else + 0, +#endif +#ifdef SUBJ_F128_EQ + (genericFuncType *) subj_f128M_eq, +#else + 0, +#endif +#ifdef SUBJ_F128_LE + (genericFuncType *) subj_f128M_le, +#else + 0, +#endif +#ifdef SUBJ_F128_LT + (genericFuncType *) subj_f128M_lt, +#else + 0, +#endif +#ifdef SUBJ_F128_EQ_SIGNALING + (genericFuncType *) subj_f128M_eq_signaling, +#else + 0, +#endif +#ifdef SUBJ_F128_LE_QUIET + (genericFuncType *) subj_f128M_le_quiet, +#else + 0, +#endif +#ifdef SUBJ_F128_LT_QUIET + (genericFuncType *) subj_f128M_lt_quiet, +#else + 0, +#endif +#endif +}; + diff --git a/src/libs/softfloat-3e/testfloat/source/testLoops.h b/src/libs/softfloat-3e/testfloat/source/testLoops.h new file mode 100644 index 00000000..f9b88d7d --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/testLoops.h @@ -0,0 +1,578 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include "softfloat.h" + +extern bool testLoops_forever; + +extern uint_fast8_t *testLoops_trueFlagsPtr; +extern uint_fast8_t (*testLoops_subjFlagsFunction)( void ); + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef FLOAT16 +void test_a_ui32_z_f16( float16_t ( uint32_t ), float16_t ( uint32_t ) ); +#endif +void test_a_ui32_z_f32( float32_t ( uint32_t ), float32_t ( uint32_t ) ); +#ifdef FLOAT64 +void test_a_ui32_z_f64( float64_t ( uint32_t ), float64_t ( uint32_t ) ); +#endif +#ifdef EXTFLOAT80 +void + test_a_ui32_z_extF80( + void ( uint32_t, extFloat80_t * ), void ( uint32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void + test_a_ui32_z_f128( + void ( uint32_t, float128_t * ), void ( uint32_t, float128_t * ) + ); +#endif +#ifdef FLOAT16 +void test_a_ui64_z_f16( float16_t ( uint64_t ), float16_t ( uint64_t ) ); +#endif +void test_a_ui64_z_f32( float32_t ( uint64_t ), float32_t ( uint64_t ) ); +#ifdef FLOAT64 +void test_a_ui64_z_f64( float64_t ( uint64_t ), float64_t ( uint64_t ) ); +#endif +#ifdef EXTFLOAT80 +void + test_a_ui64_z_extF80( + void ( uint64_t, extFloat80_t * ), void ( uint64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void + test_a_ui64_z_f128( + void ( uint64_t, float128_t * ), void ( uint64_t, float128_t * ) ); +#endif +#ifdef FLOAT16 +void test_a_i32_z_f16( float16_t ( int32_t ), float16_t ( int32_t ) ); +#endif +void test_a_i32_z_f32( float32_t ( int32_t ), float32_t ( int32_t ) ); +#ifdef FLOAT64 +void test_a_i32_z_f64( float64_t ( int32_t ), float64_t ( int32_t ) ); +#endif +#ifdef EXTFLOAT80 +void + test_a_i32_z_extF80( + void ( int32_t, extFloat80_t * ), void ( int32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void + test_a_i32_z_f128( + void ( int32_t, float128_t * ), void ( int32_t, float128_t * ) ); +#endif +#ifdef FLOAT16 +void test_a_i64_z_f16( float16_t ( int64_t ), float16_t ( int64_t ) ); +#endif +void test_a_i64_z_f32( float32_t ( int64_t ), float32_t ( int64_t ) ); +#ifdef FLOAT64 +void test_a_i64_z_f64( float64_t ( int64_t ), float64_t ( int64_t ) ); +#endif +#ifdef EXTFLOAT80 +void + test_a_i64_z_extF80( + void ( int64_t, extFloat80_t * ), void ( int64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void + test_a_i64_z_f128( + void ( int64_t, float128_t * ), void ( int64_t, float128_t * ) ); +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef FLOAT16 +void + test_a_f16_z_ui32_rx( + uint_fast32_t ( float16_t, uint_fast8_t, bool ), + uint_fast32_t ( float16_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f16_z_ui64_rx( + uint_fast64_t ( float16_t, uint_fast8_t, bool ), + uint_fast64_t ( float16_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f16_z_i32_rx( + int_fast32_t ( float16_t, uint_fast8_t, bool ), + int_fast32_t ( float16_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f16_z_i64_rx( + int_fast64_t ( float16_t, uint_fast8_t, bool ), + int_fast64_t ( float16_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f16_z_ui32_x( + uint_fast32_t ( float16_t, bool ), uint_fast32_t ( float16_t, bool ), bool + ); +void + test_a_f16_z_ui64_x( + uint_fast64_t ( float16_t, bool ), uint_fast64_t ( float16_t, bool ), bool + ); +void + test_a_f16_z_i32_x( + int_fast32_t ( float16_t, bool ), int_fast32_t ( float16_t, bool ), bool + ); +void + test_a_f16_z_i64_x( + int_fast64_t ( float16_t, bool ), int_fast64_t ( float16_t, bool ), bool + ); +void test_a_f16_z_f32( float32_t ( float16_t ), float32_t ( float16_t ) ); +#ifdef FLOAT64 +void test_a_f16_z_f64( float64_t ( float16_t ), float64_t ( float16_t ) ); +#endif +#ifdef EXTFLOAT80 +void + test_a_f16_z_extF80( + void ( float16_t, extFloat80_t * ), void ( float16_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void + test_a_f16_z_f128( + void ( float16_t, float128_t * ), void ( float16_t, float128_t * ) ); +#endif +void test_az_f16( float16_t ( float16_t ), float16_t ( float16_t ) ); +void + test_az_f16_rx( + float16_t ( float16_t, uint_fast8_t, bool ), + float16_t ( float16_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_abz_f16( + float16_t ( float16_t, float16_t ), float16_t ( float16_t, float16_t ) ); +void + test_abcz_f16( + float16_t ( float16_t, float16_t, float16_t ), + float16_t ( float16_t, float16_t, float16_t ) + ); +void + test_ab_f16_z_bool( + bool ( float16_t, float16_t ), bool ( float16_t, float16_t ) ); +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +void + test_a_f32_z_ui32_rx( + uint_fast32_t ( float32_t, uint_fast8_t, bool ), + uint_fast32_t ( float32_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f32_z_ui64_rx( + uint_fast64_t ( float32_t, uint_fast8_t, bool ), + uint_fast64_t ( float32_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f32_z_i32_rx( + int_fast32_t ( float32_t, uint_fast8_t, bool ), + int_fast32_t ( float32_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f32_z_i64_rx( + int_fast64_t ( float32_t, uint_fast8_t, bool ), + int_fast64_t ( float32_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f32_z_ui32_x( + uint_fast32_t ( float32_t, bool ), uint_fast32_t ( float32_t, bool ), bool + ); +void + test_a_f32_z_ui64_x( + uint_fast64_t ( float32_t, bool ), uint_fast64_t ( float32_t, bool ), bool + ); +void + test_a_f32_z_i32_x( + int_fast32_t ( float32_t, bool ), int_fast32_t ( float32_t, bool ), bool + ); +void + test_a_f32_z_i64_x( + int_fast64_t ( float32_t, bool ), int_fast64_t ( float32_t, bool ), bool + ); +#ifdef FLOAT16 +void test_a_f32_z_f16( float16_t ( float32_t ), float16_t ( float32_t ) ); +#endif +#ifdef FLOAT64 +void test_a_f32_z_f64( float64_t ( float32_t ), float64_t ( float32_t ) ); +#endif +#ifdef EXTFLOAT80 +void + test_a_f32_z_extF80( + void ( float32_t, extFloat80_t * ), void ( float32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void + test_a_f32_z_f128( + void ( float32_t, float128_t * ), void ( float32_t, float128_t * ) ); +#endif +void test_az_f32( float32_t ( float32_t ), float32_t ( float32_t ) ); +void + test_az_f32_rx( + float32_t ( float32_t, uint_fast8_t, bool ), + float32_t ( float32_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_abz_f32( + float32_t ( float32_t, float32_t ), float32_t ( float32_t, float32_t ) ); +void + test_abcz_f32( + float32_t ( float32_t, float32_t, float32_t ), + float32_t ( float32_t, float32_t, float32_t ) + ); +void + test_ab_f32_z_bool( + bool ( float32_t, float32_t ), bool ( float32_t, float32_t ) ); + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef FLOAT64 +void + test_a_f64_z_ui32_rx( + uint_fast32_t ( float64_t, uint_fast8_t, bool ), + uint_fast32_t ( float64_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f64_z_ui64_rx( + uint_fast64_t ( float64_t, uint_fast8_t, bool ), + uint_fast64_t ( float64_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f64_z_i32_rx( + int_fast32_t ( float64_t, uint_fast8_t, bool ), + int_fast32_t ( float64_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f64_z_i64_rx( + int_fast64_t ( float64_t, uint_fast8_t, bool ), + int_fast64_t ( float64_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f64_z_ui32_x( + uint_fast32_t ( float64_t, bool ), uint_fast32_t ( float64_t, bool ), bool + ); +void + test_a_f64_z_ui64_x( + uint_fast64_t ( float64_t, bool ), uint_fast64_t ( float64_t, bool ), bool + ); +void + test_a_f64_z_i32_x( + int_fast32_t ( float64_t, bool ), int_fast32_t ( float64_t, bool ), bool + ); +void + test_a_f64_z_i64_x( + int_fast64_t ( float64_t, bool ), int_fast64_t ( float64_t, bool ), bool + ); +#ifdef FLOAT16 +void test_a_f64_z_f16( float16_t ( float64_t ), float16_t ( float64_t ) ); +#endif +void test_a_f64_z_f32( float32_t ( float64_t ), float32_t ( float64_t ) ); +#ifdef EXTFLOAT80 +void + test_a_f64_z_extF80( + void ( float64_t, extFloat80_t * ), void ( float64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void + test_a_f64_z_f128( + void ( float64_t, float128_t * ), void ( float64_t, float128_t * ) ); +#endif +void test_az_f64( float64_t ( float64_t ), float64_t ( float64_t ) ); +void + test_az_f64_rx( + float64_t ( float64_t, uint_fast8_t, bool ), + float64_t ( float64_t, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_abz_f64( + float64_t ( float64_t, float64_t ), float64_t ( float64_t, float64_t ) ); +void + test_abcz_f64( + float64_t ( float64_t, float64_t, float64_t ), + float64_t ( float64_t, float64_t, float64_t ) + ); +void + test_ab_f64_z_bool( + bool ( float64_t, float64_t ), bool ( float64_t, float64_t ) ); +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 +void + test_a_extF80_z_ui32_rx( + uint_fast32_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast32_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_extF80_z_ui64_rx( + uint_fast64_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast64_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_extF80_z_i32_rx( + int_fast32_t ( const extFloat80_t *, uint_fast8_t, bool ), + int_fast32_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_extF80_z_i64_rx( + int_fast64_t ( const extFloat80_t *, uint_fast8_t, bool ), + int_fast64_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_extF80_z_ui32_x( + uint_fast32_t ( const extFloat80_t *, bool ), + uint_fast32_t ( const extFloat80_t *, bool ), + bool + ); +void + test_a_extF80_z_ui64_x( + uint_fast64_t ( const extFloat80_t *, bool ), + uint_fast64_t ( const extFloat80_t *, bool ), + bool + ); +void + test_a_extF80_z_i32_x( + int_fast32_t ( const extFloat80_t *, bool ), + int_fast32_t ( const extFloat80_t *, bool ), + bool + ); +void + test_a_extF80_z_i64_x( + int_fast64_t ( const extFloat80_t *, bool ), + int_fast64_t ( const extFloat80_t *, bool ), + bool + ); +#ifdef FLOAT16 +void + test_a_extF80_z_f16( + float16_t ( const extFloat80_t * ), float16_t ( const extFloat80_t * ) ); +#endif +void + test_a_extF80_z_f32( + float32_t ( const extFloat80_t * ), float32_t ( const extFloat80_t * ) ); +#ifdef FLOAT64 +void + test_a_extF80_z_f64( + float64_t ( const extFloat80_t * ), float64_t ( const extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void + test_a_extF80_z_f128( + void ( const extFloat80_t *, float128_t * ), + void ( const extFloat80_t *, float128_t * ) + ); +#endif +void + test_az_extF80( + void ( const extFloat80_t *, extFloat80_t * ), + void ( const extFloat80_t *, extFloat80_t * ) + ); +void + test_az_extF80_rx( + void ( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + void ( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + uint_fast8_t, + bool + ); +void + test_abz_extF80( + void ( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ), + void ( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ) + ); +void + test_ab_extF80_z_bool( + bool ( const extFloat80_t *, const extFloat80_t * ), + bool ( const extFloat80_t *, const extFloat80_t * ) + ); +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef FLOAT128 +void + test_a_f128_z_ui32_rx( + uint_fast32_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast32_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f128_z_ui64_rx( + uint_fast64_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast64_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f128_z_i32_rx( + int_fast32_t ( const float128_t *, uint_fast8_t, bool ), + int_fast32_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f128_z_i64_rx( + int_fast64_t ( const float128_t *, uint_fast8_t, bool ), + int_fast64_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + test_a_f128_z_ui32_x( + uint_fast32_t ( const float128_t *, bool ), + uint_fast32_t ( const float128_t *, bool ), + bool + ); +void + test_a_f128_z_ui64_x( + uint_fast64_t ( const float128_t *, bool ), + uint_fast64_t ( const float128_t *, bool ), + bool + ); +void + test_a_f128_z_i32_x( + int_fast32_t ( const float128_t *, bool ), + int_fast32_t ( const float128_t *, bool ), + bool + ); +void + test_a_f128_z_i64_x( + int_fast64_t ( const float128_t *, bool ), + int_fast64_t ( const float128_t *, bool ), + bool + ); +#ifdef FLOAT16 +void + test_a_f128_z_f16( + float16_t ( const float128_t * ), float16_t ( const float128_t * ) ); +#endif +void + test_a_f128_z_f32( + float32_t ( const float128_t * ), float32_t ( const float128_t * ) ); +#ifdef FLOAT64 +void + test_a_f128_z_f64( + float64_t ( const float128_t * ), float64_t ( const float128_t * ) ); +#endif +#ifdef EXTFLOAT80 +void + test_a_f128_z_extF80( + void ( const float128_t *, extFloat80_t * ), + void ( const float128_t *, extFloat80_t * ) + ); +#endif +void + test_az_f128( + void ( const float128_t *, float128_t * ), + void ( const float128_t *, float128_t * ) + ); +void + test_az_f128_rx( + void ( const float128_t *, uint_fast8_t, bool, float128_t * ), + void ( const float128_t *, uint_fast8_t, bool, float128_t * ), + uint_fast8_t, + bool + ); +void + test_abz_f128( + void ( const float128_t *, const float128_t *, float128_t * ), + void ( const float128_t *, const float128_t *, float128_t * ) + ); +void + test_abcz_f128( + void + ( const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ), + void + ( const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ) + ); +void + test_ab_f128_z_bool( + bool ( const float128_t *, const float128_t * ), + bool ( const float128_t *, const float128_t * ) + ); +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/testLoops_common.c b/src/libs/softfloat-3e/testfloat/source/testLoops_common.c new file mode 100644 index 00000000..ea6a53d3 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/testLoops_common.c @@ -0,0 +1,47 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "testLoops.h" + +bool testLoops_forever = false; + +uint_fast8_t *testLoops_trueFlagsPtr; +uint_fast8_t (*testLoops_subjFlagsFunction)( void ); + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f128.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f128.c new file mode 100644 index 00000000..d4540952 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f128.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined EXTFLOAT80 && defined FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_f128( + void trueFunction( const extFloat80_t *, float128_t * ), + void subjFunction( const extFloat80_t *, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( &genCases_extF80_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( &genCases_extF80_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && extF80M_isSignalingNaN( &genCases_extF80_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f16.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f16.c new file mode 100644 index 00000000..a1e4f8c1 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f16.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT16 && defined EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_f16( + float16_t trueFunction( const extFloat80_t * ), + float16_t subjFunction( const extFloat80_t * ) + ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && extF80M_isSignalingNaN( &genCases_extF80_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f32.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f32.c new file mode 100644 index 00000000..ff0e31a5 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f32.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_f32( + float32_t trueFunction( const extFloat80_t * ), + float32_t subjFunction( const extFloat80_t * ) + ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && extF80M_isSignalingNaN( &genCases_extF80_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f64.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f64.c new file mode 100644 index 00000000..b105228c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_f64.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT64 && defined EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_f64( + float64_t trueFunction( const extFloat80_t * ), + float64_t subjFunction( const extFloat80_t * ) + ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && extF80M_isSignalingNaN( &genCases_extF80_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i32_rx.c new file mode 100644 index 00000000..fa9fe98d --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i32_rx.c @@ -0,0 +1,105 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_i32_rx( + int_fast32_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + int_fast32_t subjFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! extF80M_isNaN( &genCases_extF80_a ) + || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i32_x.c new file mode 100644 index 00000000..b3dc9c94 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i32_x.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_i32_x( + int_fast32_t trueFunction( const extFloat80_t *, bool ), + int_fast32_t subjFunction( const extFloat80_t *, bool ), + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! extF80M_isNaN( &genCases_extF80_a ) + || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i64_rx.c new file mode 100644 index 00000000..0d711594 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i64_rx.c @@ -0,0 +1,106 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_i64_rx( + int_fast64_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + int_fast64_t subjFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! extF80M_isNaN( &genCases_extF80_a ) + || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, "\n\t" ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i64_x.c new file mode 100644 index 00000000..bfa9a6a5 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_i64_x.c @@ -0,0 +1,105 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_i64_x( + int_fast64_t trueFunction( const extFloat80_t *, bool ), + int_fast64_t subjFunction( const extFloat80_t *, bool ), + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! extF80M_isNaN( &genCases_extF80_a ) + || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, "\n\t" ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui32_rx.c new file mode 100644 index 00000000..9fa9cff5 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui32_rx.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_ui32_rx( + uint_fast32_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast32_t subjFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui32_x.c new file mode 100644 index 00000000..df7d8200 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui32_x.c @@ -0,0 +1,102 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_ui32_x( + uint_fast32_t trueFunction( const extFloat80_t *, bool ), + uint_fast32_t subjFunction( const extFloat80_t *, bool ), + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui64_rx.c new file mode 100644 index 00000000..3a768d7a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui64_rx.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_ui64_rx( + uint_fast64_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast64_t subjFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, "\n\t" ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui64_x.c new file mode 100644 index 00000000..48c59655 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_extF80_z_ui64_x.c @@ -0,0 +1,102 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_extF80_z_ui64_x( + uint_fast64_t trueFunction( const extFloat80_t *, bool ), + uint_fast64_t subjFunction( const extFloat80_t *, bool ), + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, "\n\t" ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_extF80.c new file mode 100644 index 00000000..ec7dfbbf --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_extF80.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined EXTFLOAT80 && defined FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_extF80( + void trueFunction( const float128_t *, extFloat80_t * ), + void subjFunction( const float128_t *, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( &genCases_f128_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( &genCases_f128_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && f128M_isSignalingNaN( &genCases_f128_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f16.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f16.c new file mode 100644 index 00000000..12540780 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f16.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT16 && defined FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_f16( + float16_t trueFunction( const float128_t * ), + float16_t subjFunction( const float128_t * ) + ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && f128M_isSignalingNaN( &genCases_f128_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f32.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f32.c new file mode 100644 index 00000000..24cae7da --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f32.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_f32( + float32_t trueFunction( const float128_t * ), + float32_t subjFunction( const float128_t * ) + ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && f128M_isSignalingNaN( &genCases_f128_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, "\n\t" ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f64.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f64.c new file mode 100644 index 00000000..bcd91bcd --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_f64.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT64 && defined FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_f64( + float64_t trueFunction( const float128_t * ), + float64_t subjFunction( const float128_t * ) + ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && f128M_isSignalingNaN( &genCases_f128_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i32_rx.c new file mode 100644 index 00000000..90848337 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i32_rx.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_i32_rx( + int_fast32_t trueFunction( const float128_t *, uint_fast8_t, bool ), + int_fast32_t subjFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f128M_isNaN( &genCases_f128_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i32_x.c new file mode 100644 index 00000000..52951765 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i32_x.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_i32_x( + int_fast32_t trueFunction( const float128_t *, bool ), + int_fast32_t subjFunction( const float128_t *, bool ), + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f128M_isNaN( &genCases_f128_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i64_rx.c new file mode 100644 index 00000000..e7da2f02 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i64_rx.c @@ -0,0 +1,105 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_i64_rx( + int_fast64_t trueFunction( const float128_t *, uint_fast8_t, bool ), + int_fast64_t subjFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f128M_isNaN( &genCases_f128_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, "\n\t" ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i64_x.c new file mode 100644 index 00000000..0597367b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_i64_x.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_i64_x( + int_fast64_t trueFunction( const float128_t *, bool ), + int_fast64_t subjFunction( const float128_t *, bool ), + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f128M_isNaN( &genCases_f128_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, "\n\t" ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui32_rx.c new file mode 100644 index 00000000..31ede56f --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui32_rx.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_ui32_rx( + uint_fast32_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast32_t subjFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui32_x.c new file mode 100644 index 00000000..b5623e13 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui32_x.c @@ -0,0 +1,102 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_ui32_x( + uint_fast32_t trueFunction( const float128_t *, bool ), + uint_fast32_t subjFunction( const float128_t *, bool ), + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui64_rx.c new file mode 100644 index 00000000..cd58c923 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui64_rx.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_ui64_rx( + uint_fast64_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast64_t subjFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, "\n\t" ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui64_x.c new file mode 100644 index 00000000..9e103f82 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f128_z_ui64_x.c @@ -0,0 +1,102 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f128_z_ui64_x( + uint_fast64_t trueFunction( const float128_t *, bool ), + uint_fast64_t subjFunction( const float128_t *, bool ), + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, "\n\t" ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_extF80.c new file mode 100644 index 00000000..dc442af6 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_extF80.c @@ -0,0 +1,106 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT16 && defined EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_extF80( + void trueFunction( float16_t, extFloat80_t * ), + void subjFunction( float16_t, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_f16_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_f16_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f128.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f128.c new file mode 100644 index 00000000..49c1fe71 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f128.c @@ -0,0 +1,106 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT16 && defined FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_f128( + void trueFunction( float16_t, float128_t * ), + void subjFunction( float16_t, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_f16_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_f16_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f32.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f32.c new file mode 100644 index 00000000..097e9cc0 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f32.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_f32( + float32_t trueFunction( float16_t ), float32_t subjFunction( float16_t ) ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f64.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f64.c new file mode 100644 index 00000000..349cc69a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_f64.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT16 && defined FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_f64( + float64_t trueFunction( float16_t ), float64_t subjFunction( float16_t ) ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i32_rx.c new file mode 100644 index 00000000..ecb5f69a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i32_rx.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_i32_rx( + int_fast32_t trueFunction( float16_t, uint_fast8_t, bool ), + int_fast32_t subjFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f16_isNaN( genCases_f16_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i32_x.c new file mode 100644 index 00000000..373eaf29 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i32_x.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_i32_x( + int_fast32_t trueFunction( float16_t, bool ), + int_fast32_t subjFunction( float16_t, bool ), + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f16_isNaN( genCases_f16_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i64_rx.c new file mode 100644 index 00000000..0ffdd63c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i64_rx.c @@ -0,0 +1,105 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_i64_rx( + int_fast64_t trueFunction( float16_t, uint_fast8_t, bool ), + int_fast64_t subjFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f16_isNaN( genCases_f16_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i64_x.c new file mode 100644 index 00000000..df73dd54 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_i64_x.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_i64_x( + int_fast64_t trueFunction( float16_t, bool ), + int_fast64_t subjFunction( float16_t, bool ), + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f16_isNaN( genCases_f16_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui32_rx.c new file mode 100644 index 00000000..434dd4cc --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui32_rx.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_ui32_rx( + uint_fast32_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast32_t subjFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui32_x.c new file mode 100644 index 00000000..392c3bd5 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui32_x.c @@ -0,0 +1,102 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_ui32_x( + uint_fast32_t trueFunction( float16_t, bool ), + uint_fast32_t subjFunction( float16_t, bool ), + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui64_rx.c new file mode 100644 index 00000000..8b47c95e --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui64_rx.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_ui64_rx( + uint_fast64_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast64_t subjFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui64_x.c new file mode 100644 index 00000000..e13ab5e6 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f16_z_ui64_x.c @@ -0,0 +1,102 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f16_z_ui64_x( + uint_fast64_t trueFunction( float16_t, bool ), + uint_fast64_t subjFunction( float16_t, bool ), + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_extF80.c new file mode 100644 index 00000000..f0473ff8 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_extF80.c @@ -0,0 +1,106 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_extF80( + void trueFunction( float32_t, extFloat80_t * ), + void subjFunction( float32_t, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_f32_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_f32_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f32_isSignalingNaN( genCases_f32_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f128.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f128.c new file mode 100644 index 00000000..956e292d --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f128.c @@ -0,0 +1,106 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_f128( + void trueFunction( float32_t, float128_t * ), + void subjFunction( float32_t, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_f32_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_f32_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f32_isSignalingNaN( genCases_f32_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f16.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f16.c new file mode 100644 index 00000000..3f9e4abe --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f16.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_f16( + float16_t trueFunction( float32_t ), float16_t subjFunction( float32_t ) ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f32_isSignalingNaN( genCases_f32_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f64.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f64.c new file mode 100644 index 00000000..c1d8c4d5 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_f64.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_f64( + float64_t trueFunction( float32_t ), float64_t subjFunction( float32_t ) ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f32_isSignalingNaN( genCases_f32_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i32_rx.c new file mode 100644 index 00000000..12d2053d --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i32_rx.c @@ -0,0 +1,100 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_i32_rx( + int_fast32_t trueFunction( float32_t, uint_fast8_t, bool ), + int_fast32_t subjFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f32_isNaN( genCases_f32_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i32_x.c new file mode 100644 index 00000000..df920aef --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i32_x.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_i32_x( + int_fast32_t trueFunction( float32_t, bool ), + int_fast32_t subjFunction( float32_t, bool ), + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f32_isNaN( genCases_f32_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i64_rx.c new file mode 100644 index 00000000..44efc79e --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i64_rx.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_i64_rx( + int_fast64_t trueFunction( float32_t, uint_fast8_t, bool ), + int_fast64_t subjFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f32_isNaN( genCases_f32_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i64_x.c new file mode 100644 index 00000000..a8dc17af --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_i64_x.c @@ -0,0 +1,100 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_i64_x( + int_fast64_t trueFunction( float32_t, bool ), + int_fast64_t subjFunction( float32_t, bool ), + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f32_isNaN( genCases_f32_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui32_rx.c new file mode 100644 index 00000000..62f865c6 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui32_rx.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_ui32_rx( + uint_fast32_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast32_t subjFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui32_x.c new file mode 100644 index 00000000..91589c4c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui32_x.c @@ -0,0 +1,98 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_ui32_x( + uint_fast32_t trueFunction( float32_t, bool ), + uint_fast32_t subjFunction( float32_t, bool ), + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui64_rx.c new file mode 100644 index 00000000..021102db --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui64_rx.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_ui64_rx( + uint_fast64_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast64_t subjFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui64_x.c new file mode 100644 index 00000000..2287ccb9 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f32_z_ui64_x.c @@ -0,0 +1,98 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_f32_z_ui64_x( + uint_fast64_t trueFunction( float32_t, bool ), + uint_fast64_t subjFunction( float32_t, bool ), + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_extF80.c new file mode 100644 index 00000000..ce18476d --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_extF80.c @@ -0,0 +1,106 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT64 && defined EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_extF80( + void trueFunction( float64_t, extFloat80_t * ), + void subjFunction( float64_t, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_f64_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_f64_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f64_isSignalingNaN( genCases_f64_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f128.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f128.c new file mode 100644 index 00000000..3f36e9e8 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f128.c @@ -0,0 +1,106 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT64 && defined FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_f128( + void trueFunction( float64_t, float128_t * ), + void subjFunction( float64_t, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_f64_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_f64_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f64_isSignalingNaN( genCases_f64_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f16.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f16.c new file mode 100644 index 00000000..63f6c15c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f16.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#if defined FLOAT16 && defined FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_f16( + float16_t trueFunction( float64_t ), float16_t subjFunction( float64_t ) ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f64_isSignalingNaN( genCases_f64_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f32.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f32.c new file mode 100644 index 00000000..8fdad441 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_f32.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_f32( + float32_t trueFunction( float64_t ), float32_t subjFunction( float64_t ) ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f64_isSignalingNaN( genCases_f64_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i32_rx.c new file mode 100644 index 00000000..bd20ad9e --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i32_rx.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_i32_rx( + int_fast32_t trueFunction( float64_t, uint_fast8_t, bool ), + int_fast32_t subjFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f64_isNaN( genCases_f64_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i32_x.c new file mode 100644 index 00000000..cf1ab501 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i32_x.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_i32_x( + int_fast32_t trueFunction( float64_t, bool ), + int_fast32_t subjFunction( float64_t, bool ), + bool exact + ) +{ + int count; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f64_isNaN( genCases_f64_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i64_rx.c new file mode 100644 index 00000000..93dc6a03 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i64_rx.c @@ -0,0 +1,105 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_i64_rx( + int_fast64_t trueFunction( float64_t, uint_fast8_t, bool ), + int_fast64_t subjFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f64_isNaN( genCases_f64_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i64_x.c new file mode 100644 index 00000000..6b1eadef --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_i64_x.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_i64_x( + int_fast64_t trueFunction( float64_t, bool ), + int_fast64_t subjFunction( float64_t, bool ), + bool exact + ) +{ + int count; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f64_isNaN( genCases_f64_a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui32_rx.c new file mode 100644 index 00000000..a7974677 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui32_rx.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_ui32_rx( + uint_fast32_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast32_t subjFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui32_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui32_x.c new file mode 100644 index 00000000..40a6ee17 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui32_x.c @@ -0,0 +1,102 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_ui32_x( + uint_fast32_t trueFunction( float64_t, bool ), + uint_fast32_t subjFunction( float64_t, bool ), + bool exact + ) +{ + int count; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui64_rx.c new file mode 100644 index 00000000..83068dd3 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui64_rx.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_ui64_rx( + uint_fast64_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast64_t subjFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui64_x.c b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui64_x.c new file mode 100644 index 00000000..38e7d55b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_f64_z_ui64_x.c @@ -0,0 +1,102 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_f64_z_ui64_x( + uint_fast64_t trueFunction( float64_t, bool ), + uint_fast64_t subjFunction( float64_t, bool ), + bool exact + ) +{ + int count; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, " " ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_extF80.c new file mode 100644 index 00000000..506f9e66 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_extF80.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_i32_z_extF80( + void trueFunction( int32_t, extFloat80_t * ), + void subjFunction( int32_t, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_i32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_i32_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_i32_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( genCases_i32_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f128.c b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f128.c new file mode 100644 index 00000000..40e2f01a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f128.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_i32_z_f128( + void trueFunction( int32_t, float128_t * ), + void subjFunction( int32_t, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_i32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_i32_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_i32_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( genCases_i32_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f16.c b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f16.c new file mode 100644 index 00000000..7c85d53c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f16.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_i32_z_f16( + float16_t trueFunction( int32_t ), float16_t subjFunction( int32_t ) ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_i32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_i32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_i32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( genCases_i32_a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f32.c b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f32.c new file mode 100644 index 00000000..fa2f8651 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f32.c @@ -0,0 +1,95 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_i32_z_f32( + float32_t trueFunction( int32_t ), float32_t subjFunction( int32_t ) ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_i32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_i32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_i32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( genCases_i32_a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f64.c b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f64.c new file mode 100644 index 00000000..0dbad0be --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i32_z_f64.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_i32_z_f64( + float64_t trueFunction( int32_t ), float64_t subjFunction( int32_t ) ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_i32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_i32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_i32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( genCases_i32_a, " " ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_extF80.c new file mode 100644 index 00000000..d8dc8d59 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_extF80.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_i64_z_extF80( + void trueFunction( int64_t, extFloat80_t * ), + void subjFunction( int64_t, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_i64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_i64_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_i64_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( genCases_i64_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f128.c b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f128.c new file mode 100644 index 00000000..f44f520c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f128.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_i64_z_f128( + void trueFunction( int64_t, float128_t * ), + void subjFunction( int64_t, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_i64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_i64_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_i64_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( genCases_i64_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f16.c b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f16.c new file mode 100644 index 00000000..53551b37 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f16.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_i64_z_f16( + float16_t trueFunction( int64_t ), float16_t subjFunction( int64_t ) ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_i64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_i64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_i64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( genCases_i64_a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f32.c b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f32.c new file mode 100644 index 00000000..19695c89 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f32.c @@ -0,0 +1,95 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_i64_z_f32( + float32_t trueFunction( int64_t ), float32_t subjFunction( int64_t ) ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_i64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_i64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_i64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( genCases_i64_a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f64.c b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f64.c new file mode 100644 index 00000000..24c96c6a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_i64_z_f64.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_i64_z_f64( + float64_t trueFunction( int64_t ), float64_t subjFunction( int64_t ) ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_i64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_i64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_i64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_i64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( genCases_i64_a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_extF80.c new file mode 100644 index 00000000..bdcb2bfe --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_extF80.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui32_z_extF80( + void trueFunction( uint32_t, extFloat80_t * ), + void subjFunction( uint32_t, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_ui32_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_ui32_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( genCases_ui32_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f128.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f128.c new file mode 100644 index 00000000..534cd9ae --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f128.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui32_z_f128( + void trueFunction( uint32_t, float128_t * ), + void subjFunction( uint32_t, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_ui32_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_ui32_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( genCases_ui32_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f16.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f16.c new file mode 100644 index 00000000..6a4cc0e4 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f16.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui32_z_f16( + float16_t trueFunction( uint32_t ), float16_t subjFunction( uint32_t ) ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_ui32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_ui32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( genCases_ui32_a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f32.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f32.c new file mode 100644 index 00000000..fde88485 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f32.c @@ -0,0 +1,95 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui32_z_f32( + float32_t trueFunction( uint32_t ), float32_t subjFunction( uint32_t ) ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_ui32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_ui32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( genCases_ui32_a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f64.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f64.c new file mode 100644 index 00000000..b3f9d882 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui32_z_f64.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui32_z_f64( + float64_t trueFunction( uint32_t ), float64_t subjFunction( uint32_t ) ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_ui32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_ui32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( genCases_ui32_a, " " ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_extF80.c new file mode 100644 index 00000000..325d500c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_extF80.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui64_z_extF80( + void trueFunction( uint64_t, extFloat80_t * ), + void subjFunction( uint64_t, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_ui64_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_ui64_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( genCases_ui64_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f128.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f128.c new file mode 100644 index 00000000..2a57c057 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f128.c @@ -0,0 +1,101 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui64_z_f128( + void trueFunction( uint64_t, float128_t * ), + void subjFunction( uint64_t, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( genCases_ui64_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( genCases_ui64_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( genCases_ui64_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f16.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f16.c new file mode 100644 index 00000000..ce54c8ff --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f16.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui64_z_f16( + float16_t trueFunction( uint64_t ), float16_t subjFunction( uint64_t ) ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_ui64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_ui64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( genCases_ui64_a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f32.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f32.c new file mode 100644 index 00000000..4a6dda3c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f32.c @@ -0,0 +1,95 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui64_z_f32( + float32_t trueFunction( uint64_t ), float32_t subjFunction( uint64_t ) ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_ui64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_ui64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( genCases_ui64_a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f64.c b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f64.c new file mode 100644 index 00000000..9fc9cd17 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_a_ui64_z_f64.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_a_ui64_z_f64( + float64_t trueFunction( uint64_t ), float64_t subjFunction( uint64_t ) ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_ui64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_ui64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_ui64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_ui64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( genCases_ui64_a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_ab_extF80_z_bool.c b/src/libs/softfloat-3e/testfloat/source/test_ab_extF80_z_bool.c new file mode 100644 index 00000000..1a830bcc --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_ab_extF80_z_bool.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_ab_extF80_z_bool( + bool trueFunction( const extFloat80_t *, const extFloat80_t * ), + bool subjFunction( const extFloat80_t *, const extFloat80_t * ) + ) +{ + int count; + bool trueZ; + uint_fast8_t trueFlags; + bool subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_extF80_a, &genCases_extF80_b ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_extF80_a, &genCases_extF80_b ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (extF80M_isSignalingNaN( &genCases_extF80_a ) + || extF80M_isSignalingNaN( &genCases_extF80_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_extF80M( + &genCases_extF80_a, &genCases_extF80_b, " " ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_ab_f128_z_bool.c b/src/libs/softfloat-3e/testfloat/source/test_ab_f128_z_bool.c new file mode 100644 index 00000000..b5ee911b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_ab_f128_z_bool.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_ab_f128_z_bool( + bool trueFunction( const float128_t *, const float128_t * ), + bool subjFunction( const float128_t *, const float128_t * ) + ) +{ + int count; + bool trueZ; + uint_fast8_t trueFlags; + bool subjZ; + uint_fast8_t subjFlags; + + genCases_f128_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &genCases_f128_a, &genCases_f128_b ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( &genCases_f128_a, &genCases_f128_b ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f128M_isSignalingNaN( &genCases_f128_a ) + || f128M_isSignalingNaN( &genCases_f128_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f128M( &genCases_f128_a, &genCases_f128_b ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_ab_f16_z_bool.c b/src/libs/softfloat-3e/testfloat/source/test_ab_f16_z_bool.c new file mode 100644 index 00000000..02be4657 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_ab_f16_z_bool.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_ab_f16_z_bool( + bool trueFunction( float16_t, float16_t ), + bool subjFunction( float16_t, float16_t ) + ) +{ + int count; + bool trueZ; + uint_fast8_t trueFlags; + bool subjZ; + uint_fast8_t subjFlags; + + genCases_f16_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, genCases_f16_b ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, genCases_f16_b ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f16_isSignalingNaN( genCases_f16_a ) + || f16_isSignalingNaN( genCases_f16_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f16( genCases_f16_a, genCases_f16_b ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_ab_f32_z_bool.c b/src/libs/softfloat-3e/testfloat/source/test_ab_f32_z_bool.c new file mode 100644 index 00000000..677892e6 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_ab_f32_z_bool.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_ab_f32_z_bool( + bool trueFunction( float32_t, float32_t ), + bool subjFunction( float32_t, float32_t ) + ) +{ + int count; + bool trueZ; + uint_fast8_t trueFlags; + bool subjZ; + uint_fast8_t subjFlags; + + genCases_f32_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, genCases_f32_b ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, genCases_f32_b ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f32_isSignalingNaN( genCases_f32_a ) + || f32_isSignalingNaN( genCases_f32_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f32( genCases_f32_a, genCases_f32_b ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_ab_f64_z_bool.c b/src/libs/softfloat-3e/testfloat/source/test_ab_f64_z_bool.c new file mode 100644 index 00000000..03b208d7 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_ab_f64_z_bool.c @@ -0,0 +1,103 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_ab_f64_z_bool( + bool trueFunction( float64_t, float64_t ), + bool subjFunction( float64_t, float64_t ) + ) +{ + int count; + bool trueZ; + uint_fast8_t trueFlags; + bool subjZ; + uint_fast8_t subjFlags; + + genCases_f64_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, genCases_f64_b ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, genCases_f64_b ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f64_isSignalingNaN( genCases_f64_a ) + || f64_isSignalingNaN( genCases_f64_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f64( genCases_f64_a, genCases_f64_b, " " ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abcz_f128.c b/src/libs/softfloat-3e/testfloat/source/test_abcz_f128.c new file mode 100644 index 00000000..8e624466 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abcz_f128.c @@ -0,0 +1,125 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_abcz_f128( + void + trueFunction( + const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ), + void + subjFunction( + const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_abc_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_abc_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( + &genCases_f128_a, &genCases_f128_b, &genCases_f128_c, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( + &genCases_f128_a, &genCases_f128_b, &genCases_f128_c, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && ( f128M_isSignalingNaN( &genCases_f128_a ) + || f128M_isSignalingNaN( &genCases_f128_b ) + || f128M_isSignalingNaN( &genCases_f128_c ) + ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_abc_f128M( + &genCases_f128_a, &genCases_f128_b, &genCases_f128_c ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abcz_f16.c b/src/libs/softfloat-3e/testfloat/source/test_abcz_f16.c new file mode 100644 index 00000000..7e455c73 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abcz_f16.c @@ -0,0 +1,111 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_abcz_f16( + float16_t trueFunction( float16_t, float16_t, float16_t ), + float16_t subjFunction( float16_t, float16_t, float16_t ) + ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_abc_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_abc_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, genCases_f16_b, genCases_f16_c ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, genCases_f16_b, genCases_f16_c ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && ( f16_isSignalingNaN( genCases_f16_a ) + || f16_isSignalingNaN( genCases_f16_b ) + || f16_isSignalingNaN( genCases_f16_c ) + ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_abc_f16( + genCases_f16_a, genCases_f16_b, genCases_f16_c ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abcz_f32.c b/src/libs/softfloat-3e/testfloat/source/test_abcz_f32.c new file mode 100644 index 00000000..c7b06c43 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abcz_f32.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_abcz_f32( + float32_t trueFunction( float32_t, float32_t, float32_t ), + float32_t subjFunction( float32_t, float32_t, float32_t ) + ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_abc_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_abc_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, genCases_f32_b, genCases_f32_c ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, genCases_f32_b, genCases_f32_c ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && ( f32_isSignalingNaN( genCases_f32_a ) + || f32_isSignalingNaN( genCases_f32_b ) + || f32_isSignalingNaN( genCases_f32_c ) + ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_abc_f32( + genCases_f32_a, genCases_f32_b, genCases_f32_c ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abcz_f64.c b/src/libs/softfloat-3e/testfloat/source/test_abcz_f64.c new file mode 100644 index 00000000..c15f0429 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abcz_f64.c @@ -0,0 +1,111 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_abcz_f64( + float64_t trueFunction( float64_t, float64_t, float64_t ), + float64_t subjFunction( float64_t, float64_t, float64_t ) + ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_abc_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_abc_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, genCases_f64_b, genCases_f64_c ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, genCases_f64_b, genCases_f64_c ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && ( f64_isSignalingNaN( genCases_f64_a ) + || f64_isSignalingNaN( genCases_f64_b ) + || f64_isSignalingNaN( genCases_f64_c ) + ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_abc_f64( + genCases_f64_a, genCases_f64_b, genCases_f64_c ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abz_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_abz_extF80.c new file mode 100644 index 00000000..041e8b7b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abz_extF80.c @@ -0,0 +1,113 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_abz_extF80( + void + trueFunction( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ), + void + subjFunction( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( &genCases_extF80_a, &genCases_extF80_b, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( &genCases_extF80_a, &genCases_extF80_b, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (extF80M_isSignalingNaN( &genCases_extF80_a ) + || extF80M_isSignalingNaN( &genCases_extF80_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_extF80M( + &genCases_extF80_a, &genCases_extF80_b, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abz_f128.c b/src/libs/softfloat-3e/testfloat/source/test_abz_f128.c new file mode 100644 index 00000000..44f4d79b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abz_f128.c @@ -0,0 +1,108 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_abz_f128( + void trueFunction( const float128_t *, const float128_t *, float128_t * ), + void subjFunction( const float128_t *, const float128_t *, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( &genCases_f128_a, &genCases_f128_b, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( &genCases_f128_a, &genCases_f128_b, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f128M_isSignalingNaN( &genCases_f128_a ) + || f128M_isSignalingNaN( &genCases_f128_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f128M( &genCases_f128_a, &genCases_f128_b ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abz_f16.c b/src/libs/softfloat-3e/testfloat/source/test_abz_f16.c new file mode 100644 index 00000000..40cd2465 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abz_f16.c @@ -0,0 +1,108 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_abz_f16( + float16_t trueFunction( float16_t, float16_t ), + float16_t subjFunction( float16_t, float16_t ) + ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, genCases_f16_b ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, genCases_f16_b ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f16_isSignalingNaN( genCases_f16_a ) + || f16_isSignalingNaN( genCases_f16_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f16( genCases_f16_a, genCases_f16_b ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abz_f32.c b/src/libs/softfloat-3e/testfloat/source/test_abz_f32.c new file mode 100644 index 00000000..f31da82b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abz_f32.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_abz_f32( + float32_t trueFunction( float32_t, float32_t ), + float32_t subjFunction( float32_t, float32_t ) + ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, genCases_f32_b ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, genCases_f32_b ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f32_isSignalingNaN( genCases_f32_a ) + || f32_isSignalingNaN( genCases_f32_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f32( genCases_f32_a, genCases_f32_b ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_abz_f64.c b/src/libs/softfloat-3e/testfloat/source/test_abz_f64.c new file mode 100644 index 00000000..caded698 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_abz_f64.c @@ -0,0 +1,108 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_abz_f64( + float64_t trueFunction( float64_t, float64_t ), + float64_t subjFunction( float64_t, float64_t ) + ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_ab_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_ab_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, genCases_f64_b ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, genCases_f64_b ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f64_isSignalingNaN( genCases_f64_a ) + || f64_isSignalingNaN( genCases_f64_b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f64( genCases_f64_a, genCases_f64_b, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_extF80.c b/src/libs/softfloat-3e/testfloat/source/test_az_extF80.c new file mode 100644 index 00000000..c9e3ed12 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_extF80.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_az_extF80( + void trueFunction( const extFloat80_t *, extFloat80_t * ), + void subjFunction( const extFloat80_t *, extFloat80_t * ) + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( &genCases_extF80_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( &genCases_extF80_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && extF80M_isSignalingNaN( &genCases_extF80_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_extF80_rx.c b/src/libs/softfloat-3e/testfloat/source/test_az_extF80_rx.c new file mode 100644 index 00000000..dd251111 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_extF80_rx.c @@ -0,0 +1,112 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef EXTFLOAT80 + +#pragma STDC FENV_ACCESS ON + +void + test_az_extF80_rx( + void + trueFunction( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + void + subjFunction( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + + genCases_extF80_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_extF80_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( &genCases_extF80_a, roundingMode, exact, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( &genCases_extF80_a, roundingMode, exact, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && extF80M_isSignalingNaN( &genCases_extF80_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &genCases_extF80_a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_f128.c b/src/libs/softfloat-3e/testfloat/source/test_az_f128.c new file mode 100644 index 00000000..fe4358cd --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_f128.c @@ -0,0 +1,107 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_az_f128( + void trueFunction( const float128_t *, float128_t * ), + void subjFunction( const float128_t *, float128_t * ) + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( &genCases_f128_a, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( &genCases_f128_a, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && f128M_isSignalingNaN( &genCases_f128_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_f128_rx.c b/src/libs/softfloat-3e/testfloat/source/test_az_f128_rx.c new file mode 100644 index 00000000..53583fae --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_f128_rx.c @@ -0,0 +1,110 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT128 + +#pragma STDC FENV_ACCESS ON + +void + test_az_f128_rx( + void trueFunction( const float128_t *, uint_fast8_t, bool, float128_t * ), + void subjFunction( const float128_t *, uint_fast8_t, bool, float128_t * ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float128_t trueZ; + uint_fast8_t trueFlags; + float128_t subjZ; + uint_fast8_t subjFlags; + + genCases_f128_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f128_a_next(); + *testLoops_trueFlagsPtr = 0; + trueFunction( &genCases_f128_a, roundingMode, exact, &trueZ ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjFunction( &genCases_f128_a, roundingMode, exact, &subjZ ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && f128M_isSignalingNaN( &genCases_f128_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &genCases_f128_a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_f16.c b/src/libs/softfloat-3e/testfloat/source/test_az_f16.c new file mode 100644 index 00000000..a3c2b9a4 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_f16.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_az_f16( + float16_t trueFunction( float16_t ), float16_t subjFunction( float16_t ) ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_f16_rx.c b/src/libs/softfloat-3e/testfloat/source/test_az_f16_rx.c new file mode 100644 index 00000000..2d1dd1ef --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_f16_rx.c @@ -0,0 +1,109 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT16 + +#pragma STDC FENV_ACCESS ON + +void + test_az_f16_rx( + float16_t trueFunction( float16_t, uint_fast8_t, bool ), + float16_t subjFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float16_t trueZ; + uint_fast8_t trueFlags; + float16_t subjZ; + uint_fast8_t subjFlags; + + genCases_f16_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f16_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f16_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f16_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f16_isSignalingNaN( genCases_f16_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( genCases_f16_a ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_f32.c b/src/libs/softfloat-3e/testfloat/source/test_az_f32.c new file mode 100644 index 00000000..46d62e37 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_f32.c @@ -0,0 +1,100 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_az_f32( + float32_t trueFunction( float32_t ), float32_t subjFunction( float32_t ) ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f32_isSignalingNaN( genCases_f32_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_f32_rx.c b/src/libs/softfloat-3e/testfloat/source/test_az_f32_rx.c new file mode 100644 index 00000000..e3e9953f --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_f32_rx.c @@ -0,0 +1,105 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#pragma STDC FENV_ACCESS ON + +void + test_az_f32_rx( + float32_t trueFunction( float32_t, uint_fast8_t, bool ), + float32_t subjFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float32_t trueZ; + uint_fast8_t trueFlags; + float32_t subjZ; + uint_fast8_t subjFlags; + + genCases_f32_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f32_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f32_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f32_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f32_isSignalingNaN( genCases_f32_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( genCases_f32_a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_f64.c b/src/libs/softfloat-3e/testfloat/source/test_az_f64.c new file mode 100644 index 00000000..01f6760e --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_f64.c @@ -0,0 +1,104 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_az_f64( + float64_t trueFunction( float64_t ), float64_t subjFunction( float64_t ) ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f64_isSignalingNaN( genCases_f64_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/test_az_f64_rx.c b/src/libs/softfloat-3e/testfloat/source/test_az_f64_rx.c new file mode 100644 index 00000000..d0c66447 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/test_az_f64_rx.c @@ -0,0 +1,109 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "softfloat.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +#ifdef FLOAT64 + +#pragma STDC FENV_ACCESS ON + +void + test_az_f64_rx( + float64_t trueFunction( float64_t, uint_fast8_t, bool ), + float64_t subjFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float64_t trueZ; + uint_fast8_t trueFlags; + float64_t subjZ; + uint_fast8_t subjFlags; + + genCases_f64_a_init(); + genCases_writeTestsTotal( testLoops_forever ); + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! genCases_done || testLoops_forever ) { + genCases_f64_a_next(); + *testLoops_trueFlagsPtr = 0; + trueZ = trueFunction( genCases_f64_a, roundingMode, exact ); + trueFlags = *testLoops_trueFlagsPtr; + testLoops_subjFlagsFunction(); + subjZ = subjFunction( genCases_f64_a, roundingMode, exact ); + subjFlags = testLoops_subjFlagsFunction(); + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs && f64_isSignalingNaN( genCases_f64_a ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( genCases_f64_a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/testfloat.c b/src/libs/softfloat-3e/testfloat/source/testfloat.c new file mode 100644 index 00000000..743e37ab --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/testfloat.c @@ -0,0 +1,1715 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <signal.h> +#include "platform.h" +#include "fail.h" +#include "softfloat.h" +#include "subjfloat_config.h" +#include "subjfloat.h" +#include "functions.h" +#include "genCases.h" +#include "verCases.h" +#include "testLoops.h" + +static void catchSIGINT( int signalCode ) +{ + + if ( verCases_stop ) exit( EXIT_FAILURE ); + verCases_stop = true; + +} + +static void (*subjFunctionPtr)(); + +#ifdef FLOAT16 +typedef float16_t funcType_a_ui32_z_f16( uint32_t ); +#endif +typedef float32_t funcType_a_ui32_z_f32( uint32_t ); +#ifdef FLOAT64 +typedef float64_t funcType_a_ui32_z_f64( uint32_t ); +#endif +#ifdef EXTFLOAT80 +typedef void funcType_a_ui32_z_extF80( uint32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +typedef void funcType_a_ui32_z_f128( uint32_t, float128_t * ); +#endif +#ifdef FLOAT16 +typedef float16_t funcType_a_ui64_z_f16( uint64_t ); +#endif +typedef float32_t funcType_a_ui64_z_f32( uint64_t ); +#ifdef FLOAT64 +typedef float64_t funcType_a_ui64_z_f64( uint64_t ); +#endif +#ifdef EXTFLOAT80 +typedef void funcType_a_ui64_z_extF80( uint64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +typedef void funcType_a_ui64_z_f128( uint64_t, float128_t * ); +#endif +#ifdef FLOAT16 +typedef float16_t funcType_a_i32_z_f16( int32_t ); +#endif +typedef float32_t funcType_a_i32_z_f32( int32_t ); +#ifdef FLOAT64 +typedef float64_t funcType_a_i32_z_f64( int32_t ); +#endif +#ifdef EXTFLOAT80 +typedef void funcType_a_i32_z_extF80( int32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +typedef void funcType_a_i32_z_f128( int32_t, float128_t * ); +#endif +#ifdef FLOAT16 +typedef float16_t funcType_a_i64_z_f16( int64_t ); +#endif +typedef float32_t funcType_a_i64_z_f32( int64_t ); +#ifdef FLOAT64 +typedef float64_t funcType_a_i64_z_f64( int64_t ); +#endif +#ifdef EXTFLOAT80 +typedef void funcType_a_i64_z_extF80( int64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +typedef void funcType_a_i64_z_f128( int64_t, float128_t * ); +#endif + +#ifdef FLOAT16 +typedef uint_fast32_t funcType_a_f16_z_ui32( float16_t ); +typedef uint_fast64_t funcType_a_f16_z_ui64( float16_t ); +typedef int_fast32_t funcType_a_f16_z_i32( float16_t ); +typedef int_fast64_t funcType_a_f16_z_i64( float16_t ); +typedef float32_t funcType_a_f16_z_f32( float16_t ); +#ifdef FLOAT64 +typedef float64_t funcType_a_f16_z_f64( float16_t ); +#endif +#ifdef EXTFLOAT80 +typedef void funcType_a_f16_z_extF80( float16_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +typedef void funcType_a_f16_z_f128( float16_t, float128_t * ); +#endif +typedef float16_t funcType_az_f16( float16_t ); +typedef float16_t funcType_abz_f16( float16_t, float16_t ); +typedef float16_t funcType_abcz_f16( float16_t, float16_t, float16_t ); +typedef bool funcType_ab_f16_z_bool( float16_t, float16_t ); +#endif + +typedef uint_fast32_t funcType_a_f32_z_ui32( float32_t ); +typedef uint_fast64_t funcType_a_f32_z_ui64( float32_t ); +typedef int_fast32_t funcType_a_f32_z_i32( float32_t ); +typedef int_fast64_t funcType_a_f32_z_i64( float32_t ); +#ifdef FLOAT16 +typedef float16_t funcType_a_f32_z_f16( float32_t ); +#endif +#ifdef FLOAT64 +typedef float64_t funcType_a_f32_z_f64( float32_t ); +#endif +#ifdef EXTFLOAT80 +typedef void funcType_a_f32_z_extF80( float32_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +typedef void funcType_a_f32_z_f128( float32_t, float128_t * ); +#endif +typedef float32_t funcType_az_f32( float32_t ); +typedef float32_t funcType_abz_f32( float32_t, float32_t ); +typedef float32_t funcType_abcz_f32( float32_t, float32_t, float32_t ); +typedef bool funcType_ab_f32_z_bool( float32_t, float32_t ); + +#ifdef FLOAT64 +typedef uint_fast32_t funcType_a_f64_z_ui32( float64_t ); +typedef uint_fast64_t funcType_a_f64_z_ui64( float64_t ); +typedef int_fast32_t funcType_a_f64_z_i32( float64_t ); +typedef int_fast64_t funcType_a_f64_z_i64( float64_t ); +#ifdef FLOAT16 +typedef float16_t funcType_a_f64_z_f16( float64_t ); +#endif +typedef float32_t funcType_a_f64_z_f32( float64_t ); +#ifdef EXTFLOAT80 +typedef void funcType_a_f64_z_extF80( float64_t, extFloat80_t * ); +#endif +#ifdef FLOAT128 +typedef void funcType_a_f64_z_f128( float64_t, float128_t * ); +#endif +typedef float64_t funcType_az_f64( float64_t ); +typedef float64_t funcType_abz_f64( float64_t, float64_t ); +typedef float64_t funcType_abcz_f64( float64_t, float64_t, float64_t ); +typedef bool funcType_ab_f64_z_bool( float64_t, float64_t ); +#endif + +#ifdef EXTFLOAT80 +typedef uint_fast32_t funcType_a_extF80_z_ui32( const extFloat80_t * ); +typedef uint_fast64_t funcType_a_extF80_z_ui64( const extFloat80_t * ); +typedef int_fast32_t funcType_a_extF80_z_i32( const extFloat80_t * ); +typedef int_fast64_t funcType_a_extF80_z_i64( const extFloat80_t * ); +#ifdef FLOAT16 +typedef float16_t funcType_a_extF80_z_f16( const extFloat80_t * ); +#endif +typedef float32_t funcType_a_extF80_z_f32( const extFloat80_t * ); +#ifdef FLOAT64 +typedef float64_t funcType_a_extF80_z_f64( const extFloat80_t * ); +#endif +#ifdef FLOAT128 +typedef void funcType_a_extF80_z_f128( const extFloat80_t *, float128_t * ); +#endif +typedef void funcType_az_extF80( const extFloat80_t *, extFloat80_t * ); +typedef + void + funcType_abz_extF80( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); +typedef + bool funcType_ab_extF80_z_bool( const extFloat80_t *, const extFloat80_t * ); +#endif + +#ifdef FLOAT128 +typedef uint_fast32_t funcType_a_f128_z_ui32( const float128_t * ); +typedef uint_fast64_t funcType_a_f128_z_ui64( const float128_t * ); +typedef int_fast32_t funcType_a_f128_z_i32( const float128_t * ); +typedef int_fast64_t funcType_a_f128_z_i64( const float128_t * ); +#ifdef FLOAT16 +typedef float16_t funcType_a_f128_z_f16( const float128_t * ); +#endif +typedef float32_t funcType_a_f128_z_f32( const float128_t * ); +#ifdef FLOAT64 +typedef float64_t funcType_a_f128_z_f64( const float128_t * ); +#endif +#ifdef EXTFLOAT80 +typedef void funcType_a_f128_z_extF80( const float128_t *, extFloat80_t * ); +#endif +typedef void funcType_az_f128( const float128_t *, float128_t * ); +typedef + void + funcType_abz_f128( const float128_t *, const float128_t *, float128_t * ); +typedef + void + funcType_abcz_f128( + const float128_t *, const float128_t *, const float128_t *, float128_t * + ); +typedef bool funcType_ab_f128_z_bool( const float128_t *, const float128_t * ); +#endif + +#ifdef FLOAT16 + +static +uint_fast32_t + subjFunction_a_f16_z_ui32_rx( + float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f16_z_ui32 *) subjFunctionPtr)( a ); + +} + +static +uint_fast64_t + subjFunction_a_f16_z_ui64_rx( + float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f16_z_ui64 *) subjFunctionPtr)( a ); + +} + +static +int_fast32_t + subjFunction_a_f16_z_i32_rx( + float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f16_z_i32 *) subjFunctionPtr)( a ); + +} + +static +int_fast64_t + subjFunction_a_f16_z_i64_rx( + float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f16_z_i64 *) subjFunctionPtr)( a ); + +} + +static +float16_t + subjFunction_az_f16_rx( float16_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_az_f16 *) subjFunctionPtr)( a ); + +} + +#endif + +static +uint_fast32_t + subjFunction_a_f32_z_ui32_rx( + float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f32_z_ui32 *) subjFunctionPtr)( a ); + +} + +static +uint_fast64_t + subjFunction_a_f32_z_ui64_rx( + float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f32_z_ui64 *) subjFunctionPtr)( a ); + +} + +static +int_fast32_t + subjFunction_a_f32_z_i32_rx( + float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f32_z_i32 *) subjFunctionPtr)( a ); + +} + +static +int_fast64_t + subjFunction_a_f32_z_i64_rx( + float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f32_z_i64 *) subjFunctionPtr)( a ); + +} + +static +float32_t + subjFunction_az_f32_rx( float32_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_az_f32 *) subjFunctionPtr)( a ); + +} + +#ifdef FLOAT64 + +static +uint_fast32_t + subjFunction_a_f64_z_ui32_rx( + float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f64_z_ui32 *) subjFunctionPtr)( a ); + +} + +static +uint_fast64_t + subjFunction_a_f64_z_ui64_rx( + float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f64_z_ui64 *) subjFunctionPtr)( a ); + +} + +static +int_fast32_t + subjFunction_a_f64_z_i32_rx( + float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f64_z_i32 *) subjFunctionPtr)( a ); + +} + +static +int_fast64_t + subjFunction_a_f64_z_i64_rx( + float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f64_z_i64 *) subjFunctionPtr)( a ); + +} + +static +float64_t + subjFunction_az_f64_rx( float64_t a, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_az_f64 *) subjFunctionPtr)( a ); + +} + +#endif + +#ifdef EXTFLOAT80 + +static +uint_fast32_t + subjFunction_a_extF80_z_ui32_rx( + const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_extF80_z_ui32 *) subjFunctionPtr)( aPtr ); + +} + +static +uint_fast64_t + subjFunction_a_extF80_z_ui64_rx( + const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_extF80_z_ui64 *) subjFunctionPtr)( aPtr ); + +} + +static +int_fast32_t + subjFunction_a_extF80_z_i32_rx( + const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_extF80_z_i32 *) subjFunctionPtr)( aPtr ); + +} + +static +int_fast64_t + subjFunction_a_extF80_z_i64_rx( + const extFloat80_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_extF80_z_i64 *) subjFunctionPtr)( aPtr ); + +} + +static +void + subjFunction_az_extF80_rx( + const extFloat80_t *aPtr, + uint_fast8_t roundingMode, + bool exact, + extFloat80_t *zPtr + ) +{ + + return ((funcType_az_extF80 *) subjFunctionPtr)( aPtr, zPtr ); + +} + +#endif + +#ifdef FLOAT128 + +static +uint_fast32_t + subjFunction_a_f128_z_ui32_rx( + const float128_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f128_z_ui32 *) subjFunctionPtr)( aPtr ); + +} + +static +uint_fast64_t + subjFunction_a_f128_z_ui64_rx( + const float128_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f128_z_ui64 *) subjFunctionPtr)( aPtr ); + +} + +static +int_fast32_t + subjFunction_a_f128_z_i32_rx( + const float128_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f128_z_i32 *) subjFunctionPtr)( aPtr ); + +} + +static +int_fast64_t + subjFunction_a_f128_z_i64_rx( + const float128_t *aPtr, uint_fast8_t roundingMode, bool exact ) +{ + + return ((funcType_a_f128_z_i64 *) subjFunctionPtr)( aPtr ); + +} + +static +void + subjFunction_az_f128_rx( + const float128_t *aPtr, + uint_fast8_t roundingMode, + bool exact, + float128_t *zPtr + ) +{ + + return ((funcType_az_f128 *) subjFunctionPtr)( aPtr, zPtr ); + +} + +#endif + +static +void + testFunctionInstance( + int functionCode, uint_fast8_t roundingMode, bool exact ) +{ +#ifdef FLOAT16 + funcType_abz_f16 *trueFunction_abz_f16; + funcType_ab_f16_z_bool *trueFunction_ab_f16_z_bool; +#endif + funcType_abz_f32 *trueFunction_abz_f32; + funcType_ab_f32_z_bool *trueFunction_ab_f32_z_bool; +#ifdef FLOAT64 + funcType_abz_f64 *trueFunction_abz_f64; + funcType_ab_f64_z_bool *trueFunction_ab_f64_z_bool; +#endif +#ifdef EXTFLOAT80 + funcType_abz_extF80 *trueFunction_abz_extF80; + funcType_ab_extF80_z_bool *trueFunction_ab_extF80_z_bool; +#endif +#ifdef FLOAT128 + funcType_abz_f128 *trueFunction_abz_f128; + funcType_ab_f128_z_bool *trueFunction_ab_f128_z_bool; +#endif + + fputs( "Testing ", stderr ); + verCases_writeFunctionName( stderr ); + fputs( ".\n", stderr ); + switch ( functionCode ) { + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 +#ifdef SUBJ_UI32_TO_F16 + case UI32_TO_F16: + test_a_ui32_z_f16( + ui32_to_f16, (funcType_a_ui32_z_f16 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef SUBJ_UI32_TO_F32 + case UI32_TO_F32: + test_a_ui32_z_f32( + ui32_to_f32, (funcType_a_ui32_z_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef FLOAT64 +#ifdef SUBJ_UI32_TO_F64 + case UI32_TO_F64: + test_a_ui32_z_f64( + ui32_to_f64, (funcType_a_ui32_z_f64 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_UI32_TO_EXTF80 + case UI32_TO_EXTF80: + test_a_ui32_z_extF80( + ui32_to_extF80M, (funcType_a_ui32_z_extF80 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_UI32_TO_F128 + case UI32_TO_F128: + test_a_ui32_z_f128( + ui32_to_f128M, (funcType_a_ui32_z_f128 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT16 +#ifdef SUBJ_UI64_TO_F16 + case UI64_TO_F16: + test_a_ui64_z_f16( + ui64_to_f16, (funcType_a_ui64_z_f16 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef SUBJ_UI64_TO_F32 + case UI64_TO_F32: + test_a_ui64_z_f32( + ui64_to_f32, (funcType_a_ui64_z_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef FLOAT64 +#ifdef SUBJ_UI64_TO_F64 + case UI64_TO_F64: + test_a_ui64_z_f64( + ui64_to_f64, (funcType_a_ui64_z_f64 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_UI64_TO_EXTF80 + case UI64_TO_EXTF80: + test_a_ui64_z_extF80( + ui64_to_extF80M, (funcType_a_ui64_z_extF80 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_UI64_TO_F128 + case UI64_TO_F128: + test_a_ui64_z_f128( + ui64_to_f128M, (funcType_a_ui64_z_f128 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT16 +#ifdef SUBJ_I32_TO_F16 + case I32_TO_F16: + test_a_i32_z_f16( + i32_to_f16, (funcType_a_i32_z_f16 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef SUBJ_I32_TO_F32 + case I32_TO_F32: + test_a_i32_z_f32( + i32_to_f32, (funcType_a_i32_z_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef FLOAT64 +#ifdef SUBJ_I32_TO_F64 + case I32_TO_F64: + test_a_i32_z_f64( + i32_to_f64, (funcType_a_i32_z_f64 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_I32_TO_EXTF80 + case I32_TO_EXTF80: + test_a_i32_z_extF80( + i32_to_extF80M, (funcType_a_i32_z_extF80 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_I32_TO_F128 + case I32_TO_F128: + test_a_i32_z_f128( + i32_to_f128M, (funcType_a_i32_z_f128 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT16 +#ifdef SUBJ_I64_TO_F16 + case I64_TO_F16: + test_a_i64_z_f16( + i64_to_f16, (funcType_a_i64_z_f16 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef SUBJ_I64_TO_F32 + case I64_TO_F32: + test_a_i64_z_f32( + i64_to_f32, (funcType_a_i64_z_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef FLOAT64 +#ifdef SUBJ_I64_TO_F64 + case I64_TO_F64: + test_a_i64_z_f64( + i64_to_f64, (funcType_a_i64_z_f64 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_I64_TO_EXTF80 + case I64_TO_EXTF80: + test_a_i64_z_extF80( + i64_to_extF80M, (funcType_a_i64_z_extF80 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_I64_TO_F128 + case I64_TO_F128: + test_a_i64_z_f128( + i64_to_f128M, (funcType_a_i64_z_f128 *) subjFunctionPtr ); + break; +#endif +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case F16_TO_UI32: + test_a_f16_z_ui32_rx( + f16_to_ui32, subjFunction_a_f16_z_ui32_rx, roundingMode, exact ); + break; + case F16_TO_UI64: + test_a_f16_z_ui64_rx( + f16_to_ui64, subjFunction_a_f16_z_ui64_rx, roundingMode, exact ); + break; + case F16_TO_I32: + test_a_f16_z_i32_rx( + f16_to_i32, subjFunction_a_f16_z_i32_rx, roundingMode, exact ); + break; + case F16_TO_I64: + test_a_f16_z_i64_rx( + f16_to_i64, subjFunction_a_f16_z_i64_rx, roundingMode, exact ); + break; +#ifdef SUBJ_F16_TO_F32 + case F16_TO_F32: + test_a_f16_z_f32( + f16_to_f32, (funcType_a_f16_z_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef FLOAT64 +#ifdef SUBJ_F16_TO_F64 + case F16_TO_F64: + test_a_f16_z_f64( + f16_to_f64, (funcType_a_f16_z_f64 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_F16_TO_EXTF80 + case F16_TO_EXTF80: + test_a_f16_z_extF80( + f16_to_extF80M, (funcType_a_f16_z_extF80 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_F16_TO_F128 + case F16_TO_F128: + test_a_f16_z_f128( + f16_to_f128M, (funcType_a_f16_z_f128 *) subjFunctionPtr ); + break; +#endif +#endif + case F16_ROUNDTOINT: + test_az_f16_rx( + f16_roundToInt, subjFunction_az_f16_rx, roundingMode, exact ); + break; +#ifdef SUBJ_F16_ADD + case F16_ADD: + trueFunction_abz_f16 = f16_add; + goto test_abz_f16; +#endif +#ifdef SUBJ_F16_SUB + case F16_SUB: + trueFunction_abz_f16 = f16_sub; + goto test_abz_f16; +#endif +#ifdef SUBJ_F16_MUL + case F16_MUL: + trueFunction_abz_f16 = f16_mul; + goto test_abz_f16; +#endif +#ifdef SUBJ_F16_MULADD + case F16_MULADD: + test_abcz_f16( f16_mulAdd, (funcType_abcz_f16 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_F16_DIV + case F16_DIV: + trueFunction_abz_f16 = f16_div; + goto test_abz_f16; +#endif +#ifdef SUBJ_F16_REM + case F16_REM: + trueFunction_abz_f16 = f16_rem; + goto test_abz_f16; +#endif + test_abz_f16: + test_abz_f16( + trueFunction_abz_f16, (funcType_abz_f16 *) subjFunctionPtr ); + break; +#ifdef SUBJ_F16_SQRT + case F16_SQRT: + test_az_f16( f16_sqrt, (funcType_az_f16 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_F16_EQ + case F16_EQ: + trueFunction_ab_f16_z_bool = f16_eq; + goto test_ab_f16_z_bool; +#endif +#ifdef SUBJ_F16_LE + case F16_LE: + trueFunction_ab_f16_z_bool = f16_le; + goto test_ab_f16_z_bool; +#endif +#ifdef SUBJ_F16_LT + case F16_LT: + trueFunction_ab_f16_z_bool = f16_lt; + goto test_ab_f16_z_bool; +#endif +#ifdef SUBJ_F16_EQ_SIGNALING + case F16_EQ_SIGNALING: + trueFunction_ab_f16_z_bool = f16_eq_signaling; + goto test_ab_f16_z_bool; +#endif +#ifdef SUBJ_F16_LE_QUIET + case F16_LE_QUIET: + trueFunction_ab_f16_z_bool = f16_le_quiet; + goto test_ab_f16_z_bool; +#endif +#ifdef SUBJ_F16_LT_QUIET + case F16_LT_QUIET: + trueFunction_ab_f16_z_bool = f16_lt_quiet; + goto test_ab_f16_z_bool; +#endif + test_ab_f16_z_bool: + test_ab_f16_z_bool( + trueFunction_ab_f16_z_bool, + (funcType_ab_f16_z_bool *) subjFunctionPtr + ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ + case F32_TO_UI32: + test_a_f32_z_ui32_rx( + f32_to_ui32, subjFunction_a_f32_z_ui32_rx, roundingMode, exact ); + break; + case F32_TO_UI64: + test_a_f32_z_ui64_rx( + f32_to_ui64, subjFunction_a_f32_z_ui64_rx, roundingMode, exact ); + break; + case F32_TO_I32: + test_a_f32_z_i32_rx( + f32_to_i32, subjFunction_a_f32_z_i32_rx, roundingMode, exact ); + break; + case F32_TO_I64: + test_a_f32_z_i64_rx( + f32_to_i64, subjFunction_a_f32_z_i64_rx, roundingMode, exact ); + break; +#ifdef FLOAT16 +#ifdef SUBJ_F32_TO_F16 + case F32_TO_F16: + test_a_f32_z_f16( + f32_to_f16, (funcType_a_f32_z_f16 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT64 +#ifdef SUBJ_F32_TO_F64 + case F32_TO_F64: + test_a_f32_z_f64( + f32_to_f64, (funcType_a_f32_z_f64 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_F32_TO_EXTF80 + case F32_TO_EXTF80: + test_a_f32_z_extF80( + f32_to_extF80M, (funcType_a_f32_z_extF80 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_F32_TO_F128 + case F32_TO_F128: + test_a_f32_z_f128( + f32_to_f128M, (funcType_a_f32_z_f128 *) subjFunctionPtr ); + break; +#endif +#endif + case F32_ROUNDTOINT: + test_az_f32_rx( + f32_roundToInt, subjFunction_az_f32_rx, roundingMode, exact ); + break; +#ifdef SUBJ_F32_ADD + case F32_ADD: + trueFunction_abz_f32 = f32_add; + goto test_abz_f32; +#endif +#ifdef SUBJ_F32_SUB + case F32_SUB: + trueFunction_abz_f32 = f32_sub; + goto test_abz_f32; +#endif +#ifdef SUBJ_F32_MUL + case F32_MUL: + trueFunction_abz_f32 = f32_mul; + goto test_abz_f32; +#endif +#ifdef SUBJ_F32_MULADD + case F32_MULADD: + test_abcz_f32( f32_mulAdd, (funcType_abcz_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_F32_DIV + case F32_DIV: + trueFunction_abz_f32 = f32_div; + goto test_abz_f32; +#endif +#ifdef SUBJ_F32_REM + case F32_REM: + trueFunction_abz_f32 = f32_rem; + goto test_abz_f32; +#endif + test_abz_f32: + test_abz_f32( + trueFunction_abz_f32, (funcType_abz_f32 *) subjFunctionPtr ); + break; +#ifdef SUBJ_F32_SQRT + case F32_SQRT: + test_az_f32( f32_sqrt, (funcType_az_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_F32_EQ + case F32_EQ: + trueFunction_ab_f32_z_bool = f32_eq; + goto test_ab_f32_z_bool; +#endif +#ifdef SUBJ_F32_LE + case F32_LE: + trueFunction_ab_f32_z_bool = f32_le; + goto test_ab_f32_z_bool; +#endif +#ifdef SUBJ_F32_LT + case F32_LT: + trueFunction_ab_f32_z_bool = f32_lt; + goto test_ab_f32_z_bool; +#endif +#ifdef SUBJ_F32_EQ_SIGNALING + case F32_EQ_SIGNALING: + trueFunction_ab_f32_z_bool = f32_eq_signaling; + goto test_ab_f32_z_bool; +#endif +#ifdef SUBJ_F32_LE_QUIET + case F32_LE_QUIET: + trueFunction_ab_f32_z_bool = f32_le_quiet; + goto test_ab_f32_z_bool; +#endif +#ifdef SUBJ_F32_LT_QUIET + case F32_LT_QUIET: + trueFunction_ab_f32_z_bool = f32_lt_quiet; + goto test_ab_f32_z_bool; +#endif + test_ab_f32_z_bool: + test_ab_f32_z_bool( + trueFunction_ab_f32_z_bool, + (funcType_ab_f32_z_bool *) subjFunctionPtr + ); + break; + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT64 + case F64_TO_UI32: + test_a_f64_z_ui32_rx( + f64_to_ui32, subjFunction_a_f64_z_ui32_rx, roundingMode, exact ); + break; + case F64_TO_UI64: + test_a_f64_z_ui64_rx( + f64_to_ui64, subjFunction_a_f64_z_ui64_rx, roundingMode, exact ); + break; + case F64_TO_I32: + test_a_f64_z_i32_rx( + f64_to_i32, subjFunction_a_f64_z_i32_rx, roundingMode, exact ); + break; + case F64_TO_I64: + test_a_f64_z_i64_rx( + f64_to_i64, subjFunction_a_f64_z_i64_rx, roundingMode, exact ); + break; +#ifdef FLOAT16 +#ifdef SUBJ_F64_TO_F16 + case F64_TO_F16: + test_a_f64_z_f16( + f64_to_f16, (funcType_a_f64_z_f16 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef SUBJ_F64_TO_F32 + case F64_TO_F32: + test_a_f64_z_f32( + f64_to_f32, (funcType_a_f64_z_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_F64_TO_EXTF80 + case F64_TO_EXTF80: + test_a_f64_z_extF80( + f64_to_extF80M, (funcType_a_f64_z_extF80 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_F64_TO_F128 + case F64_TO_F128: + test_a_f64_z_f128( + f64_to_f128M, (funcType_a_f64_z_f128 *) subjFunctionPtr ); + break; +#endif +#endif + case F64_ROUNDTOINT: + test_az_f64_rx( + f64_roundToInt, subjFunction_az_f64_rx, roundingMode, exact ); + break; +#ifdef SUBJ_F64_ADD + case F64_ADD: + trueFunction_abz_f64 = f64_add; + goto test_abz_f64; +#endif +#ifdef SUBJ_F64_SUB + case F64_SUB: + trueFunction_abz_f64 = f64_sub; + goto test_abz_f64; +#endif +#ifdef SUBJ_F64_MUL + case F64_MUL: + trueFunction_abz_f64 = f64_mul; + goto test_abz_f64; +#endif +#ifdef SUBJ_F64_MULADD + case F64_MULADD: + test_abcz_f64( f64_mulAdd, (funcType_abcz_f64 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_F64_DIV + case F64_DIV: + trueFunction_abz_f64 = f64_div; + goto test_abz_f64; +#endif +#ifdef SUBJ_F64_REM + case F64_REM: + trueFunction_abz_f64 = f64_rem; + goto test_abz_f64; +#endif + test_abz_f64: + test_abz_f64( + trueFunction_abz_f64, (funcType_abz_f64 *) subjFunctionPtr ); + break; +#ifdef SUBJ_F64_SQRT + case F64_SQRT: + test_az_f64( f64_sqrt, (funcType_az_f64 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_F64_EQ + case F64_EQ: + trueFunction_ab_f64_z_bool = f64_eq; + goto test_ab_f64_z_bool; +#endif +#ifdef SUBJ_F64_LE + case F64_LE: + trueFunction_ab_f64_z_bool = f64_le; + goto test_ab_f64_z_bool; +#endif +#ifdef SUBJ_F64_LT + case F64_LT: + trueFunction_ab_f64_z_bool = f64_lt; + goto test_ab_f64_z_bool; +#endif +#ifdef SUBJ_F64_EQ_SIGNALING + case F64_EQ_SIGNALING: + trueFunction_ab_f64_z_bool = f64_eq_signaling; + goto test_ab_f64_z_bool; +#endif +#ifdef SUBJ_F64_LE_QUIET + case F64_LE_QUIET: + trueFunction_ab_f64_z_bool = f64_le_quiet; + goto test_ab_f64_z_bool; +#endif +#ifdef SUBJ_F64_LT_QUIET + case F64_LT_QUIET: + trueFunction_ab_f64_z_bool = f64_lt_quiet; + goto test_ab_f64_z_bool; +#endif + test_ab_f64_z_bool: + test_ab_f64_z_bool( + trueFunction_ab_f64_z_bool, + (funcType_ab_f64_z_bool *) subjFunctionPtr + ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + case EXTF80_TO_UI32: + test_a_extF80_z_ui32_rx( + extF80M_to_ui32, + subjFunction_a_extF80_z_ui32_rx, + roundingMode, + exact + ); + break; + case EXTF80_TO_UI64: + test_a_extF80_z_ui64_rx( + extF80M_to_ui64, + subjFunction_a_extF80_z_ui64_rx, + roundingMode, + exact + ); + break; + case EXTF80_TO_I32: + test_a_extF80_z_i32_rx( + extF80M_to_i32, subjFunction_a_extF80_z_i32_rx, roundingMode, exact + ); + break; + case EXTF80_TO_I64: + test_a_extF80_z_i64_rx( + extF80M_to_i64, subjFunction_a_extF80_z_i64_rx, roundingMode, exact + ); + break; +#ifdef FLOAT16 +#ifdef SUBJ_EXTF80_TO_F16 + case EXTF80_TO_F16: + test_a_extF80_z_f16( + extF80M_to_f16, (funcType_a_extF80_z_f16 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef SUBJ_EXTF80_TO_F32 + case EXTF80_TO_F32: + test_a_extF80_z_f32( + extF80M_to_f32, (funcType_a_extF80_z_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef FLOAT64 +#ifdef SUBJ_EXTF80_TO_F64 + case EXTF80_TO_F64: + test_a_extF80_z_f64( + extF80M_to_f64, (funcType_a_extF80_z_f64 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef FLOAT128 +#ifdef SUBJ_EXTF80_TO_F128 + case EXTF80_TO_F128: + test_a_extF80_z_f128( + extF80M_to_f128M, (funcType_a_extF80_z_f128 *) subjFunctionPtr ); + break; +#endif +#endif + case EXTF80_ROUNDTOINT: + test_az_extF80_rx( + extF80M_roundToInt, subjFunction_az_extF80_rx, roundingMode, exact + ); + break; +#ifdef SUBJ_EXTF80_ADD + case EXTF80_ADD: + trueFunction_abz_extF80 = extF80M_add; + goto test_abz_extF80; +#endif +#ifdef SUBJ_EXTF80_SUB + case EXTF80_SUB: + trueFunction_abz_extF80 = extF80M_sub; + goto test_abz_extF80; +#endif +#ifdef SUBJ_EXTF80_MUL + case EXTF80_MUL: + trueFunction_abz_extF80 = extF80M_mul; + goto test_abz_extF80; +#endif +#ifdef SUBJ_EXTF80_DIV + case EXTF80_DIV: + trueFunction_abz_extF80 = extF80M_div; + goto test_abz_extF80; +#endif +#ifdef SUBJ_EXTF80_REM + case EXTF80_REM: + trueFunction_abz_extF80 = extF80M_rem; + goto test_abz_extF80; +#endif + test_abz_extF80: + test_abz_extF80( + trueFunction_abz_extF80, (funcType_abz_extF80 *) subjFunctionPtr ); + break; +#ifdef SUBJ_EXTF80_SQRT + case EXTF80_SQRT: + test_az_extF80( extF80M_sqrt, (funcType_az_extF80 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_EXTF80_EQ + case EXTF80_EQ: + trueFunction_ab_extF80_z_bool = extF80M_eq; + goto test_ab_extF80_z_bool; +#endif +#ifdef SUBJ_EXTF80_LE + case EXTF80_LE: + trueFunction_ab_extF80_z_bool = extF80M_le; + goto test_ab_extF80_z_bool; +#endif +#ifdef SUBJ_EXTF80_LT + case EXTF80_LT: + trueFunction_ab_extF80_z_bool = extF80M_lt; + goto test_ab_extF80_z_bool; +#endif +#ifdef SUBJ_EXTF80_EQ_SIGNALING + case EXTF80_EQ_SIGNALING: + trueFunction_ab_extF80_z_bool = extF80M_eq_signaling; + goto test_ab_extF80_z_bool; +#endif +#ifdef SUBJ_EXTF80_LE_QUIET + case EXTF80_LE_QUIET: + trueFunction_ab_extF80_z_bool = extF80M_le_quiet; + goto test_ab_extF80_z_bool; +#endif +#ifdef SUBJ_EXTF80_LT_QUIET + case EXTF80_LT_QUIET: + trueFunction_ab_extF80_z_bool = extF80M_lt_quiet; + goto test_ab_extF80_z_bool; +#endif + test_ab_extF80_z_bool: + test_ab_extF80_z_bool( + trueFunction_ab_extF80_z_bool, + (funcType_ab_extF80_z_bool *) subjFunctionPtr + ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT128 + case F128_TO_UI32: + test_a_f128_z_ui32_rx( + f128M_to_ui32, subjFunction_a_f128_z_ui32_rx, roundingMode, exact + ); + break; + case F128_TO_UI64: + test_a_f128_z_ui64_rx( + f128M_to_ui64, subjFunction_a_f128_z_ui64_rx, roundingMode, exact + ); + break; + case F128_TO_I32: + test_a_f128_z_i32_rx( + f128M_to_i32, subjFunction_a_f128_z_i32_rx, roundingMode, exact ); + break; + case F128_TO_I64: + test_a_f128_z_i64_rx( + f128M_to_i64, subjFunction_a_f128_z_i64_rx, roundingMode, exact ); + break; +#ifdef FLOAT16 +#ifdef SUBJ_F128_TO_F16 + case F128_TO_F16: + test_a_f128_z_f16( + f128M_to_f16, (funcType_a_f128_z_f16 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef SUBJ_F128_TO_F32 + case F128_TO_F32: + test_a_f128_z_f32( + f128M_to_f32, (funcType_a_f128_z_f32 *) subjFunctionPtr ); + break; +#endif +#ifdef FLOAT64 +#ifdef SUBJ_F128_TO_F64 + case F128_TO_F64: + test_a_f128_z_f64( + f128M_to_f64, (funcType_a_f128_z_f64 *) subjFunctionPtr ); + break; +#endif +#endif +#ifdef EXTFLOAT80 +#ifdef SUBJ_F128_TO_EXTF80 + case F128_TO_EXTF80: + test_a_f128_z_extF80( + f128M_to_extF80M, (funcType_a_f128_z_extF80 *) subjFunctionPtr ); + break; +#endif +#endif + case F128_ROUNDTOINT: + test_az_f128_rx( + f128M_roundToInt, subjFunction_az_f128_rx, roundingMode, exact ); + break; +#ifdef SUBJ_F128_ADD + case F128_ADD: + trueFunction_abz_f128 = f128M_add; + goto test_abz_f128; +#endif +#ifdef SUBJ_F128_SUB + case F128_SUB: + trueFunction_abz_f128 = f128M_sub; + goto test_abz_f128; +#endif +#ifdef SUBJ_F128_MUL + case F128_MUL: + trueFunction_abz_f128 = f128M_mul; + goto test_abz_f128; +#endif +#ifdef SUBJ_F128_MULADD + case F128_MULADD: + test_abcz_f128( f128M_mulAdd, (funcType_abcz_f128 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_F128_DIV + case F128_DIV: + trueFunction_abz_f128 = f128M_div; + goto test_abz_f128; +#endif +#ifdef SUBJ_F128_REM + case F128_REM: + trueFunction_abz_f128 = f128M_rem; + goto test_abz_f128; +#endif + test_abz_f128: + test_abz_f128( + trueFunction_abz_f128, (funcType_abz_f128 *) subjFunctionPtr ); + break; +#ifdef SUBJ_F128_SQRT + case F128_SQRT: + test_az_f128( f128M_sqrt, (funcType_az_f128 *) subjFunctionPtr ); + break; +#endif +#ifdef SUBJ_F128_EQ + case F128_EQ: + trueFunction_ab_f128_z_bool = f128M_eq; + goto test_ab_f128_z_bool; +#endif +#ifdef SUBJ_F128_LE + case F128_LE: + trueFunction_ab_f128_z_bool = f128M_le; + goto test_ab_f128_z_bool; +#endif +#ifdef SUBJ_F128_LT + case F128_LT: + trueFunction_ab_f128_z_bool = f128M_lt; + goto test_ab_f128_z_bool; +#endif +#ifdef SUBJ_F128_EQ_SIGNALING + case F128_EQ_SIGNALING: + trueFunction_ab_f128_z_bool = f128M_eq_signaling; + goto test_ab_f128_z_bool; +#endif +#ifdef SUBJ_F128_LE_QUIET + case F128_LE_QUIET: + trueFunction_ab_f128_z_bool = f128M_le_quiet; + goto test_ab_f128_z_bool; +#endif +#ifdef SUBJ_F128_LT_QUIET + case F128_LT_QUIET: + trueFunction_ab_f128_z_bool = f128M_lt_quiet; + goto test_ab_f128_z_bool; +#endif + test_ab_f128_z_bool: + test_ab_f128_z_bool( + trueFunction_ab_f128_z_bool, + (funcType_ab_f128_z_bool *) subjFunctionPtr + ); + break; +#endif + } + if ( (verCases_errorStop && verCases_anyErrors) || verCases_stop ) { + verCases_exitWithStatus(); + } + +} + +static +void + testFunction( + const struct standardFunctionInfo *standardFunctionInfoPtr, + uint_fast8_t roundingPrecisionIn, + int roundingCodeIn + ) +{ + int functionCode, functionAttribs; + bool standardFunctionHasFixedRounding; + int roundingCode; + bool exact; + uint_fast8_t roundingPrecision, roundingMode = 0; + + functionCode = standardFunctionInfoPtr->functionCode; + functionAttribs = functionInfos[functionCode].attribs; + standardFunctionHasFixedRounding = false; + if ( functionAttribs & FUNC_ARG_ROUNDINGMODE ) { + roundingCode = standardFunctionInfoPtr->roundingCode; + if ( roundingCode ) { + standardFunctionHasFixedRounding = true; + roundingCodeIn = roundingCode; + } + } + exact = standardFunctionInfoPtr->exact; + verCases_functionNamePtr = standardFunctionInfoPtr->namePtr; + roundingPrecision = 32; + for (;;) { + if ( functionAttribs & FUNC_EFF_ROUNDINGPRECISION ) { + if ( roundingPrecisionIn ) roundingPrecision = roundingPrecisionIn; + } else { + roundingPrecision = 0; + } +#ifdef EXTFLOAT80 + verCases_roundingPrecision = roundingPrecision; + if ( roundingPrecision ) { + extF80_roundingPrecision = roundingPrecision; + subjfloat_setExtF80RoundingPrecision( roundingPrecision ); + } +#endif + for ( + roundingCode = 1; roundingCode < NUM_ROUNDINGMODES; ++roundingCode + ) { +#ifndef SUBJFLOAT_ROUND_NEAR_MAXMAG + if ( roundingCode != ROUND_NEAR_MAXMAG ) { +#endif +#if defined FLOAT_ROUND_ODD && ! defined SUBJFLOAT_ROUND_NEAR_MAXMAG + if ( roundingCode != ROUND_ODD ) { +#endif + if ( + functionAttribs + & (FUNC_ARG_ROUNDINGMODE | FUNC_EFF_ROUNDINGMODE) + ) { + if ( roundingCodeIn ) roundingCode = roundingCodeIn; + } else { + roundingCode = 0; + } + verCases_roundingCode = + standardFunctionHasFixedRounding ? 0 : roundingCode; + if ( roundingCode ) { + roundingMode = roundingModes[roundingCode]; + softfloat_roundingMode = roundingMode; + if ( ! standardFunctionHasFixedRounding ) { + subjfloat_setRoundingMode( roundingMode ); + } + } + testFunctionInstance( functionCode, roundingMode, exact ); + if ( roundingCodeIn || ! roundingCode ) break; +#if defined FLOAT_ROUND_ODD && ! defined SUBJFLOAT_ROUND_NEAR_MAXMAG + } +#endif +#ifndef SUBJFLOAT_ROUND_NEAR_MAXMAG + } +#endif + } + if ( roundingPrecisionIn || ! roundingPrecision ) break; + if ( roundingPrecision == 80 ) { + break; + } else if ( roundingPrecision == 64 ) { + roundingPrecision = 80; + } else if ( roundingPrecision == 32 ) { + roundingPrecision = 64; + } + } + +} + +int main( int argc, char *argv[] ) +{ + bool haveFunctionArg; + const struct standardFunctionInfo *standardFunctionInfoPtr; + int numOperands; + uint_fast8_t roundingPrecision; + int roundingCode; + const char *argPtr; + void (*const *subjFunctionPtrPtr)(); + const char *functionNamePtr; + unsigned long ui; + long i; + int functionMatchAttrib; + + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + fail_programName = "testfloat"; + if ( argc <= 1 ) goto writeHelpMessage; + genCases_setLevel( 1 ); + verCases_maxErrorCount = 20; + testLoops_trueFlagsPtr = &softfloat_exceptionFlags; + testLoops_subjFlagsFunction = subjfloat_clearExceptionFlags; + haveFunctionArg = false; + standardFunctionInfoPtr = 0; + numOperands = 0; + roundingPrecision = 0; + roundingCode = 0; + for (;;) { + --argc; + if ( ! argc ) break; + argPtr = *++argv; + if ( ! argPtr ) break; + if ( argPtr[0] == '-' ) ++argPtr; + if ( + ! strcmp( argPtr, "help" ) || ! strcmp( argPtr, "-help" ) + || ! strcmp( argPtr, "h" ) + ) { + writeHelpMessage: + fputs( +"testfloat [<option>...] <function>\n" +" <option>: (* is default)\n" +" -help --Write this message and exit.\n" +" -list --List all testable subject functions and exit.\n" +" -seed <num> --Set pseudo-random number generator seed to <num>.\n" +" * -seed 1\n" +" -level <num> --Testing level <num> (1 or 2).\n" +" * -level 1\n" +" -errors <num> --Stop each function test after <num> errors.\n" +" * -errors 20\n" +" -errorstop --Exit after first function with any error.\n" +" -forever --Test one function repeatedly (implies '-level 2').\n" +" -checkNaNs --Check for specific NaN results.\n" +" -checkInvInts --Check for specific invalid integer results.\n" +" -checkAll --Same as both '-checkNaNs' and '-checkInvInts'.\n" +#ifdef EXTFLOAT80 +" -precision32 --For extF80, test only 32-bit rounding precision.\n" +" -precision64 --For extF80, test only 64-bit rounding precision.\n" +" -precision80 --For extF80, test only 80-bit rounding precision.\n" +#endif +" -r<round> --Test only specified rounding (if not inherent to\n" +" function).\n" +" -tininessbefore --Underflow tininess is detected before rounding.\n" +" -tininessafter --Underflow tininess is detected after rounding.\n" +" <function>:\n" +" <int>_to_<float> <float>_add <float>_eq\n" +" <float>_to_<int>_r_<round> <float>_sub <float>_le\n" +" <float>_to_<int>_rx_<round> <float>_mul <float>_lt\n" +" <float>_to_<float> <float>_mulAdd <float>_eq_signaling\n" +" <float>_roundToInt_r_<round> <float>_div <float>_le_quiet\n" +" <float>_roundToInt_x <float>_rem <float>_lt_quiet\n" +" <float>_sqrt\n" +" -all1 --All unary functions.\n" +" -all2 --All binary functions.\n" +" <int>:\n" +" ui32 --Unsigned 32-bit integer.\n" +" ui64 --Unsigned 64-bit integer.\n" +" i32 --Signed 32-bit integer.\n" +" i64 --Signed 64-bit integer.\n" +" <float>:\n" +#ifdef FLOAT16 +" f16 --Binary 16-bit floating-point (half-precision).\n" +#endif +" f32 --Binary 32-bit floating-point (single-precision).\n" +#ifdef FLOAT64 +" f64 --Binary 64-bit floating-point (double-precision).\n" +#endif +#ifdef EXTFLOAT80 +" extF80 --Binary 80-bit extended floating-point.\n" +#endif +#ifdef FLOAT128 +" f128 --Binary 128-bit floating-point (quadruple-precision).\n" +#endif +" <round>:\n" +" near_even --Round to nearest/even.\n" +" minMag --Round to minimum magnitude (toward zero).\n" +" min --Round to minimum (down).\n" +" max --Round to maximum (up).\n" +#ifdef SUBJFLOAT_ROUND_NEAR_MAXMAG +" near_maxMag --Round to nearest/maximum magnitude (nearest/away).\n" +#endif +#if defined FLOAT_ROUND_ODD && defined SUBJFLOAT_ROUND_ODD +" odd --Round to odd (jamming). (Not allowed as an inherent\n" +" rounding mode. For 'roundToInt_x', rounds to minimum\n" +" magnitude instead.)\n" +#endif + , + stdout + ); + return EXIT_SUCCESS; + } else if ( ! strcmp( argPtr, "list" ) ) { + standardFunctionInfoPtr = standardFunctionInfos; + subjFunctionPtrPtr = subjfloat_functions; + for (;;) { + functionNamePtr = standardFunctionInfoPtr->namePtr; + if ( ! functionNamePtr ) break; + if ( *subjFunctionPtrPtr ) puts( functionNamePtr ); + ++standardFunctionInfoPtr; + ++subjFunctionPtrPtr; + } + return EXIT_SUCCESS; + } else if ( ! strcmp( argPtr, "seed" ) ) { + if ( argc < 2 ) goto optionError; + ui = strtoul( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + srand( ui ); + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "level" ) ) { + if ( argc < 2 ) goto optionError; + i = strtol( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + genCases_setLevel( i ); + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "level1" ) ) { + genCases_setLevel( 1 ); + } else if ( ! strcmp( argPtr, "level2" ) ) { + genCases_setLevel( 2 ); + } else if ( ! strcmp( argPtr, "errors" ) ) { + if ( argc < 2 ) goto optionError; + i = strtol( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + verCases_maxErrorCount = i; + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "errorstop" ) ) { + verCases_errorStop = true; + } else if ( ! strcmp( argPtr, "forever" ) ) { + genCases_setLevel( 2 ); + testLoops_forever = true; + } else if ( + ! strcmp( argPtr, "checkNaNs" ) || ! strcmp( argPtr, "checknans" ) + ) { + verCases_checkNaNs = true; + } else if ( + ! strcmp( argPtr, "checkInvInts" ) + || ! strcmp( argPtr, "checkinvints" ) + ) { + verCases_checkInvInts = true; + } else if ( + ! strcmp( argPtr, "checkAll" ) || ! strcmp( argPtr, "checkall" ) + ) { + verCases_checkNaNs = true; + verCases_checkInvInts = true; +#ifdef EXTFLOAT80 + } else if ( ! strcmp( argPtr, "precision32" ) ) { + roundingPrecision = 32; + } else if ( ! strcmp( argPtr, "precision64" ) ) { + roundingPrecision = 64; + } else if ( ! strcmp( argPtr, "precision80" ) ) { + roundingPrecision = 80; +#endif + } else if ( + ! strcmp( argPtr, "rnear_even" ) + || ! strcmp( argPtr, "rneareven" ) + || ! strcmp( argPtr, "rnearest_even" ) + ) { + roundingCode = ROUND_NEAR_EVEN; + } else if ( + ! strcmp( argPtr, "rminmag" ) || ! strcmp( argPtr, "rminMag" ) + ) { + roundingCode = ROUND_MINMAG; + } else if ( ! strcmp( argPtr, "rmin" ) ) { + roundingCode = ROUND_MIN; + } else if ( ! strcmp( argPtr, "rmax" ) ) { + roundingCode = ROUND_MAX; + } else if ( + ! strcmp( argPtr, "rnear_maxmag" ) + || ! strcmp( argPtr, "rnear_maxMag" ) + || ! strcmp( argPtr, "rnearmaxmag" ) + || ! strcmp( argPtr, "rnearest_maxmag" ) + || ! strcmp( argPtr, "rnearest_maxMag" ) + ) { +#ifdef SUBJFLOAT_ROUND_NEAR_MAXMAG + roundingCode = ROUND_NEAR_MAXMAG; +#else + fail( + "Rounding mode 'near_maxMag' is not supported or cannot be tested" + ); +#endif +#ifdef FLOAT_ROUND_ODD + } else if ( ! strcmp( argPtr, "rodd" ) ) { +#ifdef SUBJFLOAT_ROUND_ODD + roundingCode = ROUND_ODD; +#else + fail( "Rounding mode 'odd' is not supported or cannot be tested" ); +#endif +#endif + } else if ( ! strcmp( argPtr, "tininessbefore" ) ) { + softfloat_detectTininess = softfloat_tininess_beforeRounding; + } else if ( ! strcmp( argPtr, "tininessafter" ) ) { + softfloat_detectTininess = softfloat_tininess_afterRounding; + } else if ( ! strcmp( argPtr, "all1" ) ) { + haveFunctionArg = true; + standardFunctionInfoPtr = 0; + numOperands = 1; + } else if ( ! strcmp( argPtr, "all2" ) ) { + haveFunctionArg = true; + standardFunctionInfoPtr = 0; + numOperands = 2; + } else { + standardFunctionInfoPtr = standardFunctionInfos; + for (;;) { + functionNamePtr = standardFunctionInfoPtr->namePtr; + if ( ! functionNamePtr ) { + fail( "Invalid argument '%s'", *argv ); + } + if ( ! strcmp( argPtr, functionNamePtr ) ) break; + ++standardFunctionInfoPtr; + } + subjFunctionPtr = + subjfloat_functions + [standardFunctionInfoPtr - standardFunctionInfos]; + if ( ! subjFunctionPtr ) { + fail( + "Function '%s' is not supported or cannot be tested", + argPtr + ); + } + haveFunctionArg = true; + } + } + if ( ! haveFunctionArg ) fail( "Function argument required" ); + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + signal( SIGINT, catchSIGINT ); + signal( SIGTERM, catchSIGINT ); + if ( standardFunctionInfoPtr ) { + if ( testLoops_forever ) { + if ( ! roundingPrecision ) roundingPrecision = 80; + if ( ! roundingCode ) roundingCode = ROUND_NEAR_EVEN; + } + testFunction( + standardFunctionInfoPtr, roundingPrecision, roundingCode ); + } else { + if ( testLoops_forever ) { + fail( "Can test only one function with '-forever' option" ); + } + functionMatchAttrib = + (numOperands == 1) ? FUNC_ARG_UNARY : FUNC_ARG_BINARY; + standardFunctionInfoPtr = standardFunctionInfos; + subjFunctionPtrPtr = subjfloat_functions; + while ( standardFunctionInfoPtr->namePtr ) { + subjFunctionPtr = *subjFunctionPtrPtr; + if ( + subjFunctionPtr + && (functionInfos[standardFunctionInfoPtr->functionCode] + .attribs + & functionMatchAttrib) + ) { + testFunction( + standardFunctionInfoPtr, roundingPrecision, roundingCode ); + } + ++standardFunctionInfoPtr; + ++subjFunctionPtrPtr; + } + } + verCases_exitWithStatus(); + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + optionError: + fail( "'%s' option requires numeric argument", *argv ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/testfloat_gen.c b/src/libs/softfloat-3e/testfloat/source/testfloat_gen.c new file mode 100644 index 00000000..67882c19 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/testfloat_gen.c @@ -0,0 +1,953 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <signal.h> +#include "platform.h" +#include "fail.h" +#include "softfloat.h" +#include "functions.h" +#include "genCases.h" +#include "genLoops.h" + +enum { + TYPE_UI32 = NUM_FUNCTIONS, + TYPE_UI64, + TYPE_I32, + TYPE_I64, + TYPE_F16, + TYPE_F16_2, + TYPE_F16_3, + TYPE_F32, + TYPE_F32_2, + TYPE_F32_3, + TYPE_F64, + TYPE_F64_2, + TYPE_F64_3, + TYPE_EXTF80, + TYPE_EXTF80_2, + TYPE_EXTF80_3, + TYPE_F128, + TYPE_F128_2, + TYPE_F128_3 +}; + +static void catchSIGINT( int signalCode ) +{ + + if ( genLoops_stop ) exit( EXIT_FAILURE ); + genLoops_stop = true; + +} + +int main( int argc, char *argv[] ) +{ + const char *prefixTextPtr; + uint_fast8_t roundingMode; + bool exact; + int functionCode; + const char *argPtr; + unsigned long ui; + long i; + int functionAttribs; +#ifdef FLOAT16 + float16_t (*trueFunction_abz_f16)( float16_t, float16_t ); + bool (*trueFunction_ab_f16_z_bool)( float16_t, float16_t ); +#endif + float32_t (*trueFunction_abz_f32)( float32_t, float32_t ); + bool (*trueFunction_ab_f32_z_bool)( float32_t, float32_t ); +#ifdef FLOAT64 + float64_t (*trueFunction_abz_f64)( float64_t, float64_t ); + bool (*trueFunction_ab_f64_z_bool)( float64_t, float64_t ); +#endif +#ifdef EXTFLOAT80 + void + (*trueFunction_abz_extF80)( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); + bool + (*trueFunction_ab_extF80_z_bool)( + const extFloat80_t *, const extFloat80_t * ); +#endif +#ifdef FLOAT128 + void + (*trueFunction_abz_f128)( + const float128_t *, const float128_t *, float128_t * ); + bool + (*trueFunction_ab_f128_z_bool)( const float128_t *, const float128_t * ); +#endif + + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + fail_programName = "testfloat_gen"; + if ( argc <= 1 ) goto writeHelpMessage; + prefixTextPtr = 0; + softfloat_detectTininess = softfloat_tininess_afterRounding; +#ifdef EXTFLOAT80 + extF80_roundingPrecision = 80; +#endif + roundingMode = softfloat_round_near_even; + exact = false; + genCases_setLevel( 1 ); + genLoops_trueFlagsPtr = &softfloat_exceptionFlags; + genLoops_forever = false; + genLoops_givenCount = false; + functionCode = 0; + for (;;) { + --argc; + if ( ! argc ) break; + argPtr = *++argv; + if ( ! argPtr ) break; + if ( argPtr[0] == '-' ) ++argPtr; + if ( + ! strcmp( argPtr, "help" ) || ! strcmp( argPtr, "-help" ) + || ! strcmp( argPtr, "h" ) + ) { + writeHelpMessage: + fputs( +"testfloat_gen [<option>...] <type>|<function>\n" +" <option>: (* is default)\n" +" -help --Write this message and exit.\n" +" -prefix <text> --Write <text> as a line of output before any test cases.\n" +" -seed <num> --Set pseudo-random number generator seed to <num>.\n" +" * -seed 1\n" +" -level <num> --Testing level <num> (1 or 2).\n" +" * -level 1\n" +" -n <num> --Generate <num> test cases.\n" +" -forever --Generate test cases indefinitely (implies '-level 2').\n" +#ifdef EXTFLOAT80 +" -precision32 --For extF80, rounding precision is 32 bits.\n" +" -precision64 --For extF80, rounding precision is 64 bits.\n" +" * -precision80 --For extF80, rounding precision is 80 bits.\n" +#endif +" * -rnear_even --Round to nearest/even.\n" +" -rminMag --Round to minimum magnitude (toward zero).\n" +" -rmin --Round to minimum (down).\n" +" -rmax --Round to maximum (up).\n" +" -rnear_maxMag --Round to nearest/maximum magnitude (nearest/away).\n" +#ifdef FLOAT_ROUND_ODD +" -rodd --Round to odd (jamming). (For rounding to an integer\n" +" value, rounds to minimum magnitude instead.)\n" +#endif +" -tininessbefore --Detect underflow tininess before rounding.\n" +" * -tininessafter --Detect underflow tininess after rounding.\n" +" * -notexact --Rounding to integer is not exact (no inexact\n" +" exceptions).\n" +" -exact --Rounding to integer is exact (raising inexact\n" +" exceptions).\n" +" <type>:\n" +" <int> --Generate test cases with one integer operand.\n" +" <float> --Generate test cases with one floating-point operand.\n" +" <float> <num> --Generate test cases with <num> (1, 2, or 3)\n" +" floating-point operands.\n" +" <function>:\n" +" <int>_to_<float> <float>_add <float>_eq\n" +" <float>_to_<int> <float>_sub <float>_le\n" +" <float>_to_<float> <float>_mul <float>_lt\n" +" <float>_roundToInt <float>_mulAdd <float>_eq_signaling\n" +" <float>_div <float>_le_quiet\n" +" <float>_rem <float>_lt_quiet\n" +" <float>_sqrt\n" +" <int>:\n" +" ui32 --Unsigned 32-bit integer.\n" +" ui64 --Unsigned 64-bit integer.\n" +" i32 --Signed 32-bit integer.\n" +" i64 --Signed 64-bit integer.\n" +" <float>:\n" +#ifdef FLOAT16 +" f16 --Binary 16-bit floating-point (half-precision).\n" +#endif +" f32 --Binary 32-bit floating-point (single-precision).\n" +#ifdef FLOAT64 +" f64 --Binary 64-bit floating-point (double-precision).\n" +#endif +#ifdef EXTFLOAT80 +" extF80 --Binary 80-bit extended floating-point.\n" +#endif +#ifdef FLOAT128 +" f128 --Binary 128-bit floating-point (quadruple-precision).\n" +#endif + , + stdout + ); + return EXIT_SUCCESS; + } else if ( ! strcmp( argPtr, "prefix" ) ) { + if ( argc < 2 ) goto optionError; + prefixTextPtr = argv[1]; + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "seed" ) ) { + if ( argc < 2 ) goto optionError; + ui = strtoul( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + srand( ui ); + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "level" ) ) { + if ( argc < 2 ) goto optionError; + i = strtol( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + genCases_setLevel( i ); + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "level1" ) ) { + genCases_setLevel( 1 ); + } else if ( ! strcmp( argPtr, "level2" ) ) { + genCases_setLevel( 2 ); + } else if ( ! strcmp( argPtr, "n" ) ) { + if ( argc < 2 ) goto optionError; + genLoops_forever = true; + genLoops_givenCount = true; + i = strtol( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + genLoops_count = i; + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "forever" ) ) { + genCases_setLevel( 2 ); + genLoops_forever = true; + genLoops_givenCount = false; +#ifdef EXTFLOAT80 + } else if ( ! strcmp( argPtr, "precision32" ) ) { + extF80_roundingPrecision = 32; + } else if ( ! strcmp( argPtr, "precision64" ) ) { + extF80_roundingPrecision = 64; + } else if ( ! strcmp( argPtr, "precision80" ) ) { + extF80_roundingPrecision = 80; +#endif + } else if ( + ! strcmp( argPtr, "rnear_even" ) + || ! strcmp( argPtr, "rneareven" ) + || ! strcmp( argPtr, "rnearest_even" ) + ) { + roundingMode = softfloat_round_near_even; + } else if ( + ! strcmp( argPtr, "rminmag" ) || ! strcmp( argPtr, "rminMag" ) + ) { + roundingMode = softfloat_round_minMag; + } else if ( ! strcmp( argPtr, "rmin" ) ) { + roundingMode = softfloat_round_min; + } else if ( ! strcmp( argPtr, "rmax" ) ) { + roundingMode = softfloat_round_max; + } else if ( + ! strcmp( argPtr, "rnear_maxmag" ) + || ! strcmp( argPtr, "rnear_maxMag" ) + || ! strcmp( argPtr, "rnearmaxmag" ) + || ! strcmp( argPtr, "rnearest_maxmag" ) + || ! strcmp( argPtr, "rnearest_maxMag" ) + ) { + roundingMode = softfloat_round_near_maxMag; +#ifdef FLOAT_ROUND_ODD + } else if ( ! strcmp( argPtr, "rodd" ) ) { + roundingMode = softfloat_round_odd; +#endif + } else if ( ! strcmp( argPtr, "tininessbefore" ) ) { + softfloat_detectTininess = softfloat_tininess_beforeRounding; + } else if ( ! strcmp( argPtr, "tininessafter" ) ) { + softfloat_detectTininess = softfloat_tininess_afterRounding; + } else if ( ! strcmp( argPtr, "notexact" ) ) { + exact = false; + } else if ( ! strcmp( argPtr, "exact" ) ) { + exact = true; + } else if ( + ! strcmp( argPtr, "ui32" ) || ! strcmp( argPtr, "uint32" ) + ) { + functionCode = TYPE_UI32; + if ( 2 <= argc ) goto absorbArg1; + } else if ( + ! strcmp( argPtr, "ui64" ) || ! strcmp( argPtr, "uint64" ) + ) { + functionCode = TYPE_UI64; + if ( 2 <= argc ) goto absorbArg1; + } else if ( + ! strcmp( argPtr, "i32" ) || ! strcmp( argPtr, "int32" ) + ) { + functionCode = TYPE_I32; + if ( 2 <= argc ) goto absorbArg1; + } else if ( + ! strcmp( argPtr, "i64" ) || ! strcmp( argPtr, "int64" ) + ) { + functionCode = TYPE_I64; + if ( 2 <= argc ) goto absorbArg1; +#ifdef FLOAT16 + } else if ( + ! strcmp( argPtr, "f16" ) || ! strcmp( argPtr, "float16" ) + ) { + functionCode = TYPE_F16; + goto absorbArg; +#endif + } else if ( + ! strcmp( argPtr, "f32" ) || ! strcmp( argPtr, "float32" ) + ) { + functionCode = TYPE_F32; +#ifdef FLOAT64 + goto absorbArg; + } else if ( + ! strcmp( argPtr, "f64" ) || ! strcmp( argPtr, "float64" ) + ) { + functionCode = TYPE_F64; +#endif +#ifdef EXTFLOAT80 + goto absorbArg; + } else if ( + ! strcmp( argPtr, "extF80" ) || ! strcmp( argPtr, "extFloat80" ) + ) { + functionCode = TYPE_EXTF80; +#endif +#ifdef FLOAT128 + goto absorbArg; + } else if ( + ! strcmp( argPtr, "f128" ) || ! strcmp( argPtr, "float128" ) + ) { + functionCode = TYPE_F128; +#endif + absorbArg: + if ( 2 <= argc ) { + if ( ! strcmp( argv[1], "2" ) ) { + --argc; + ++argv; + ++functionCode; + } else if ( ! strcmp( argv[1], "3" ) ) { + --argc; + ++argv; + functionCode += 2; + } else { + absorbArg1: + if ( ! strcmp( argv[1], "1" ) ) { + --argc; + ++argv; + } + } + } + } else { + functionCode = 1; + while ( strcmp( argPtr, functionInfos[functionCode].namePtr ) ) { + ++functionCode; + if ( functionCode == NUM_FUNCTIONS ) goto invalidArg; + } + functionAttribs = functionInfos[functionCode].attribs; + if ( + (functionAttribs & FUNC_ARG_EXACT) + && ! (functionAttribs & FUNC_ARG_ROUNDINGMODE) + ) { + goto invalidArg; + } + } + } + if ( ! functionCode ) fail( "Type or function argument required" ); + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + if ( prefixTextPtr ) { + fputs( prefixTextPtr, stdout ); + fputc( '\n', stdout ); + } + softfloat_roundingMode = roundingMode; + signal( SIGINT, catchSIGINT ); + signal( SIGTERM, catchSIGINT ); + switch ( functionCode ) { + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ + case TYPE_UI32: + gen_a_ui32(); + break; + case TYPE_UI64: + gen_a_ui64(); + break; + case TYPE_I32: + gen_a_i32(); + break; + case TYPE_I64: + gen_a_i64(); + break; +#ifdef FLOAT16 + case TYPE_F16: + gen_a_f16(); + break; + case TYPE_F16_2: + gen_ab_f16(); + break; + case TYPE_F16_3: + gen_abc_f16(); + break; +#endif + case TYPE_F32: + gen_a_f32(); + break; + case TYPE_F32_2: + gen_ab_f32(); + break; + case TYPE_F32_3: + gen_abc_f32(); + break; +#ifdef FLOAT64 + case TYPE_F64: + gen_a_f64(); + break; + case TYPE_F64_2: + gen_ab_f64(); + break; + case TYPE_F64_3: + gen_abc_f64(); + break; +#endif +#ifdef EXTFLOAT80 + case TYPE_EXTF80: + gen_a_extF80(); + break; + case TYPE_EXTF80_2: + gen_ab_extF80(); + break; + case TYPE_EXTF80_3: + gen_abc_extF80(); + break; +#endif +#ifdef FLOAT128 + case TYPE_F128: + gen_a_f128(); + break; + case TYPE_F128_2: + gen_ab_f128(); + break; + case TYPE_F128_3: + gen_abc_f128(); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case UI32_TO_F16: + gen_a_ui32_z_f16( ui32_to_f16 ); + break; +#endif + case UI32_TO_F32: + gen_a_ui32_z_f32( ui32_to_f32 ); + break; +#ifdef FLOAT64 + case UI32_TO_F64: + gen_a_ui32_z_f64( ui32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case UI32_TO_EXTF80: + gen_a_ui32_z_extF80( ui32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case UI32_TO_F128: + gen_a_ui32_z_f128( ui32_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case UI64_TO_F16: + gen_a_ui64_z_f16( ui64_to_f16 ); + break; +#endif + case UI64_TO_F32: + gen_a_ui64_z_f32( ui64_to_f32 ); + break; +#ifdef FLOAT64 + case UI64_TO_F64: + gen_a_ui64_z_f64( ui64_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case UI64_TO_EXTF80: + gen_a_ui64_z_extF80( ui64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case UI64_TO_F128: + gen_a_ui64_z_f128( ui64_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case I32_TO_F16: + gen_a_i32_z_f16( i32_to_f16 ); + break; +#endif + case I32_TO_F32: + gen_a_i32_z_f32( i32_to_f32 ); + break; +#ifdef FLOAT64 + case I32_TO_F64: + gen_a_i32_z_f64( i32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case I32_TO_EXTF80: + gen_a_i32_z_extF80( i32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case I32_TO_F128: + gen_a_i32_z_f128( i32_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case I64_TO_F16: + gen_a_i64_z_f16( i64_to_f16 ); + break; +#endif + case I64_TO_F32: + gen_a_i64_z_f32( i64_to_f32 ); + break; +#ifdef FLOAT64 + case I64_TO_F64: + gen_a_i64_z_f64( i64_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case I64_TO_EXTF80: + gen_a_i64_z_extF80( i64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case I64_TO_F128: + gen_a_i64_z_f128( i64_to_f128M ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case F16_TO_UI32: + gen_a_f16_z_ui32_rx( f16_to_ui32, roundingMode, exact ); + break; + case F16_TO_UI64: + gen_a_f16_z_ui64_rx( f16_to_ui64, roundingMode, exact ); + break; + case F16_TO_I32: + gen_a_f16_z_i32_rx( f16_to_i32, roundingMode, exact ); + break; + case F16_TO_I64: + gen_a_f16_z_i64_rx( f16_to_i64, roundingMode, exact ); + break; + case F16_TO_F32: + gen_a_f16_z_f32( f16_to_f32 ); + break; +#ifdef FLOAT64 + case F16_TO_F64: + gen_a_f16_z_f64( f16_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F16_TO_EXTF80: + gen_a_f16_z_extF80( f16_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F16_TO_F128: + gen_a_f16_z_f128( f16_to_f128M ); + break; +#endif + case F16_ROUNDTOINT: + gen_az_f16_rx( f16_roundToInt, roundingMode, exact ); + break; + case F16_ADD: + trueFunction_abz_f16 = f16_add; + goto gen_abz_f16; + case F16_SUB: + trueFunction_abz_f16 = f16_sub; + goto gen_abz_f16; + case F16_MUL: + trueFunction_abz_f16 = f16_mul; + goto gen_abz_f16; + case F16_DIV: + trueFunction_abz_f16 = f16_div; + goto gen_abz_f16; + case F16_REM: + trueFunction_abz_f16 = f16_rem; + gen_abz_f16: + gen_abz_f16( trueFunction_abz_f16 ); + break; + case F16_MULADD: + gen_abcz_f16( f16_mulAdd ); + break; + case F16_SQRT: + gen_az_f16( f16_sqrt ); + break; + case F16_EQ: + trueFunction_ab_f16_z_bool = f16_eq; + goto gen_ab_f16_z_bool; + case F16_LE: + trueFunction_ab_f16_z_bool = f16_le; + goto gen_ab_f16_z_bool; + case F16_LT: + trueFunction_ab_f16_z_bool = f16_lt; + goto gen_ab_f16_z_bool; + case F16_EQ_SIGNALING: + trueFunction_ab_f16_z_bool = f16_eq_signaling; + goto gen_ab_f16_z_bool; + case F16_LE_QUIET: + trueFunction_ab_f16_z_bool = f16_le_quiet; + goto gen_ab_f16_z_bool; + case F16_LT_QUIET: + trueFunction_ab_f16_z_bool = f16_lt_quiet; + gen_ab_f16_z_bool: + gen_ab_f16_z_bool( trueFunction_ab_f16_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ + case F32_TO_UI32: + gen_a_f32_z_ui32_rx( f32_to_ui32, roundingMode, exact ); + break; + case F32_TO_UI64: + gen_a_f32_z_ui64_rx( f32_to_ui64, roundingMode, exact ); + break; + case F32_TO_I32: + gen_a_f32_z_i32_rx( f32_to_i32, roundingMode, exact ); + break; + case F32_TO_I64: + gen_a_f32_z_i64_rx( f32_to_i64, roundingMode, exact ); + break; +#ifdef FLOAT16 + case F32_TO_F16: + gen_a_f32_z_f16( f32_to_f16 ); + break; +#endif +#ifdef FLOAT64 + case F32_TO_F64: + gen_a_f32_z_f64( f32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F32_TO_EXTF80: + gen_a_f32_z_extF80( f32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F32_TO_F128: + gen_a_f32_z_f128( f32_to_f128M ); + break; +#endif + case F32_ROUNDTOINT: + gen_az_f32_rx( f32_roundToInt, roundingMode, exact ); + break; + case F32_ADD: + trueFunction_abz_f32 = f32_add; + goto gen_abz_f32; + case F32_SUB: + trueFunction_abz_f32 = f32_sub; + goto gen_abz_f32; + case F32_MUL: + trueFunction_abz_f32 = f32_mul; + goto gen_abz_f32; + case F32_DIV: + trueFunction_abz_f32 = f32_div; + goto gen_abz_f32; + case F32_REM: + trueFunction_abz_f32 = f32_rem; + gen_abz_f32: + gen_abz_f32( trueFunction_abz_f32 ); + break; + case F32_MULADD: + gen_abcz_f32( f32_mulAdd ); + break; + case F32_SQRT: + gen_az_f32( f32_sqrt ); + break; + case F32_EQ: + trueFunction_ab_f32_z_bool = f32_eq; + goto gen_ab_f32_z_bool; + case F32_LE: + trueFunction_ab_f32_z_bool = f32_le; + goto gen_ab_f32_z_bool; + case F32_LT: + trueFunction_ab_f32_z_bool = f32_lt; + goto gen_ab_f32_z_bool; + case F32_EQ_SIGNALING: + trueFunction_ab_f32_z_bool = f32_eq_signaling; + goto gen_ab_f32_z_bool; + case F32_LE_QUIET: + trueFunction_ab_f32_z_bool = f32_le_quiet; + goto gen_ab_f32_z_bool; + case F32_LT_QUIET: + trueFunction_ab_f32_z_bool = f32_lt_quiet; + gen_ab_f32_z_bool: + gen_ab_f32_z_bool( trueFunction_ab_f32_z_bool ); + break; + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT64 + case F64_TO_UI32: + gen_a_f64_z_ui32_rx( f64_to_ui32, roundingMode, exact ); + break; + case F64_TO_UI64: + gen_a_f64_z_ui64_rx( f64_to_ui64, roundingMode, exact ); + break; + case F64_TO_I32: + gen_a_f64_z_i32_rx( f64_to_i32, roundingMode, exact ); + break; + case F64_TO_I64: + gen_a_f64_z_i64_rx( f64_to_i64, roundingMode, exact ); + break; +#ifdef FLOAT16 + case F64_TO_F16: + gen_a_f64_z_f16( f64_to_f16 ); + break; +#endif + case F64_TO_F32: + gen_a_f64_z_f32( f64_to_f32 ); + break; +#ifdef EXTFLOAT80 + case F64_TO_EXTF80: + gen_a_f64_z_extF80( f64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F64_TO_F128: + gen_a_f64_z_f128( f64_to_f128M ); + break; +#endif + case F64_ROUNDTOINT: + gen_az_f64_rx( f64_roundToInt, roundingMode, exact ); + break; + case F64_ADD: + trueFunction_abz_f64 = f64_add; + goto gen_abz_f64; + case F64_SUB: + trueFunction_abz_f64 = f64_sub; + goto gen_abz_f64; + case F64_MUL: + trueFunction_abz_f64 = f64_mul; + goto gen_abz_f64; + case F64_DIV: + trueFunction_abz_f64 = f64_div; + goto gen_abz_f64; + case F64_REM: + trueFunction_abz_f64 = f64_rem; + gen_abz_f64: + gen_abz_f64( trueFunction_abz_f64 ); + break; + case F64_MULADD: + gen_abcz_f64( f64_mulAdd ); + break; + case F64_SQRT: + gen_az_f64( f64_sqrt ); + break; + case F64_EQ: + trueFunction_ab_f64_z_bool = f64_eq; + goto gen_ab_f64_z_bool; + case F64_LE: + trueFunction_ab_f64_z_bool = f64_le; + goto gen_ab_f64_z_bool; + case F64_LT: + trueFunction_ab_f64_z_bool = f64_lt; + goto gen_ab_f64_z_bool; + case F64_EQ_SIGNALING: + trueFunction_ab_f64_z_bool = f64_eq_signaling; + goto gen_ab_f64_z_bool; + case F64_LE_QUIET: + trueFunction_ab_f64_z_bool = f64_le_quiet; + goto gen_ab_f64_z_bool; + case F64_LT_QUIET: + trueFunction_ab_f64_z_bool = f64_lt_quiet; + gen_ab_f64_z_bool: + gen_ab_f64_z_bool( trueFunction_ab_f64_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + case EXTF80_TO_UI32: + gen_a_extF80_z_ui32_rx( extF80M_to_ui32, roundingMode, exact ); + break; + case EXTF80_TO_UI64: + gen_a_extF80_z_ui64_rx( extF80M_to_ui64, roundingMode, exact ); + break; + case EXTF80_TO_I32: + gen_a_extF80_z_i32_rx( extF80M_to_i32, roundingMode, exact ); + break; + case EXTF80_TO_I64: + gen_a_extF80_z_i64_rx( extF80M_to_i64, roundingMode, exact ); + break; +#ifdef FLOAT16 + case EXTF80_TO_F16: + gen_a_extF80_z_f16( extF80M_to_f16 ); + break; +#endif + case EXTF80_TO_F32: + gen_a_extF80_z_f32( extF80M_to_f32 ); + break; +#ifdef FLOAT64 + case EXTF80_TO_F64: + gen_a_extF80_z_f64( extF80M_to_f64 ); + break; +#endif +#ifdef FLOAT128 + case EXTF80_TO_F128: + gen_a_extF80_z_f128( extF80M_to_f128M ); + break; +#endif + case EXTF80_ROUNDTOINT: + gen_az_extF80_rx( extF80M_roundToInt, roundingMode, exact ); + break; + case EXTF80_ADD: + trueFunction_abz_extF80 = extF80M_add; + goto gen_abz_extF80; + case EXTF80_SUB: + trueFunction_abz_extF80 = extF80M_sub; + goto gen_abz_extF80; + case EXTF80_MUL: + trueFunction_abz_extF80 = extF80M_mul; + goto gen_abz_extF80; + case EXTF80_DIV: + trueFunction_abz_extF80 = extF80M_div; + goto gen_abz_extF80; + case EXTF80_REM: + trueFunction_abz_extF80 = extF80M_rem; + gen_abz_extF80: + gen_abz_extF80( trueFunction_abz_extF80 ); + break; + case EXTF80_SQRT: + gen_az_extF80( extF80M_sqrt ); + break; + case EXTF80_EQ: + trueFunction_ab_extF80_z_bool = extF80M_eq; + goto gen_ab_extF80_z_bool; + case EXTF80_LE: + trueFunction_ab_extF80_z_bool = extF80M_le; + goto gen_ab_extF80_z_bool; + case EXTF80_LT: + trueFunction_ab_extF80_z_bool = extF80M_lt; + goto gen_ab_extF80_z_bool; + case EXTF80_EQ_SIGNALING: + trueFunction_ab_extF80_z_bool = extF80M_eq_signaling; + goto gen_ab_extF80_z_bool; + case EXTF80_LE_QUIET: + trueFunction_ab_extF80_z_bool = extF80M_le_quiet; + goto gen_ab_extF80_z_bool; + case EXTF80_LT_QUIET: + trueFunction_ab_extF80_z_bool = extF80M_lt_quiet; + gen_ab_extF80_z_bool: + gen_ab_extF80_z_bool( trueFunction_ab_extF80_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT128 + case F128_TO_UI32: + gen_a_f128_z_ui32_rx( f128M_to_ui32, roundingMode, exact ); + break; + case F128_TO_UI64: + gen_a_f128_z_ui64_rx( f128M_to_ui64, roundingMode, exact ); + break; + case F128_TO_I32: + gen_a_f128_z_i32_rx( f128M_to_i32, roundingMode, exact ); + break; + case F128_TO_I64: + gen_a_f128_z_i64_rx( f128M_to_i64, roundingMode, exact ); + break; +#ifdef FLOAT16 + case F128_TO_F16: + gen_a_f128_z_f16( f128M_to_f16 ); + break; +#endif + case F128_TO_F32: + gen_a_f128_z_f32( f128M_to_f32 ); + break; +#ifdef FLOAT64 + case F128_TO_F64: + gen_a_f128_z_f64( f128M_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F128_TO_EXTF80: + gen_a_f128_z_extF80( f128M_to_extF80M ); + break; +#endif + case F128_ROUNDTOINT: + gen_az_f128_rx( f128M_roundToInt, roundingMode, exact ); + break; + case F128_ADD: + trueFunction_abz_f128 = f128M_add; + goto gen_abz_f128; + case F128_SUB: + trueFunction_abz_f128 = f128M_sub; + goto gen_abz_f128; + case F128_MUL: + trueFunction_abz_f128 = f128M_mul; + goto gen_abz_f128; + case F128_DIV: + trueFunction_abz_f128 = f128M_div; + goto gen_abz_f128; + case F128_REM: + trueFunction_abz_f128 = f128M_rem; + gen_abz_f128: + gen_abz_f128( trueFunction_abz_f128 ); + break; + case F128_MULADD: + gen_abcz_f128( f128M_mulAdd ); + break; + case F128_SQRT: + gen_az_f128( f128M_sqrt ); + break; + case F128_EQ: + trueFunction_ab_f128_z_bool = f128M_eq; + goto gen_ab_f128_z_bool; + case F128_LE: + trueFunction_ab_f128_z_bool = f128M_le; + goto gen_ab_f128_z_bool; + case F128_LT: + trueFunction_ab_f128_z_bool = f128M_lt; + goto gen_ab_f128_z_bool; + case F128_EQ_SIGNALING: + trueFunction_ab_f128_z_bool = f128M_eq_signaling; + goto gen_ab_f128_z_bool; + case F128_LE_QUIET: + trueFunction_ab_f128_z_bool = f128M_le_quiet; + goto gen_ab_f128_z_bool; + case F128_LT_QUIET: + trueFunction_ab_f128_z_bool = f128M_lt_quiet; + gen_ab_f128_z_bool: + gen_ab_f128_z_bool( trueFunction_ab_f128_z_bool ); + break; +#endif + } + return EXIT_SUCCESS; + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + optionError: + fail( "'%s' option requires numeric argument", *argv ); + invalidArg: + fail( "Invalid argument '%s'", *argv ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/testfloat_ver.c b/src/libs/softfloat-3e/testfloat/source/testfloat_ver.c new file mode 100644 index 00000000..e1e613ce --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/testfloat_ver.c @@ -0,0 +1,795 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <signal.h> +#include "platform.h" +#include "fail.h" +#include "softfloat.h" +#include "functions.h" +#include "verCases.h" +#include "writeCase.h" +#include "verLoops.h" + +static void catchSIGINT( int signalCode ) +{ + + if ( verCases_stop ) exit( EXIT_FAILURE ); + verCases_stop = true; + +} + +int main( int argc, char *argv[] ) +{ + bool exact; + int functionCode, roundingCode, tininessCode; + const char *argPtr; + long i; + int functionAttribs; + uint_fast8_t roundingMode; +#ifdef FLOAT16 + float16_t (*trueFunction_abz_f16)( float16_t, float16_t ); + bool (*trueFunction_ab_f16_z_bool)( float16_t, float16_t ); +#endif + float32_t (*trueFunction_abz_f32)( float32_t, float32_t ); + bool (*trueFunction_ab_f32_z_bool)( float32_t, float32_t ); +#ifdef FLOAT64 + float64_t (*trueFunction_abz_f64)( float64_t, float64_t ); + bool (*trueFunction_ab_f64_z_bool)( float64_t, float64_t ); +#endif +#ifdef EXTFLOAT80 + void + (*trueFunction_abz_extF80)( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); + bool + (*trueFunction_ab_extF80_z_bool)( + const extFloat80_t *, const extFloat80_t * ); +#endif +#ifdef FLOAT128 + void + (*trueFunction_abz_f128)( + const float128_t *, const float128_t *, float128_t * ); + bool + (*trueFunction_ab_f128_z_bool)( const float128_t *, const float128_t * ); +#endif + + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + fail_programName = "testfloat_ver"; + if ( argc <= 1 ) goto writeHelpMessage; + softfloat_detectTininess = softfloat_tininess_afterRounding; +#ifdef EXTFLOAT80 + extF80_roundingPrecision = 80; +#endif + roundingMode = softfloat_round_near_even; + exact = false; + verCases_maxErrorCount = 20; + verLoops_trueFlagsPtr = &softfloat_exceptionFlags; + functionCode = 0; + roundingCode = ROUND_NEAR_EVEN; + tininessCode = TININESS_AFTER_ROUNDING; + for (;;) { + --argc; + if ( ! argc ) break; + argPtr = *++argv; + if ( ! argPtr ) break; + if ( argPtr[0] == '-' ) ++argPtr; + if ( + ! strcmp( argPtr, "help" ) || ! strcmp( argPtr, "-help" ) + || ! strcmp( argPtr, "h" ) + ) { + writeHelpMessage: + fputs( +"testfloat_ver [<option>...] <function>\n" +" <option>: (* is default)\n" +" -help --Write this message and exit.\n" +" -errors <num> --Stop after <num> errors.\n" +" * -errors 20\n" +" -checkNaNs --Check for specific NaN results.\n" +" -checkInvInts --Check for specific invalid integer results.\n" +" -checkAll --Same as both '-checkNaNs' and '-checkInvInts'.\n" +#ifdef EXTFLOAT80 +" -precision32 --For extF80, rounding precision is 32 bits.\n" +" -precision64 --For extF80, rounding precision is 64 bits.\n" +" * -precision80 --For extF80, rounding precision is 80 bits.\n" +#endif +" * -rnear_even --Round to nearest/even.\n" +" -rminMag --Round to minimum magnitude (toward zero).\n" +" -rmin --Round to minimum (down).\n" +" -rmax --Round to maximum (up).\n" +" -rnear_maxMag --Round to nearest/maximum magnitude (nearest/away).\n" +#ifdef FLOAT_ROUND_ODD +" -rodd --Round to odd (jamming). (For rounding to an integer\n" +" value, rounds to minimum magnitude instead.)\n" +#endif +" -tininessbefore --Detect underflow tininess before rounding.\n" +" * -tininessafter --Detect underflow tininess after rounding.\n" +" * -notexact --Rounding to integer is not exact (no inexact\n" +" exceptions).\n" +" -exact --Rounding to integer is exact (raising inexact\n" +" exceptions).\n" +" <function>:\n" +" <int>_to_<float> <float>_add <float>_eq\n" +" <float>_to_<int> <float>_sub <float>_le\n" +" <float>_to_<float> <float>_mul <float>_lt\n" +" <float>_roundToInt <float>_mulAdd <float>_eq_signaling\n" +" <float>_div <float>_le_quiet\n" +" <float>_rem <float>_lt_quiet\n" +" <float>_sqrt\n" +" <int>:\n" +" ui32 --Unsigned 32-bit integer.\n" +" ui64 --Unsigned 64-bit integer.\n" +" i32 --Signed 32-bit integer.\n" +" i64 --Signed 64-bit integer.\n" +" <float>:\n" +#ifdef FLOAT16 +" f16 --Binary 16-bit floating-point (half-precision).\n" +#endif +" f32 --Binary 32-bit floating-point (single-precision).\n" +#ifdef FLOAT64 +" f64 --Binary 64-bit floating-point (double-precision).\n" +#endif +#ifdef EXTFLOAT80 +" extF80 --Binary 80-bit extended floating-point.\n" +#endif +#ifdef FLOAT128 +" f128 --Binary 128-bit floating-point (quadruple-precision).\n" +#endif + , + stdout + ); + return EXIT_SUCCESS; + } else if ( ! strcmp( argPtr, "errors" ) ) { + if ( argc < 2 ) goto optionError; + i = strtol( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + verCases_maxErrorCount = i; + --argc; + ++argv; + } else if ( + ! strcmp( argPtr, "checkNaNs" ) || ! strcmp( argPtr, "checknans" ) + ) { + verCases_checkNaNs = true; + } else if ( + ! strcmp( argPtr, "checkInvInts" ) + || ! strcmp( argPtr, "checkinvints" ) + ) { + verCases_checkInvInts = true; + } else if ( + ! strcmp( argPtr, "checkAll" ) || ! strcmp( argPtr, "checkall" ) + ) { + verCases_checkNaNs = true; + verCases_checkInvInts = true; +#ifdef EXTFLOAT80 + } else if ( ! strcmp( argPtr, "precision32" ) ) { + extF80_roundingPrecision = 32; + } else if ( ! strcmp( argPtr, "precision64" ) ) { + extF80_roundingPrecision = 64; + } else if ( ! strcmp( argPtr, "precision80" ) ) { + extF80_roundingPrecision = 80; +#endif + } else if ( + ! strcmp( argPtr, "rnear_even" ) + || ! strcmp( argPtr, "rneareven" ) + || ! strcmp( argPtr, "rnearest_even" ) + ) { + roundingCode = ROUND_NEAR_EVEN; + } else if ( + ! strcmp( argPtr, "rminmag" ) || ! strcmp( argPtr, "rminMag" ) + ) { + roundingCode = ROUND_MINMAG; + } else if ( ! strcmp( argPtr, "rmin" ) ) { + roundingCode = ROUND_MIN; + } else if ( ! strcmp( argPtr, "rmax" ) ) { + roundingCode = ROUND_MAX; + } else if ( + ! strcmp( argPtr, "rnear_maxmag" ) + || ! strcmp( argPtr, "rnear_maxMag" ) + || ! strcmp( argPtr, "rnearmaxmag" ) + || ! strcmp( argPtr, "rnearest_maxmag" ) + || ! strcmp( argPtr, "rnearest_maxMag" ) + ) { + roundingCode = ROUND_NEAR_MAXMAG; +#ifdef FLOAT_ROUND_ODD + } else if ( ! strcmp( argPtr, "rodd" ) ) { + roundingCode = ROUND_ODD; +#endif + } else if ( ! strcmp( argPtr, "tininessbefore" ) ) { + tininessCode = TININESS_BEFORE_ROUNDING; + } else if ( ! strcmp( argPtr, "tininessafter" ) ) { + tininessCode = TININESS_AFTER_ROUNDING; + } else if ( ! strcmp( argPtr, "notexact" ) ) { + exact = false; + } else if ( ! strcmp( argPtr, "exact" ) ) { + exact = true; + } else { + functionCode = 1; + while ( strcmp( argPtr, functionInfos[functionCode].namePtr ) ) { + ++functionCode; + if ( functionCode == NUM_FUNCTIONS ) goto invalidArg; + } + functionAttribs = functionInfos[functionCode].attribs; + if ( + (functionAttribs & FUNC_ARG_EXACT) + && ! (functionAttribs & FUNC_ARG_ROUNDINGMODE) + ) { + goto invalidArg; + } + } + } + if ( ! functionCode ) fail( "Function argument required" ); + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + verCases_functionNamePtr = functionInfos[functionCode].namePtr; +#ifdef EXTFLOAT80 + verCases_roundingPrecision = + functionAttribs & FUNC_EFF_ROUNDINGPRECISION ? extF80_roundingPrecision + : 0; +#endif + verCases_roundingCode = + functionAttribs & (FUNC_ARG_ROUNDINGMODE | FUNC_EFF_ROUNDINGMODE) + ? roundingCode + : 0; +#ifdef EXTFLOAT80 + verCases_tininessCode = + (functionAttribs & FUNC_EFF_TININESSMODE) + || ((functionAttribs & FUNC_EFF_TININESSMODE_REDUCEDPREC) + && extF80_roundingPrecision + && (extF80_roundingPrecision < 80)) + ? tininessCode + : 0; +#else + verCases_tininessCode = + functionAttribs & FUNC_EFF_TININESSMODE ? tininessCode : 0; +#endif + verCases_usesExact = ((functionAttribs & FUNC_ARG_EXACT) != 0); + verCases_exact = exact; + roundingMode = roundingModes[roundingCode]; + softfloat_roundingMode = roundingMode; + softfloat_detectTininess = tininessModes[tininessCode]; + signal( SIGINT, catchSIGINT ); + signal( SIGTERM, catchSIGINT ); + fputs( "Testing ", stderr ); + verCases_writeFunctionName( stderr ); + fputs( ".\n", stderr ); + switch ( functionCode ) { + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case UI32_TO_F16: + ver_a_ui32_z_f16( ui32_to_f16 ); + break; +#endif + case UI32_TO_F32: + ver_a_ui32_z_f32( ui32_to_f32 ); + break; +#ifdef FLOAT64 + case UI32_TO_F64: + ver_a_ui32_z_f64( ui32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case UI32_TO_EXTF80: + ver_a_ui32_z_extF80( ui32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case UI32_TO_F128: + ver_a_ui32_z_f128( ui32_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case UI64_TO_F16: + ver_a_ui64_z_f16( ui64_to_f16 ); + break; +#endif + case UI64_TO_F32: + ver_a_ui64_z_f32( ui64_to_f32 ); + break; +#ifdef FLOAT64 + case UI64_TO_F64: + ver_a_ui64_z_f64( ui64_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case UI64_TO_EXTF80: + ver_a_ui64_z_extF80( ui64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case UI64_TO_F128: + ver_a_ui64_z_f128( ui64_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case I32_TO_F16: + ver_a_i32_z_f16( i32_to_f16 ); + break; +#endif + case I32_TO_F32: + ver_a_i32_z_f32( i32_to_f32 ); + break; +#ifdef FLOAT64 + case I32_TO_F64: + ver_a_i32_z_f64( i32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case I32_TO_EXTF80: + ver_a_i32_z_extF80( i32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case I32_TO_F128: + ver_a_i32_z_f128( i32_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case I64_TO_F16: + ver_a_i64_z_f16( i64_to_f16 ); + break; +#endif + case I64_TO_F32: + ver_a_i64_z_f32( i64_to_f32 ); + break; +#ifdef FLOAT64 + case I64_TO_F64: + ver_a_i64_z_f64( i64_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case I64_TO_EXTF80: + ver_a_i64_z_extF80( i64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case I64_TO_F128: + ver_a_i64_z_f128( i64_to_f128M ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case F16_TO_UI32: + ver_a_f16_z_ui32_rx( f16_to_ui32, roundingMode, exact ); + break; + case F16_TO_UI64: + ver_a_f16_z_ui64_rx( f16_to_ui64, roundingMode, exact ); + break; + case F16_TO_I32: + ver_a_f16_z_i32_rx( f16_to_i32, roundingMode, exact ); + break; + case F16_TO_I64: + ver_a_f16_z_i64_rx( f16_to_i64, roundingMode, exact ); + break; + case F16_TO_F32: + ver_a_f16_z_f32( f16_to_f32 ); + break; +#ifdef FLOAT64 + case F16_TO_F64: + ver_a_f16_z_f64( f16_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F16_TO_EXTF80: + ver_a_f16_z_extF80( f16_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F16_TO_F128: + ver_a_f16_z_f128( f16_to_f128M ); + break; +#endif + case F16_ROUNDTOINT: + ver_az_f16_rx( f16_roundToInt, roundingMode, exact ); + break; + case F16_ADD: + trueFunction_abz_f16 = f16_add; + goto ver_abz_f16; + case F16_SUB: + trueFunction_abz_f16 = f16_sub; + goto ver_abz_f16; + case F16_MUL: + trueFunction_abz_f16 = f16_mul; + goto ver_abz_f16; + case F16_DIV: + trueFunction_abz_f16 = f16_div; + goto ver_abz_f16; + case F16_REM: + trueFunction_abz_f16 = f16_rem; + ver_abz_f16: + ver_abz_f16( trueFunction_abz_f16 ); + break; + case F16_MULADD: + ver_abcz_f16( f16_mulAdd ); + break; + case F16_SQRT: + ver_az_f16( f16_sqrt ); + break; + case F16_EQ: + trueFunction_ab_f16_z_bool = f16_eq; + goto ver_ab_f16_z_bool; + case F16_LE: + trueFunction_ab_f16_z_bool = f16_le; + goto ver_ab_f16_z_bool; + case F16_LT: + trueFunction_ab_f16_z_bool = f16_lt; + goto ver_ab_f16_z_bool; + case F16_EQ_SIGNALING: + trueFunction_ab_f16_z_bool = f16_eq_signaling; + goto ver_ab_f16_z_bool; + case F16_LE_QUIET: + trueFunction_ab_f16_z_bool = f16_le_quiet; + goto ver_ab_f16_z_bool; + case F16_LT_QUIET: + trueFunction_ab_f16_z_bool = f16_lt_quiet; + ver_ab_f16_z_bool: + ver_ab_f16_z_bool( trueFunction_ab_f16_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ + case F32_TO_UI32: + ver_a_f32_z_ui32_rx( f32_to_ui32, roundingMode, exact ); + break; + case F32_TO_UI64: + ver_a_f32_z_ui64_rx( f32_to_ui64, roundingMode, exact ); + break; + case F32_TO_I32: + ver_a_f32_z_i32_rx( f32_to_i32, roundingMode, exact ); + break; + case F32_TO_I64: + ver_a_f32_z_i64_rx( f32_to_i64, roundingMode, exact ); + break; +#ifdef FLOAT16 + case F32_TO_F16: + ver_a_f32_z_f16( f32_to_f16 ); + break; +#endif +#ifdef FLOAT64 + case F32_TO_F64: + ver_a_f32_z_f64( f32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F32_TO_EXTF80: + ver_a_f32_z_extF80( f32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F32_TO_F128: + ver_a_f32_z_f128( f32_to_f128M ); + break; +#endif + case F32_ROUNDTOINT: + ver_az_f32_rx( f32_roundToInt, roundingMode, exact ); + break; + case F32_ADD: + trueFunction_abz_f32 = f32_add; + goto ver_abz_f32; + case F32_SUB: + trueFunction_abz_f32 = f32_sub; + goto ver_abz_f32; + case F32_MUL: + trueFunction_abz_f32 = f32_mul; + goto ver_abz_f32; + case F32_DIV: + trueFunction_abz_f32 = f32_div; + goto ver_abz_f32; + case F32_REM: + trueFunction_abz_f32 = f32_rem; + ver_abz_f32: + ver_abz_f32( trueFunction_abz_f32 ); + break; + case F32_MULADD: + ver_abcz_f32( f32_mulAdd ); + break; + case F32_SQRT: + ver_az_f32( f32_sqrt ); + break; + case F32_EQ: + trueFunction_ab_f32_z_bool = f32_eq; + goto ver_ab_f32_z_bool; + case F32_LE: + trueFunction_ab_f32_z_bool = f32_le; + goto ver_ab_f32_z_bool; + case F32_LT: + trueFunction_ab_f32_z_bool = f32_lt; + goto ver_ab_f32_z_bool; + case F32_EQ_SIGNALING: + trueFunction_ab_f32_z_bool = f32_eq_signaling; + goto ver_ab_f32_z_bool; + case F32_LE_QUIET: + trueFunction_ab_f32_z_bool = f32_le_quiet; + goto ver_ab_f32_z_bool; + case F32_LT_QUIET: + trueFunction_ab_f32_z_bool = f32_lt_quiet; + ver_ab_f32_z_bool: + ver_ab_f32_z_bool( trueFunction_ab_f32_z_bool ); + break; + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT64 + case F64_TO_UI32: + ver_a_f64_z_ui32_rx( f64_to_ui32, roundingMode, exact ); + break; + case F64_TO_UI64: + ver_a_f64_z_ui64_rx( f64_to_ui64, roundingMode, exact ); + break; + case F64_TO_I32: + ver_a_f64_z_i32_rx( f64_to_i32, roundingMode, exact ); + break; + case F64_TO_I64: + ver_a_f64_z_i64_rx( f64_to_i64, roundingMode, exact ); + break; +#ifdef FLOAT16 + case F64_TO_F16: + ver_a_f64_z_f16( f64_to_f16 ); + break; +#endif + case F64_TO_F32: + ver_a_f64_z_f32( f64_to_f32 ); + break; +#ifdef EXTFLOAT80 + case F64_TO_EXTF80: + ver_a_f64_z_extF80( f64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F64_TO_F128: + ver_a_f64_z_f128( f64_to_f128M ); + break; +#endif + case F64_ROUNDTOINT: + ver_az_f64_rx( f64_roundToInt, roundingMode, exact ); + break; + case F64_ADD: + trueFunction_abz_f64 = f64_add; + goto ver_abz_f64; + case F64_SUB: + trueFunction_abz_f64 = f64_sub; + goto ver_abz_f64; + case F64_MUL: + trueFunction_abz_f64 = f64_mul; + goto ver_abz_f64; + case F64_DIV: + trueFunction_abz_f64 = f64_div; + goto ver_abz_f64; + case F64_REM: + trueFunction_abz_f64 = f64_rem; + ver_abz_f64: + ver_abz_f64( trueFunction_abz_f64 ); + break; + case F64_MULADD: + ver_abcz_f64( f64_mulAdd ); + break; + case F64_SQRT: + ver_az_f64( f64_sqrt ); + break; + case F64_EQ: + trueFunction_ab_f64_z_bool = f64_eq; + goto ver_ab_f64_z_bool; + case F64_LE: + trueFunction_ab_f64_z_bool = f64_le; + goto ver_ab_f64_z_bool; + case F64_LT: + trueFunction_ab_f64_z_bool = f64_lt; + goto ver_ab_f64_z_bool; + case F64_EQ_SIGNALING: + trueFunction_ab_f64_z_bool = f64_eq_signaling; + goto ver_ab_f64_z_bool; + case F64_LE_QUIET: + trueFunction_ab_f64_z_bool = f64_le_quiet; + goto ver_ab_f64_z_bool; + case F64_LT_QUIET: + trueFunction_ab_f64_z_bool = f64_lt_quiet; + ver_ab_f64_z_bool: + ver_ab_f64_z_bool( trueFunction_ab_f64_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + case EXTF80_TO_UI32: + ver_a_extF80_z_ui32_rx( extF80M_to_ui32, roundingMode, exact ); + break; + case EXTF80_TO_UI64: + ver_a_extF80_z_ui64_rx( extF80M_to_ui64, roundingMode, exact ); + break; + case EXTF80_TO_I32: + ver_a_extF80_z_i32_rx( extF80M_to_i32, roundingMode, exact ); + break; + case EXTF80_TO_I64: + ver_a_extF80_z_i64_rx( extF80M_to_i64, roundingMode, exact ); + break; +#ifdef FLOAT16 + case EXTF80_TO_F16: + ver_a_extF80_z_f16( extF80M_to_f16 ); + break; +#endif + case EXTF80_TO_F32: + ver_a_extF80_z_f32( extF80M_to_f32 ); + break; +#ifdef FLOAT64 + case EXTF80_TO_F64: + ver_a_extF80_z_f64( extF80M_to_f64 ); + break; +#endif +#ifdef FLOAT128 + case EXTF80_TO_F128: + ver_a_extF80_z_f128( extF80M_to_f128M ); + break; +#endif + case EXTF80_ROUNDTOINT: + ver_az_extF80_rx( extF80M_roundToInt, roundingMode, exact ); + break; + case EXTF80_ADD: + trueFunction_abz_extF80 = extF80M_add; + goto ver_abz_extF80; + case EXTF80_SUB: + trueFunction_abz_extF80 = extF80M_sub; + goto ver_abz_extF80; + case EXTF80_MUL: + trueFunction_abz_extF80 = extF80M_mul; + goto ver_abz_extF80; + case EXTF80_DIV: + trueFunction_abz_extF80 = extF80M_div; + goto ver_abz_extF80; + case EXTF80_REM: + trueFunction_abz_extF80 = extF80M_rem; + ver_abz_extF80: + ver_abz_extF80( trueFunction_abz_extF80 ); + break; + case EXTF80_SQRT: + ver_az_extF80( extF80M_sqrt ); + break; + case EXTF80_EQ: + trueFunction_ab_extF80_z_bool = extF80M_eq; + goto ver_ab_extF80_z_bool; + case EXTF80_LE: + trueFunction_ab_extF80_z_bool = extF80M_le; + goto ver_ab_extF80_z_bool; + case EXTF80_LT: + trueFunction_ab_extF80_z_bool = extF80M_lt; + goto ver_ab_extF80_z_bool; + case EXTF80_EQ_SIGNALING: + trueFunction_ab_extF80_z_bool = extF80M_eq_signaling; + goto ver_ab_extF80_z_bool; + case EXTF80_LE_QUIET: + trueFunction_ab_extF80_z_bool = extF80M_le_quiet; + goto ver_ab_extF80_z_bool; + case EXTF80_LT_QUIET: + trueFunction_ab_extF80_z_bool = extF80M_lt_quiet; + ver_ab_extF80_z_bool: + ver_ab_extF80_z_bool( trueFunction_ab_extF80_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT128 + case F128_TO_UI32: + ver_a_f128_z_ui32_rx( f128M_to_ui32, roundingMode, exact ); + break; + case F128_TO_UI64: + ver_a_f128_z_ui64_rx( f128M_to_ui64, roundingMode, exact ); + break; + case F128_TO_I32: + ver_a_f128_z_i32_rx( f128M_to_i32, roundingMode, exact ); + break; + case F128_TO_I64: + ver_a_f128_z_i64_rx( f128M_to_i64, roundingMode, exact ); + break; +#ifdef FLOAT16 + case F128_TO_F16: + ver_a_f128_z_f16( f128M_to_f16 ); + break; +#endif + case F128_TO_F32: + ver_a_f128_z_f32( f128M_to_f32 ); + break; +#ifdef FLOAT64 + case F128_TO_F64: + ver_a_f128_z_f64( f128M_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F128_TO_EXTF80: + ver_a_f128_z_extF80( f128M_to_extF80M ); + break; +#endif + case F128_ROUNDTOINT: + ver_az_f128_rx( f128M_roundToInt, roundingMode, exact ); + break; + case F128_ADD: + trueFunction_abz_f128 = f128M_add; + goto ver_abz_f128; + case F128_SUB: + trueFunction_abz_f128 = f128M_sub; + goto ver_abz_f128; + case F128_MUL: + trueFunction_abz_f128 = f128M_mul; + goto ver_abz_f128; + case F128_DIV: + trueFunction_abz_f128 = f128M_div; + goto ver_abz_f128; + case F128_REM: + trueFunction_abz_f128 = f128M_rem; + ver_abz_f128: + ver_abz_f128( trueFunction_abz_f128 ); + break; + case F128_MULADD: + ver_abcz_f128( f128M_mulAdd ); + break; + case F128_SQRT: + ver_az_f128( f128M_sqrt ); + break; + case F128_EQ: + trueFunction_ab_f128_z_bool = f128M_eq; + goto ver_ab_f128_z_bool; + case F128_LE: + trueFunction_ab_f128_z_bool = f128M_le; + goto ver_ab_f128_z_bool; + case F128_LT: + trueFunction_ab_f128_z_bool = f128M_lt; + goto ver_ab_f128_z_bool; + case F128_EQ_SIGNALING: + trueFunction_ab_f128_z_bool = f128M_eq_signaling; + goto ver_ab_f128_z_bool; + case F128_LE_QUIET: + trueFunction_ab_f128_z_bool = f128M_le_quiet; + goto ver_ab_f128_z_bool; + case F128_LT_QUIET: + trueFunction_ab_f128_z_bool = f128M_lt_quiet; + ver_ab_f128_z_bool: + ver_ab_f128_z_bool( trueFunction_ab_f128_z_bool ); + break; +#endif + } + verCases_exitWithStatus(); + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + optionError: + fail( "'%s' option requires numeric argument", *argv ); + invalidArg: + fail( "Invalid argument '%s'", *argv ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/testsoftfloat.c b/src/libs/softfloat-3e/testfloat/source/testsoftfloat.c new file mode 100644 index 00000000..1aa1f025 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/testsoftfloat.c @@ -0,0 +1,1127 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <signal.h> +#include "platform.h" +#include "fail.h" +#include "softfloat.h" +#include "slowfloat.h" +#include "functions.h" +#include "genCases.h" +#include "verCases.h" +#include "writeCase.h" +#include "testLoops.h" + +static void catchSIGINT( int signalCode ) +{ + + if ( verCases_stop ) exit( EXIT_FAILURE ); + verCases_stop = true; + +} + +static uint_fast8_t softfloat_clearExceptionFlags( void ) +{ + uint_fast8_t prevFlags; + + prevFlags = softfloat_exceptionFlags; + softfloat_exceptionFlags = 0; + return prevFlags; + +} + +static +void + testFunctionInstance( + int functionCode, uint_fast8_t roundingMode, bool exact ) +{ +#ifdef FLOAT16 + float16_t (*trueFunction_abz_f16)( float16_t, float16_t ); + float16_t (*subjFunction_abz_f16)( float16_t, float16_t ); + bool (*trueFunction_ab_f16_z_bool)( float16_t, float16_t ); + bool (*subjFunction_ab_f16_z_bool)( float16_t, float16_t ); +#endif + float32_t (*trueFunction_abz_f32)( float32_t, float32_t ); + float32_t (*subjFunction_abz_f32)( float32_t, float32_t ); + bool (*trueFunction_ab_f32_z_bool)( float32_t, float32_t ); + bool (*subjFunction_ab_f32_z_bool)( float32_t, float32_t ); +#ifdef FLOAT64 + float64_t (*trueFunction_abz_f64)( float64_t, float64_t ); + float64_t (*subjFunction_abz_f64)( float64_t, float64_t ); + bool (*trueFunction_ab_f64_z_bool)( float64_t, float64_t ); + bool (*subjFunction_ab_f64_z_bool)( float64_t, float64_t ); +#endif +#ifdef EXTFLOAT80 + void (*trueFunction_abz_extF80M)( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); + void (*subjFunction_abz_extF80M)( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); + bool (*trueFunction_ab_extF80M_z_bool)( + const extFloat80_t *, const extFloat80_t * ); + bool (*subjFunction_ab_extF80M_z_bool)( + const extFloat80_t *, const extFloat80_t * ); +#endif +#ifdef FLOAT128 + void (*trueFunction_abz_f128M)( + const float128_t *, const float128_t *, float128_t * ); + void (*subjFunction_abz_f128M)( + const float128_t *, const float128_t *, float128_t * ); + bool (*trueFunction_ab_f128M_z_bool)( + const float128_t *, const float128_t * ); + bool (*subjFunction_ab_f128M_z_bool)( + const float128_t *, const float128_t * ); +#endif + + fputs( "Testing ", stderr ); + verCases_writeFunctionName( stderr ); + fputs( ".\n", stderr ); + switch ( functionCode ) { + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case UI32_TO_F16: + test_a_ui32_z_f16( slow_ui32_to_f16, ui32_to_f16 ); + break; +#endif + case UI32_TO_F32: + test_a_ui32_z_f32( slow_ui32_to_f32, ui32_to_f32 ); + break; +#ifdef FLOAT64 + case UI32_TO_F64: + test_a_ui32_z_f64( slow_ui32_to_f64, ui32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case UI32_TO_EXTF80: + test_a_ui32_z_extF80( slow_ui32_to_extF80M, ui32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case UI32_TO_F128: + test_a_ui32_z_f128( slow_ui32_to_f128M, ui32_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case UI64_TO_F16: + test_a_ui64_z_f16( slow_ui64_to_f16, ui64_to_f16 ); + break; +#endif + case UI64_TO_F32: + test_a_ui64_z_f32( slow_ui64_to_f32, ui64_to_f32 ); + break; +#ifdef FLOAT64 + case UI64_TO_F64: + test_a_ui64_z_f64( slow_ui64_to_f64, ui64_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case UI64_TO_EXTF80: + test_a_ui64_z_extF80( slow_ui64_to_extF80M, ui64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case UI64_TO_F128: + test_a_ui64_z_f128( slow_ui64_to_f128M, ui64_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case I32_TO_F16: + test_a_i32_z_f16( slow_i32_to_f16, i32_to_f16 ); + break; +#endif + case I32_TO_F32: + test_a_i32_z_f32( slow_i32_to_f32, i32_to_f32 ); + break; +#ifdef FLOAT64 + case I32_TO_F64: + test_a_i32_z_f64( slow_i32_to_f64, i32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case I32_TO_EXTF80: + test_a_i32_z_extF80( slow_i32_to_extF80M, i32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case I32_TO_F128: + test_a_i32_z_f128( slow_i32_to_f128M, i32_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case I64_TO_F16: + test_a_i64_z_f16( slow_i64_to_f16, i64_to_f16 ); + break; +#endif + case I64_TO_F32: + test_a_i64_z_f32( slow_i64_to_f32, i64_to_f32 ); + break; +#ifdef FLOAT64 + case I64_TO_F64: + test_a_i64_z_f64( slow_i64_to_f64, i64_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case I64_TO_EXTF80: + test_a_i64_z_extF80( slow_i64_to_extF80M, i64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case I64_TO_F128: + test_a_i64_z_f128( slow_i64_to_f128M, i64_to_f128M ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case F16_TO_UI32: + test_a_f16_z_ui32_rx( + slow_f16_to_ui32, f16_to_ui32, roundingMode, exact ); + break; + case F16_TO_UI64: + test_a_f16_z_ui64_rx( + slow_f16_to_ui64, f16_to_ui64, roundingMode, exact ); + break; + case F16_TO_I32: + test_a_f16_z_i32_rx( + slow_f16_to_i32, f16_to_i32, roundingMode, exact ); + break; + case F16_TO_I64: + test_a_f16_z_i64_rx( + slow_f16_to_i64, f16_to_i64, roundingMode, exact ); + break; + case F16_TO_UI32_R_MINMAG: + test_a_f16_z_ui32_x( + slow_f16_to_ui32_r_minMag, f16_to_ui32_r_minMag, exact ); + break; + case F16_TO_UI64_R_MINMAG: + test_a_f16_z_ui64_x( + slow_f16_to_ui64_r_minMag, f16_to_ui64_r_minMag, exact ); + break; + case F16_TO_I32_R_MINMAG: + test_a_f16_z_i32_x( + slow_f16_to_i32_r_minMag, f16_to_i32_r_minMag, exact ); + break; + case F16_TO_I64_R_MINMAG: + test_a_f16_z_i64_x( + slow_f16_to_i64_r_minMag, f16_to_i64_r_minMag, exact ); + break; + case F16_TO_F32: + test_a_f16_z_f32( slow_f16_to_f32, f16_to_f32 ); + break; +#ifdef FLOAT64 + case F16_TO_F64: + test_a_f16_z_f64( slow_f16_to_f64, f16_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F16_TO_EXTF80: + test_a_f16_z_extF80( slow_f16_to_extF80M, f16_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F16_TO_F128: + test_a_f16_z_f128( slow_f16_to_f128M, f16_to_f128M ); + break; +#endif + case F16_ROUNDTOINT: + test_az_f16_rx( + slow_f16_roundToInt, f16_roundToInt, roundingMode, exact ); + break; + case F16_ADD: + trueFunction_abz_f16 = slow_f16_add; + subjFunction_abz_f16 = f16_add; + goto test_abz_f16; + case F16_SUB: + trueFunction_abz_f16 = slow_f16_sub; + subjFunction_abz_f16 = f16_sub; + goto test_abz_f16; + case F16_MUL: + trueFunction_abz_f16 = slow_f16_mul; + subjFunction_abz_f16 = f16_mul; + goto test_abz_f16; + case F16_DIV: + trueFunction_abz_f16 = slow_f16_div; + subjFunction_abz_f16 = f16_div; + goto test_abz_f16; + case F16_REM: + trueFunction_abz_f16 = slow_f16_rem; + subjFunction_abz_f16 = f16_rem; + test_abz_f16: + test_abz_f16( trueFunction_abz_f16, subjFunction_abz_f16 ); + break; + case F16_MULADD: + test_abcz_f16( slow_f16_mulAdd, f16_mulAdd ); + break; + case F16_SQRT: + test_az_f16( slow_f16_sqrt, f16_sqrt ); + break; + case F16_EQ: + trueFunction_ab_f16_z_bool = slow_f16_eq; + subjFunction_ab_f16_z_bool = f16_eq; + goto test_ab_f16_z_bool; + case F16_LE: + trueFunction_ab_f16_z_bool = slow_f16_le; + subjFunction_ab_f16_z_bool = f16_le; + goto test_ab_f16_z_bool; + case F16_LT: + trueFunction_ab_f16_z_bool = slow_f16_lt; + subjFunction_ab_f16_z_bool = f16_lt; + goto test_ab_f16_z_bool; + case F16_EQ_SIGNALING: + trueFunction_ab_f16_z_bool = slow_f16_eq_signaling; + subjFunction_ab_f16_z_bool = f16_eq_signaling; + goto test_ab_f16_z_bool; + case F16_LE_QUIET: + trueFunction_ab_f16_z_bool = slow_f16_le_quiet; + subjFunction_ab_f16_z_bool = f16_le_quiet; + goto test_ab_f16_z_bool; + case F16_LT_QUIET: + trueFunction_ab_f16_z_bool = slow_f16_lt_quiet; + subjFunction_ab_f16_z_bool = f16_lt_quiet; + test_ab_f16_z_bool: + test_ab_f16_z_bool( + trueFunction_ab_f16_z_bool, subjFunction_ab_f16_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ + case F32_TO_UI32: + test_a_f32_z_ui32_rx( + slow_f32_to_ui32, f32_to_ui32, roundingMode, exact ); + break; + case F32_TO_UI64: + test_a_f32_z_ui64_rx( + slow_f32_to_ui64, f32_to_ui64, roundingMode, exact ); + break; + case F32_TO_I32: + test_a_f32_z_i32_rx( + slow_f32_to_i32, f32_to_i32, roundingMode, exact ); + break; + case F32_TO_I64: + test_a_f32_z_i64_rx( + slow_f32_to_i64, f32_to_i64, roundingMode, exact ); + break; + case F32_TO_UI32_R_MINMAG: + test_a_f32_z_ui32_x( + slow_f32_to_ui32_r_minMag, f32_to_ui32_r_minMag, exact ); + break; + case F32_TO_UI64_R_MINMAG: + test_a_f32_z_ui64_x( + slow_f32_to_ui64_r_minMag, f32_to_ui64_r_minMag, exact ); + break; + case F32_TO_I32_R_MINMAG: + test_a_f32_z_i32_x( + slow_f32_to_i32_r_minMag, f32_to_i32_r_minMag, exact ); + break; + case F32_TO_I64_R_MINMAG: + test_a_f32_z_i64_x( + slow_f32_to_i64_r_minMag, f32_to_i64_r_minMag, exact ); + break; +#ifdef FLOAT16 + case F32_TO_F16: + test_a_f32_z_f16( slow_f32_to_f16, f32_to_f16 ); + break; +#endif +#ifdef FLOAT64 + case F32_TO_F64: + test_a_f32_z_f64( slow_f32_to_f64, f32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F32_TO_EXTF80: + test_a_f32_z_extF80( slow_f32_to_extF80M, f32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F32_TO_F128: + test_a_f32_z_f128( slow_f32_to_f128M, f32_to_f128M ); + break; +#endif + case F32_ROUNDTOINT: + test_az_f32_rx( + slow_f32_roundToInt, f32_roundToInt, roundingMode, exact ); + break; + case F32_ADD: + trueFunction_abz_f32 = slow_f32_add; + subjFunction_abz_f32 = f32_add; + goto test_abz_f32; + case F32_SUB: + trueFunction_abz_f32 = slow_f32_sub; + subjFunction_abz_f32 = f32_sub; + goto test_abz_f32; + case F32_MUL: + trueFunction_abz_f32 = slow_f32_mul; + subjFunction_abz_f32 = f32_mul; + goto test_abz_f32; + case F32_DIV: + trueFunction_abz_f32 = slow_f32_div; + subjFunction_abz_f32 = f32_div; + goto test_abz_f32; + case F32_REM: + trueFunction_abz_f32 = slow_f32_rem; + subjFunction_abz_f32 = f32_rem; + test_abz_f32: + test_abz_f32( trueFunction_abz_f32, subjFunction_abz_f32 ); + break; + case F32_MULADD: + test_abcz_f32( slow_f32_mulAdd, f32_mulAdd ); + break; + case F32_SQRT: + test_az_f32( slow_f32_sqrt, f32_sqrt ); + break; + case F32_EQ: + trueFunction_ab_f32_z_bool = slow_f32_eq; + subjFunction_ab_f32_z_bool = f32_eq; + goto test_ab_f32_z_bool; + case F32_LE: + trueFunction_ab_f32_z_bool = slow_f32_le; + subjFunction_ab_f32_z_bool = f32_le; + goto test_ab_f32_z_bool; + case F32_LT: + trueFunction_ab_f32_z_bool = slow_f32_lt; + subjFunction_ab_f32_z_bool = f32_lt; + goto test_ab_f32_z_bool; + case F32_EQ_SIGNALING: + trueFunction_ab_f32_z_bool = slow_f32_eq_signaling; + subjFunction_ab_f32_z_bool = f32_eq_signaling; + goto test_ab_f32_z_bool; + case F32_LE_QUIET: + trueFunction_ab_f32_z_bool = slow_f32_le_quiet; + subjFunction_ab_f32_z_bool = f32_le_quiet; + goto test_ab_f32_z_bool; + case F32_LT_QUIET: + trueFunction_ab_f32_z_bool = slow_f32_lt_quiet; + subjFunction_ab_f32_z_bool = f32_lt_quiet; + test_ab_f32_z_bool: + test_ab_f32_z_bool( + trueFunction_ab_f32_z_bool, subjFunction_ab_f32_z_bool ); + break; + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT64 + case F64_TO_UI32: + test_a_f64_z_ui32_rx( + slow_f64_to_ui32, f64_to_ui32, roundingMode, exact ); + break; + case F64_TO_UI64: + test_a_f64_z_ui64_rx( + slow_f64_to_ui64, f64_to_ui64, roundingMode, exact ); + break; + case F64_TO_I32: + test_a_f64_z_i32_rx( + slow_f64_to_i32, f64_to_i32, roundingMode, exact ); + break; + case F64_TO_I64: + test_a_f64_z_i64_rx( + slow_f64_to_i64, f64_to_i64, roundingMode, exact ); + break; + case F64_TO_UI32_R_MINMAG: + test_a_f64_z_ui32_x( + slow_f64_to_ui32_r_minMag, f64_to_ui32_r_minMag, exact ); + break; + case F64_TO_UI64_R_MINMAG: + test_a_f64_z_ui64_x( + slow_f64_to_ui64_r_minMag, f64_to_ui64_r_minMag, exact ); + break; + case F64_TO_I32_R_MINMAG: + test_a_f64_z_i32_x( + slow_f64_to_i32_r_minMag, f64_to_i32_r_minMag, exact ); + break; + case F64_TO_I64_R_MINMAG: + test_a_f64_z_i64_x( + slow_f64_to_i64_r_minMag, f64_to_i64_r_minMag, exact ); + break; +#ifdef FLOAT16 + case F64_TO_F16: + test_a_f64_z_f16( slow_f64_to_f16, f64_to_f16 ); + break; +#endif + case F64_TO_F32: + test_a_f64_z_f32( slow_f64_to_f32, f64_to_f32 ); + break; +#ifdef EXTFLOAT80 + case F64_TO_EXTF80: + test_a_f64_z_extF80( slow_f64_to_extF80M, f64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F64_TO_F128: + test_a_f64_z_f128( slow_f64_to_f128M, f64_to_f128M ); + break; +#endif + case F64_ROUNDTOINT: + test_az_f64_rx( + slow_f64_roundToInt, f64_roundToInt, roundingMode, exact ); + break; + case F64_ADD: + trueFunction_abz_f64 = slow_f64_add; + subjFunction_abz_f64 = f64_add; + goto test_abz_f64; + case F64_SUB: + trueFunction_abz_f64 = slow_f64_sub; + subjFunction_abz_f64 = f64_sub; + goto test_abz_f64; + case F64_MUL: + trueFunction_abz_f64 = slow_f64_mul; + subjFunction_abz_f64 = f64_mul; + goto test_abz_f64; + case F64_DIV: + trueFunction_abz_f64 = slow_f64_div; + subjFunction_abz_f64 = f64_div; + goto test_abz_f64; + case F64_REM: + trueFunction_abz_f64 = slow_f64_rem; + subjFunction_abz_f64 = f64_rem; + test_abz_f64: + test_abz_f64( trueFunction_abz_f64, subjFunction_abz_f64 ); + break; + case F64_MULADD: + test_abcz_f64( slow_f64_mulAdd, f64_mulAdd ); + break; + case F64_SQRT: + test_az_f64( slow_f64_sqrt, f64_sqrt ); + break; + case F64_EQ: + trueFunction_ab_f64_z_bool = slow_f64_eq; + subjFunction_ab_f64_z_bool = f64_eq; + goto test_ab_f64_z_bool; + case F64_LE: + trueFunction_ab_f64_z_bool = slow_f64_le; + subjFunction_ab_f64_z_bool = f64_le; + goto test_ab_f64_z_bool; + case F64_LT: + trueFunction_ab_f64_z_bool = slow_f64_lt; + subjFunction_ab_f64_z_bool = f64_lt; + goto test_ab_f64_z_bool; + case F64_EQ_SIGNALING: + trueFunction_ab_f64_z_bool = slow_f64_eq_signaling; + subjFunction_ab_f64_z_bool = f64_eq_signaling; + goto test_ab_f64_z_bool; + case F64_LE_QUIET: + trueFunction_ab_f64_z_bool = slow_f64_le_quiet; + subjFunction_ab_f64_z_bool = f64_le_quiet; + goto test_ab_f64_z_bool; + case F64_LT_QUIET: + trueFunction_ab_f64_z_bool = slow_f64_lt_quiet; + subjFunction_ab_f64_z_bool = f64_lt_quiet; + test_ab_f64_z_bool: + test_ab_f64_z_bool( + trueFunction_ab_f64_z_bool, subjFunction_ab_f64_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + case EXTF80_TO_UI32: + test_a_extF80_z_ui32_rx( + slow_extF80M_to_ui32, extF80M_to_ui32, roundingMode, exact ); + break; + case EXTF80_TO_UI64: + test_a_extF80_z_ui64_rx( + slow_extF80M_to_ui64, extF80M_to_ui64, roundingMode, exact ); + break; + case EXTF80_TO_I32: + test_a_extF80_z_i32_rx( + slow_extF80M_to_i32, extF80M_to_i32, roundingMode, exact ); + break; + case EXTF80_TO_I64: + test_a_extF80_z_i64_rx( + slow_extF80M_to_i64, extF80M_to_i64, roundingMode, exact ); + break; + case EXTF80_TO_UI32_R_MINMAG: + test_a_extF80_z_ui32_x( + slow_extF80M_to_ui32_r_minMag, extF80M_to_ui32_r_minMag, exact ); + break; + case EXTF80_TO_UI64_R_MINMAG: + test_a_extF80_z_ui64_x( + slow_extF80M_to_ui64_r_minMag, extF80M_to_ui64_r_minMag, exact ); + break; + case EXTF80_TO_I32_R_MINMAG: + test_a_extF80_z_i32_x( + slow_extF80M_to_i32_r_minMag, extF80M_to_i32_r_minMag, exact ); + break; + case EXTF80_TO_I64_R_MINMAG: + test_a_extF80_z_i64_x( + slow_extF80M_to_i64_r_minMag, extF80M_to_i64_r_minMag, exact ); + break; +#ifdef FLOAT16 + case EXTF80_TO_F16: + test_a_extF80_z_f16( slow_extF80M_to_f16, extF80M_to_f16 ); + break; +#endif + case EXTF80_TO_F32: + test_a_extF80_z_f32( slow_extF80M_to_f32, extF80M_to_f32 ); + break; +#ifdef FLOAT64 + case EXTF80_TO_F64: + test_a_extF80_z_f64( slow_extF80M_to_f64, extF80M_to_f64 ); + break; +#endif +#ifdef FLOAT128 + case EXTF80_TO_F128: + test_a_extF80_z_f128( slow_extF80M_to_f128M, extF80M_to_f128M ); + break; +#endif + case EXTF80_ROUNDTOINT: + test_az_extF80_rx( + slow_extF80M_roundToInt, extF80M_roundToInt, roundingMode, exact ); + break; + case EXTF80_ADD: + trueFunction_abz_extF80M = slow_extF80M_add; + subjFunction_abz_extF80M = extF80M_add; + goto test_abz_extF80; + case EXTF80_SUB: + trueFunction_abz_extF80M = slow_extF80M_sub; + subjFunction_abz_extF80M = extF80M_sub; + goto test_abz_extF80; + case EXTF80_MUL: + trueFunction_abz_extF80M = slow_extF80M_mul; + subjFunction_abz_extF80M = extF80M_mul; + goto test_abz_extF80; + case EXTF80_DIV: + trueFunction_abz_extF80M = slow_extF80M_div; + subjFunction_abz_extF80M = extF80M_div; + goto test_abz_extF80; + case EXTF80_REM: + trueFunction_abz_extF80M = slow_extF80M_rem; + subjFunction_abz_extF80M = extF80M_rem; + test_abz_extF80: + test_abz_extF80( trueFunction_abz_extF80M, subjFunction_abz_extF80M ); + break; + case EXTF80_SQRT: + test_az_extF80( slow_extF80M_sqrt, extF80M_sqrt ); + break; + case EXTF80_EQ: + trueFunction_ab_extF80M_z_bool = slow_extF80M_eq; + subjFunction_ab_extF80M_z_bool = extF80M_eq; + goto test_ab_extF80_z_bool; + case EXTF80_LE: + trueFunction_ab_extF80M_z_bool = slow_extF80M_le; + subjFunction_ab_extF80M_z_bool = extF80M_le; + goto test_ab_extF80_z_bool; + case EXTF80_LT: + trueFunction_ab_extF80M_z_bool = slow_extF80M_lt; + subjFunction_ab_extF80M_z_bool = extF80M_lt; + goto test_ab_extF80_z_bool; + case EXTF80_EQ_SIGNALING: + trueFunction_ab_extF80M_z_bool = slow_extF80M_eq_signaling; + subjFunction_ab_extF80M_z_bool = extF80M_eq_signaling; + goto test_ab_extF80_z_bool; + case EXTF80_LE_QUIET: + trueFunction_ab_extF80M_z_bool = slow_extF80M_le_quiet; + subjFunction_ab_extF80M_z_bool = extF80M_le_quiet; + goto test_ab_extF80_z_bool; + case EXTF80_LT_QUIET: + trueFunction_ab_extF80M_z_bool = slow_extF80M_lt_quiet; + subjFunction_ab_extF80M_z_bool = extF80M_lt_quiet; + test_ab_extF80_z_bool: + test_ab_extF80_z_bool( + trueFunction_ab_extF80M_z_bool, subjFunction_ab_extF80M_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT128 + case F128_TO_UI32: + test_a_f128_z_ui32_rx( + slow_f128M_to_ui32, f128M_to_ui32, roundingMode, exact ); + break; + case F128_TO_UI64: + test_a_f128_z_ui64_rx( + slow_f128M_to_ui64, f128M_to_ui64, roundingMode, exact ); + break; + case F128_TO_I32: + test_a_f128_z_i32_rx( + slow_f128M_to_i32, f128M_to_i32, roundingMode, exact ); + break; + case F128_TO_I64: + test_a_f128_z_i64_rx( + slow_f128M_to_i64, f128M_to_i64, roundingMode, exact ); + break; + case F128_TO_UI32_R_MINMAG: + test_a_f128_z_ui32_x( + slow_f128M_to_ui32_r_minMag, f128M_to_ui32_r_minMag, exact ); + break; + case F128_TO_UI64_R_MINMAG: + test_a_f128_z_ui64_x( + slow_f128M_to_ui64_r_minMag, f128M_to_ui64_r_minMag, exact ); + break; + case F128_TO_I32_R_MINMAG: + test_a_f128_z_i32_x( + slow_f128M_to_i32_r_minMag, f128M_to_i32_r_minMag, exact ); + break; + case F128_TO_I64_R_MINMAG: + test_a_f128_z_i64_x( + slow_f128M_to_i64_r_minMag, f128M_to_i64_r_minMag, exact ); + break; +#ifdef FLOAT16 + case F128_TO_F16: + test_a_f128_z_f16( slow_f128M_to_f16, f128M_to_f16 ); + break; +#endif + case F128_TO_F32: + test_a_f128_z_f32( slow_f128M_to_f32, f128M_to_f32 ); + break; +#ifdef FLOAT64 + case F128_TO_F64: + test_a_f128_z_f64( slow_f128M_to_f64, f128M_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F128_TO_EXTF80: + test_a_f128_z_extF80( slow_f128M_to_extF80M, f128M_to_extF80M ); + break; +#endif + case F128_ROUNDTOINT: + test_az_f128_rx( + slow_f128M_roundToInt, f128M_roundToInt, roundingMode, exact ); + break; + case F128_ADD: + trueFunction_abz_f128M = slow_f128M_add; + subjFunction_abz_f128M = f128M_add; + goto test_abz_f128; + case F128_SUB: + trueFunction_abz_f128M = slow_f128M_sub; + subjFunction_abz_f128M = f128M_sub; + goto test_abz_f128; + case F128_MUL: + trueFunction_abz_f128M = slow_f128M_mul; + subjFunction_abz_f128M = f128M_mul; + goto test_abz_f128; + case F128_DIV: + trueFunction_abz_f128M = slow_f128M_div; + subjFunction_abz_f128M = f128M_div; + goto test_abz_f128; + case F128_REM: + trueFunction_abz_f128M = slow_f128M_rem; + subjFunction_abz_f128M = f128M_rem; + test_abz_f128: + test_abz_f128( trueFunction_abz_f128M, subjFunction_abz_f128M ); + break; + case F128_MULADD: + test_abcz_f128( slow_f128M_mulAdd, f128M_mulAdd ); + break; + case F128_SQRT: + test_az_f128( slow_f128M_sqrt, f128M_sqrt ); + break; + case F128_EQ: + trueFunction_ab_f128M_z_bool = slow_f128M_eq; + subjFunction_ab_f128M_z_bool = f128M_eq; + goto test_ab_f128_z_bool; + case F128_LE: + trueFunction_ab_f128M_z_bool = slow_f128M_le; + subjFunction_ab_f128M_z_bool = f128M_le; + goto test_ab_f128_z_bool; + case F128_LT: + trueFunction_ab_f128M_z_bool = slow_f128M_lt; + subjFunction_ab_f128M_z_bool = f128M_lt; + goto test_ab_f128_z_bool; + case F128_EQ_SIGNALING: + trueFunction_ab_f128M_z_bool = slow_f128M_eq_signaling; + subjFunction_ab_f128M_z_bool = f128M_eq_signaling; + goto test_ab_f128_z_bool; + case F128_LE_QUIET: + trueFunction_ab_f128M_z_bool = slow_f128M_le_quiet; + subjFunction_ab_f128M_z_bool = f128M_le_quiet; + goto test_ab_f128_z_bool; + case F128_LT_QUIET: + trueFunction_ab_f128M_z_bool = slow_f128M_lt_quiet; + subjFunction_ab_f128M_z_bool = f128M_lt_quiet; + test_ab_f128_z_bool: + test_ab_f128_z_bool( + trueFunction_ab_f128M_z_bool, subjFunction_ab_f128M_z_bool ); + break; +#endif + } + if ( (verCases_errorStop && verCases_anyErrors) || verCases_stop ) { + verCases_exitWithStatus(); + } + +} + +enum { EXACT_FALSE = 1, EXACT_TRUE }; + +static +void + testFunction( + int functionCode, + uint_fast8_t roundingPrecisionIn, + int roundingCodeIn, + int tininessCodeIn, + int exactCodeIn + ) +{ + int functionAttribs; + uint_fast8_t roundingPrecision; + int roundingCode; + uint_fast8_t roundingMode = 0; + int exactCode; + bool exact; + int tininessCode; + uint_fast8_t tininessMode; + + functionAttribs = functionInfos[functionCode].attribs; + verCases_functionNamePtr = functionInfos[functionCode].namePtr; + roundingPrecision = 32; + for (;;) { + if ( functionAttribs & FUNC_EFF_ROUNDINGPRECISION ) { + if ( roundingPrecisionIn ) roundingPrecision = roundingPrecisionIn; + } else { + roundingPrecision = 0; + } +#ifdef EXTFLOAT80 + verCases_roundingPrecision = roundingPrecision; + if ( roundingPrecision ) { + slow_extF80_roundingPrecision = roundingPrecision; + extF80_roundingPrecision = roundingPrecision; + } +#endif + for ( + roundingCode = 1; roundingCode < NUM_ROUNDINGMODES; ++roundingCode + ) { + if ( + functionAttribs + & (FUNC_ARG_ROUNDINGMODE | FUNC_EFF_ROUNDINGMODE) + ) { + if ( roundingCodeIn ) roundingCode = roundingCodeIn; + } else { + roundingCode = 0; + } + verCases_roundingCode = roundingCode; + if ( roundingCode ) { + roundingMode = roundingModes[roundingCode]; + if ( functionAttribs & FUNC_EFF_ROUNDINGMODE ) { + slowfloat_roundingMode = roundingMode; + softfloat_roundingMode = roundingMode; + } + } + for ( + exactCode = EXACT_FALSE; exactCode <= EXACT_TRUE; ++exactCode + ) { + if ( functionAttribs & FUNC_ARG_EXACT ) { + if ( exactCodeIn ) exactCode = exactCodeIn; + } else { + exactCode = 0; + } + exact = (exactCode == EXACT_TRUE); + verCases_usesExact = (exactCode != 0); + verCases_exact = exact; + for ( + tininessCode = 1; + tininessCode < NUM_TININESSMODES; + ++tininessCode + ) { + if ( + (functionAttribs & FUNC_EFF_TININESSMODE) + || ((functionAttribs + & FUNC_EFF_TININESSMODE_REDUCEDPREC) + && roundingPrecision + && (roundingPrecision < 80)) + ) { + if ( tininessCodeIn ) tininessCode = tininessCodeIn; + } else { + tininessCode = 0; + } + verCases_tininessCode = tininessCode; + if ( tininessCode ) { + tininessMode = tininessModes[tininessCode]; + slowfloat_detectTininess = tininessMode; + softfloat_detectTininess = tininessMode; + } + testFunctionInstance( functionCode, roundingMode, exact ); + if ( tininessCodeIn || ! tininessCode ) break; + } + if ( exactCodeIn || ! exactCode ) break; + } + if ( roundingCodeIn || ! roundingCode ) break; + } + if ( roundingPrecisionIn || ! roundingPrecision ) break; + if ( roundingPrecision == 80 ) { + break; + } else if ( roundingPrecision == 64 ) { + roundingPrecision = 80; + } else if ( roundingPrecision == 32 ) { + roundingPrecision = 64; + } + } + +} + +int main( int argc, char *argv[] ) +{ + bool haveFunctionArg; + int functionCode, numOperands; + uint_fast8_t roundingPrecision; + int roundingCode, tininessCode, exactCode; + const char *argPtr; + unsigned long ui; + long i; + int functionMatchAttrib; + + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + fail_programName = "testsoftfloat"; + if ( argc <= 1 ) goto writeHelpMessage; + genCases_setLevel( 1 ); + verCases_maxErrorCount = 20; + testLoops_trueFlagsPtr = &slowfloat_exceptionFlags; + testLoops_subjFlagsFunction = softfloat_clearExceptionFlags; + haveFunctionArg = false; + functionCode = 0; + numOperands = 0; + roundingPrecision = 0; + roundingCode = 0; + tininessCode = 0; + exactCode = 0; + for (;;) { + --argc; + if ( ! argc ) break; + argPtr = *++argv; + if ( ! argPtr ) break; + if ( argPtr[0] == '-' ) ++argPtr; + if ( + ! strcmp( argPtr, "help" ) || ! strcmp( argPtr, "-help" ) + || ! strcmp( argPtr, "h" ) + ) { + writeHelpMessage: + fputs( +"testsoftfloat [<option>...] <function>\n" +" <option>: (* is default)\n" +" -help --Write this message and exit.\n" +" -seed <num> --Set pseudo-random number generator seed to <num>.\n" +" * -seed 1\n" +" -level <num> --Testing level <num> (1 or 2).\n" +" * -level 1\n" +" -errors <num> --Stop each function test after <num> errors.\n" +" * -errors 20\n" +" -errorstop --Exit after first function with any error.\n" +" -forever --Test one function repeatedly (implies '-level 2').\n" +#ifdef EXTFLOAT80 +" -precision32 --For extF80, test only 32-bit rounding precision.\n" +" -precision64 --For extF80, test only 64-bit rounding precision.\n" +" -precision80 --For extF80, test only 80-bit rounding precision.\n" +#endif +" -rnear_even --Test only rounding to nearest/even.\n" +" -rminMag --Test only rounding to minimum magnitude (toward zero).\n" +" -rmin --Test only rounding to minimum (down).\n" +" -rmax --Test only rounding to maximum (up).\n" +" -rnear_maxMag --Test only rounding to nearest/maximum magnitude\n" +" (nearest/away).\n" +#ifdef FLOAT_ROUND_ODD +" -rodd --Test only rounding to odd (jamming). (For rounding to\n" +" an integer value, 'minMag' rounding is done instead.)\n" +#endif +" -tininessbefore --Test only underflow tininess detected before rounding.\n" +" -tininessafter --Test only underflow tininess detected after rounding.\n" +" -notexact --Test only non-exact rounding to integer (no inexact\n" +" exceptions).\n" +" -exact --Test only exact rounding to integer (raising inexact\n" +" exceptions).\n" +" <function>:\n" +" <int>_to_<float> <float>_add <float>_eq\n" +" <float>_to_<int> <float>_sub <float>_le\n" +" <float>_to_<int>_r_minMag <float>_mul <float>_lt\n" +" <float>_to_<float> <float>_mulAdd <float>_eq_signaling\n" +" <float>_roundToInt <float>_div <float>_le_quiet\n" +" <float>_rem <float>_lt_quiet\n" +" <float>_sqrt\n" +" -all1 --All unary functions.\n" +" -all2 --All binary functions.\n" +" <int>:\n" +" ui32 --Unsigned 32-bit integer.\n" +" ui64 --Unsigned 64-bit integer.\n" +" i32 --Signed 32-bit integer.\n" +" i64 --Signed 64-bit integer.\n" +" <float>:\n" +#ifdef FLOAT16 +" f16 --Binary 16-bit floating-point (half-precision).\n" +#endif +" f32 --Binary 32-bit floating-point (single-precision).\n" +#ifdef FLOAT64 +" f64 --Binary 64-bit floating-point (double-precision).\n" +#endif +#ifdef EXTFLOAT80 +" extF80 --Binary 80-bit extended floating-point.\n" +#endif +#ifdef FLOAT128 +" f128 --Binary 128-bit floating-point (quadruple-precision).\n" +#endif + , + stdout + ); + return EXIT_SUCCESS; + } else if ( ! strcmp( argPtr, "seed" ) ) { + if ( argc < 2 ) goto optionError; + ui = strtoul( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + srand( ui ); + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "level" ) ) { + if ( argc < 2 ) goto optionError; + i = strtol( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + genCases_setLevel( i ); + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "level1" ) ) { + genCases_setLevel( 1 ); + } else if ( ! strcmp( argPtr, "level2" ) ) { + genCases_setLevel( 2 ); + } else if ( ! strcmp( argPtr, "errors" ) ) { + if ( argc < 2 ) goto optionError; + i = strtol( argv[1], (char **) &argPtr, 10 ); + if ( *argPtr ) goto optionError; + verCases_maxErrorCount = i; + --argc; + ++argv; + } else if ( ! strcmp( argPtr, "errorstop" ) ) { + verCases_errorStop = true; + } else if ( ! strcmp( argPtr, "forever" ) ) { + genCases_setLevel( 2 ); + testLoops_forever = true; +#ifdef EXTFLOAT80 + } else if ( ! strcmp( argPtr, "precision32" ) ) { + roundingPrecision = 32; + } else if ( ! strcmp( argPtr, "precision64" ) ) { + roundingPrecision = 64; + } else if ( ! strcmp( argPtr, "precision80" ) ) { + roundingPrecision = 80; +#endif + } else if ( + ! strcmp( argPtr, "rnear_even" ) + || ! strcmp( argPtr, "rneareven" ) + || ! strcmp( argPtr, "rnearest_even" ) + ) { + roundingCode = ROUND_NEAR_EVEN; + } else if ( + ! strcmp( argPtr, "rminmag" ) || ! strcmp( argPtr, "rminMag" ) + ) { + roundingCode = ROUND_MINMAG; + } else if ( ! strcmp( argPtr, "rmin" ) ) { + roundingCode = ROUND_MIN; + } else if ( ! strcmp( argPtr, "rmax" ) ) { + roundingCode = ROUND_MAX; + } else if ( + ! strcmp( argPtr, "rnear_maxmag" ) + || ! strcmp( argPtr, "rnear_maxMag" ) + || ! strcmp( argPtr, "rnearmaxmag" ) + || ! strcmp( argPtr, "rnearest_maxmag" ) + || ! strcmp( argPtr, "rnearest_maxMag" ) + ) { + roundingCode = ROUND_NEAR_MAXMAG; +#ifdef FLOAT_ROUND_ODD + } else if ( ! strcmp( argPtr, "rodd" ) ) { + roundingCode = ROUND_ODD; +#endif + } else if ( ! strcmp( argPtr, "tininessbefore" ) ) { + tininessCode = TININESS_BEFORE_ROUNDING; + } else if ( ! strcmp( argPtr, "tininessafter" ) ) { + tininessCode = TININESS_AFTER_ROUNDING; + } else if ( ! strcmp( argPtr, "notexact" ) ) { + exactCode = EXACT_FALSE; + } else if ( ! strcmp( argPtr, "exact" ) ) { + exactCode = EXACT_TRUE; + } else if ( ! strcmp( argPtr, "all1" ) ) { + haveFunctionArg = true; + functionCode = 0; + numOperands = 1; + } else if ( ! strcmp( argPtr, "all2" ) ) { + haveFunctionArg = true; + functionCode = 0; + numOperands = 2; + } else { + functionCode = 1; + while ( strcmp( argPtr, functionInfos[functionCode].namePtr ) ) { + ++functionCode; + if ( functionCode == NUM_FUNCTIONS ) { + fail( "Invalid argument '%s'", *argv ); + } + } + haveFunctionArg = true; + } + } + if ( ! haveFunctionArg ) fail( "Function argument required" ); + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + signal( SIGINT, catchSIGINT ); + signal( SIGTERM, catchSIGINT ); + if ( functionCode ) { + if ( testLoops_forever ) { + if ( ! roundingPrecision ) roundingPrecision = 80; + if ( ! roundingCode ) roundingCode = ROUND_NEAR_EVEN; + } + testFunction( + functionCode, + roundingPrecision, + roundingCode, + tininessCode, + exactCode + ); + } else { + if ( testLoops_forever ) { + fail( "Can test only one function with '-forever' option" ); + } + functionMatchAttrib = + (numOperands == 1) ? FUNC_ARG_UNARY : FUNC_ARG_BINARY; + for ( + functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode + ) { + if ( functionInfos[functionCode].attribs & functionMatchAttrib ) { + testFunction( + functionCode, + roundingPrecision, + roundingCode, + tininessCode, + exactCode + ); + } + } + } + verCases_exitWithStatus(); + /*------------------------------------------------------------------------ + *------------------------------------------------------------------------*/ + optionError: + fail( "'%s' option requires numeric argument", *argv ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/timesoftfloat.c b/src/libs/softfloat-3e/testfloat/source/timesoftfloat.c new file mode 100644 index 00000000..b0705a91 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/timesoftfloat.c @@ -0,0 +1,5060 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <time.h> +#include "platform.h" +#include "uint128.h" +#include "fail.h" +#include "softfloat.h" +#include "functions.h" + +enum { minIterations = 1000 }; + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +static const char *functionNamePtr; +static uint_fast8_t roundingPrecision; +static int roundingCode; +static int tininessCode; +static bool usesExact; +static bool exact; + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +static void reportTime( int_fast64_t count, clock_t clockTicks ) +{ + static const char *roundingModeNames[NUM_ROUNDINGMODES] = { + 0, + ", rounding near_even", + ", rounding minMag", + ", rounding min", + ", rounding max", + ", rounding near_maxMag", +#ifdef FLOAT_ROUND_ODD + ", rounding odd" +#endif + }; + + printf( + "%9.4f Mop/s: %s", + count / ((float) clockTicks / CLOCKS_PER_SEC) / 1000000, + functionNamePtr + ); + if ( roundingCode ) { +#ifdef EXTFLOAT80 + if ( roundingPrecision ) { + printf( ", precision %d", (int) roundingPrecision ); + } +#endif + fputs( roundingModeNames[roundingCode], stdout ); + if ( tininessCode ) { + fputs( + (tininessCode == TININESS_BEFORE_ROUNDING) + ? ", tininess before rounding" + : ", tininess after rounding", + stdout + ); + } + } + if ( usesExact ) fputs( exact ? ", exact" : ", not exact", stdout ); + fputc( '\n', stdout ); + fflush( stdout ); + +} + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT16 +union ui16_f16 { uint16_t ui; float16_t f; }; +#endif +union ui32_f32 { uint32_t ui; float32_t f; }; +#ifdef FLOAT64 +union ui64_f64 { uint64_t ui; float64_t f; }; +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +enum { numInputs_ui32 = 32 }; + +static const uint32_t inputs_ui32[numInputs_ui32] = { + 0x00004487, 0x405CF80F, 0x00000000, 0x000002FC, + 0x000DFFFE, 0x0C8EF795, 0x0FFFEE01, 0x000006CA, + 0x00009BFE, 0x00B79D1D, 0x60001002, 0x00000049, + 0x0BFF7FFF, 0x0000F37A, 0x0011DFFE, 0x00000006, + 0x000FDFFA, 0x0000082F, 0x10200003, 0x2172089B, + 0x00003E02, 0x000019E8, 0x0008FFFE, 0x000004A4, + 0x00208002, 0x07C42FBF, 0x0FFFE3FF, 0x040B9F13, + 0x40000008, 0x0001BF56, 0x000017F6, 0x000A908A +}; + +#ifdef FLOAT16 + +static void time_a_ui32_z_f16( float16_t function( uint32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static void time_a_ui32_z_f32( float32_t function( uint32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT64 + +static void time_a_ui32_z_f64( float64_t function( uint32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef EXTFLOAT80 + +static void time_a_ui32_z_extF80( void function( uint32_t, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui32[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui32[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT128 + +static void time_a_ui32_z_f128( void function( uint32_t, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui32[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui32[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_ui32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +enum { numInputs_ui64 = 32 }; + +static const int64_t inputs_ui64[numInputs_ui64] = { + UINT64_C( 0x04003C0000000001 ), UINT64_C( 0x0000000003C589BC ), + UINT64_C( 0x00000000400013FE ), UINT64_C( 0x0000000000186171 ), + UINT64_C( 0x0000000000010406 ), UINT64_C( 0x000002861920038D ), + UINT64_C( 0x0000000010001DFF ), UINT64_C( 0x22E5F0F387AEC8F0 ), + UINT64_C( 0x00007C0000010002 ), UINT64_C( 0x00756EBD1AD0C1C7 ), + UINT64_C( 0x0003FDFFFFFFFFBE ), UINT64_C( 0x0007D0FB2C2CA951 ), + UINT64_C( 0x0007FC0007FFFFFE ), UINT64_C( 0x0000001F942B18BB ), + UINT64_C( 0x0000080101FFFFFE ), UINT64_C( 0x000000000000F688 ), + UINT64_C( 0x000000000008BFFF ), UINT64_C( 0x0000000006F5AF08 ), + UINT64_C( 0x0021008000000002 ), UINT64_C( 0x0000000000000003 ), + UINT64_C( 0x3FFFFFFFFF80007D ), UINT64_C( 0x0000000000000078 ), + UINT64_C( 0x0007FFFFFF802003 ), UINT64_C( 0x1BBC775B78016AB0 ), + UINT64_C( 0x0006FFE000000002 ), UINT64_C( 0x0002B89854671BC1 ), + UINT64_C( 0x0000010001FFFFE2 ), UINT64_C( 0x00000000000FB103 ), + UINT64_C( 0x07FFFFFFFFFFF7FF ), UINT64_C( 0x00036155C7076FB0 ), + UINT64_C( 0x00000020FBFFFFFE ), UINT64_C( 0x0000099AE6455357 ) +}; + +#ifdef FLOAT16 + +static void time_a_ui64_z_f16( float16_t function( uint64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static void time_a_ui64_z_f32( float32_t function( uint64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT64 + +static void time_a_ui64_z_f64( float64_t function( uint64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef EXTFLOAT80 + +static void time_a_ui64_z_extF80( void function( uint64_t, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui64[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui64[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT128 + +static void time_a_ui64_z_f128( void function( uint64_t, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_ui64[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_ui64[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_ui64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +enum { numInputs_i32 = 32 }; + +static const int32_t inputs_i32[numInputs_i32] = { + -0x00004487, 0x405CF80F, 0x00000000, -0x000002FC, + -0x000DFFFE, 0x0C8EF795, -0x0FFFEE01, 0x000006CA, + 0x00009BFE, -0x00B79D1D, -0x60001002, -0x00000049, + 0x0BFF7FFF, 0x0000F37A, 0x0011DFFE, 0x00000006, + -0x000FDFFA, -0x0000082F, 0x10200003, -0x2172089B, + 0x00003E02, 0x000019E8, 0x0008FFFE, -0x000004A4, + -0x00208002, 0x07C42FBF, 0x0FFFE3FF, 0x040B9F13, + -0x40000008, 0x0001BF56, 0x000017F6, 0x000A908A +}; + +#ifdef FLOAT16 + +static void time_a_i32_z_f16( float16_t function( int32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static void time_a_i32_z_f32( float32_t function( int32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT64 + +static void time_a_i32_z_f64( float64_t function( int32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i32[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef EXTFLOAT80 + +static void time_a_i32_z_extF80( void function( int32_t, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i32[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i32[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT128 + +static void time_a_i32_z_f128( void function( int32_t, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i32[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i32[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_i32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +enum { numInputs_i64 = 32 }; + +static const int64_t inputs_i64[numInputs_i64] = { + -INT64_C( 0x04003C0000000001 ), INT64_C( 0x0000000003C589BC ), + INT64_C( 0x00000000400013FE ), INT64_C( 0x0000000000186171 ), + -INT64_C( 0x0000000000010406 ), -INT64_C( 0x000002861920038D ), + INT64_C( 0x0000000010001DFF ), -INT64_C( 0x22E5F0F387AEC8F0 ), + -INT64_C( 0x00007C0000010002 ), INT64_C( 0x00756EBD1AD0C1C7 ), + INT64_C( 0x0003FDFFFFFFFFBE ), INT64_C( 0x0007D0FB2C2CA951 ), + INT64_C( 0x0007FC0007FFFFFE ), INT64_C( 0x0000001F942B18BB ), + INT64_C( 0x0000080101FFFFFE ), -INT64_C( 0x000000000000F688 ), + INT64_C( 0x000000000008BFFF ), INT64_C( 0x0000000006F5AF08 ), + -INT64_C( 0x0021008000000002 ), INT64_C( 0x0000000000000003 ), + INT64_C( 0x3FFFFFFFFF80007D ), INT64_C( 0x0000000000000078 ), + -INT64_C( 0x0007FFFFFF802003 ), INT64_C( 0x1BBC775B78016AB0 ), + -INT64_C( 0x0006FFE000000002 ), -INT64_C( 0x0002B89854671BC1 ), + -INT64_C( 0x0000010001FFFFE2 ), -INT64_C( 0x00000000000FB103 ), + INT64_C( 0x07FFFFFFFFFFF7FF ), -INT64_C( 0x00036155C7076FB0 ), + INT64_C( 0x00000020FBFFFFFE ), INT64_C( 0x0000099AE6455357 ) +}; + +#ifdef FLOAT16 + +static void time_a_i64_z_f16( float16_t function( int64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static void time_a_i64_z_f32( float32_t function( int64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT64 + +static void time_a_i64_z_f64( float64_t function( int64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i64[inputNum] ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef EXTFLOAT80 + +static void time_a_i64_z_extF80( void function( int64_t, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i64[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i64[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT128 + +static void time_a_i64_z_f128( void function( int64_t, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( inputs_i64[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( inputs_i64[inputNum], &z ); + inputNum = (inputNum + 1) & (numInputs_i64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT16 + +enum { numInputs_f16 = 32 }; + +static const uint16_t inputs_F16UI[numInputs_f16] = { + 0x0BBA, 0x77FE, 0x084F, 0x9C0F, 0x7800, 0x4436, 0xCE67, 0x80F3, + 0x87EF, 0xC2FA, 0x7BFF, 0x13FE, 0x7BFE, 0x1C00, 0xAC46, 0xEAFA, + 0x3813, 0x4804, 0x385E, 0x8000, 0xB86C, 0x4B7D, 0xC7FD, 0xC97F, + 0x260C, 0x78EE, 0xB84F, 0x249E, 0x0D27, 0x37DC, 0x8400, 0xE8EF +}; + +static +void + time_a_f16_z_ui32_rx( + uint_fast32_t function( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f16_z_ui64_rx( + uint_fast64_t function( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f16_z_i32_rx( + int_fast32_t function( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f16_z_i64_rx( + int_fast64_t function( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f16_z_ui32_x( uint_fast32_t function( float16_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f16_z_ui64_x( uint_fast64_t function( float16_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_a_f16_z_i32_x( int_fast32_t function( float16_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_a_f16_z_i64_x( int_fast64_t function( float16_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static void time_a_f16_z_f32( float32_t function( float16_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT64 + +static void time_a_f16_z_f64( float64_t function( float16_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef EXTFLOAT80 + +static void time_a_f16_z_extF80( void function( float16_t, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT128 + +static void time_a_f16_z_f128( void function( float16_t, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static +void + time_az_f16_rx( + float16_t function( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static void time_abz_f16( float16_t function( float16_t, float16_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA, uB; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNumA]; + uB.ui = inputs_F16UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f16 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNumA]; + uB.ui = inputs_F16UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f16 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_abcz_f16( float16_t function( float16_t, float16_t, float16_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB, inputNumC; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA, uB, uC; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + inputNumC = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNumA]; + uB.ui = inputs_F16UI[inputNumB]; + uC.ui = inputs_F16UI[inputNumC]; + function( uA.f, uB.f, uC.f ); + inputNumA = (inputNumA + 1) & (numInputs_f16 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f16 - 1); + if ( ! inputNumB ) ++inputNumC; + inputNumC = (inputNumC + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + inputNumC = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNumA]; + uB.ui = inputs_F16UI[inputNumB]; + uC.ui = inputs_F16UI[inputNumC]; + function( uA.f, uB.f, uC.f ); + inputNumA = (inputNumA + 1) & (numInputs_f16 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f16 - 1); + if ( ! inputNumB ) ++inputNumC; + inputNumC = (inputNumC + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static void time_ab_f16_z_bool( bool function( float16_t, float16_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA, uB; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI[inputNumA]; + uB.ui = inputs_F16UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f16 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI[inputNumA]; + uB.ui = inputs_F16UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f16 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static const uint16_t inputs_F16UI_pos[numInputs_f16] = { + 0x0BBA, 0x77FE, 0x084F, 0x1C0F, 0x7800, 0x4436, 0x4E67, 0x00F3, + 0x07EF, 0x42FA, 0x7BFF, 0x13FE, 0x7BFE, 0x1C00, 0x2C46, 0x6AFA, + 0x3813, 0x4804, 0x385E, 0x0000, 0x386C, 0x4B7D, 0x47FD, 0x497F, + 0x260C, 0x78EE, 0x384F, 0x249E, 0x0D27, 0x37DC, 0x0400, 0x68EF +}; + +static void time_az_f16_pos( float16_t function( float16_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui16_f16 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F16UI_pos[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F16UI_pos[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f16 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +enum { numInputs_f32 = 32 }; + +static const uint32_t inputs_F32UI[numInputs_f32] = { + 0x4EFA0000, 0xC1D0B328, 0x80000000, 0x3E69A31E, + 0xAF803EFF, 0x3F800000, 0x17BF8000, 0xE74A301A, + 0x4E010003, 0x7EE3C75D, 0xBD803FE0, 0xBFFEFF00, + 0x7981F800, 0x431FFFFC, 0xC100C000, 0x3D87EFFF, + 0x4103FEFE, 0xBC000007, 0xBF01F7FF, 0x4E6C6B5C, + 0xC187FFFE, 0xC58B9F13, 0x4F88007F, 0xDF004007, + 0xB7FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000, + 0xDB428661, 0x33F89B1F, 0xA3BFEFFF, 0x537BFFBE +}; + +static +void + time_a_f32_z_ui32_rx( + uint_fast32_t function( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f32_z_ui64_rx( + uint_fast64_t function( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f32_z_i32_rx( + int_fast32_t function( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f32_z_i64_rx( + int_fast64_t function( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f32_z_ui32_x( uint_fast32_t function( float32_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f32_z_ui64_x( uint_fast64_t function( float32_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_a_f32_z_i32_x( int_fast32_t function( float32_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_a_f32_z_i64_x( int_fast64_t function( float32_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT16 + +static void time_a_f32_z_f16( float16_t function( float32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT64 + +static void time_a_f32_z_f64( float64_t function( float32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef EXTFLOAT80 + +static void time_a_f32_z_extF80( void function( float32_t, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT128 + +static void time_a_f32_z_f128( void function( float32_t, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static +void + time_az_f32_rx( + float32_t function( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static void time_abz_f32( float32_t function( float32_t, float32_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA, uB; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNumA]; + uB.ui = inputs_F32UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f32 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNumA]; + uB.ui = inputs_F32UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f32 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_abcz_f32( float32_t function( float32_t, float32_t, float32_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB, inputNumC; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA, uB, uC; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + inputNumC = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNumA]; + uB.ui = inputs_F32UI[inputNumB]; + uC.ui = inputs_F32UI[inputNumC]; + function( uA.f, uB.f, uC.f ); + inputNumA = (inputNumA + 1) & (numInputs_f32 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f32 - 1); + if ( ! inputNumB ) ++inputNumC; + inputNumC = (inputNumC + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + inputNumC = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNumA]; + uB.ui = inputs_F32UI[inputNumB]; + uC.ui = inputs_F32UI[inputNumC]; + function( uA.f, uB.f, uC.f ); + inputNumA = (inputNumA + 1) & (numInputs_f32 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f32 - 1); + if ( ! inputNumB ) ++inputNumC; + inputNumC = (inputNumC + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static void time_ab_f32_z_bool( bool function( float32_t, float32_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA, uB; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI[inputNumA]; + uB.ui = inputs_F32UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f32 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI[inputNumA]; + uB.ui = inputs_F32UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f32 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static const uint32_t inputs_F32UI_pos[numInputs_f32] = { + 0x4EFA0000, 0x41D0B328, 0x00000000, 0x3E69A31E, + 0x2F803EFF, 0x3F800000, 0x17BF8000, 0x674A301A, + 0x4E010003, 0x7EE3C75D, 0x3D803FE0, 0x3FFEFF00, + 0x7981F800, 0x431FFFFC, 0x4100C000, 0x3D87EFFF, + 0x4103FEFE, 0x3C000007, 0x3F01F7FF, 0x4E6C6B5C, + 0x4187FFFE, 0x458B9F13, 0x4F88007F, 0x5F004007, + 0x37FFD7FE, 0x7E8001FB, 0x46EFFBFF, 0x31C10000, + 0x5B428661, 0x33F89B1F, 0x23BFEFFF, 0x537BFFBE +}; + +static void time_az_f32_pos( float32_t function( float32_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui32_f32 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F32UI_pos[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F32UI_pos[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f32 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT64 + +enum { numInputs_f64 = 32 }; + +static const uint64_t inputs_F64UI[numInputs_f64] = { + UINT64_C( 0x422FFFC008000000 ), + UINT64_C( 0xB7E0000480000000 ), + UINT64_C( 0xF3FD2546120B7935 ), + UINT64_C( 0x3FF0000000000000 ), + UINT64_C( 0xCE07F766F09588D6 ), + UINT64_C( 0x8000000000000000 ), + UINT64_C( 0x3FCE000400000000 ), + UINT64_C( 0x8313B60F0032BED8 ), + UINT64_C( 0xC1EFFFFFC0002000 ), + UINT64_C( 0x3FB3C75D224F2B0F ), + UINT64_C( 0x7FD00000004000FF ), + UINT64_C( 0xA12FFF8000001FFF ), + UINT64_C( 0x3EE0000000FE0000 ), + UINT64_C( 0x0010000080000004 ), + UINT64_C( 0x41CFFFFE00000020 ), + UINT64_C( 0x40303FFFFFFFFFFD ), + UINT64_C( 0x3FD000003FEFFFFF ), + UINT64_C( 0xBFD0000010000000 ), + UINT64_C( 0xB7FC6B5C16CA55CF ), + UINT64_C( 0x413EEB940B9D1301 ), + UINT64_C( 0xC7E00200001FFFFF ), + UINT64_C( 0x47F00021FFFFFFFE ), + UINT64_C( 0xBFFFFFFFF80000FF ), + UINT64_C( 0xC07FFFFFE00FFFFF ), + UINT64_C( 0x001497A63740C5E8 ), + UINT64_C( 0xC4BFFFE0001FFFFF ), + UINT64_C( 0x96FFDFFEFFFFFFFF ), + UINT64_C( 0x403FC000000001FE ), + UINT64_C( 0xFFD00000000001F6 ), + UINT64_C( 0x0640400002000000 ), + UINT64_C( 0x479CEE1E4F789FE0 ), + UINT64_C( 0xC237FFFFFFFFFDFE ) +}; + +static +void + time_a_f64_z_ui32_rx( + uint_fast32_t function( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f64_z_ui64_rx( + uint_fast64_t function( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f64_z_i32_rx( + int_fast32_t function( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f64_z_i64_rx( + int_fast64_t function( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f64_z_ui32_x( uint_fast32_t function( float64_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f64_z_ui64_x( uint_fast64_t function( float64_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_a_f64_z_i32_x( int_fast32_t function( float64_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_a_f64_z_i64_x( int_fast64_t function( float64_t, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT16 + +static void time_a_f64_z_f16( float16_t function( float64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static void time_a_f64_z_f32( float32_t function( float64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef EXTFLOAT80 + +static void time_a_f64_z_extF80( void function( float64_t, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT128 + +static void time_a_f64_z_f128( void function( float64_t, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, &z ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static +void + time_az_f64_rx( + float64_t function( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNum]; + function( uA.f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static void time_abz_f64( float64_t function( float64_t, float64_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA, uB; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNumA]; + uB.ui = inputs_F64UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f64 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNumA]; + uB.ui = inputs_F64UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f64 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void time_abcz_f64( float64_t function( float64_t, float64_t, float64_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB, inputNumC; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA, uB, uC; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + inputNumC = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNumA]; + uB.ui = inputs_F64UI[inputNumB]; + uC.ui = inputs_F64UI[inputNumC]; + function( uA.f, uB.f, uC.f ); + inputNumA = (inputNumA + 1) & (numInputs_f64 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f64 - 1); + if ( ! inputNumB ) ++inputNumC; + inputNumC = (inputNumC + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + inputNumC = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNumA]; + uB.ui = inputs_F64UI[inputNumB]; + uC.ui = inputs_F64UI[inputNumC]; + function( uA.f, uB.f, uC.f ); + inputNumA = (inputNumA + 1) & (numInputs_f64 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f64 - 1); + if ( ! inputNumB ) ++inputNumC; + inputNumC = (inputNumC + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static void time_ab_f64_z_bool( bool function( float64_t, float64_t ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA, uB; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI[inputNumA]; + uB.ui = inputs_F64UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f64 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI[inputNumA]; + uB.ui = inputs_F64UI[inputNumB]; + function( uA.f, uB.f ); + inputNumA = (inputNumA + 1) & (numInputs_f64 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static const uint64_t inputs_F64UI_pos[numInputs_f64] = { + UINT64_C( 0x422FFFC008000000 ), + UINT64_C( 0x37E0000480000000 ), + UINT64_C( 0x73FD2546120B7935 ), + UINT64_C( 0x3FF0000000000000 ), + UINT64_C( 0x4E07F766F09588D6 ), + UINT64_C( 0x0000000000000000 ), + UINT64_C( 0x3FCE000400000000 ), + UINT64_C( 0x0313B60F0032BED8 ), + UINT64_C( 0x41EFFFFFC0002000 ), + UINT64_C( 0x3FB3C75D224F2B0F ), + UINT64_C( 0x7FD00000004000FF ), + UINT64_C( 0x212FFF8000001FFF ), + UINT64_C( 0x3EE0000000FE0000 ), + UINT64_C( 0x0010000080000004 ), + UINT64_C( 0x41CFFFFE00000020 ), + UINT64_C( 0x40303FFFFFFFFFFD ), + UINT64_C( 0x3FD000003FEFFFFF ), + UINT64_C( 0x3FD0000010000000 ), + UINT64_C( 0x37FC6B5C16CA55CF ), + UINT64_C( 0x413EEB940B9D1301 ), + UINT64_C( 0x47E00200001FFFFF ), + UINT64_C( 0x47F00021FFFFFFFE ), + UINT64_C( 0x3FFFFFFFF80000FF ), + UINT64_C( 0x407FFFFFE00FFFFF ), + UINT64_C( 0x001497A63740C5E8 ), + UINT64_C( 0x44BFFFE0001FFFFF ), + UINT64_C( 0x16FFDFFEFFFFFFFF ), + UINT64_C( 0x403FC000000001FE ), + UINT64_C( 0x7FD00000000001F6 ), + UINT64_C( 0x0640400002000000 ), + UINT64_C( 0x479CEE1E4F789FE0 ), + UINT64_C( 0x4237FFFFFFFFFDFE ) +}; + +static void time_az_f64_pos( float64_t function( float64_t ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + union ui64_f64 uA; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + uA.ui = inputs_F64UI_pos[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + uA.ui = inputs_F64UI_pos[inputNum]; + function( uA.f ); + inputNum = (inputNum + 1) & (numInputs_f64 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef EXTFLOAT80 + +#ifdef LITTLEENDIAN +#define extF80Const( v64, v0 ) { UINT64_C( v0 ), v64 } +#else +#define extF80Const( v64, v0 ) { v64, UINT64_C( v0 ) } +#endif + +enum { numInputs_extF80 = 32 }; + +static +const union { struct extFloat80M s; extFloat80_t f; } + inputs_extF80[numInputs_extF80] = { + extF80Const( 0xC03F, 0xA9BE15A19C1E8B62 ), + extF80Const( 0x8000, 0x0000000000000000 ), + extF80Const( 0x75A8, 0xE59591E4788957A5 ), + extF80Const( 0xBFFF, 0xFFF0000000000040 ), + extF80Const( 0x0CD8, 0xFC000000000007FE ), + extF80Const( 0x43BA, 0x99A4000000000000 ), + extF80Const( 0x3FFF, 0x8000000000000000 ), + extF80Const( 0x4081, 0x94FBF1BCEB5545F0 ), + extF80Const( 0x403E, 0xFFF0000000002000 ), + extF80Const( 0x3FFE, 0xC860E3C75D224F28 ), + extF80Const( 0x407E, 0xFC00000FFFFFFFFE ), + extF80Const( 0x737A, 0x800000007FFDFFFE ), + extF80Const( 0x4044, 0xFFFFFF80000FFFFF ), + extF80Const( 0xBBFE, 0x8000040000001FFE ), + extF80Const( 0xC002, 0xFF80000000000020 ), + extF80Const( 0xDE8D, 0xFFFFFFFFFFE00004 ), + extF80Const( 0xC004, 0x8000000000003FFB ), + extF80Const( 0x407F, 0x800000000003FFFE ), + extF80Const( 0xC000, 0xA459EE6A5C16CA55 ), + extF80Const( 0x8003, 0xC42CBF7399AEEB94 ), + extF80Const( 0xBF7F, 0xF800000000000006 ), + extF80Const( 0xC07F, 0xBF56BE8871F28FEA ), + extF80Const( 0xC07E, 0xFFFF77FFFFFFFFFE ), + extF80Const( 0xADC9, 0x8000000FFFFFFFDE ), + extF80Const( 0xC001, 0xEFF7FFFFFFFFFFFF ), + extF80Const( 0x4001, 0xBE84F30125C497A6 ), + extF80Const( 0xC06B, 0xEFFFFFFFFFFFFFFF ), + extF80Const( 0x4080, 0xFFFFFFFFBFFFFFFF ), + extF80Const( 0x87E9, 0x81FFFFFFFFFFFBFF ), + extF80Const( 0xA63F, 0x801FFFFFFEFFFFFE ), + extF80Const( 0x403C, 0x801FFFFFFFF7FFFF ), + extF80Const( 0x4018, 0x8000000000080003 ) + }; + +static +void + time_a_extF80_z_ui32_rx( + uint_fast32_t function( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_extF80_z_ui64_rx( + uint_fast64_t function( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_extF80_z_i32_rx( + int_fast32_t function( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_extF80_z_i64_rx( + int_fast64_t function( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_extF80_z_ui32_x( + uint_fast32_t function( const extFloat80_t *, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_extF80_z_ui64_x( + uint_fast64_t function( const extFloat80_t *, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_extF80_z_i32_x( + int_fast32_t function( const extFloat80_t *, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_extF80_z_i64_x( + int_fast64_t function( const extFloat80_t *, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT16 + +static void time_a_extF80_z_f16( float16_t function( const extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static void time_a_extF80_z_f32( float32_t function( const extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT64 + +static void time_a_extF80_z_f64( float64_t function( const extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef FLOAT128 + +static +void + time_a_extF80_z_f128( void function( const extFloat80_t *, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, &z ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, &z ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static +void + time_az_extF80_rx( + void function( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact, &z ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, roundingMode, exact, &z ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_abz_extF80( + void + function( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ) + ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( + &inputs_extF80[inputNumA].f, &inputs_extF80[inputNumB].f, &z ); + inputNumA = (inputNumA + 1) & (numInputs_extF80 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( + &inputs_extF80[inputNumA].f, &inputs_extF80[inputNumB].f, &z ); + inputNumA = (inputNumA + 1) & (numInputs_extF80 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_ab_extF80_z_bool( + bool function( const extFloat80_t *, const extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( + &inputs_extF80[inputNumA].f, &inputs_extF80[inputNumB].f ); + inputNumA = (inputNumA + 1) & (numInputs_extF80 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNumA].f, &inputs_extF80[inputNumB].f ); + inputNumA = (inputNumA + 1) & (numInputs_extF80 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +const union { struct extFloat80M s; extFloat80_t f; } + inputs_extF80_pos[numInputs_extF80] = { + extF80Const( 0x403F, 0xA9BE15A19C1E8B62 ), + extF80Const( 0x0000, 0x0000000000000000 ), + extF80Const( 0x75A8, 0xE59591E4788957A5 ), + extF80Const( 0x3FFF, 0xFFF0000000000040 ), + extF80Const( 0x0CD8, 0xFC000000000007FE ), + extF80Const( 0x43BA, 0x99A4000000000000 ), + extF80Const( 0x3FFF, 0x8000000000000000 ), + extF80Const( 0x4081, 0x94FBF1BCEB5545F0 ), + extF80Const( 0x403E, 0xFFF0000000002000 ), + extF80Const( 0x3FFE, 0xC860E3C75D224F28 ), + extF80Const( 0x407E, 0xFC00000FFFFFFFFE ), + extF80Const( 0x737A, 0x800000007FFDFFFE ), + extF80Const( 0x4044, 0xFFFFFF80000FFFFF ), + extF80Const( 0x3BFE, 0x8000040000001FFE ), + extF80Const( 0x4002, 0xFF80000000000020 ), + extF80Const( 0x5E8D, 0xFFFFFFFFFFE00004 ), + extF80Const( 0x4004, 0x8000000000003FFB ), + extF80Const( 0x407F, 0x800000000003FFFE ), + extF80Const( 0x4000, 0xA459EE6A5C16CA55 ), + extF80Const( 0x0003, 0xC42CBF7399AEEB94 ), + extF80Const( 0x3F7F, 0xF800000000000006 ), + extF80Const( 0x407F, 0xBF56BE8871F28FEA ), + extF80Const( 0x407E, 0xFFFF77FFFFFFFFFE ), + extF80Const( 0x2DC9, 0x8000000FFFFFFFDE ), + extF80Const( 0x4001, 0xEFF7FFFFFFFFFFFF ), + extF80Const( 0x4001, 0xBE84F30125C497A6 ), + extF80Const( 0x406B, 0xEFFFFFFFFFFFFFFF ), + extF80Const( 0x4080, 0xFFFFFFFFBFFFFFFF ), + extF80Const( 0x07E9, 0x81FFFFFFFFFFFBFF ), + extF80Const( 0x263F, 0x801FFFFFFEFFFFFE ), + extF80Const( 0x403C, 0x801FFFFFFFF7FFFF ), + extF80Const( 0x4018, 0x8000000000080003 ) + }; + +static +void + time_az_extF80_pos( void function( const extFloat80_t *, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_extF80[inputNum].f, &z ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_extF80[inputNum].f, &z ); + inputNum = (inputNum + 1) & (numInputs_extF80 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT128 + +#ifdef LITTLEENDIAN +#define f128Const( v64, v0 ) { UINT64_C( v0 ), UINT64_C( v64 ) } +#else +#define f128Const( v64, v0 ) { UINT64_C( v64 ), UINT64_C( v0 ) } +#endif + +enum { numInputs_f128 = 32 }; + +static +const union { struct uint128 ui; float128_t f; } + inputs_f128[numInputs_f128] = { + f128Const( 0x3FDA200000100000, 0x0000000000000000 ), + f128Const( 0x3FFF000000000000, 0x0000000000000000 ), + f128Const( 0x85F14776190C8306, 0xD8715F4E3D54BB92 ), + f128Const( 0xF2B00000007FFFFF, 0xFFFFFFFFFFF7FFFF ), + f128Const( 0x8000000000000000, 0x0000000000000000 ), + f128Const( 0xBFFFFFFFFFE00000, 0x0000008000000000 ), + f128Const( 0x407F1719CE722F3E, 0xDA6B3FE5FF29425B ), + f128Const( 0x43FFFF8000000000, 0x0000000000400000 ), + f128Const( 0x401E000000000100, 0x0000000000002000 ), + f128Const( 0x3FFED71DACDA8E47, 0x4860E3C75D224F28 ), + f128Const( 0xBF7ECFC1E90647D1, 0x7A124FE55623EE44 ), + f128Const( 0x0DF7007FFFFFFFFF, 0xFFFFFFFFEFFFFFFF ), + f128Const( 0x3FE5FFEFFFFFFFFF, 0xFFFFFFFFFFFFEFFF ), + f128Const( 0x403FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFBFE ), + f128Const( 0xBFFB2FBF7399AFEB, 0xA459EE6A5C16CA55 ), + f128Const( 0xBDB8FFFFFFFFFFFC, 0x0000000000000400 ), + f128Const( 0x3FC8FFDFFFFFFFFF, 0xFFFFFFFFF0000000 ), + f128Const( 0x3FFBFFFFFFDFFFFF, 0xFFF8000000000000 ), + f128Const( 0x407043C11737BE84, 0xDDD58212ADC937F4 ), + f128Const( 0x8001000000000000, 0x0000001000000001 ), + f128Const( 0xC036FFFFFFFFFFFF, 0xFE40000000000000 ), + f128Const( 0x4002FFFFFE000002, 0x0000000000000000 ), + f128Const( 0x4000C3FEDE897773, 0x326AC4FD8EFBE6DC ), + f128Const( 0xBFFF0000000FFFFF, 0xFFFFFE0000000000 ), + f128Const( 0x62C3E502146E426D, 0x43F3CAA0DC7DF1A0 ), + f128Const( 0xB5CBD32E52BB570E, 0xBCC477CB11C6236C ), + f128Const( 0xE228FFFFFFC00000, 0x0000000000000000 ), + f128Const( 0x3F80000000000000, 0x0000000080000008 ), + f128Const( 0xC1AFFFDFFFFFFFFF, 0xFFFC000000000000 ), + f128Const( 0xC96F000000000000, 0x00000001FFFBFFFF ), + f128Const( 0x3DE09BFE7923A338, 0xBCC8FBBD7CEC1F4F ), + f128Const( 0x401CFFFFFFFFFFFF, 0xFFFFFFFEFFFFFF80 ) + }; + +static +void + time_a_f128_z_ui32_rx( + uint_fast32_t function( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f128_z_ui64_rx( + uint_fast64_t function( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f128_z_i32_rx( + int_fast32_t function( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f128_z_i64_rx( + int_fast64_t function( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f128_z_ui32_x( + uint_fast32_t function( const float128_t *, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f128_z_ui64_x( + uint_fast64_t function( const float128_t *, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f128_z_i32_x( + int_fast32_t function( const float128_t *, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_a_f128_z_i64_x( + int_fast64_t function( const float128_t *, bool ), bool exact ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, exact ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT16 + +static void time_a_f128_z_f16( float16_t function( const float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static void time_a_f128_z_f32( float32_t function( const float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#ifdef FLOAT64 + +static void time_a_f128_z_f64( float64_t function( const float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +#ifdef EXTFLOAT80 + +static +void + time_a_f128_z_extF80( void function( const float128_t *, extFloat80_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + extFloat80_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, &z ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, &z ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +static +void + time_az_f128_rx( + void function( const float128_t *, uint_fast8_t, bool, float128_t * ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact, &z ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, roundingMode, exact, &z ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_abz_f128( + void function( const float128_t *, const float128_t *, float128_t * ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( + &inputs_f128[inputNumA].f, &inputs_f128[inputNumB].f, &z ); + inputNumA = (inputNumA + 1) & (numInputs_f128 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNumA].f, &inputs_f128[inputNumB].f, &z ); + inputNumA = (inputNumA + 1) & (numInputs_f128 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_abcz_f128( + void + function( + const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ) + ) +{ + int_fast64_t count; + int inputNumA, inputNumB, inputNumC; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + inputNumC = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( + &inputs_f128[inputNumA].f, + &inputs_f128[inputNumB].f, + &inputs_f128[inputNumC].f, + &z + ); + inputNumA = (inputNumA + 1) & (numInputs_f128 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f128 - 1); + if ( ! inputNumB ) ++inputNumC; + inputNumC = (inputNumC + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + inputNumC = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( + &inputs_f128[inputNumA].f, + &inputs_f128[inputNumB].f, + &inputs_f128[inputNumC].f, + &z + ); + inputNumA = (inputNumA + 1) & (numInputs_f128 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f128 - 1); + if ( ! inputNumB ) ++inputNumC; + inputNumC = (inputNumC + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +void + time_ab_f128_z_bool( bool function( const float128_t *, const float128_t * ) ) +{ + int_fast64_t count; + int inputNumA, inputNumB; + clock_t startClock; + int_fast64_t i; + clock_t endClock; + + count = 0; + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNumA].f, &inputs_f128[inputNumB].f ); + inputNumA = (inputNumA + 1) & (numInputs_f128 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNumA = 0; + inputNumB = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNumA].f, &inputs_f128[inputNumB].f ); + inputNumA = (inputNumA + 1) & (numInputs_f128 - 1); + if ( ! inputNumA ) ++inputNumB; + inputNumB = (inputNumB + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +static +const union { struct uint128 ui; float128_t f; } + inputs_f128_pos[numInputs_f128] = { + f128Const( 0x3FDA200000100000, 0x0000000000000000 ), + f128Const( 0x3FFF000000000000, 0x0000000000000000 ), + f128Const( 0x05F14776190C8306, 0xD8715F4E3D54BB92 ), + f128Const( 0x72B00000007FFFFF, 0xFFFFFFFFFFF7FFFF ), + f128Const( 0x0000000000000000, 0x0000000000000000 ), + f128Const( 0x3FFFFFFFFFE00000, 0x0000008000000000 ), + f128Const( 0x407F1719CE722F3E, 0xDA6B3FE5FF29425B ), + f128Const( 0x43FFFF8000000000, 0x0000000000400000 ), + f128Const( 0x401E000000000100, 0x0000000000002000 ), + f128Const( 0x3FFED71DACDA8E47, 0x4860E3C75D224F28 ), + f128Const( 0x3F7ECFC1E90647D1, 0x7A124FE55623EE44 ), + f128Const( 0x0DF7007FFFFFFFFF, 0xFFFFFFFFEFFFFFFF ), + f128Const( 0x3FE5FFEFFFFFFFFF, 0xFFFFFFFFFFFFEFFF ), + f128Const( 0x403FFFFFFFFFFFFF, 0xFFFFFFFFFFFFFBFE ), + f128Const( 0x3FFB2FBF7399AFEB, 0xA459EE6A5C16CA55 ), + f128Const( 0x3DB8FFFFFFFFFFFC, 0x0000000000000400 ), + f128Const( 0x3FC8FFDFFFFFFFFF, 0xFFFFFFFFF0000000 ), + f128Const( 0x3FFBFFFFFFDFFFFF, 0xFFF8000000000000 ), + f128Const( 0x407043C11737BE84, 0xDDD58212ADC937F4 ), + f128Const( 0x0001000000000000, 0x0000001000000001 ), + f128Const( 0x4036FFFFFFFFFFFF, 0xFE40000000000000 ), + f128Const( 0x4002FFFFFE000002, 0x0000000000000000 ), + f128Const( 0x4000C3FEDE897773, 0x326AC4FD8EFBE6DC ), + f128Const( 0x3FFF0000000FFFFF, 0xFFFFFE0000000000 ), + f128Const( 0x62C3E502146E426D, 0x43F3CAA0DC7DF1A0 ), + f128Const( 0x35CBD32E52BB570E, 0xBCC477CB11C6236C ), + f128Const( 0x6228FFFFFFC00000, 0x0000000000000000 ), + f128Const( 0x3F80000000000000, 0x0000000080000008 ), + f128Const( 0x41AFFFDFFFFFFFFF, 0xFFFC000000000000 ), + f128Const( 0x496F000000000000, 0x00000001FFFBFFFF ), + f128Const( 0x3DE09BFE7923A338, 0xBCC8FBBD7CEC1F4F ), + f128Const( 0x401CFFFFFFFFFFFF, 0xFFFFFFFEFFFFFF80 ) + }; + +static +void time_az_f128_pos( void function( const float128_t *, float128_t * ) ) +{ + int_fast64_t count; + int inputNum; + clock_t startClock; + int_fast64_t i; + float128_t z; + clock_t endClock; + + count = 0; + inputNum = 0; + startClock = clock(); + do { + for ( i = minIterations; i; --i ) { + function( &inputs_f128[inputNum].f, &z ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + count += minIterations; + } while ( clock() - startClock < CLOCKS_PER_SEC ); + inputNum = 0; + startClock = clock(); + for ( i = count; i; --i ) { + function( &inputs_f128[inputNum].f, &z ); + inputNum = (inputNum + 1) & (numInputs_f128 - 1); + } + endClock = clock(); + reportTime( count, endClock - startClock ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +static +void + timeFunctionInstance( + int functionCode, uint_fast8_t roundingMode, bool exact ) +{ +#ifdef FLOAT16 + float16_t (*function_abz_f16)( float16_t, float16_t ); + bool (*function_ab_f16_z_bool)( float16_t, float16_t ); +#endif + float32_t (*function_abz_f32)( float32_t, float32_t ); + bool (*function_ab_f32_z_bool)( float32_t, float32_t ); +#ifdef FLOAT64 + float64_t (*function_abz_f64)( float64_t, float64_t ); + bool (*function_ab_f64_z_bool)( float64_t, float64_t ); +#endif +#ifdef EXTFLOAT80 + void + (*function_abz_extF80)( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ); + bool + (*function_ab_extF80_z_bool)( + const extFloat80_t *, const extFloat80_t * ); +#endif +#ifdef FLOAT128 + void + (*function_abz_f128)( + const float128_t *, const float128_t *, float128_t * ); + bool (*function_ab_f128_z_bool)( const float128_t *, const float128_t * ); +#endif + + switch ( functionCode ) { + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case UI32_TO_F16: + time_a_ui32_z_f16( ui32_to_f16 ); + break; +#endif + case UI32_TO_F32: + time_a_ui32_z_f32( ui32_to_f32 ); + break; +#ifdef FLOAT64 + case UI32_TO_F64: + time_a_ui32_z_f64( ui32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case UI32_TO_EXTF80: + time_a_ui32_z_extF80( ui32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case UI32_TO_F128: + time_a_ui32_z_f128( ui32_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case UI64_TO_F16: + time_a_ui64_z_f16( ui64_to_f16 ); + break; +#endif + case UI64_TO_F32: + time_a_ui64_z_f32( ui64_to_f32 ); + break; +#ifdef FLOAT64 + case UI64_TO_F64: + time_a_ui64_z_f64( ui64_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case UI64_TO_EXTF80: + time_a_ui64_z_extF80( ui64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case UI64_TO_F128: + time_a_ui64_z_f128( ui64_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case I32_TO_F16: + time_a_i32_z_f16( i32_to_f16 ); + break; +#endif + case I32_TO_F32: + time_a_i32_z_f32( i32_to_f32 ); + break; +#ifdef FLOAT64 + case I32_TO_F64: + time_a_i32_z_f64( i32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case I32_TO_EXTF80: + time_a_i32_z_extF80( i32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case I32_TO_F128: + time_a_i32_z_f128( i32_to_f128M ); + break; +#endif +#ifdef FLOAT16 + case I64_TO_F16: + time_a_i64_z_f16( i64_to_f16 ); + break; +#endif + case I64_TO_F32: + time_a_i64_z_f32( i64_to_f32 ); + break; +#ifdef FLOAT64 + case I64_TO_F64: + time_a_i64_z_f64( i64_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case I64_TO_EXTF80: + time_a_i64_z_extF80( i64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case I64_TO_F128: + time_a_i64_z_f128( i64_to_f128M ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT16 + case F16_TO_UI32: + time_a_f16_z_ui32_rx( f16_to_ui32, roundingMode, exact ); + break; + case F16_TO_UI64: + time_a_f16_z_ui64_rx( f16_to_ui64, roundingMode, exact ); + break; + case F16_TO_I32: + time_a_f16_z_i32_rx( f16_to_i32, roundingMode, exact ); + break; + case F16_TO_I64: + time_a_f16_z_i64_rx( f16_to_i64, roundingMode, exact ); + break; + case F16_TO_UI32_R_MINMAG: + time_a_f16_z_ui32_x( f16_to_ui32_r_minMag, exact ); + break; + case F16_TO_UI64_R_MINMAG: + time_a_f16_z_ui64_x( f16_to_ui64_r_minMag, exact ); + break; + case F16_TO_I32_R_MINMAG: + time_a_f16_z_i32_x( f16_to_i32_r_minMag, exact ); + break; + case F16_TO_I64_R_MINMAG: + time_a_f16_z_i64_x( f16_to_i64_r_minMag, exact ); + break; + case F16_TO_F32: + time_a_f16_z_f32( f16_to_f32 ); + break; +#ifdef FLOAT64 + case F16_TO_F64: + time_a_f16_z_f64( f16_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F16_TO_EXTF80: + time_a_f16_z_extF80( f16_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F16_TO_F128: + time_a_f16_z_f128( f16_to_f128M ); + break; +#endif + case F16_ROUNDTOINT: + time_az_f16_rx( f16_roundToInt, roundingMode, exact ); + break; + case F16_ADD: + function_abz_f16 = f16_add; + goto time_abz_f16; + case F16_SUB: + function_abz_f16 = f16_sub; + goto time_abz_f16; + case F16_MUL: + function_abz_f16 = f16_mul; + goto time_abz_f16; + case F16_DIV: + function_abz_f16 = f16_div; + goto time_abz_f16; + case F16_REM: + function_abz_f16 = f16_rem; + time_abz_f16: + time_abz_f16( function_abz_f16 ); + break; + case F16_MULADD: + time_abcz_f16( f16_mulAdd ); + break; + case F16_SQRT: + time_az_f16_pos( f16_sqrt ); + break; + case F16_EQ: + function_ab_f16_z_bool = f16_eq; + goto time_ab_f16_z_bool; + case F16_LE: + function_ab_f16_z_bool = f16_le; + goto time_ab_f16_z_bool; + case F16_LT: + function_ab_f16_z_bool = f16_lt; + goto time_ab_f16_z_bool; + case F16_EQ_SIGNALING: + function_ab_f16_z_bool = f16_eq_signaling; + goto time_ab_f16_z_bool; + case F16_LE_QUIET: + function_ab_f16_z_bool = f16_le_quiet; + goto time_ab_f16_z_bool; + case F16_LT_QUIET: + function_ab_f16_z_bool = f16_lt_quiet; + time_ab_f16_z_bool: + time_ab_f16_z_bool( function_ab_f16_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ + case F32_TO_UI32: + time_a_f32_z_ui32_rx( f32_to_ui32, roundingMode, exact ); + break; + case F32_TO_UI64: + time_a_f32_z_ui64_rx( f32_to_ui64, roundingMode, exact ); + break; + case F32_TO_I32: + time_a_f32_z_i32_rx( f32_to_i32, roundingMode, exact ); + break; + case F32_TO_I64: + time_a_f32_z_i64_rx( f32_to_i64, roundingMode, exact ); + break; + case F32_TO_UI32_R_MINMAG: + time_a_f32_z_ui32_x( f32_to_ui32_r_minMag, exact ); + break; + case F32_TO_UI64_R_MINMAG: + time_a_f32_z_ui64_x( f32_to_ui64_r_minMag, exact ); + break; + case F32_TO_I32_R_MINMAG: + time_a_f32_z_i32_x( f32_to_i32_r_minMag, exact ); + break; + case F32_TO_I64_R_MINMAG: + time_a_f32_z_i64_x( f32_to_i64_r_minMag, exact ); + break; +#ifdef FLOAT16 + case F32_TO_F16: + time_a_f32_z_f16( f32_to_f16 ); + break; +#endif +#ifdef FLOAT64 + case F32_TO_F64: + time_a_f32_z_f64( f32_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F32_TO_EXTF80: + time_a_f32_z_extF80( f32_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F32_TO_F128: + time_a_f32_z_f128( f32_to_f128M ); + break; +#endif + case F32_ROUNDTOINT: + time_az_f32_rx( f32_roundToInt, roundingMode, exact ); + break; + case F32_ADD: + function_abz_f32 = f32_add; + goto time_abz_f32; + case F32_SUB: + function_abz_f32 = f32_sub; + goto time_abz_f32; + case F32_MUL: + function_abz_f32 = f32_mul; + goto time_abz_f32; + case F32_DIV: + function_abz_f32 = f32_div; + goto time_abz_f32; + case F32_REM: + function_abz_f32 = f32_rem; + time_abz_f32: + time_abz_f32( function_abz_f32 ); + break; + case F32_MULADD: + time_abcz_f32( f32_mulAdd ); + break; + case F32_SQRT: + time_az_f32_pos( f32_sqrt ); + break; + case F32_EQ: + function_ab_f32_z_bool = f32_eq; + goto time_ab_f32_z_bool; + case F32_LE: + function_ab_f32_z_bool = f32_le; + goto time_ab_f32_z_bool; + case F32_LT: + function_ab_f32_z_bool = f32_lt; + goto time_ab_f32_z_bool; + case F32_EQ_SIGNALING: + function_ab_f32_z_bool = f32_eq_signaling; + goto time_ab_f32_z_bool; + case F32_LE_QUIET: + function_ab_f32_z_bool = f32_le_quiet; + goto time_ab_f32_z_bool; + case F32_LT_QUIET: + function_ab_f32_z_bool = f32_lt_quiet; + time_ab_f32_z_bool: + time_ab_f32_z_bool( function_ab_f32_z_bool ); + break; + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT64 + case F64_TO_UI32: + time_a_f64_z_ui32_rx( f64_to_ui32, roundingMode, exact ); + break; + case F64_TO_UI64: + time_a_f64_z_ui64_rx( f64_to_ui64, roundingMode, exact ); + break; + case F64_TO_I32: + time_a_f64_z_i32_rx( f64_to_i32, roundingMode, exact ); + break; + case F64_TO_I64: + time_a_f64_z_i64_rx( f64_to_i64, roundingMode, exact ); + break; + case F64_TO_UI32_R_MINMAG: + time_a_f64_z_ui32_x( f64_to_ui32_r_minMag, exact ); + break; + case F64_TO_UI64_R_MINMAG: + time_a_f64_z_ui64_x( f64_to_ui64_r_minMag, exact ); + break; + case F64_TO_I32_R_MINMAG: + time_a_f64_z_i32_x( f64_to_i32_r_minMag, exact ); + break; + case F64_TO_I64_R_MINMAG: + time_a_f64_z_i64_x( f64_to_i64_r_minMag, exact ); + break; +#ifdef FLOAT16 + case F64_TO_F16: + time_a_f64_z_f16( f64_to_f16 ); + break; +#endif + case F64_TO_F32: + time_a_f64_z_f32( f64_to_f32 ); + break; +#ifdef EXTFLOAT80 + case F64_TO_EXTF80: + time_a_f64_z_extF80( f64_to_extF80M ); + break; +#endif +#ifdef FLOAT128 + case F64_TO_F128: + time_a_f64_z_f128( f64_to_f128M ); + break; +#endif + case F64_ROUNDTOINT: + time_az_f64_rx( f64_roundToInt, roundingMode, exact ); + break; + case F64_ADD: + function_abz_f64 = f64_add; + goto time_abz_f64; + case F64_SUB: + function_abz_f64 = f64_sub; + goto time_abz_f64; + case F64_MUL: + function_abz_f64 = f64_mul; + goto time_abz_f64; + case F64_DIV: + function_abz_f64 = f64_div; + goto time_abz_f64; + case F64_REM: + function_abz_f64 = f64_rem; + time_abz_f64: + time_abz_f64( function_abz_f64 ); + break; + case F64_MULADD: + time_abcz_f64( f64_mulAdd ); + break; + case F64_SQRT: + time_az_f64_pos( f64_sqrt ); + break; + case F64_EQ: + function_ab_f64_z_bool = f64_eq; + goto time_ab_f64_z_bool; + case F64_LE: + function_ab_f64_z_bool = f64_le; + goto time_ab_f64_z_bool; + case F64_LT: + function_ab_f64_z_bool = f64_lt; + goto time_ab_f64_z_bool; + case F64_EQ_SIGNALING: + function_ab_f64_z_bool = f64_eq_signaling; + goto time_ab_f64_z_bool; + case F64_LE_QUIET: + function_ab_f64_z_bool = f64_le_quiet; + goto time_ab_f64_z_bool; + case F64_LT_QUIET: + function_ab_f64_z_bool = f64_lt_quiet; + time_ab_f64_z_bool: + time_ab_f64_z_bool( function_ab_f64_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef EXTFLOAT80 + case EXTF80_TO_UI32: + time_a_extF80_z_ui32_rx( extF80M_to_ui32, roundingMode, exact ); + break; + case EXTF80_TO_UI64: + time_a_extF80_z_ui64_rx( extF80M_to_ui64, roundingMode, exact ); + break; + case EXTF80_TO_I32: + time_a_extF80_z_i32_rx( extF80M_to_i32, roundingMode, exact ); + break; + case EXTF80_TO_I64: + time_a_extF80_z_i64_rx( extF80M_to_i64, roundingMode, exact ); + break; + case EXTF80_TO_UI32_R_MINMAG: + time_a_extF80_z_ui32_x( extF80M_to_ui32_r_minMag, exact ); + break; + case EXTF80_TO_UI64_R_MINMAG: + time_a_extF80_z_ui64_x( extF80M_to_ui64_r_minMag, exact ); + break; + case EXTF80_TO_I32_R_MINMAG: + time_a_extF80_z_i32_x( extF80M_to_i32_r_minMag, exact ); + break; + case EXTF80_TO_I64_R_MINMAG: + time_a_extF80_z_i64_x( extF80M_to_i64_r_minMag, exact ); + break; +#ifdef FLOAT16 + case EXTF80_TO_F16: + time_a_extF80_z_f16( extF80M_to_f16 ); + break; +#endif + case EXTF80_TO_F32: + time_a_extF80_z_f32( extF80M_to_f32 ); + break; +#ifdef FLOAT64 + case EXTF80_TO_F64: + time_a_extF80_z_f64( extF80M_to_f64 ); + break; +#endif +#ifdef FLOAT128 + case EXTF80_TO_F128: + time_a_extF80_z_f128( extF80M_to_f128M ); + break; +#endif + case EXTF80_ROUNDTOINT: + time_az_extF80_rx( extF80M_roundToInt, roundingMode, exact ); + break; + case EXTF80_ADD: + function_abz_extF80 = extF80M_add; + goto time_abz_extF80; + case EXTF80_SUB: + function_abz_extF80 = extF80M_sub; + goto time_abz_extF80; + case EXTF80_MUL: + function_abz_extF80 = extF80M_mul; + goto time_abz_extF80; + case EXTF80_DIV: + function_abz_extF80 = extF80M_div; + goto time_abz_extF80; + case EXTF80_REM: + function_abz_extF80 = extF80M_rem; + time_abz_extF80: + time_abz_extF80( function_abz_extF80 ); + break; + case EXTF80_SQRT: + time_az_extF80_pos( extF80M_sqrt ); + break; + case EXTF80_EQ: + function_ab_extF80_z_bool = extF80M_eq; + goto time_ab_extF80_z_bool; + case EXTF80_LE: + function_ab_extF80_z_bool = extF80M_le; + goto time_ab_extF80_z_bool; + case EXTF80_LT: + function_ab_extF80_z_bool = extF80M_lt; + goto time_ab_extF80_z_bool; + case EXTF80_EQ_SIGNALING: + function_ab_extF80_z_bool = extF80M_eq_signaling; + goto time_ab_extF80_z_bool; + case EXTF80_LE_QUIET: + function_ab_extF80_z_bool = extF80M_le_quiet; + goto time_ab_extF80_z_bool; + case EXTF80_LT_QUIET: + function_ab_extF80_z_bool = extF80M_lt_quiet; + time_ab_extF80_z_bool: + time_ab_extF80_z_bool( function_ab_extF80_z_bool ); + break; +#endif + /*-------------------------------------------------------------------- + *--------------------------------------------------------------------*/ +#ifdef FLOAT128 + case F128_TO_UI32: + time_a_f128_z_ui32_rx( f128M_to_ui32, roundingMode, exact ); + break; + case F128_TO_UI64: + time_a_f128_z_ui64_rx( f128M_to_ui64, roundingMode, exact ); + break; + case F128_TO_I32: + time_a_f128_z_i32_rx( f128M_to_i32, roundingMode, exact ); + break; + case F128_TO_I64: + time_a_f128_z_i64_rx( f128M_to_i64, roundingMode, exact ); + break; + case F128_TO_UI32_R_MINMAG: + time_a_f128_z_ui32_x( f128M_to_ui32_r_minMag, exact ); + break; + case F128_TO_UI64_R_MINMAG: + time_a_f128_z_ui64_x( f128M_to_ui64_r_minMag, exact ); + break; + case F128_TO_I32_R_MINMAG: + time_a_f128_z_i32_x( f128M_to_i32_r_minMag, exact ); + break; + case F128_TO_I64_R_MINMAG: + time_a_f128_z_i64_x( f128M_to_i64_r_minMag, exact ); + break; +#ifdef FLOAT16 + case F128_TO_F16: + time_a_f128_z_f16( f128M_to_f16 ); + break; +#endif + case F128_TO_F32: + time_a_f128_z_f32( f128M_to_f32 ); + break; +#ifdef FLOAT64 + case F128_TO_F64: + time_a_f128_z_f64( f128M_to_f64 ); + break; +#endif +#ifdef EXTFLOAT80 + case F128_TO_EXTF80: + time_a_f128_z_extF80( f128M_to_extF80M ); + break; +#endif + case F128_ROUNDTOINT: + time_az_f128_rx( f128M_roundToInt, roundingMode, exact ); + break; + case F128_ADD: + function_abz_f128 = f128M_add; + goto time_abz_f128; + case F128_SUB: + function_abz_f128 = f128M_sub; + goto time_abz_f128; + case F128_MUL: + function_abz_f128 = f128M_mul; + goto time_abz_f128; + case F128_DIV: + function_abz_f128 = f128M_div; + goto time_abz_f128; + case F128_REM: + function_abz_f128 = f128M_rem; + time_abz_f128: + time_abz_f128( function_abz_f128 ); + break; + case F128_MULADD: + time_abcz_f128( f128M_mulAdd ); + break; + case F128_SQRT: + time_az_f128_pos( f128M_sqrt ); + break; + case F128_EQ: + function_ab_f128_z_bool = f128M_eq; + goto time_ab_f128_z_bool; + case F128_LE: + function_ab_f128_z_bool = f128M_le; + goto time_ab_f128_z_bool; + case F128_LT: + function_ab_f128_z_bool = f128M_lt; + goto time_ab_f128_z_bool; + case F128_EQ_SIGNALING: + function_ab_f128_z_bool = f128M_eq_signaling; + goto time_ab_f128_z_bool; + case F128_LE_QUIET: + function_ab_f128_z_bool = f128M_le_quiet; + goto time_ab_f128_z_bool; + case F128_LT_QUIET: + function_ab_f128_z_bool = f128M_lt_quiet; + time_ab_f128_z_bool: + time_ab_f128_z_bool( function_ab_f128_z_bool ); + break; +#endif + } + +} + +enum { EXACT_FALSE = 1, EXACT_TRUE }; + +static +void + timeFunction( + int functionCode, + uint_fast8_t roundingPrecisionIn, + int roundingCodeIn, + int tininessCodeIn, + int exactCodeIn + ) +{ + int functionAttribs, exactCode; + uint_fast8_t roundingMode = softfloat_round_near_even, tininessMode; + + functionNamePtr = functionInfos[functionCode].namePtr; + functionAttribs = functionInfos[functionCode].attribs; + roundingPrecision = 32; + for (;;) { + if ( functionAttribs & FUNC_EFF_ROUNDINGPRECISION ) { + if ( roundingPrecisionIn ) roundingPrecision = roundingPrecisionIn; + } else { + roundingPrecision = 0; + } +#ifdef EXTFLOAT80 + if ( roundingPrecision ) extF80_roundingPrecision = roundingPrecision; +#endif + for ( + roundingCode = 1; roundingCode < NUM_ROUNDINGMODES; ++roundingCode + ) { + if ( + functionAttribs + & (FUNC_ARG_ROUNDINGMODE | FUNC_EFF_ROUNDINGMODE) + ) { + if ( roundingCodeIn ) roundingCode = roundingCodeIn; + } else { + roundingCode = 0; + } + if ( roundingCode ) { + roundingMode = roundingModes[roundingCode]; + if ( functionAttribs & FUNC_EFF_ROUNDINGMODE ) { + softfloat_roundingMode = roundingMode; + } + } + for ( + exactCode = EXACT_FALSE; exactCode <= EXACT_TRUE; ++exactCode + ) { + if ( functionAttribs & FUNC_ARG_EXACT ) { + if ( exactCodeIn ) exactCode = exactCodeIn; + } else { + exactCode = 0; + } + exact = (exactCode == EXACT_TRUE ); + usesExact = (exactCode != 0 ); + for ( + tininessCode = 1; + tininessCode < NUM_TININESSMODES; + ++tininessCode + ) { + if ( + (functionAttribs & FUNC_EFF_TININESSMODE) + || ((functionAttribs + & FUNC_EFF_TININESSMODE_REDUCEDPREC) + && roundingPrecision + && (roundingPrecision < 80)) + ) { + if ( tininessCodeIn ) tininessCode = tininessCodeIn; + } else { + tininessCode = 0; + } + if ( tininessCode ) { + tininessMode = tininessModes[tininessCode]; + softfloat_detectTininess = tininessMode; + } + timeFunctionInstance( functionCode, roundingMode, exact ); + if ( tininessCodeIn || ! tininessCode ) break; + } + if ( exactCodeIn || ! exactCode ) break; + } + if ( roundingCodeIn || ! roundingCode ) break; + } + if ( roundingPrecisionIn || ! roundingPrecision ) break; + if ( roundingPrecision == 80 ) { + break; + } else if ( roundingPrecision == 64 ) { + roundingPrecision = 80; + } else if ( roundingPrecision == 32 ) { + roundingPrecision = 64; + } + } + +} + +int main( int argc, char *argv[] ) +{ + bool haveFunctionArg; + int functionCode, numOperands; + uint_fast8_t roundingPrecision; + int roundingCode, tininessCode, exactCode; + const char *argPtr; + + fail_programName = "timesoftfloat"; + if ( argc <= 1 ) goto writeHelpMessage; + haveFunctionArg = false; + functionCode = 0; + numOperands = 0; + roundingPrecision = 0; + roundingCode = 0; + tininessCode = 0; + exactCode = 0; + for (;;) { + --argc; + if ( ! argc ) break; + argPtr = *++argv; + if ( ! argPtr ) break; + if ( argPtr[0] == '-' ) ++argPtr; + if ( + ! strcmp( argPtr, "help" ) || ! strcmp( argPtr, "-help" ) + || ! strcmp( argPtr, "h" ) + ) { + writeHelpMessage: + fputs( +"timesoftfloat [<option>...] <function>\n" +" <option>: (* is default)\n" +" -help --Write this message and exit.\n" +#ifdef EXTFLOAT80 +" -precision32 --For extF80, time only 32-bit rounding precision.\n" +" -precision64 --For extF80, time only 64-bit rounding precision.\n" +" -precision80 --For extF80, time only 80-bit rounding precision.\n" +#endif +" -rnear_even --Time only rounding to nearest/even.\n" +" -rminMag --Time only rounding to minimum magnitude (toward zero).\n" +" -rmin --Time only rounding to minimum (down).\n" +" -rmax --Time only rounding to maximum (up).\n" +" -rnear_maxMag --Time only rounding to nearest/maximum magnitude\n" +" (nearest/away).\n" +#ifdef FLOAT_ROUND_ODD +" -rodd --Time only rounding to odd (jamming).\n" +#endif +" -tininessbefore --Time only underflow tininess detected before rounding.\n" +" -tininessafter --Time only underflow tininess detected after rounding.\n" +" -notexact --Time only non-exact rounding to integer (no inexact\n" +" exception).\n" +" -exact --Time only exact rounding to integer (allow inexact\n" +" exception).\n" +" <function>:\n" +" <int>_to_<float> <float>_add <float>_eq\n" +" <float>_to_<int> <float>_sub <float>_le\n" +" <float>_to_<int>_r_minMag <float>_mul <float>_lt\n" +" <float>_to_<float> <float>_mulAdd <float>_eq_signaling\n" +" <float>_roundToInt <float>_div <float>_le_quiet\n" +" <float>_rem <float>_lt_quiet\n" +" <float>_sqrt\n" +" -all1 --All unary functions.\n" +" -all2 --All binary functions.\n" +" -all --All functions.\n" +" <int>:\n" +" ui32 --Unsigned 32-bit integer.\n" +" ui64 --Unsigned 64-bit integer.\n" +" i32 --Signed 32-bit integer.\n" +" i64 --Signed 64-bit integer.\n" +" <float>:\n" +#ifdef FLOAT16 +" f16 --Binary 16-bit floating-point (half-precision).\n" +#endif +" f32 --Binary 32-bit floating-point (single-precision).\n" +#ifdef FLOAT64 +" f64 --Binary 64-bit floating-point (double-precision).\n" +#endif +#ifdef EXTFLOAT80 +" extF80 --Binary 80-bit extended floating-point.\n" +#endif +#ifdef FLOAT128 +" f128 --Binary 128-bit floating-point (quadruple-precision).\n" +#endif + , + stdout + ); + return EXIT_SUCCESS; +#ifdef EXTFLOAT80 + } else if ( ! strcmp( argPtr, "precision32" ) ) { + roundingPrecision = 32; + } else if ( ! strcmp( argPtr, "precision64" ) ) { + roundingPrecision = 64; + } else if ( ! strcmp( argPtr, "precision80" ) ) { + roundingPrecision = 80; +#endif + } else if ( + ! strcmp( argPtr, "rnear_even" ) + || ! strcmp( argPtr, "rneareven" ) + || ! strcmp( argPtr, "rnearest_even" ) + ) { + roundingCode = ROUND_NEAR_EVEN; + } else if ( + ! strcmp( argPtr, "rminmag" ) || ! strcmp( argPtr, "rminMag" ) + ) { + roundingCode = ROUND_MINMAG; + } else if ( ! strcmp( argPtr, "rmin" ) ) { + roundingCode = ROUND_MIN; + } else if ( ! strcmp( argPtr, "rmax" ) ) { + roundingCode = ROUND_MAX; + } else if ( + ! strcmp( argPtr, "rnear_maxmag" ) + || ! strcmp( argPtr, "rnear_maxMag" ) + || ! strcmp( argPtr, "rnearmaxmag" ) + || ! strcmp( argPtr, "rnearest_maxmag" ) + || ! strcmp( argPtr, "rnearest_maxMag" ) + ) { + roundingCode = ROUND_NEAR_MAXMAG; +#ifdef FLOAT_ROUND_ODD + } else if ( ! strcmp( argPtr, "rodd" ) ) { + roundingCode = ROUND_ODD; +#endif + } else if ( ! strcmp( argPtr, "tininessbefore" ) ) { + tininessCode = TININESS_BEFORE_ROUNDING; + } else if ( ! strcmp( argPtr, "tininessafter" ) ) { + tininessCode = TININESS_AFTER_ROUNDING; + } else if ( ! strcmp( argPtr, "notexact" ) ) { + exactCode = EXACT_FALSE; + } else if ( ! strcmp( argPtr, "exact" ) ) { + exactCode = EXACT_TRUE; + } else if ( ! strcmp( argPtr, "all1" ) ) { + haveFunctionArg = true; + functionCode = 0; + numOperands = 1; + } else if ( ! strcmp( argPtr, "all2" ) ) { + haveFunctionArg = true; + functionCode = 0; + numOperands = 2; + } else if ( ! strcmp( argPtr, "all" ) ) { + haveFunctionArg = true; + functionCode = 0; + numOperands = 0; + } else { + functionCode = 1; + while ( strcmp( argPtr, functionInfos[functionCode].namePtr ) ) { + ++functionCode; + if ( functionCode == NUM_FUNCTIONS ) { + fail( "Invalid argument '%s'", *argv ); + } + } + haveFunctionArg = true; + } + } + if ( ! haveFunctionArg ) fail( "Function argument required" ); + if ( functionCode ) { + timeFunction( + functionCode, + roundingPrecision, + roundingCode, + tininessCode, + exactCode + ); + } else { + for ( + functionCode = 1; functionCode < NUM_FUNCTIONS; ++functionCode + ) { + if ( + ! numOperands + || (functionInfos[functionCode].attribs + & ((numOperands == 1) ? FUNC_ARG_UNARY + : FUNC_ARG_BINARY)) + ) { + timeFunction( + functionCode, + roundingPrecision, + roundingCode, + tininessCode, + exactCode + ); + } + } + } + return EXIT_SUCCESS; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/uint128.c b/src/libs/softfloat-3e/testfloat/source/uint128.c new file mode 100644 index 00000000..0dcbdfef --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/uint128.c @@ -0,0 +1,99 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "uint128.h" + +struct uint128 shortShiftLeft128( struct uint128 a, int count ) +{ + struct uint128 z; + + z.v64 = a.v64<<count | a.v0>>(-count & 63); + z.v0 = a.v0<<count; + return z; + +} + +struct uint128 shortShiftRight128( struct uint128 a, int count ) +{ + struct uint128 z; + + z.v64 = a.v64>>count; + z.v0 = a.v64<<(-count & 63) | a.v0>>count; + return z; + +} + +struct uint128 shortShiftRightJam128( struct uint128 a, int count ) +{ + int negCount; + struct uint128 z; + + negCount = -count; + z.v64 = a.v64>>count; + z.v0 = + a.v64<<(negCount & 63) | a.v0>>count + | ((uint64_t) (a.v0<<(negCount & 63)) != 0); + return z; + +} + +struct uint128 neg128( struct uint128 a ) +{ + + if ( a.v0 ) { + a.v64 = ~a.v64; + a.v0 = -a.v0; + } else { + a.v64 = -a.v64; + } + return a; + +} + +struct uint128 add128( struct uint128 a, struct uint128 b ) +{ + struct uint128 z; + + z.v0 = a.v0 + b.v0; + z.v64 = a.v64 + b.v64 + (z.v0 < a.v0); + return z; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/uint128.h b/src/libs/softfloat-3e/testfloat/source/uint128.h new file mode 100644 index 00000000..387c4be5 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/uint128.h @@ -0,0 +1,76 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#ifndef uint128_h +#define uint128_h 1 + +#include <stdbool.h> +#include <stdint.h> + +#ifdef LITTLEENDIAN +struct uint128 { uint64_t v0, v64; }; +#else +struct uint128 { uint64_t v64, v0; }; +#endif + +#ifdef INLINE + +INLINE bool eq128( struct uint128 a, struct uint128 b ) + { return (a.v64 == b.v64) && (a.v0 == b.v0); } + +INLINE bool le128( struct uint128 a, struct uint128 b ) + { return (a.v64 < b.v64) || ((a.v64 == b.v64) && (a.v0 <= b.v0)); } + +INLINE bool lt128( struct uint128 a, struct uint128 b ) + { return (a.v64 < b.v64) || ((a.v64 == b.v64) && (a.v0 < b.v0)); } + +#else + +bool eq128( struct uint128, struct uint128 ); +bool le128( struct uint128, struct uint128 ); +bool lt128( struct uint128, struct uint128 ); + +#endif + +struct uint128 shortShiftLeft128( struct uint128, int ); +struct uint128 shortShiftRight128( struct uint128, int ); +struct uint128 shortShiftRightJam128( struct uint128, int ); +struct uint128 neg128( struct uint128 ); +struct uint128 add128( struct uint128, struct uint128 ); + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/uint128_inline.c b/src/libs/softfloat-3e/testfloat/source/uint128_inline.c new file mode 100644 index 00000000..ab12c1e1 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/uint128_inline.c @@ -0,0 +1,56 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" + +#ifdef LITTLEENDIAN +struct uint128 { uint64_t v0, v64; }; +#else +struct uint128 { uint64_t v64, v0; }; +#endif + +bool eq128( struct uint128 a, struct uint128 b ) + { return (a.v64 == b.v64) && (a.v0 == b.v0); } + +bool le128( struct uint128 a, struct uint128 b ) + { return (a.v64 < b.v64) || ((a.v64 == b.v64) && (a.v0 <= b.v0)); } + +bool lt128( struct uint128 a, struct uint128 b ) + { return (a.v64 < b.v64) || ((a.v64 == b.v64) && (a.v0 < b.v0)); } + diff --git a/src/libs/softfloat-3e/testfloat/source/verCases.h b/src/libs/softfloat-3e/testfloat/source/verCases.h new file mode 100644 index 00000000..27ed1c9b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/verCases.h @@ -0,0 +1,193 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <signal.h> +#include "uint128.h" +#include "softfloat.h" + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +extern const char *verCases_functionNamePtr; +extern uint_fast8_t verCases_roundingPrecision; +extern int verCases_roundingCode; +extern int verCases_tininessCode; +extern bool verCases_usesExact, verCases_exact; +extern bool verCases_checkNaNs, verCases_checkInvInts; +extern uint_fast32_t verCases_maxErrorCount; +extern bool verCases_errorStop; + +void verCases_writeFunctionName( FILE * ); + +extern volatile sig_atomic_t verCases_stop; + +extern bool verCases_anyErrors; + +void verCases_exitWithStatus( void ); + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef INLINE + +#ifdef FLOAT16 + +INLINE bool f16_same( float16_t a, float16_t b ) +{ + union { uint16_t ui; float16_t f; } uA, uB; + uA.f = a; + uB.f = b; + return (uA.ui == uB.ui); +} + +INLINE bool f16_isNaN( float16_t a ) +{ + union { uint16_t ui; float16_t f; } uA; + uA.f = a; + return 0x7C00 < (uA.ui & 0x7FFF); +} + +#endif + +INLINE bool f32_same( float32_t a, float32_t b ) +{ + union { uint32_t ui; float32_t f; } uA, uB; + uA.f = a; + uB.f = b; + return (uA.ui == uB.ui); +} + +INLINE bool f32_isNaN( float32_t a ) +{ + union { uint32_t ui; float32_t f; } uA; + uA.f = a; + return 0x7F800000 < (uA.ui & 0x7FFFFFFF); +} + +#ifdef FLOAT64 + +INLINE bool f64_same( float64_t a, float64_t b ) +{ + union { uint64_t ui; float64_t f; } uA, uB; + uA.f = a; + uB.f = b; + return (uA.ui == uB.ui); +} + +INLINE bool f64_isNaN( float64_t a ) +{ + union { uint64_t ui; float64_t f; } uA; + uA.f = a; + return + UINT64_C( 0x7FF0000000000000 ) + < (uA.ui & UINT64_C( 0x7FFFFFFFFFFFFFFF )); +} + +#endif + +#ifdef EXTFLOAT80 + +INLINE bool extF80M_same( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + const struct extFloat80M *aSPtr = (const struct extFloat80M *) aPtr; + const struct extFloat80M *bSPtr = (const struct extFloat80M *) bPtr; + return + (aSPtr->signExp == bSPtr->signExp) && (aSPtr->signif == bSPtr->signif); +} + +INLINE bool extF80M_isNaN( const extFloat80_t *aPtr ) +{ + const struct extFloat80M *aSPtr = (const struct extFloat80M *) aPtr; + return + ((aSPtr->signExp & 0x7FFF) == 0x7FFF) + && (aSPtr->signif & UINT64_C( 0x7FFFFFFFFFFFFFFF )); +} + +#endif + +#ifdef FLOAT128 + +INLINE bool f128M_same( const float128_t *aPtr, const float128_t *bPtr ) +{ + const struct uint128 *uiAPtr = (const struct uint128 *) aPtr; + const struct uint128 *uiBPtr = (const struct uint128 *) bPtr; + return (uiAPtr->v64 == uiBPtr->v64) && (uiAPtr->v0 == uiBPtr->v0); +} + +INLINE bool f128M_isNaN( const float128_t *aPtr ) +{ + const struct uint128 *uiAPtr = (const struct uint128 *) aPtr; + uint_fast64_t absA64 = uiAPtr->v64 & UINT64_C( 0x7FFFFFFFFFFFFFFF ); + return + (UINT64_C( 0x7FFF000000000000 ) < absA64) + || ((absA64 == UINT64_C( 0x7FFF000000000000 )) && uiAPtr->v0); +} + +#endif + +#else + +#ifdef FLOAT16 +bool f16_same( float16_t, float16_t ); +bool f16_isNaN( float16_t ); +#endif +bool f32_same( float32_t, float32_t ); +bool f32_isNaN( float32_t ); +#ifdef FLOAT64 +bool f64_same( float64_t, float64_t ); +bool f64_isNaN( float64_t ); +#endif +#ifdef EXTFLOAT80 +bool extF80M_same( const extFloat80_t *, const extFloat80_t * ); +bool extF80M_isNaN( const extFloat80_t * ); +#endif +#ifdef FLOAT128 +bool f128M_same( const float128_t *, const float128_t * ); +bool f128M_isNaN( const float128_t * ); +#endif + +#endif + +extern uint_fast32_t verCases_tenThousandsCount, verCases_errorCount; + +void verCases_writeTestsPerformed( int ); +void verCases_perTenThousand( void ); +void verCases_writeErrorFound( int ); + diff --git a/src/libs/softfloat-3e/testfloat/source/verCases_common.c b/src/libs/softfloat-3e/testfloat/source/verCases_common.c new file mode 100644 index 00000000..f1e33858 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/verCases_common.c @@ -0,0 +1,138 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017, 2018 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> +#include <stdio.h> +#include <signal.h> +#include "platform.h" +#include "verCases.h" + +const char *verCases_functionNamePtr; +uint_fast8_t verCases_roundingPrecision = 0; +int verCases_roundingCode = 0; +int verCases_tininessCode = 0; +bool verCases_usesExact = false; +bool verCases_exact; +bool verCases_checkNaNs = false; +bool verCases_checkInvInts = false; +uint_fast32_t verCases_maxErrorCount = 0; +bool verCases_errorStop = false; + +volatile sig_atomic_t verCases_stop = false; + +bool verCases_anyErrors = false; + +void verCases_exitWithStatus( void ) +{ + + exit( verCases_anyErrors ? EXIT_FAILURE : EXIT_SUCCESS ); + +} + +uint_fast32_t verCases_tenThousandsCount, verCases_errorCount; + +void verCases_writeTestsPerformed( int count ) +{ + + if ( verCases_tenThousandsCount ) { + fprintf( + stderr, + "\r%lu%04d tests performed", + (unsigned long) verCases_tenThousandsCount, + count + ); + } else { + fprintf( stderr, "\r%d tests performed", count ); + } + if ( verCases_errorCount ) { + fprintf( + stderr, + "; %lu error%s found.\n", + (unsigned long) verCases_errorCount, + (verCases_errorCount == 1) ? "" : "s" + ); + } else { + fputs( ".\n", stderr ); + if ( verCases_tenThousandsCount ) { + fprintf( + stdout, + "In %lu%04d tests, no errors found in ", + (unsigned long) verCases_tenThousandsCount, + count + ); + } else { + fprintf( stdout, "In %d tests, no errors found in ", count ); + } + verCases_writeFunctionName( stdout ); + fputs( ".\n", stdout ); + fflush( stdout ); + } + +} + +void verCases_perTenThousand( void ) +{ + + ++verCases_tenThousandsCount; + if ( verCases_stop ) { + verCases_writeTestsPerformed( 0 ); + verCases_exitWithStatus(); + } + fprintf( + stderr, "\r%3lu0000", (unsigned long) verCases_tenThousandsCount ); + +} + +void verCases_writeErrorFound( int count ) +{ + + fputc( '\r', stderr ); + if ( verCases_errorCount == 1 ) { + fputs( "Errors found in ", stdout ); + verCases_writeFunctionName( stdout ); + fputs( ":\n", stdout ); + } + if ( verCases_stop ) { + verCases_writeTestsPerformed( count ); + verCases_exitWithStatus(); + } + verCases_anyErrors = true; + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/verCases_inline.c b/src/libs/softfloat-3e/testfloat/source/verCases_inline.c new file mode 100644 index 00000000..8e2171ef --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/verCases_inline.c @@ -0,0 +1,138 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "platform.h" +#include "uint128.h" +#include "softfloat.h" + +#ifdef FLOAT16 + +bool f16_same( float16_t a, float16_t b ) +{ + union { uint16_t ui; float16_t f; } uA, uB; + uA.f = a; + uB.f = b; + return (uA.ui == uB.ui); +} + +bool f16_isNaN( float16_t a ) +{ + union { uint16_t ui; float16_t f; } uA; + uA.f = a; + return 0x7C00 < (uA.ui & 0x7FFF); +} + +#endif + +bool f32_same( float32_t a, float32_t b ) +{ + union { uint32_t ui; float32_t f; } uA, uB; + uA.f = a; + uB.f = b; + return (uA.ui == uB.ui); +} + +bool f32_isNaN( float32_t a ) +{ + union { uint32_t ui; float32_t f; } uA; + uA.f = a; + return 0x7F800000 < (uA.ui & 0x7FFFFFFF); +} + +#ifdef FLOAT64 + +bool f64_same( float64_t a, float64_t b ) +{ + union { uint64_t ui; float64_t f; } uA, uB; + uA.f = a; + uB.f = b; + return (uA.ui == uB.ui); +} + +bool f64_isNaN( float64_t a ) +{ + union { uint64_t ui; float64_t f; } uA; + uA.f = a; + return + UINT64_C( 0x7FF0000000000000 ) + < (uA.ui & UINT64_C( 0x7FFFFFFFFFFFFFFF )); +} + +#endif + +#ifdef EXTFLOAT80 + +bool extF80M_same( const extFloat80_t *aPtr, const extFloat80_t *bPtr ) +{ + const struct extFloat80M *aSPtr = (const struct extFloat80M *) aPtr; + const struct extFloat80M *bSPtr = (const struct extFloat80M *) bPtr; + return + (aSPtr->signExp == bSPtr->signExp) && (aSPtr->signif == bSPtr->signif); +} + +bool extF80M_isNaN( const extFloat80_t *aPtr ) +{ + const struct extFloat80M *aSPtr = (const struct extFloat80M *) aPtr; + return + ((aSPtr->signExp & 0x7FFF) == 0x7FFF) + && (aSPtr->signif & UINT64_C( 0x7FFFFFFFFFFFFFFF )); +} + +#endif + +#ifdef FLOAT128 + +bool f128M_same( const float128_t *aPtr, const float128_t *bPtr ) +{ + const struct uint128 *uiAPtr = (const struct uint128 *) aPtr; + const struct uint128 *uiBPtr = (const struct uint128 *) bPtr; + return (uiAPtr->v64 == uiBPtr->v64) && (uiAPtr->v0 == uiBPtr->v0); +} + +bool f128M_isNaN( const float128_t *aPtr ) +{ + const struct uint128 *uiAPtr = (const struct uint128 *) aPtr; + uint_fast64_t absA64 = uiAPtr->v64 & UINT64_C( 0x7FFFFFFFFFFFFFFF ); + return + (UINT64_C( 0x7FFF000000000000 ) < absA64) + || ((absA64 == UINT64_C( 0x7FFF000000000000 )) && uiAPtr->v0); +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/verCases_writeFunctionName.c b/src/libs/softfloat-3e/testfloat/source/verCases_writeFunctionName.c new file mode 100644 index 00000000..b8a09ae4 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/verCases_writeFunctionName.c @@ -0,0 +1,79 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdio.h> +#include "platform.h" +#include "functions.h" +#include "verCases.h" + +void verCases_writeFunctionName( FILE *streamPtr ) +{ + static const char *roundingModeNames[NUM_ROUNDINGMODES] = { + 0, + ", rounding near_even", + ", rounding minMag", + ", rounding min", + ", rounding max", + ", rounding near_maxMag", +#ifdef FLOAT_ROUND_ODD + ", rounding odd" +#endif + }; + + fputs( verCases_functionNamePtr, streamPtr ); + if ( verCases_roundingCode ) { + if ( verCases_roundingPrecision ) { + fprintf( + streamPtr, ", precision %d", (int) verCases_roundingPrecision + ); + } + fputs( roundingModeNames[verCases_roundingCode], streamPtr ); + if ( verCases_tininessCode ) { + fputs( + (verCases_tininessCode == TININESS_BEFORE_ROUNDING) + ? ", tininess before rounding" + : ", tininess after rounding", + streamPtr + ); + } + } + if ( verCases_usesExact ) { + fputs( verCases_exact ? ", exact" : ", not exact", streamPtr ); + } + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/verLoops.c b/src/libs/softfloat-3e/testfloat/source/verLoops.c new file mode 100644 index 00000000..01735957 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/verLoops.c @@ -0,0 +1,5283 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <stdlib.h> +#include <stdio.h> +#include "platform.h" +#include "uint128.h" +#include "fail.h" +#include "softfloat.h" +#include "readHex.h" +#include "verCases.h" +#include "writeCase.h" +#include "verLoops.h" + +uint_fast8_t *verLoops_trueFlagsPtr; + +static bool atEndOfInput( void ) +{ + int i; + + i = fgetc( stdin ); + if ( i == EOF ) { + if ( ! ferror( stdin ) && feof( stdin ) ) return true; + fail( "Error reading input" ); + } + ungetc( i, stdin ); + return false; + +} + +static void failFromBadInput( void ) +{ + + fail( "Invalid input format" ); + +} + +static void readVerInput_bool( bool *aPtr ) +{ + + if ( ! readHex_bool( aPtr, ' ' ) ) failFromBadInput(); + +} + +static void readVerInput_ui32( uint_fast32_t *aPtr ) +{ + uint32_t a; + + if ( ! readHex_ui32( &a, ' ' ) ) failFromBadInput(); + *aPtr = a; + +} + +static void readVerInput_ui64( uint_fast64_t *aPtr ) +{ + uint64_t a; + + if ( ! readHex_ui64( &a, ' ' ) ) failFromBadInput(); + *aPtr = a; + +} + +static void readVerInput_i32( int_fast32_t *aPtr ) +{ + union { uint32_t ui; int32_t i; } uA; + + if ( ! readHex_ui32( &uA.ui, ' ' ) ) failFromBadInput(); + *aPtr = uA.i; + +} + +static void readVerInput_i64( int_fast64_t *aPtr ) +{ + union { uint64_t ui; int64_t i; } uA; + + if ( ! readHex_ui64( &uA.ui, ' ' ) ) failFromBadInput(); + *aPtr = uA.i; + +} + +#ifdef FLOAT16 + +static void readVerInput_f16( float16_t *aPtr ) +{ + union { uint16_t ui; float16_t f; } uA; + + if ( ! readHex_ui16( &uA.ui, ' ' ) ) failFromBadInput(); + *aPtr = uA.f; + +} + +#endif + +static void readVerInput_f32( float32_t *aPtr ) +{ + union { uint32_t ui; float32_t f; } uA; + + if ( ! readHex_ui32( &uA.ui, ' ' ) ) failFromBadInput(); + *aPtr = uA.f; + +} + +#ifdef FLOAT64 + +static void readVerInput_f64( float64_t *aPtr ) +{ + union { uint64_t ui; float64_t f; } uA; + + if ( ! readHex_ui64( &uA.ui, ' ' ) ) failFromBadInput(); + *aPtr = uA.f; + +} + +#endif + +#ifdef EXTFLOAT80 + +static void readVerInput_extF80( extFloat80_t *aPtr ) +{ + struct extFloat80M *aSPtr; + + aSPtr = (struct extFloat80M *) aPtr; + if ( + ! readHex_ui16( &aSPtr->signExp, 0 ) + || ! readHex_ui64( &aSPtr->signif, ' ' ) + ) { + failFromBadInput(); + } + +} + +#endif + +#ifdef FLOAT128 + +static void readVerInput_f128( float128_t *aPtr ) +{ + struct uint128 *uiAPtr; + + uiAPtr = (struct uint128 *) aPtr; + if ( + ! readHex_ui64( &uiAPtr->v64, 0 ) || ! readHex_ui64( &uiAPtr->v0, ' ' ) + ) { + failFromBadInput(); + } + +} + +#endif + +static void readVerInput_flags( uint_fast8_t *flagsPtr ) +{ + uint_least8_t commonFlags; + uint_fast8_t flags; + + if ( ! readHex_ui8( &commonFlags, '\n' ) || (0x20 <= commonFlags) ) { + failFromBadInput(); + } + flags = 0; + if ( commonFlags & 0x10 ) flags |= softfloat_flag_invalid; + if ( commonFlags & 0x08 ) flags |= softfloat_flag_infinite; + if ( commonFlags & 0x04 ) flags |= softfloat_flag_overflow; + if ( commonFlags & 0x02 ) flags |= softfloat_flag_underflow; + if ( commonFlags & 0x01 ) flags |= softfloat_flag_inexact; + *flagsPtr = flags; + +} + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT16 + +void ver_a_ui32_z_f16( float16_t trueFunction( uint32_t ) ) +{ + int count; + uint_fast32_t a; + float16_t subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui32( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_a_ui32_z_f32( float32_t trueFunction( uint32_t ) ) +{ + int count; + uint_fast32_t a; + float32_t subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui32( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT64 + +void ver_a_ui32_z_f64( float64_t trueFunction( uint32_t ) ) +{ + int count; + uint_fast32_t a; + float64_t subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui32( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( a, " " ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void ver_a_ui32_z_extF80( void trueFunction( uint32_t, extFloat80_t * ) ) +{ + int count; + uint_fast32_t a; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui32( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT128 + +void ver_a_ui32_z_f128( void trueFunction( uint32_t, float128_t * ) ) +{ + int count; + uint_fast32_t a; + float128_t subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui32( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui32( a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT16 + +void ver_a_ui64_z_f16( float16_t trueFunction( uint64_t ) ) +{ + int count; + uint_fast64_t a; + float16_t subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui64( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_a_ui64_z_f32( float32_t trueFunction( uint64_t ) ) +{ + int count; + uint_fast64_t a; + float32_t subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui64( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT64 + +void ver_a_ui64_z_f64( float64_t trueFunction( uint64_t ) ) +{ + int count; + uint_fast64_t a; + float64_t subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui64( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void ver_a_ui64_z_extF80( void trueFunction( uint64_t, extFloat80_t * ) ) +{ + int count; + uint_fast64_t a; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui64( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT128 + +void ver_a_ui64_z_f128( void trueFunction( uint64_t, float128_t * ) ) +{ + int count; + uint_fast64_t a; + float128_t subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_ui64( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_ui64( a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT16 + +void ver_a_i32_z_f16( float16_t trueFunction( int32_t ) ) +{ + int count; + int_fast32_t a; + float16_t subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i32( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_a_i32_z_f32( float32_t trueFunction( int32_t ) ) +{ + int count; + int_fast32_t a; + float32_t subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i32( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT64 + +void ver_a_i32_z_f64( float64_t trueFunction( int32_t ) ) +{ + int count; + int_fast32_t a; + float64_t subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i32( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( a, " " ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void ver_a_i32_z_extF80( void trueFunction( int32_t, extFloat80_t * ) ) +{ + int count; + int_fast32_t a; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i32( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT128 + +void ver_a_i32_z_f128( void trueFunction( int32_t, float128_t * ) ) +{ + int count; + int_fast32_t a; + float128_t subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i32( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i32( a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT16 + +void ver_a_i64_z_f16( float16_t trueFunction( int64_t ) ) +{ + int count; + int_fast64_t a; + float16_t subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i64( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_a_i64_z_f32( float32_t trueFunction( int64_t ) ) +{ + int count; + int_fast64_t a; + float32_t subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i64( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT64 + +void ver_a_i64_z_f64( float64_t trueFunction( int64_t ) ) +{ + int count; + int_fast64_t a; + float64_t subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i64( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void ver_a_i64_z_extF80( void trueFunction( int64_t, extFloat80_t * ) ) +{ + int count; + int_fast64_t a; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i64( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT128 + +void ver_a_i64_z_f128( void trueFunction( int64_t, float128_t * ) ) +{ + int count; + int_fast64_t a; + float128_t subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_i64( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_i64( a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT16 + +void + ver_a_f16_z_ui32_rx( + uint_fast32_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float16_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f16_z_ui64_rx( + uint_fast64_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float16_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f16_z_i32_rx( + int_fast32_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float16_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f16_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f16_z_i64_rx( + int_fast64_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float16_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f16_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f16_z_ui32_x( + uint_fast32_t trueFunction( float16_t, bool ), bool exact ) +{ + int count; + float16_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f16_z_ui64_x( + uint_fast64_t trueFunction( float16_t, bool ), bool exact ) +{ + int count; + float16_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f16_z_i32_x( + int_fast32_t trueFunction( float16_t, bool ), bool exact ) +{ + int count; + float16_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f16_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f16_z_i64_x( + int_fast64_t trueFunction( float16_t, bool ), bool exact ) +{ + int count; + float16_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f16_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_a_f16_z_f32( float32_t trueFunction( float16_t ) ) +{ + int count; + float16_t a; + float32_t subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT64 + +void ver_a_f16_z_f64( float64_t trueFunction( float16_t ) ) +{ + int count; + float16_t a; + float64_t subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void ver_a_f16_z_extF80( void trueFunction( float16_t, extFloat80_t * ) ) +{ + int count; + float16_t a; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT128 + +void ver_a_f16_z_f128( void trueFunction( float16_t, float128_t * ) ) +{ + int count; + float16_t a; + float128_t subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_az_f16( float16_t trueFunction( float16_t ) ) +{ + int count; + float16_t a, subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_az_f16_rx( + float16_t trueFunction( float16_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float16_t a, subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f16_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f16( a ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_abz_f16( float16_t trueFunction( float16_t, float16_t ) ) +{ + int count; + float16_t a, b, subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_f16( &b ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f16_isSignalingNaN( a ) || f16_isSignalingNaN( b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f16( a, b ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_abcz_f16( float16_t trueFunction( float16_t, float16_t, float16_t ) ) +{ + int count; + float16_t a, b, c, subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_f16( &b ); + readVerInput_f16( &c ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b, c ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f16_isSignalingNaN( a ) || f16_isSignalingNaN( b ) + || f16_isSignalingNaN( c )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_abc_f16( a, b, c ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_ab_f16_z_bool( bool trueFunction( float16_t, float16_t ) ) +{ + int count; + float16_t a, b; + bool subjZ; + uint_fast8_t subjFlags; + bool trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f16( &a ); + readVerInput_f16( &b ); + readVerInput_bool( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f16_isSignalingNaN( a ) || f16_isSignalingNaN( b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f16( a, b ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +void + ver_a_f32_z_ui32_rx( + uint_fast32_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float32_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f32_z_ui64_rx( + uint_fast64_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float32_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f32_z_i32_rx( + int_fast32_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float32_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f32_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f32_z_i64_rx( + int_fast64_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float32_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f32_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f32_z_ui32_x( + uint_fast32_t trueFunction( float32_t, bool ), bool exact ) +{ + int count; + float32_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f32_z_ui64_x( + uint_fast64_t trueFunction( float32_t, bool ), bool exact ) +{ + int count; + float32_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f32_z_i32_x( + int_fast32_t trueFunction( float32_t, bool ), bool exact ) +{ + int count; + float32_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f32_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f32_z_i64_x( + int_fast64_t trueFunction( float32_t, bool ), bool exact ) +{ + int count; + float32_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f32_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT16 + +void ver_a_f32_z_f16( float16_t trueFunction( float32_t ) ) +{ + int count; + float32_t a; + float16_t subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f32_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT64 + +void ver_a_f32_z_f64( float64_t trueFunction( float32_t ) ) +{ + int count; + float32_t a; + float64_t subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f32_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void ver_a_f32_z_extF80( void trueFunction( float32_t, extFloat80_t * ) ) +{ + int count; + float32_t a; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f32_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT128 + +void ver_a_f32_z_f128( void trueFunction( float32_t, float128_t * ) ) +{ + int count; + float32_t a; + float128_t subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f32_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_az_f32( float32_t trueFunction( float32_t ) ) +{ + int count; + float32_t a, subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f32_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_az_f32_rx( + float32_t trueFunction( float32_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float32_t a, subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f32_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f32( a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_abz_f32( float32_t trueFunction( float32_t, float32_t ) ) +{ + int count; + float32_t a, b, subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_f32( &b ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f32_isSignalingNaN( a ) || f32_isSignalingNaN( b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f32( a, b ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_abcz_f32( float32_t trueFunction( float32_t, float32_t, float32_t ) ) +{ + int count; + float32_t a, b, c, subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_f32( &b ); + readVerInput_f32( &c ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b, c ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f32_isSignalingNaN( a ) || f32_isSignalingNaN( b ) + || f32_isSignalingNaN( c )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_abc_f32( a, b, c ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_ab_f32_z_bool( bool trueFunction( float32_t, float32_t ) ) +{ + int count; + float32_t a, b; + bool subjZ; + uint_fast8_t subjFlags; + bool trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f32( &a ); + readVerInput_f32( &b ); + readVerInput_bool( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f32_isSignalingNaN( a ) || f32_isSignalingNaN( b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f32( a, b ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT64 + +void + ver_a_f64_z_ui32_rx( + uint_fast32_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float64_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f64_z_ui64_rx( + uint_fast64_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float64_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f64_z_i32_rx( + int_fast32_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float64_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f64_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f64_z_i64_rx( + int_fast64_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float64_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f64_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f64_z_ui32_x( + uint_fast32_t trueFunction( float64_t, bool ), bool exact ) +{ + int count; + float64_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f64_z_ui64_x( + uint_fast64_t trueFunction( float64_t, bool ), bool exact ) +{ + int count; + float64_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f64_z_i32_x( + int_fast32_t trueFunction( float64_t, bool ), bool exact ) +{ + int count; + float64_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f64_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f64_z_i64_x( + int_fast64_t trueFunction( float64_t, bool ), bool exact ) +{ + int count; + float64_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f64_isNaN( a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT16 + +void ver_a_f64_z_f16( float16_t trueFunction( float64_t ) ) +{ + int count; + float64_t a; + float16_t subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f64_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_a_f64_z_f32( float32_t trueFunction( float64_t ) ) +{ + int count; + float64_t a; + float32_t subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f64_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef EXTFLOAT80 + +void ver_a_f64_z_extF80( void trueFunction( float64_t, extFloat80_t * ) ) +{ + int count; + float64_t a; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f64_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT128 + +void ver_a_f64_z_f128( void trueFunction( float64_t, float128_t * ) ) +{ + int count; + float64_t a; + float128_t subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f64_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_az_f64( float64_t trueFunction( float64_t ) ) +{ + int count; + float64_t a, subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f64_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_az_f64_rx( + float64_t trueFunction( float64_t, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float64_t a, subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f64_isSignalingNaN( a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f64( a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_abz_f64( float64_t trueFunction( float64_t, float64_t ) ) +{ + int count; + float64_t a, b, subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_f64( &b ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f64_isSignalingNaN( a ) || f64_isSignalingNaN( b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f64( a, b, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_abcz_f64( float64_t trueFunction( float64_t, float64_t, float64_t ) ) +{ + int count; + float64_t a, b, c, subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_f64( &b ); + readVerInput_f64( &c ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b, c ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f64_isSignalingNaN( a ) || f64_isSignalingNaN( b ) + || f64_isSignalingNaN( c )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_abc_f64( a, b, c ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void ver_ab_f64_z_bool( bool trueFunction( float64_t, float64_t ) ) +{ + int count; + float64_t a, b; + bool subjZ; + uint_fast8_t subjFlags; + bool trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f64( &a ); + readVerInput_f64( &b ); + readVerInput_bool( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( a, b ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f64_isSignalingNaN( a ) || f64_isSignalingNaN( b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f64( a, b, " " ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef EXTFLOAT80 + +void + ver_a_extF80_z_ui32_rx( + uint_fast32_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + extFloat80_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_extF80_z_ui64_rx( + uint_fast64_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + extFloat80_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, "\n\t" ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_extF80_z_i32_rx( + int_fast32_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + extFloat80_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! extF80M_isNaN( &a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_extF80_z_i64_rx( + int_fast64_t trueFunction( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + extFloat80_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! extF80M_isNaN( &a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, "\n\t" ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_extF80_z_ui32_x( + uint_fast32_t trueFunction( const extFloat80_t *, bool ), bool exact ) +{ + int count; + extFloat80_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_extF80_z_ui64_x( + uint_fast64_t trueFunction( const extFloat80_t *, bool ), bool exact ) +{ + int count; + extFloat80_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, "\n\t" ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_extF80_z_i32_x( + int_fast32_t trueFunction( const extFloat80_t *, bool ), bool exact ) +{ + int count; + extFloat80_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! extF80M_isNaN( &a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_extF80_z_i64_x( + int_fast64_t trueFunction( const extFloat80_t *, bool ), bool exact ) +{ + int count; + extFloat80_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! extF80M_isNaN( &a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, "\n\t" ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT16 + +void ver_a_extF80_z_f16( float16_t trueFunction( const extFloat80_t * ) ) +{ + int count; + extFloat80_t a; + float16_t subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_a_extF80_z_f32( float32_t trueFunction( const extFloat80_t * ) ) +{ + int count; + extFloat80_t a; + float32_t subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, " " ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT64 + +void ver_a_extF80_z_f64( float64_t trueFunction( const extFloat80_t * ) ) +{ + int count; + extFloat80_t a; + float64_t subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef FLOAT128 + +void + ver_a_extF80_z_f128( void trueFunction( const extFloat80_t *, float128_t * ) ) +{ + int count; + extFloat80_t a; + float128_t subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_az_extF80( void trueFunction( const extFloat80_t *, extFloat80_t * ) ) +{ + int count; + extFloat80_t a, subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_az_extF80_rx( + void + trueFunction( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + extFloat80_t a, subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, roundingMode, exact, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && extF80M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_extF80M( &a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_abz_extF80( + void + trueFunction( + const extFloat80_t *, const extFloat80_t *, extFloat80_t * ) + ) +{ + int count; + extFloat80_t a, b, subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_extF80( &b ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, &b, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (extF80M_isSignalingNaN( &a ) + || extF80M_isSignalingNaN( &b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_extF80M( &a, &b, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_ab_extF80_z_bool( + bool trueFunction( const extFloat80_t *, const extFloat80_t * ) ) +{ + int count; + extFloat80_t a, b; + bool subjZ; + uint_fast8_t subjFlags; + bool trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_extF80( &a ); + readVerInput_extF80( &b ); + readVerInput_bool( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, &b ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (extF80M_isSignalingNaN( &a ) + || extF80M_isSignalingNaN( &b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_extF80M( &a, &b, " " ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ + +#ifdef FLOAT128 + +void + ver_a_f128_z_ui32_rx( + uint_fast32_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float128_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f128_z_ui64_rx( + uint_fast64_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float128_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, "\n\t" ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f128_z_i32_rx( + int_fast32_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float128_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f128M_isNaN( &a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f128_z_i64_rx( + int_fast64_t trueFunction( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float128_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, roundingMode, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f128M_isNaN( &a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, "\n\t" ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f128_z_ui32_x( + uint_fast32_t trueFunction( const float128_t *, bool ), bool exact ) +{ + int count; + float128_t a; + uint_fast32_t subjZ; + uint_fast8_t subjFlags; + uint_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_ui32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0xFFFFFFFF) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, " " ); + writeCase_z_ui32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f128_z_ui64_x( + uint_fast64_t trueFunction( const float128_t *, bool ), bool exact ) +{ + int count; + float128_t a; + uint_fast64_t subjZ; + uint_fast8_t subjFlags; + uint_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_ui64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != UINT64_C( 0xFFFFFFFFFFFFFFFF )) && (subjZ != 0)) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, "\n\t" ); + writeCase_z_ui64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f128_z_i32_x( + int_fast32_t trueFunction( const float128_t *, bool ), bool exact ) +{ + int count; + float128_t a; + int_fast32_t subjZ; + uint_fast8_t subjFlags; + int_fast32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_i32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != 0x7FFFFFFF) && (subjZ != -0x7FFFFFFF - 1) + && (! f128M_isNaN( &a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, " " ); + writeCase_z_i32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_a_f128_z_i64_x( + int_fast64_t trueFunction( const float128_t *, bool ), bool exact ) +{ + int count; + float128_t a; + int_fast64_t subjZ; + uint_fast8_t subjFlags; + int_fast64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_i64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, exact ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + verCases_checkInvInts + || (trueFlags != softfloat_flag_invalid) + || (subjFlags != softfloat_flag_invalid) + || ((subjZ != INT64_C( 0x7FFFFFFFFFFFFFFF )) + && (subjZ != -INT64_C( 0x7FFFFFFFFFFFFFFF ) - 1) + && (! f128M_isNaN( &a ) || (subjZ != 0))) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, "\n\t" ); + writeCase_z_i64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT16 + +void ver_a_f128_z_f16( float16_t trueFunction( const float128_t * ) ) +{ + int count; + float128_t a; + float16_t subjZ; + uint_fast8_t subjFlags; + float16_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_f16( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f16_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f128M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f16_isNaN( trueZ ) + || ! f16_isNaN( subjZ ) + || f16_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, " " ); + writeCase_z_f16( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_a_f128_z_f32( float32_t trueFunction( const float128_t * ) ) +{ + int count; + float128_t a; + float32_t subjZ; + uint_fast8_t subjFlags; + float32_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_f32( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f32_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f128M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f32_isNaN( trueZ ) + || ! f32_isNaN( subjZ ) + || f32_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, "\n\t" ); + writeCase_z_f32( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#ifdef FLOAT64 + +void ver_a_f128_z_f64( float64_t trueFunction( const float128_t * ) ) +{ + int count; + float128_t a; + float64_t subjZ; + uint_fast8_t subjFlags; + float64_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_f64( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f64_same( trueZ, subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f128M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f64_isNaN( trueZ ) + || ! f64_isNaN( subjZ ) + || f64_isSignalingNaN( subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, "\n\t" ); + writeCase_z_f64( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void + ver_a_f128_z_extF80( void trueFunction( const float128_t *, extFloat80_t * ) ) +{ + int count; + float128_t a; + extFloat80_t subjZ; + uint_fast8_t subjFlags; + extFloat80_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_extF80( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! extF80M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f128M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! extF80M_isNaN( &trueZ ) + || ! extF80M_isNaN( &subjZ ) + || extF80M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, "\n\t" ); + writeCase_z_extF80M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + +void ver_az_f128( void trueFunction( const float128_t *, float128_t * ) ) +{ + int count; + float128_t a, subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f128M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_az_f128_rx( + void trueFunction( const float128_t *, uint_fast8_t, bool, float128_t * ), + uint_fast8_t roundingMode, + bool exact + ) +{ + int count; + float128_t a, subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, roundingMode, exact, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( ! verCases_checkNaNs && f128M_isSignalingNaN( &a ) ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_a_f128M( &a, " " ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_abz_f128( + void trueFunction( const float128_t *, const float128_t *, float128_t * ) + ) +{ + int count; + float128_t a, b, subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_f128( &b ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, &b, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f128M_isSignalingNaN( &a ) + || f128M_isSignalingNaN( &b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f128M( &a, &b ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_abcz_f128( + void + trueFunction( + const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ) + ) +{ + int count; + float128_t a, b, c, subjZ; + uint_fast8_t subjFlags; + float128_t trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_f128( &b ); + readVerInput_f128( &c ); + readVerInput_f128( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueFunction( &a, &b, &c, &trueZ ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( ! f128M_same( &trueZ, &subjZ ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && ( f128M_isSignalingNaN( &a ) + || f128M_isSignalingNaN( &b ) + || f128M_isSignalingNaN( &c ) + ) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( + verCases_checkNaNs + || ! f128M_isNaN( &trueZ ) + || ! f128M_isNaN( &subjZ ) + || f128M_isSignalingNaN( &subjZ ) + || (trueFlags != subjFlags) + ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_abc_f128M( &a, &b, &c ); + writeCase_z_f128M( &trueZ, trueFlags, &subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +void + ver_ab_f128_z_bool( + bool trueFunction( const float128_t *, const float128_t * ) ) +{ + int count; + float128_t a, b; + bool subjZ; + uint_fast8_t subjFlags; + bool trueZ; + uint_fast8_t trueFlags; + + verCases_errorCount = 0; + verCases_tenThousandsCount = 0; + count = 10000; + while ( ! atEndOfInput() ) { + readVerInput_f128( &a ); + readVerInput_f128( &b ); + readVerInput_bool( &subjZ ); + readVerInput_flags( &subjFlags ); + *verLoops_trueFlagsPtr = 0; + trueZ = trueFunction( &a, &b ); + trueFlags = *verLoops_trueFlagsPtr; + --count; + if ( ! count ) { + verCases_perTenThousand(); + count = 10000; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + if ( + ! verCases_checkNaNs + && (f128M_isSignalingNaN( &a ) + || f128M_isSignalingNaN( &b )) + ) { + trueFlags |= softfloat_flag_invalid; + } + if ( (trueZ != subjZ) || (trueFlags != subjFlags) ) { + ++verCases_errorCount; + verCases_writeErrorFound( 10000 - count ); + writeCase_ab_f128M( &a, &b ); + writeCase_z_bool( trueZ, trueFlags, subjZ, subjFlags ); + if ( verCases_errorCount == verCases_maxErrorCount ) break; + } + } + } + verCases_writeTestsPerformed( 10000 - count ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/verLoops.h b/src/libs/softfloat-3e/testfloat/source/verLoops.h new file mode 100644 index 00000000..5115e918 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/verLoops.h @@ -0,0 +1,320 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "softfloat.h" + +extern uint_fast8_t *verLoops_trueFlagsPtr; + +#ifdef FLOAT16 +void ver_a_ui32_z_f16( float16_t ( uint32_t ) ); +#endif +void ver_a_ui32_z_f32( float32_t ( uint32_t ) ); +#ifdef FLOAT64 +void ver_a_ui32_z_f64( float64_t ( uint32_t ) ); +#endif +#ifdef EXTFLOAT80 +void ver_a_ui32_z_extF80( void ( uint32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void ver_a_ui32_z_f128( void ( uint32_t, float128_t * ) ); +#endif +#ifdef FLOAT16 +void ver_a_ui64_z_f16( float16_t ( uint64_t ) ); +#endif +void ver_a_ui64_z_f32( float32_t ( uint64_t ) ); +#ifdef FLOAT64 +void ver_a_ui64_z_f64( float64_t ( uint64_t ) ); +#endif +#ifdef EXTFLOAT80 +void ver_a_ui64_z_extF80( void ( uint64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void ver_a_ui64_z_f128( void ( uint64_t, float128_t * ) ); +#endif +#ifdef FLOAT16 +void ver_a_i32_z_f16( float16_t ( int32_t ) ); +#endif +void ver_a_i32_z_f32( float32_t ( int32_t ) ); +#ifdef FLOAT64 +void ver_a_i32_z_f64( float64_t ( int32_t ) ); +#endif +#ifdef EXTFLOAT80 +void ver_a_i32_z_extF80( void ( int32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void ver_a_i32_z_f128( void ( int32_t, float128_t * ) ); +#endif +#ifdef FLOAT16 +void ver_a_i64_z_f16( float16_t ( int64_t ) ); +#endif +void ver_a_i64_z_f32( float32_t ( int64_t ) ); +#ifdef FLOAT64 +void ver_a_i64_z_f64( float64_t ( int64_t ) ); +#endif +#ifdef EXTFLOAT80 +void ver_a_i64_z_extF80( void ( int64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void ver_a_i64_z_f128( void ( int64_t, float128_t * ) ); +#endif + +#ifdef FLOAT16 +void + ver_a_f16_z_ui32_rx( + uint_fast32_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f16_z_ui64_rx( + uint_fast64_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f16_z_i32_rx( + int_fast32_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f16_z_i64_rx( + int_fast64_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void ver_a_f16_z_ui32_x( uint_fast32_t ( float16_t, bool ), bool ); +void ver_a_f16_z_ui64_x( uint_fast64_t ( float16_t, bool ), bool ); +void ver_a_f16_z_i32_x( int_fast32_t ( float16_t, bool ), bool ); +void ver_a_f16_z_i64_x( int_fast64_t ( float16_t, bool ), bool ); +void ver_a_f16_z_f32( float32_t ( float16_t ) ); +#ifdef FLOAT64 +void ver_a_f16_z_f64( float64_t ( float16_t ) ); +#endif +#ifdef EXTFLOAT80 +void ver_a_f16_z_extF80( void ( float16_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void ver_a_f16_z_f128( void ( float16_t, float128_t * ) ); +#endif +void ver_az_f16( float16_t ( float16_t ) ); +void + ver_az_f16_rx( + float16_t ( float16_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void ver_abz_f16( float16_t ( float16_t, float16_t ) ); +void ver_abcz_f16( float16_t ( float16_t, float16_t, float16_t ) ); +void ver_ab_f16_z_bool( bool ( float16_t, float16_t ) ); +#endif + +void + ver_a_f32_z_ui32_rx( + uint_fast32_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f32_z_ui64_rx( + uint_fast64_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f32_z_i32_rx( + int_fast32_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f32_z_i64_rx( + int_fast64_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void ver_a_f32_z_ui32_x( uint_fast32_t ( float32_t, bool ), bool ); +void ver_a_f32_z_ui64_x( uint_fast64_t ( float32_t, bool ), bool ); +void ver_a_f32_z_i32_x( int_fast32_t ( float32_t, bool ), bool ); +void ver_a_f32_z_i64_x( int_fast64_t ( float32_t, bool ), bool ); +#ifdef FLOAT16 +void ver_a_f32_z_f16( float16_t ( float32_t ) ); +#endif +#ifdef FLOAT64 +void ver_a_f32_z_f64( float64_t ( float32_t ) ); +#endif +#ifdef EXTFLOAT80 +void ver_a_f32_z_extF80( void ( float32_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void ver_a_f32_z_f128( void ( float32_t, float128_t * ) ); +#endif +void ver_az_f32( float32_t ( float32_t ) ); +void + ver_az_f32_rx( + float32_t ( float32_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void ver_abz_f32( float32_t ( float32_t, float32_t ) ); +void ver_abcz_f32( float32_t ( float32_t, float32_t, float32_t ) ); +void ver_ab_f32_z_bool( bool ( float32_t, float32_t ) ); + +#ifdef FLOAT64 +void + ver_a_f64_z_ui32_rx( + uint_fast32_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f64_z_ui64_rx( + uint_fast64_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f64_z_i32_rx( + int_fast32_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void + ver_a_f64_z_i64_rx( + int_fast64_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void ver_a_f64_z_ui32_x( uint_fast32_t ( float64_t, bool ), bool ); +void ver_a_f64_z_ui64_x( uint_fast64_t ( float64_t, bool ), bool ); +void ver_a_f64_z_i32_x( int_fast32_t ( float64_t, bool ), bool ); +void ver_a_f64_z_i64_x( int_fast64_t ( float64_t, bool ), bool ); +#ifdef FLOAT16 +void ver_a_f64_z_f16( float16_t ( float64_t ) ); +#endif +void ver_a_f64_z_f32( float32_t ( float64_t ) ); +#ifdef EXTFLOAT80 +void ver_a_f64_z_extF80( void ( float64_t, extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void ver_a_f64_z_f128( void ( float64_t, float128_t * ) ); +#endif +void ver_az_f64( float64_t ( float64_t ) ); +void + ver_az_f64_rx( + float64_t ( float64_t, uint_fast8_t, bool ), uint_fast8_t, bool ); +void ver_abz_f64( float64_t ( float64_t, float64_t ) ); +void ver_abcz_f64( float64_t ( float64_t, float64_t, float64_t ) ); +void ver_ab_f64_z_bool( bool ( float64_t, float64_t ) ); +#endif + +#ifdef EXTFLOAT80 +void + ver_a_extF80_z_ui32_rx( + uint_fast32_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + ver_a_extF80_z_ui64_rx( + uint_fast64_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + ver_a_extF80_z_i32_rx( + int_fast32_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + ver_a_extF80_z_i64_rx( + int_fast64_t ( const extFloat80_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + ver_a_extF80_z_ui32_x( uint_fast32_t ( const extFloat80_t *, bool ), bool ); +void + ver_a_extF80_z_ui64_x( uint_fast64_t ( const extFloat80_t *, bool ), bool ); +void ver_a_extF80_z_i32_x( int_fast32_t ( const extFloat80_t *, bool ), bool ); +void ver_a_extF80_z_i64_x( int_fast64_t ( const extFloat80_t *, bool ), bool ); +#ifdef FLOAT16 +void ver_a_extF80_z_f16( float16_t ( const extFloat80_t * ) ); +#endif +void ver_a_extF80_z_f32( float32_t ( const extFloat80_t * ) ); +#ifdef FLOAT64 +void ver_a_extF80_z_f64( float64_t ( const extFloat80_t * ) ); +#endif +#ifdef FLOAT128 +void ver_a_extF80_z_f128( void ( const extFloat80_t *, float128_t * ) ); +#endif +void ver_az_extF80( void ( const extFloat80_t *, extFloat80_t * ) ); +void + ver_az_extF80_rx( + void ( const extFloat80_t *, uint_fast8_t, bool, extFloat80_t * ), + uint_fast8_t, + bool + ); +void + ver_abz_extF80( + void ( const extFloat80_t *, const extFloat80_t *, extFloat80_t * ) ); +void + ver_ab_extF80_z_bool( bool ( const extFloat80_t *, const extFloat80_t * ) ); +#endif + +#ifdef FLOAT128 +void + ver_a_f128_z_ui32_rx( + uint_fast32_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + ver_a_f128_z_ui64_rx( + uint_fast64_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + ver_a_f128_z_i32_rx( + int_fast32_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void + ver_a_f128_z_i64_rx( + int_fast64_t ( const float128_t *, uint_fast8_t, bool ), + uint_fast8_t, + bool + ); +void ver_a_f128_z_ui32_x( uint_fast32_t ( const float128_t *, bool ), bool ); +void ver_a_f128_z_ui64_x( uint_fast64_t ( const float128_t *, bool ), bool ); +void ver_a_f128_z_i32_x( int_fast32_t ( const float128_t *, bool ), bool ); +void ver_a_f128_z_i64_x( int_fast64_t ( const float128_t *, bool ), bool ); +#ifdef FLOAT16 +void ver_a_f128_z_f16( float16_t ( const float128_t * ) ); +#endif +void ver_a_f128_z_f32( float32_t ( const float128_t * ) ); +#ifdef FLOAT64 +void ver_a_f128_z_f64( float64_t ( const float128_t * ) ); +#endif +#ifdef EXTFLOAT80 +void ver_a_f128_z_extF80( void ( const float128_t *, extFloat80_t * ) ); +#endif +void ver_az_f128( void ( const float128_t *, float128_t * ) ); +void + ver_az_f128_rx( + void ( const float128_t *, uint_fast8_t, bool, float128_t * ), + uint_fast8_t, + bool + ); +void + ver_abz_f128( void ( const float128_t *, const float128_t *, float128_t * ) ); +void + ver_abcz_f128( + void + ( + const float128_t *, + const float128_t *, + const float128_t *, + float128_t * + ) + ); +void ver_ab_f128_z_bool( bool ( const float128_t *, const float128_t * ) ); +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase.h b/src/libs/softfloat-3e/testfloat/source/writeCase.h new file mode 100644 index 00000000..d1054c8c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase.h @@ -0,0 +1,97 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "softfloat.h" + +void writeCase_a_ui32( uint_fast32_t, const char * ); +void writeCase_a_ui64( uint_fast64_t, const char * ); +#define writeCase_a_i32 writeCase_a_ui32 +#define writeCase_a_i64 writeCase_a_ui64 +#ifdef FLOAT16 +void writeCase_a_f16( float16_t ); +void writeCase_ab_f16( float16_t, float16_t ); +void writeCase_abc_f16( float16_t, float16_t, float16_t ); +#endif +void writeCase_a_f32( float32_t, const char * ); +void writeCase_ab_f32( float32_t, float32_t ); +void writeCase_abc_f32( float32_t, float32_t, float32_t ); +#ifdef FLOAT64 +void writeCase_a_f64( float64_t, const char * ); +void writeCase_ab_f64( float64_t, float64_t, const char * ); +void writeCase_abc_f64( float64_t, float64_t, float64_t ); +#endif +#ifdef EXTFLOAT80 +void writeCase_a_extF80M( const extFloat80_t *, const char * ); +void + writeCase_ab_extF80M( + const extFloat80_t *, const extFloat80_t *, const char * ); +#endif +#ifdef FLOAT128 +void writeCase_a_f128M( const float128_t *, const char * ); +void writeCase_ab_f128M( const float128_t *, const float128_t * ); +void + writeCase_abc_f128M( + const float128_t *, const float128_t *, const float128_t * ); +#endif + +void writeCase_z_bool( bool, uint_fast8_t, bool, uint_fast8_t ); +void + writeCase_z_ui32( uint_fast32_t, uint_fast8_t, uint_fast32_t, uint_fast8_t ); +void + writeCase_z_ui64( uint_fast64_t, uint_fast8_t, uint_fast64_t, uint_fast8_t ); +#define writeCase_z_i32 writeCase_z_ui32 +#define writeCase_z_i64 writeCase_z_ui64 +#ifdef FLOAT16 +void writeCase_z_f16( float16_t, uint_fast8_t, float16_t, uint_fast8_t ); +#endif +void writeCase_z_f32( float32_t, uint_fast8_t, float32_t, uint_fast8_t ); +#ifdef FLOAT64 +void writeCase_z_f64( float64_t, uint_fast8_t, float64_t, uint_fast8_t ); +#endif +#ifdef EXTFLOAT80 +void + writeCase_z_extF80M( + const extFloat80_t *, uint_fast8_t, const extFloat80_t *, uint_fast8_t ); +#endif +#ifdef FLOAT128 +void + writeCase_z_f128M( + const float128_t *, uint_fast8_t, const float128_t *, uint_fast8_t ); +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_a_extF80M.c b/src/libs/softfloat-3e/testfloat/source/writeCase_a_extF80M.c new file mode 100644 index 00000000..b960f0d0 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_a_extF80M.c @@ -0,0 +1,55 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef EXTFLOAT80 + +void writeCase_a_extF80M( const extFloat80_t *aPtr, const char *sepStringPtr ) +{ + + writeHex_extF80M( aPtr, 0 ); + fputs( sepStringPtr, stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_a_f128M.c b/src/libs/softfloat-3e/testfloat/source/writeCase_a_f128M.c new file mode 100644 index 00000000..630f0002 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_a_f128M.c @@ -0,0 +1,55 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT128 + +void writeCase_a_f128M( const float128_t *aPtr, const char *sepStringPtr ) +{ + + writeHex_f128M( aPtr, 0 ); + fputs( sepStringPtr, stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_a_f16.c b/src/libs/softfloat-3e/testfloat/source/writeCase_a_f16.c new file mode 100644 index 00000000..f404b459 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_a_f16.c @@ -0,0 +1,55 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT16 + +void writeCase_a_f16( float16_t a ) +{ + + writeHex_f16( a, 0 ); + fputs( " ", stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_a_f32.c b/src/libs/softfloat-3e/testfloat/source/writeCase_a_f32.c new file mode 100644 index 00000000..edaaae2a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_a_f32.c @@ -0,0 +1,51 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +void writeCase_a_f32( float32_t a, const char *sepStringPtr ) +{ + + writeHex_f32( a, 0 ); + fputs( sepStringPtr, stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_a_f64.c b/src/libs/softfloat-3e/testfloat/source/writeCase_a_f64.c new file mode 100644 index 00000000..b5e0ec61 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_a_f64.c @@ -0,0 +1,55 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT64 + +void writeCase_a_f64( float64_t a, const char *sepStringPtr ) +{ + + writeHex_f64( a, 0 ); + fputs( sepStringPtr, stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_a_ui32.c b/src/libs/softfloat-3e/testfloat/source/writeCase_a_ui32.c new file mode 100644 index 00000000..5d96e043 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_a_ui32.c @@ -0,0 +1,51 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +void writeCase_a_ui32( uint_fast32_t a, const char *sepStringPtr ) +{ + + writeHex_ui32( a, 0 ); + fputs( sepStringPtr, stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_a_ui64.c b/src/libs/softfloat-3e/testfloat/source/writeCase_a_ui64.c new file mode 100644 index 00000000..5666721a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_a_ui64.c @@ -0,0 +1,51 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +void writeCase_a_ui64( uint_fast64_t a, const char *sepStringPtr ) +{ + + writeHex_ui64( a, 0 ); + fputs( sepStringPtr, stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_ab_extF80M.c b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_extF80M.c new file mode 100644 index 00000000..e66e6792 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_extF80M.c @@ -0,0 +1,62 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef EXTFLOAT80 + +void + writeCase_ab_extF80M( + const extFloat80_t *aPtr, + const extFloat80_t *bPtr, + const char *sepStringPtr + ) +{ + + writeHex_extF80M( aPtr, 0 ); + fputs( " ", stdout ); + writeHex_extF80M( bPtr, 0 ); + fputs( sepStringPtr, stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f128M.c b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f128M.c new file mode 100644 index 00000000..8ff0deee --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f128M.c @@ -0,0 +1,57 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT128 + +void writeCase_ab_f128M( const float128_t *aPtr, const float128_t *bPtr ) +{ + + writeHex_f128M( aPtr, 0 ); + fputs( " ", stdout ); + writeHex_f128M( bPtr, 0 ); + fputs( "\n\t", stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f16.c b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f16.c new file mode 100644 index 00000000..6c86e933 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f16.c @@ -0,0 +1,57 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT16 + +void writeCase_ab_f16( float16_t a, float16_t b ) +{ + + writeHex_f16( a, 0 ); + fputs( " ", stdout ); + writeHex_f16( b, 0 ); + fputs( " ", stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f32.c b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f32.c new file mode 100644 index 00000000..1218dfba --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f32.c @@ -0,0 +1,53 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +void writeCase_ab_f32( float32_t a, float32_t b ) +{ + + writeHex_f32( a, 0 ); + fputs( " ", stdout ); + writeHex_f32( b, 0 ); + fputs( " ", stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f64.c b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f64.c new file mode 100644 index 00000000..251f009c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_ab_f64.c @@ -0,0 +1,57 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT64 + +void writeCase_ab_f64( float64_t a, float64_t b, const char *sepStringPtr ) +{ + + writeHex_f64( a, 0 ); + fputs( " ", stdout ); + writeHex_f64( b, 0 ); + fputs( sepStringPtr, stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f128M.c b/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f128M.c new file mode 100644 index 00000000..c9697442 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f128M.c @@ -0,0 +1,61 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT128 + +void + writeCase_abc_f128M( + const float128_t *aPtr, const float128_t *bPtr, const float128_t *cPtr ) +{ + + writeHex_f128M( aPtr, 0 ); + fputs( " ", stdout ); + writeHex_f128M( bPtr, 0 ); + fputs( "\n\t", stdout ); + writeHex_f128M( cPtr, 0 ); + fputs( "\n\t", stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f16.c b/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f16.c new file mode 100644 index 00000000..17acf2aa --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f16.c @@ -0,0 +1,59 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT16 + +void writeCase_abc_f16( float16_t a, float16_t b, float16_t c ) +{ + + writeHex_f16( a, 0 ); + fputs( " ", stdout ); + writeHex_f16( b, 0 ); + fputs( " ", stdout ); + writeHex_f16( c, 0 ); + fputs( " ", stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f32.c b/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f32.c new file mode 100644 index 00000000..09a46a31 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f32.c @@ -0,0 +1,55 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +void writeCase_abc_f32( float32_t a, float32_t b, float32_t c ) +{ + + writeHex_f32( a, 0 ); + fputs( " ", stdout ); + writeHex_f32( b, 0 ); + fputs( " ", stdout ); + writeHex_f32( c, 0 ); + fputs( "\n\t", stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f64.c b/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f64.c new file mode 100644 index 00000000..1f0a4ae0 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_abc_f64.c @@ -0,0 +1,59 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT64 + +void writeCase_abc_f64( float64_t a, float64_t b, float64_t c ) +{ + + writeHex_f64( a, 0 ); + fputs( " ", stdout ); + writeHex_f64( b, 0 ); + fputs( " ", stdout ); + writeHex_f64( c, 0 ); + fputs( "\n\t", stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_z_bool.c b/src/libs/softfloat-3e/testfloat/source/writeCase_z_bool.c new file mode 100644 index 00000000..aca956b6 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_z_bool.c @@ -0,0 +1,59 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +void + writeCase_z_bool( + bool trueZ, uint_fast8_t trueFlags, bool subjZ, uint_fast8_t subjFlags ) +{ + + fputs( "=> ", stdout ); + writeHex_bool( subjZ, ' ' ); + writeHex_softfloat_flags( subjFlags, 0 ); + fputs( " expected ", stdout ); + writeHex_bool( trueZ, ' ' ); + writeHex_softfloat_flags( trueFlags, '\n' ); + fflush( stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_z_extF80M.c b/src/libs/softfloat-3e/testfloat/source/writeCase_z_extF80M.c new file mode 100644 index 00000000..8c0f3f0b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_z_extF80M.c @@ -0,0 +1,67 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef EXTFLOAT80 + +void + writeCase_z_extF80M( + const extFloat80_t *trueZPtr, + uint_fast8_t trueFlags, + const extFloat80_t *subjZPtr, + uint_fast8_t subjFlags + ) +{ + + fputs( "=> ", stdout ); + writeHex_extF80M( subjZPtr, ' ' ); + writeHex_softfloat_flags( subjFlags, 0 ); + fputs( " expected ", stdout ); + writeHex_extF80M( trueZPtr, ' ' ); + writeHex_softfloat_flags( trueFlags, '\n' ); + fflush( stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_z_f128M.c b/src/libs/softfloat-3e/testfloat/source/writeCase_z_f128M.c new file mode 100644 index 00000000..ec574bb5 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_z_f128M.c @@ -0,0 +1,67 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT128 + +void + writeCase_z_f128M( + const float128_t *trueZPtr, + uint_fast8_t trueFlags, + const float128_t *subjZPtr, + uint_fast8_t subjFlags + ) +{ + + fputs( "=> ", stdout ); + writeHex_f128M( subjZPtr, ' ' ); + writeHex_softfloat_flags( subjFlags, 0 ); + fputs( "\n\texpected ", stdout ); + writeHex_f128M( trueZPtr, ' ' ); + writeHex_softfloat_flags( trueFlags, '\n' ); + fflush( stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_z_f16.c b/src/libs/softfloat-3e/testfloat/source/writeCase_z_f16.c new file mode 100644 index 00000000..f8a11eee --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_z_f16.c @@ -0,0 +1,67 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT16 + +void + writeCase_z_f16( + float16_t trueZ, + uint_fast8_t trueFlags, + float16_t subjZ, + uint_fast8_t subjFlags + ) +{ + + fputs( "=> ", stdout ); + writeHex_f16( subjZ, ' ' ); + writeHex_softfloat_flags( subjFlags, 0 ); + fputs( " expected ", stdout ); + writeHex_f16( trueZ, ' ' ); + writeHex_softfloat_flags( trueFlags, '\n' ); + fflush( stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_z_f32.c b/src/libs/softfloat-3e/testfloat/source/writeCase_z_f32.c new file mode 100644 index 00000000..b1593b7e --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_z_f32.c @@ -0,0 +1,63 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "writeHex.h" +#include "writeCase.h" + +void + writeCase_z_f32( + float32_t trueZ, + uint_fast8_t trueFlags, + float32_t subjZ, + uint_fast8_t subjFlags + ) +{ + + fputs( "=> ", stdout ); + writeHex_f32( subjZ, ' ' ); + writeHex_softfloat_flags( subjFlags, 0 ); + fputs( " expected ", stdout ); + writeHex_f32( trueZ, ' ' ); + writeHex_softfloat_flags( trueFlags, '\n' ); + fflush( stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_z_f64.c b/src/libs/softfloat-3e/testfloat/source/writeCase_z_f64.c new file mode 100644 index 00000000..97f2bf56 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_z_f64.c @@ -0,0 +1,67 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "softfloat.h" +#include "writeHex.h" +#include "writeCase.h" + +#ifdef FLOAT64 + +void + writeCase_z_f64( + float64_t trueZ, + uint_fast8_t trueFlags, + float64_t subjZ, + uint_fast8_t subjFlags + ) +{ + + fputs( "=> ", stdout ); + writeHex_f64( subjZ, ' ' ); + writeHex_softfloat_flags( subjFlags, 0 ); + fputs( " expected ", stdout ); + writeHex_f64( trueZ, ' ' ); + writeHex_softfloat_flags( trueFlags, '\n' ); + fflush( stdout ); + +} + +#endif + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_z_ui32.c b/src/libs/softfloat-3e/testfloat/source/writeCase_z_ui32.c new file mode 100644 index 00000000..ed07ffc5 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_z_ui32.c @@ -0,0 +1,62 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +void + writeCase_z_ui32( + uint_fast32_t trueZ, + uint_fast8_t trueFlags, + uint_fast32_t subjZ, + uint_fast8_t subjFlags + ) +{ + + fputs( "=> ", stdout ); + writeHex_ui32( subjZ, ' ' ); + writeHex_softfloat_flags( subjFlags, 0 ); + fputs( " expected ", stdout ); + writeHex_ui32( trueZ, ' ' ); + writeHex_softfloat_flags( trueFlags, '\n' ); + fflush( stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeCase_z_ui64.c b/src/libs/softfloat-3e/testfloat/source/writeCase_z_ui64.c new file mode 100644 index 00000000..f20cb188 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeCase_z_ui64.c @@ -0,0 +1,62 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "writeHex.h" +#include "writeCase.h" + +void + writeCase_z_ui64( + uint_fast64_t trueZ, + uint_fast8_t trueFlags, + uint_fast64_t subjZ, + uint_fast8_t subjFlags + ) +{ + + fputs( "=> ", stdout ); + writeHex_ui64( subjZ, ' ' ); + writeHex_softfloat_flags( subjFlags, 0 ); + fputs( " expected ", stdout ); + writeHex_ui64( trueZ, ' ' ); + writeHex_softfloat_flags( trueFlags, '\n' ); + fflush( stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeHex.c b/src/libs/softfloat-3e/testfloat/source/writeHex.c new file mode 100644 index 00000000..442bbb99 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeHex.c @@ -0,0 +1,224 @@ + +/*============================================================================ + +This C source file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017 The Regents of the +University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include "platform.h" +#include "uint128.h" +#include "softfloat.h" +#include "writeHex.h" + +void writeHex_bool( bool a, char sepChar ) +{ + + fputc( a ? '1' : '0', stdout ); + if ( sepChar ) fputc( sepChar, stdout ); + +} + +void writeHex_ui8( uint_fast8_t a, char sepChar ) +{ + int digit; + + digit = a>>4 & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + digit = a & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + if ( sepChar ) fputc( sepChar, stdout ); + +} + +static void writeHex_ui12( uint_fast16_t a, char sepChar ) +{ + int digit; + + digit = a>>8 & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + digit = a>>4 & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + digit = a & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + if ( sepChar ) fputc( sepChar, stdout ); + +} + +void writeHex_ui16( uint_fast16_t a, char sepChar ) +{ + int digit; + + digit = a>>12 & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + digit = a>>8 & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + digit = a>>4 & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + digit = a & 0xF; + if ( 9 < digit ) digit += 'A' - ('0' + 10); + fputc( '0' + digit, stdout ); + if ( sepChar ) fputc( sepChar, stdout ); + +} + +void writeHex_ui32( uint_fast32_t a, char sepChar ) +{ + + writeHex_ui16( a>>16, 0 ); + writeHex_ui16( a, sepChar ); + +} + +void writeHex_ui64( uint_fast64_t a, char sepChar ) +{ + + writeHex_ui32( a>>32, 0 ); + writeHex_ui32( a, sepChar ); + +} + +#ifdef FLOAT16 + +void writeHex_f16( float16_t a, char sepChar ) +{ + union { uint16_t ui; float16_t f; } uA; + uint_fast16_t uiA; + + uA.f = a; + uiA = uA.ui; + fputc( uiA & 0x8000 ? '-' : '+', stdout ); + writeHex_ui8( uiA>>10 & 0x1F, 0 ); + fputc( '.', stdout ); + fputc( '0' + (uiA>>8 & 3), stdout ); + writeHex_ui8( uiA, sepChar ); + +} + +#endif + +void writeHex_f32( float32_t a, char sepChar ) +{ + union { uint32_t ui; float32_t f; } uA; + uint_fast32_t uiA; + + uA.f = a; + uiA = uA.ui; + fputc( uiA & 0x80000000 ? '-' : '+', stdout ); + writeHex_ui8( uiA>>23, 0 ); + fputc( '.', stdout ); + writeHex_ui8( uiA>>16 & 0x7F, 0 ); + writeHex_ui16( uiA, sepChar ); + +} + +#ifdef FLOAT64 + +void writeHex_f64( float64_t a, char sepChar ) +{ + union { uint64_t ui; float64_t f; } uA; + uint_fast64_t uiA; + + uA.f = a; + uiA = uA.ui; + fputc( uiA & UINT64_C( 0x8000000000000000 ) ? '-' : '+', stdout ); + writeHex_ui12( uiA>>52 & 0x7FF, 0 ); + fputc( '.', stdout ); + writeHex_ui12( uiA>>40, 0 ); + writeHex_ui8( uiA>>32, 0 ); + writeHex_ui32( uiA, sepChar ); + +} + +#endif + +#ifdef EXTFLOAT80 + +void writeHex_extF80M( const extFloat80_t *aPtr, char sepChar ) +{ + const struct extFloat80M *aSPtr; + uint_fast16_t uiA64; + + aSPtr = (const struct extFloat80M *) aPtr; + uiA64 = aSPtr->signExp; + fputc( uiA64 & 0x8000 ? '-' : '+', stdout ); + writeHex_ui16( uiA64 & 0x7FFF, 0 ); + fputc( '.', stdout ); + writeHex_ui64( aSPtr->signif, sepChar ); + +} + +#endif + +#ifdef FLOAT128 + +void writeHex_f128M( const float128_t *aPtr, char sepChar ) +{ + const struct uint128 *uiAPtr; + uint_fast64_t uiA64; + + uiAPtr = (const struct uint128 *) aPtr; + uiA64 = uiAPtr->v64; + fputc( uiA64 & UINT64_C( 0x8000000000000000 ) ? '-' : '+', stdout ); + writeHex_ui16( uiA64>>48 & 0x7FFF, 0 ); + fputc( '.', stdout ); + writeHex_ui16( uiA64>>32, 0 ); + writeHex_ui32( uiA64, 0 ); + writeHex_ui64( uiAPtr->v0, sepChar ); + +} + +#endif + +void writeHex_softfloat_flags( uint_fast8_t flags, char sepChar ) +{ + + fputc( flags & softfloat_flag_invalid ? 'v' : '.', stdout ); + fputc( flags & softfloat_flag_infinite ? 'i' : '.', stdout ); + fputc( flags & softfloat_flag_overflow ? 'o' : '.', stdout ); + fputc( flags & softfloat_flag_underflow ? 'u' : '.', stdout ); + fputc( flags & softfloat_flag_inexact ? 'x' : '.', stdout ); + if ( sepChar ) fputc( sepChar, stdout ); + +} + diff --git a/src/libs/softfloat-3e/testfloat/source/writeHex.h b/src/libs/softfloat-3e/testfloat/source/writeHex.h new file mode 100644 index 00000000..951a26fd --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/source/writeHex.h @@ -0,0 +1,61 @@ + +/*============================================================================ + +This C header file is part of TestFloat, Release 3e, a package of programs for +testing the correctness of floating-point arithmetic complying with the IEEE +Standard for Floating-Point, by John R. Hauser. + +Copyright 2011, 2012, 2013, 2014, 2015, 2017 The Regents of the University of +California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the University nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +=============================================================================*/ + +#include <stdbool.h> +#include <stdint.h> +#include "softfloat.h" + +void writeHex_bool( bool, char ); +void writeHex_ui8( uint_fast8_t, char ); +void writeHex_ui16( uint_fast16_t, char ); +void writeHex_ui32( uint_fast32_t, char ); +void writeHex_ui64( uint_fast64_t, char ); +#ifdef FLOAT16 +void writeHex_f16( float16_t, char ); +#endif +void writeHex_f32( float32_t, char ); +#ifdef FLOAT64 +void writeHex_f64( float64_t, char ); +#endif +#ifdef EXTFLOAT80 +void writeHex_extF80M( const extFloat80_t *, char ); +#endif +#ifdef FLOAT128 +void writeHex_f128M( const float128_t *, char ); +#endif +void writeHex_softfloat_flags( uint_fast8_t, char ); + |