diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:49:04 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 16:49:04 +0000 |
commit | 16f504a9dca3fe3b70568f67b7d41241ae485288 (patch) | |
tree | c60f36ada0496ba928b7161059ba5ab1ab224f9d /src/libs/softfloat-3e/testfloat | |
parent | Initial commit. (diff) | |
download | virtualbox-upstream.tar.xz virtualbox-upstream.zip |
Adding upstream version 7.0.6-dfsg.upstream/7.0.6-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/libs/softfloat-3e/testfloat')
205 files changed, 54576 insertions, 0 deletions
diff --git a/src/libs/softfloat-3e/testfloat/COPYING.txt b/src/libs/softfloat-3e/testfloat/COPYING.txt new file mode 100644 index 00000000..196f34d8 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/COPYING.txt @@ -0,0 +1,37 @@ + +License for Berkeley TestFloat Release 3e + +John R. Hauser +2018 January 20 + +The following applies to the whole of TestFloat Release 3e as well as to +each source file individually. + +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. + diff --git a/src/libs/softfloat-3e/testfloat/Makefile.kmk b/src/libs/softfloat-3e/testfloat/Makefile.kmk new file mode 100644 index 00000000..c1282be0 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/Makefile.kmk @@ -0,0 +1,271 @@ +# $Id: Makefile.kmk $ +## @file +# Sub-Makefile for TestFloat-3e. +# + +# +# Copyright (C) 2022 Oracle and/or its affiliates. +# +# This file is part of VirtualBox base platform packages, as +# available from https://www.virtualbox.org. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, in version 3 of the +# License. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see <https://www.gnu.org/licenses>. +# +# SPDX-License-Identifier: GPL-3.0-only +# + +SUB_DEPTH = ../../../.. +include $(KBUILD_PATH)/subheader.kmk + +# +# Basis template for building test stuff. +# +TEMPLATE_VBoxTestFloat = Template for building SoftFloat-3e +TEMPLATE_VBoxTestFloat_EXTENDS = VBoxR3DllNonPedantic +TEMPLATE_VBoxTestFloat_SDKS = $(TEMPLATE_VBoxR3DllNonPedantic_SDKS) VBOX_SOFTFLOAT +TEMPLATE_VBoxTestFloat_DEFS = $(TEMPLATE_VBoxR3DllNonPedantic_DEFS) \ + FLOAT16 \ + FLOAT64 \ + EXTFLOAT80 \ + FLOAT128 \ + FLOAT_ROUND_ODD +ifn1of ($(KBUILD_TARGET), win) +TEMPLATE_VBoxTestFloat_DEFS.amd64 = $(TEMPLATE_VBoxR3DllNonPedantic_DEFS.amd64) LONG_DOUBLE_IS_EXTFLOAT80 +endif +if1of ($(KBUILD_TARGET), win) + TEMPLATE_VBoxTestFloat_INCS.amd64 = ../build/Win-amd64-VCC $(TEMPLATE_VBoxR3DllNonPedantic_INCS.amd64) +else + TEMPLATE_VBoxTestFloat_INCS.amd64 = build/Linux-x86_64-GCC $(TEMPLATE_VBoxR3DllNonPedantic_INCS.amd64) +endif +TEMPLATE_VBoxTestFloat_INCS = $(TEMPLATE_VBoxR3DllNonPedantic_INCS) \ + source/subj-C \ + source + +# -wd4068: test_a_ui32_z_f16.c(48): warning C4068: unknown pragma 'STDC' +# -wd4146: primitives.h(74): warning C4146: unary minus operator applied to unsigned type, result still unsigned +# -wd4715: genCases_f16.c(336) : warning C4715: 'f16Random': not all control paths return a value +TEMPLATE_VBoxTestFloat_CFLAGS.win = $(TEMPLATE_VBoxR3DllNonPedantic_CFLAGS) -wd4068 -wd4146 -wd4715 + +# +# For linking test executables. +# +TEMPLATE_VBoxTestFloatExe = Template for building SoftFloat-3e programs. +TEMPLATE_VBoxTestFloatExe_EXTENDS = VBoxTestFloat +TEMPLATE_VBoxTestFloatExe_INST = $(INST_TESTCASE) +TEMPLATE_VBoxTestFloatExe_LIBS = \ + $(VBox-TestFloat_1_TARGET) \ + $(TEMPLATE_VBoxTestFloat_LIBS) + +# -wd4098: testfloat.c(438): warning C4098: 'subjFunction_az_extF80_rx': 'void' function returning a value +# -wd4102: testfloat.c(767): warning C4102: 'test_abz_f16': unreferenced label +# -wd4701: testfloat.c(1410) : warning C4701: potentially uninitialized local variable 'roundingMode' used +TEMPLATE_VBoxTestFloatExe_CFLAGS.win = $(TEMPLATE_VBoxTestFloat_CFLAGS.win) -wd4098 -wd4102 -wd4701 + + +# +# Library. +# +LIBRARIES += VBox-TestFloat +VBox-TestFloat_TEMPLATE := VBoxTestFloat +VBox-TestFloat_INSTTYPE := none +VBox-TestFloat_SOURCES := \ + source/uint128_inline.c \ + source/uint128.c \ + source/fail.c \ + source/functions_common.c \ + source/functionInfos.c \ + source/standardFunctionInfos.c \ + source/random.c \ + source/genCases_common.c \ + source/genCases_writeTestsTotal.c \ + source/verCases_inline.c \ + source/verCases_common.c \ + source/verCases_writeFunctionName.c \ + source/readHex.c \ + source/writeHex.c \ + source/writeCase_a_ui32.c \ + source/writeCase_a_ui64.c \ + source/writeCase_a_f16.c \ + source/writeCase_ab_f16.c \ + source/writeCase_abc_f16.c \ + source/writeCase_a_f32.c \ + source/writeCase_ab_f32.c \ + source/writeCase_abc_f32.c \ + source/writeCase_a_f64.c \ + source/writeCase_ab_f64.c \ + source/writeCase_abc_f64.c \ + source/writeCase_a_extF80M.c \ + source/writeCase_ab_extF80M.c \ + source/writeCase_a_f128M.c \ + source/writeCase_ab_f128M.c \ + source/writeCase_abc_f128M.c \ + source/writeCase_z_bool.c \ + source/writeCase_z_ui32.c \ + source/writeCase_z_ui64.c \ + source/writeCase_z_f16.c \ + source/writeCase_z_f32.c \ + source/writeCase_z_f64.c \ + source/writeCase_z_extF80M.c \ + source/writeCase_z_f128M.c \ + source/testLoops_common.c \ + \ + source/test_a_ui32_z_f16.c \ + source/test_a_ui32_z_f32.c \ + source/test_a_ui32_z_f64.c \ + source/test_a_ui32_z_extF80.c \ + source/test_a_ui32_z_f128.c \ + source/test_a_ui64_z_f16.c \ + source/test_a_ui64_z_f32.c \ + source/test_a_ui64_z_f64.c \ + source/test_a_ui64_z_extF80.c \ + source/test_a_ui64_z_f128.c \ + source/test_a_i32_z_f16.c \ + source/test_a_i32_z_f32.c \ + source/test_a_i32_z_f64.c \ + source/test_a_i32_z_extF80.c \ + source/test_a_i32_z_f128.c \ + source/test_a_i64_z_f16.c \ + source/test_a_i64_z_f32.c \ + source/test_a_i64_z_f64.c \ + source/test_a_i64_z_extF80.c \ + source/test_a_i64_z_f128.c \ + source/test_a_f16_z_ui32_rx.c \ + source/test_a_f16_z_ui64_rx.c \ + source/test_a_f16_z_i32_rx.c \ + source/test_a_f16_z_i64_rx.c \ + source/test_a_f16_z_ui32_x.c \ + source/test_a_f16_z_ui64_x.c \ + source/test_a_f16_z_i32_x.c \ + source/test_a_f16_z_i64_x.c \ + source/test_a_f16_z_f32.c \ + source/test_a_f16_z_f64.c \ + source/test_a_f16_z_extF80.c \ + source/test_a_f16_z_f128.c \ + source/test_az_f16.c \ + source/test_az_f16_rx.c \ + source/test_abz_f16.c \ + source/test_abcz_f16.c \ + source/test_ab_f16_z_bool.c \ + source/test_a_f32_z_ui32_rx.c \ + source/test_a_f32_z_ui64_rx.c \ + source/test_a_f32_z_i32_rx.c \ + source/test_a_f32_z_i64_rx.c \ + source/test_a_f32_z_ui32_x.c \ + source/test_a_f32_z_ui64_x.c \ + source/test_a_f32_z_i32_x.c \ + source/test_a_f32_z_i64_x.c \ + source/test_a_f32_z_f16.c \ + source/test_a_f32_z_f64.c \ + source/test_a_f32_z_extF80.c \ + source/test_a_f32_z_f128.c \ + source/test_az_f32.c \ + source/test_az_f32_rx.c \ + source/test_abz_f32.c \ + source/test_abcz_f32.c \ + source/test_ab_f32_z_bool.c \ + source/test_a_f64_z_ui32_rx.c \ + source/test_a_f64_z_ui64_rx.c \ + source/test_a_f64_z_i32_rx.c \ + source/test_a_f64_z_i64_rx.c \ + source/test_a_f64_z_ui32_x.c \ + source/test_a_f64_z_ui64_x.c \ + source/test_a_f64_z_i32_x.c \ + source/test_a_f64_z_i64_x.c \ + source/test_a_f64_z_f16.c \ + source/test_a_f64_z_f32.c \ + source/test_a_f64_z_extF80.c \ + source/test_a_f64_z_f128.c \ + source/test_az_f64.c \ + source/test_az_f64_rx.c \ + source/test_abz_f64.c \ + source/test_abcz_f64.c \ + source/test_ab_f64_z_bool.c \ + source/test_a_extF80_z_ui32_rx.c \ + source/test_a_extF80_z_ui64_rx.c \ + source/test_a_extF80_z_i32_rx.c \ + source/test_a_extF80_z_i64_rx.c \ + source/test_a_extF80_z_ui32_x.c \ + source/test_a_extF80_z_ui64_x.c \ + source/test_a_extF80_z_i32_x.c \ + source/test_a_extF80_z_i64_x.c \ + source/test_a_extF80_z_f16.c \ + source/test_a_extF80_z_f32.c \ + source/test_a_extF80_z_f64.c \ + source/test_a_extF80_z_f128.c \ + source/test_az_extF80.c \ + source/test_az_extF80_rx.c \ + source/test_abz_extF80.c \ + source/test_ab_extF80_z_bool.c \ + source/test_a_f128_z_ui32_rx.c \ + source/test_a_f128_z_ui64_rx.c \ + source/test_a_f128_z_i32_rx.c \ + source/test_a_f128_z_i64_rx.c \ + source/test_a_f128_z_ui32_x.c \ + source/test_a_f128_z_ui64_x.c \ + source/test_a_f128_z_i32_x.c \ + source/test_a_f128_z_i64_x.c \ + source/test_a_f128_z_f16.c \ + source/test_a_f128_z_f32.c \ + source/test_a_f128_z_f64.c \ + source/test_a_f128_z_extF80.c \ + source/test_az_f128.c \ + source/test_az_f128_rx.c \ + source/test_abz_f128.c \ + source/test_abcz_f128.c \ + source/test_ab_f128_z_bool.c \ + \ + source/genCases_ui32.c \ + source/genCases_ui64.c \ + source/genCases_i32.c \ + source/genCases_i64.c \ + source/genCases_f16.c \ + source/genCases_f32.c \ + source/genCases_f64.c \ + source/genCases_extF80.c \ + source/genCases_f128.c + + +PROGRAMS += tstTestFloat +tstTestFloat_TEMPLATE = VBoxTestFloatExe +tstTestFloat_SOURCES = \ + source/testfloat.c \ + source/subjfloat_functions.c \ + source/subj-C/subjfloat.c + +PROGRAMS += tstTestFloatVer +tstTestFloatVer_TEMPLATE = VBoxTestFloatExe +tstTestFloatVer_SOURCES = \ + source/testfloat_ver.c \ + source/verLoops.c + +PROGRAMS += tstTestFloatGen +tstTestFloatGen_TEMPLATE = VBoxTestFloatExe +tstTestFloatGen_SOURCES = \ + source/testfloat_gen.c \ + source/genLoops.c + +PROGRAMS += tstTestFloatTime +tstTestFloatTime_TEMPLATE = VBoxTestFloatExe +tstTestFloatTime_SOURCES = \ + source/timesoftfloat.c +tstTestFloatTime_CFLAGS.win = -wd4459 # timesoftfloat.c(4201): warning C4459: declaration of 'exact' hides global declaration + +PROGRAMS += tstTestFloat2 +tstTestFloat2_TEMPLATE = VBoxTestFloatExe +tstTestFloat2_SOURCES = \ + source/testsoftfloat.c \ + source/slowfloat.c + +include $(FILE_KBUILD_SUB_FOOTER) + diff --git a/src/libs/softfloat-3e/testfloat/README.html b/src/libs/softfloat-3e/testfloat/README.html new file mode 100644 index 00000000..131968e0 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/README.html @@ -0,0 +1,82 @@ + +<HTML> + +<HEAD> +<TITLE>Berkeley TestFloat Package Overview</TITLE> +</HEAD> + +<BODY> + +<H1>Package Overview for Berkeley TestFloat Release 3e</H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + +<P> +Berkeley TestFloat is a small collection of programs for testing that an +implementation of binary floating-point conforms to the IEEE Standard for +Floating-Point Arithmetic. +TestFloat is distributed in the form of C source code. +</P> + +<P> +The TestFloat package is documented in the following files in the +<CODE>doc</CODE> subdirectory: +<BLOCKQUOTE> +<TABLE> +<TR> +<TD><A HREF="doc/TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A></TD> +<TD> +General documentation for understanding and using the TestFloat programs. +</TD> +</TR> +<TD><A HREF="doc/testfloat_gen.html"><NOBR><CODE>testfloat_gen.html</CODE></NOBR></A></TD> +<TD> +Specific documentation for the <CODE>testfloat_gen</CODE> program. +</TD> +</TR> +<TR> +<TD><A HREF="doc/testfloat_ver.html"><NOBR><CODE>testfloat_ver.html</CODE></NOBR></A></TD> +<TD> +Specific documentation for the <CODE>testfloat_ver</CODE> program. +</TD> +</TR> +<TR> +<TD><A HREF="doc/testfloat.html"><NOBR><CODE>testfloat.html</CODE></NOBR></A></TD> +<TD> +Specific documentation for the all-in-one <CODE>testfloat</CODE> program. +</TD> +</TR> +<TR> +<TD><A HREF="doc/testsoftfloat.html"><NOBR><CODE>testsoftfloat.html</CODE></NOBR></A></TD> +<TD> +Specific documentation for the <CODE>testsoftfloat</CODE> program. +</TD> +</TR> +<TR> +<TD><A HREF="doc/timesoftfloat.html"><NOBR><CODE>timesoftfloat.html</CODE></NOBR></A></TD> +<TD> +Specific documentation for the <CODE>timesoftfloat</CODE> program. +</TD> +</TR> +<TR> +<TD><A HREF="doc/TestFloat-source.html"><NOBR><CODE>TestFloat-source.html</CODE></NOBR></A></TD> +<TD> +Documentation for building TestFloat. +</TD> +</TR> +<TR> +<TD><A HREF="doc/TestFloat-history.html"><NOBR><CODE>TestFloat-history.html</CODE></NOBR></A><CODE> </CODE></TD> +<TD> +History of the major changes to TestFloat. +</TD> +</TR> +</TABLE> +</BLOCKQUOTE> +Other files in the package comprise the source code for TestFloat. +</P> + +</BODY> + diff --git a/src/libs/softfloat-3e/testfloat/README.txt b/src/libs/softfloat-3e/testfloat/README.txt new file mode 100644 index 00000000..9bbda571 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/README.txt @@ -0,0 +1,26 @@ + +Package Overview for Berkeley TestFloat Release 3e + +John R. Hauser +2018 January 20 + +Berkeley TestFloat is a small collection of programs for testing that an +implementation of binary floating-point conforms to the IEEE Standard for +Floating-Point Arithmetic. TestFloat is distributed in the form of C source +code. + +The TestFloat package is documented in the following files in the "doc" +subdirectory: + + TestFloat-general.html General documentation for understanding and using + the TestFloat programs. + testfloat_gen.html \ + testfloat_ver.html | Specific documentation for each TestFloat + testfloat.html | program. + testsoftfloat.html | + timesoftfloat.html / + TestFloat-source.html Documentation for building TestFloat. + TestFloat-history.html History of the major changes to TestFloat. + +Other files in the package comprise the source code for TestFloat. + diff --git a/src/libs/softfloat-3e/testfloat/build/Linux-386-GCC/Makefile b/src/libs/softfloat-3e/testfloat/build/Linux-386-GCC/Makefile new file mode 100644 index 00000000..8f36554a --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Linux-386-GCC/Makefile @@ -0,0 +1,355 @@ + +#============================================================================= +# +# This Makefile 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. +# +#============================================================================= + +SOURCE_DIR ?= ../../source +SOFTFLOAT_DIR ?= ../../../SoftFloat-3e +PLATFORM ?= Linux-386-GCC + +SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C +SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include + +SOFTFLOAT_H = \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h +SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) + +TESTFLOAT_OPTS ?= \ + -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD \ + -DLONG_DOUBLE_IS_EXTFLOAT80 + +DELETE = rm -f +C_INCLUDES = \ + -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) +COMPILE_C = \ + gcc -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O2 -o $@ +COMPILE_SLOWFLOAT_C = \ + gcc -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O3 -o $@ +MAKELIB = ar crs $@ +LINK = gcc -o $@ +OTHER_LIBS = -lm + +OBJ = .o +LIB = .a +EXE = + +.PHONY: all +all: \ + testsoftfloat$(EXE) \ + timesoftfloat$(EXE) \ + testfloat_gen$(EXE) \ + testfloat_ver$(EXE) \ + testfloat$(EXE) \ + +OBJS_GENCASES = \ + genCases_ui32$(OBJ) \ + genCases_ui64$(OBJ) \ + genCases_i32$(OBJ) \ + genCases_i64$(OBJ) \ + genCases_f16$(OBJ) \ + genCases_f32$(OBJ) \ + genCases_f64$(OBJ) \ + genCases_extF80$(OBJ) \ + genCases_f128$(OBJ) \ + +OBJS_WRITECASE = \ + writeCase_a_ui32$(OBJ) \ + writeCase_a_ui64$(OBJ) \ + writeCase_a_f16$(OBJ) \ + writeCase_ab_f16$(OBJ) \ + writeCase_abc_f16$(OBJ) \ + writeCase_a_f32$(OBJ) \ + writeCase_ab_f32$(OBJ) \ + writeCase_abc_f32$(OBJ) \ + writeCase_a_f64$(OBJ) \ + writeCase_ab_f64$(OBJ) \ + writeCase_abc_f64$(OBJ) \ + writeCase_a_extF80M$(OBJ) \ + writeCase_ab_extF80M$(OBJ) \ + writeCase_a_f128M$(OBJ) \ + writeCase_ab_f128M$(OBJ) \ + writeCase_abc_f128M$(OBJ) \ + writeCase_z_bool$(OBJ) \ + writeCase_z_ui32$(OBJ) \ + writeCase_z_ui64$(OBJ) \ + writeCase_z_f16$(OBJ) \ + writeCase_z_f32$(OBJ) \ + writeCase_z_f64$(OBJ) \ + writeCase_z_extF80M$(OBJ) \ + writeCase_z_f128M$(OBJ) \ + +OBJS_TEST = \ + test_a_ui32_z_f16$(OBJ) \ + test_a_ui32_z_f32$(OBJ) \ + test_a_ui32_z_f64$(OBJ) \ + test_a_ui32_z_extF80$(OBJ) \ + test_a_ui32_z_f128$(OBJ) \ + test_a_ui64_z_f16$(OBJ) \ + test_a_ui64_z_f32$(OBJ) \ + test_a_ui64_z_f64$(OBJ) \ + test_a_ui64_z_extF80$(OBJ) \ + test_a_ui64_z_f128$(OBJ) \ + test_a_i32_z_f16$(OBJ) \ + test_a_i32_z_f32$(OBJ) \ + test_a_i32_z_f64$(OBJ) \ + test_a_i32_z_extF80$(OBJ) \ + test_a_i32_z_f128$(OBJ) \ + test_a_i64_z_f16$(OBJ) \ + test_a_i64_z_f32$(OBJ) \ + test_a_i64_z_f64$(OBJ) \ + test_a_i64_z_extF80$(OBJ) \ + test_a_i64_z_f128$(OBJ) \ + test_a_f16_z_ui32_rx$(OBJ) \ + test_a_f16_z_ui64_rx$(OBJ) \ + test_a_f16_z_i32_rx$(OBJ) \ + test_a_f16_z_i64_rx$(OBJ) \ + test_a_f16_z_ui32_x$(OBJ) \ + test_a_f16_z_ui64_x$(OBJ) \ + test_a_f16_z_i32_x$(OBJ) \ + test_a_f16_z_i64_x$(OBJ) \ + test_a_f16_z_f32$(OBJ) \ + test_a_f16_z_f64$(OBJ) \ + test_a_f16_z_extF80$(OBJ) \ + test_a_f16_z_f128$(OBJ) \ + test_az_f16$(OBJ) \ + test_az_f16_rx$(OBJ) \ + test_abz_f16$(OBJ) \ + test_abcz_f16$(OBJ) \ + test_ab_f16_z_bool$(OBJ) \ + test_a_f32_z_ui32_rx$(OBJ) \ + test_a_f32_z_ui64_rx$(OBJ) \ + test_a_f32_z_i32_rx$(OBJ) \ + test_a_f32_z_i64_rx$(OBJ) \ + test_a_f32_z_ui32_x$(OBJ) \ + test_a_f32_z_ui64_x$(OBJ) \ + test_a_f32_z_i32_x$(OBJ) \ + test_a_f32_z_i64_x$(OBJ) \ + test_a_f32_z_f16$(OBJ) \ + test_a_f32_z_f64$(OBJ) \ + test_a_f32_z_extF80$(OBJ) \ + test_a_f32_z_f128$(OBJ) \ + test_az_f32$(OBJ) \ + test_az_f32_rx$(OBJ) \ + test_abz_f32$(OBJ) \ + test_abcz_f32$(OBJ) \ + test_ab_f32_z_bool$(OBJ) \ + test_a_f64_z_ui32_rx$(OBJ) \ + test_a_f64_z_ui64_rx$(OBJ) \ + test_a_f64_z_i32_rx$(OBJ) \ + test_a_f64_z_i64_rx$(OBJ) \ + test_a_f64_z_ui32_x$(OBJ) \ + test_a_f64_z_ui64_x$(OBJ) \ + test_a_f64_z_i32_x$(OBJ) \ + test_a_f64_z_i64_x$(OBJ) \ + test_a_f64_z_f16$(OBJ) \ + test_a_f64_z_f32$(OBJ) \ + test_a_f64_z_extF80$(OBJ) \ + test_a_f64_z_f128$(OBJ) \ + test_az_f64$(OBJ) \ + test_az_f64_rx$(OBJ) \ + test_abz_f64$(OBJ) \ + test_abcz_f64$(OBJ) \ + test_ab_f64_z_bool$(OBJ) \ + test_a_extF80_z_ui32_rx$(OBJ) \ + test_a_extF80_z_ui64_rx$(OBJ) \ + test_a_extF80_z_i32_rx$(OBJ) \ + test_a_extF80_z_i64_rx$(OBJ) \ + test_a_extF80_z_ui32_x$(OBJ) \ + test_a_extF80_z_ui64_x$(OBJ) \ + test_a_extF80_z_i32_x$(OBJ) \ + test_a_extF80_z_i64_x$(OBJ) \ + test_a_extF80_z_f16$(OBJ) \ + test_a_extF80_z_f32$(OBJ) \ + test_a_extF80_z_f64$(OBJ) \ + test_a_extF80_z_f128$(OBJ) \ + test_az_extF80$(OBJ) \ + test_az_extF80_rx$(OBJ) \ + test_abz_extF80$(OBJ) \ + test_ab_extF80_z_bool$(OBJ) \ + test_a_f128_z_ui32_rx$(OBJ) \ + test_a_f128_z_ui64_rx$(OBJ) \ + test_a_f128_z_i32_rx$(OBJ) \ + test_a_f128_z_i64_rx$(OBJ) \ + test_a_f128_z_ui32_x$(OBJ) \ + test_a_f128_z_ui64_x$(OBJ) \ + test_a_f128_z_i32_x$(OBJ) \ + test_a_f128_z_i64_x$(OBJ) \ + test_a_f128_z_f16$(OBJ) \ + test_a_f128_z_f32$(OBJ) \ + test_a_f128_z_f64$(OBJ) \ + test_a_f128_z_extF80$(OBJ) \ + test_az_f128$(OBJ) \ + test_az_f128_rx$(OBJ) \ + test_abz_f128$(OBJ) \ + test_abcz_f128$(OBJ) \ + test_ab_f128_z_bool$(OBJ) \ + +OBJS_LIB = \ + uint128_inline$(OBJ) \ + uint128$(OBJ) \ + fail$(OBJ) \ + functions_common$(OBJ) \ + functionInfos$(OBJ) \ + standardFunctionInfos$(OBJ) \ + random$(OBJ) \ + genCases_common$(OBJ) \ + $(OBJS_GENCASES) \ + genCases_writeTestsTotal$(OBJ) \ + verCases_inline$(OBJ) \ + verCases_common$(OBJ) \ + verCases_writeFunctionName$(OBJ) \ + readHex$(OBJ) \ + writeHex$(OBJ) \ + $(OBJS_WRITECASE) \ + testLoops_common$(OBJ) \ + $(OBJS_TEST) \ + +uint128$(OBJ): $(SOURCE_DIR)/uint128.h +fail$(OBJ): $(SOURCE_DIR)/fail.h +functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h +functionInfos$(OBJ): $(SOURCE_DIR)/functions.h +standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h +random$(OBJ): $(SOURCE_DIR)/random.h +genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h +$(OBJS_GENCASES): \ + $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h +genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h +genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h +verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h +verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h +readHex$(OBJ): $(SOURCE_DIR)/readHex.h +writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h +$(OBJS_WRITECASE): \ + $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h +testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h +$(OBJS_TEST): \ + $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ + $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h +$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c + $(COMPILE_C) $(SOURCE_DIR)/$*.c +testfloat$(LIB): $(OBJS_LIB) + $(MAKELIB) $^ + +OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) + +slowfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c + $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c +testsoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c + +testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) + +timesoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c + +timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) + +genLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/genLoops.c + $(COMPILE_C) $(SOURCE_DIR)/genLoops.c +testfloat_gen$(OBJ): \ + $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/testfloat_gen.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c + +testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) + +verLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c + $(COMPILE_C) $(SOURCE_DIR)/verLoops.c +testfloat_ver$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ + $(SOURCE_DIR)/testfloat_ver.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c + +testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) + +subjfloat$(OBJ): \ + platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ + $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c + $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c +subjfloat_functions$(OBJ): \ + platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c + $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c +testfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat.c + +testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +.PHONY: clean +clean: + $(DELETE) $(OBJS_LIB) testfloat$(LIB) + $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) + $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) + $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) + diff --git a/src/libs/softfloat-3e/testfloat/build/Linux-386-GCC/platform.h b/src/libs/softfloat-3e/testfloat/build/Linux-386-GCC/platform.h new file mode 100644 index 00000000..8b0de318 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Linux-386-GCC/platform.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, 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. + +=============================================================================*/ + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#define LITTLEENDIAN 1 + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef __GNUC_STDC_INLINE__ +#define INLINE inline +#else +#define INLINE extern inline +#endif + diff --git a/src/libs/softfloat-3e/testfloat/build/Linux-386-SSE2-GCC/Makefile b/src/libs/softfloat-3e/testfloat/build/Linux-386-SSE2-GCC/Makefile new file mode 100644 index 00000000..f9ae0689 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Linux-386-SSE2-GCC/Makefile @@ -0,0 +1,355 @@ + +#============================================================================= +# +# This Makefile 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. +# +#============================================================================= + +SOURCE_DIR ?= ../../source +SOFTFLOAT_DIR ?= ../../../SoftFloat-3e +PLATFORM ?= Linux-386-SSE2-GCC + +SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C +SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include + +SOFTFLOAT_H = \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h +SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) + +TESTFLOAT_OPTS ?= \ + -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD \ + -DLONG_DOUBLE_IS_EXTFLOAT80 + +DELETE = rm -f +C_INCLUDES = \ + -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) +COMPILE_C = \ + gcc -c -Werror-implicit-function-declaration -msse2 -mfpmath=sse \ + $(TESTFLOAT_OPTS) $(C_INCLUDES) -O2 -o $@ +COMPILE_SLOWFLOAT_C = \ + gcc -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O3 -o $@ +MAKELIB = ar crs $@ +LINK = gcc -o $@ +OTHER_LIBS = -lm + +OBJ = .o +LIB = .a +EXE = + +.PHONY: all +all: \ + testsoftfloat$(EXE) \ + timesoftfloat$(EXE) \ + testfloat_gen$(EXE) \ + testfloat_ver$(EXE) \ + testfloat$(EXE) \ + +OBJS_GENCASES = \ + genCases_ui32$(OBJ) \ + genCases_ui64$(OBJ) \ + genCases_i32$(OBJ) \ + genCases_i64$(OBJ) \ + genCases_f16$(OBJ) \ + genCases_f32$(OBJ) \ + genCases_f64$(OBJ) \ + genCases_extF80$(OBJ) \ + genCases_f128$(OBJ) \ + +OBJS_WRITECASE = \ + writeCase_a_ui32$(OBJ) \ + writeCase_a_ui64$(OBJ) \ + writeCase_a_f16$(OBJ) \ + writeCase_ab_f16$(OBJ) \ + writeCase_abc_f16$(OBJ) \ + writeCase_a_f32$(OBJ) \ + writeCase_ab_f32$(OBJ) \ + writeCase_abc_f32$(OBJ) \ + writeCase_a_f64$(OBJ) \ + writeCase_ab_f64$(OBJ) \ + writeCase_abc_f64$(OBJ) \ + writeCase_a_extF80M$(OBJ) \ + writeCase_ab_extF80M$(OBJ) \ + writeCase_a_f128M$(OBJ) \ + writeCase_ab_f128M$(OBJ) \ + writeCase_abc_f128M$(OBJ) \ + writeCase_z_bool$(OBJ) \ + writeCase_z_ui32$(OBJ) \ + writeCase_z_ui64$(OBJ) \ + writeCase_z_f16$(OBJ) \ + writeCase_z_f32$(OBJ) \ + writeCase_z_f64$(OBJ) \ + writeCase_z_extF80M$(OBJ) \ + writeCase_z_f128M$(OBJ) \ + +OBJS_TEST = \ + test_a_ui32_z_f16$(OBJ) \ + test_a_ui32_z_f32$(OBJ) \ + test_a_ui32_z_f64$(OBJ) \ + test_a_ui32_z_extF80$(OBJ) \ + test_a_ui32_z_f128$(OBJ) \ + test_a_ui64_z_f16$(OBJ) \ + test_a_ui64_z_f32$(OBJ) \ + test_a_ui64_z_f64$(OBJ) \ + test_a_ui64_z_extF80$(OBJ) \ + test_a_ui64_z_f128$(OBJ) \ + test_a_i32_z_f16$(OBJ) \ + test_a_i32_z_f32$(OBJ) \ + test_a_i32_z_f64$(OBJ) \ + test_a_i32_z_extF80$(OBJ) \ + test_a_i32_z_f128$(OBJ) \ + test_a_i64_z_f16$(OBJ) \ + test_a_i64_z_f32$(OBJ) \ + test_a_i64_z_f64$(OBJ) \ + test_a_i64_z_extF80$(OBJ) \ + test_a_i64_z_f128$(OBJ) \ + test_a_f16_z_ui32_rx$(OBJ) \ + test_a_f16_z_ui64_rx$(OBJ) \ + test_a_f16_z_i32_rx$(OBJ) \ + test_a_f16_z_i64_rx$(OBJ) \ + test_a_f16_z_ui32_x$(OBJ) \ + test_a_f16_z_ui64_x$(OBJ) \ + test_a_f16_z_i32_x$(OBJ) \ + test_a_f16_z_i64_x$(OBJ) \ + test_a_f16_z_f32$(OBJ) \ + test_a_f16_z_f64$(OBJ) \ + test_a_f16_z_extF80$(OBJ) \ + test_a_f16_z_f128$(OBJ) \ + test_az_f16$(OBJ) \ + test_az_f16_rx$(OBJ) \ + test_abz_f16$(OBJ) \ + test_abcz_f16$(OBJ) \ + test_ab_f16_z_bool$(OBJ) \ + test_a_f32_z_ui32_rx$(OBJ) \ + test_a_f32_z_ui64_rx$(OBJ) \ + test_a_f32_z_i32_rx$(OBJ) \ + test_a_f32_z_i64_rx$(OBJ) \ + test_a_f32_z_ui32_x$(OBJ) \ + test_a_f32_z_ui64_x$(OBJ) \ + test_a_f32_z_i32_x$(OBJ) \ + test_a_f32_z_i64_x$(OBJ) \ + test_a_f32_z_f16$(OBJ) \ + test_a_f32_z_f64$(OBJ) \ + test_a_f32_z_extF80$(OBJ) \ + test_a_f32_z_f128$(OBJ) \ + test_az_f32$(OBJ) \ + test_az_f32_rx$(OBJ) \ + test_abz_f32$(OBJ) \ + test_abcz_f32$(OBJ) \ + test_ab_f32_z_bool$(OBJ) \ + test_a_f64_z_ui32_rx$(OBJ) \ + test_a_f64_z_ui64_rx$(OBJ) \ + test_a_f64_z_i32_rx$(OBJ) \ + test_a_f64_z_i64_rx$(OBJ) \ + test_a_f64_z_ui32_x$(OBJ) \ + test_a_f64_z_ui64_x$(OBJ) \ + test_a_f64_z_i32_x$(OBJ) \ + test_a_f64_z_i64_x$(OBJ) \ + test_a_f64_z_f16$(OBJ) \ + test_a_f64_z_f32$(OBJ) \ + test_a_f64_z_extF80$(OBJ) \ + test_a_f64_z_f128$(OBJ) \ + test_az_f64$(OBJ) \ + test_az_f64_rx$(OBJ) \ + test_abz_f64$(OBJ) \ + test_abcz_f64$(OBJ) \ + test_ab_f64_z_bool$(OBJ) \ + test_a_extF80_z_ui32_rx$(OBJ) \ + test_a_extF80_z_ui64_rx$(OBJ) \ + test_a_extF80_z_i32_rx$(OBJ) \ + test_a_extF80_z_i64_rx$(OBJ) \ + test_a_extF80_z_ui32_x$(OBJ) \ + test_a_extF80_z_ui64_x$(OBJ) \ + test_a_extF80_z_i32_x$(OBJ) \ + test_a_extF80_z_i64_x$(OBJ) \ + test_a_extF80_z_f16$(OBJ) \ + test_a_extF80_z_f32$(OBJ) \ + test_a_extF80_z_f64$(OBJ) \ + test_a_extF80_z_f128$(OBJ) \ + test_az_extF80$(OBJ) \ + test_az_extF80_rx$(OBJ) \ + test_abz_extF80$(OBJ) \ + test_ab_extF80_z_bool$(OBJ) \ + test_a_f128_z_ui32_rx$(OBJ) \ + test_a_f128_z_ui64_rx$(OBJ) \ + test_a_f128_z_i32_rx$(OBJ) \ + test_a_f128_z_i64_rx$(OBJ) \ + test_a_f128_z_ui32_x$(OBJ) \ + test_a_f128_z_ui64_x$(OBJ) \ + test_a_f128_z_i32_x$(OBJ) \ + test_a_f128_z_i64_x$(OBJ) \ + test_a_f128_z_f16$(OBJ) \ + test_a_f128_z_f32$(OBJ) \ + test_a_f128_z_f64$(OBJ) \ + test_a_f128_z_extF80$(OBJ) \ + test_az_f128$(OBJ) \ + test_az_f128_rx$(OBJ) \ + test_abz_f128$(OBJ) \ + test_abcz_f128$(OBJ) \ + test_ab_f128_z_bool$(OBJ) \ + +OBJS_LIB = \ + uint128_inline$(OBJ) \ + uint128$(OBJ) \ + fail$(OBJ) \ + functions_common$(OBJ) \ + functionInfos$(OBJ) \ + standardFunctionInfos$(OBJ) \ + random$(OBJ) \ + genCases_common$(OBJ) \ + $(OBJS_GENCASES) \ + genCases_writeTestsTotal$(OBJ) \ + verCases_inline$(OBJ) \ + verCases_common$(OBJ) \ + verCases_writeFunctionName$(OBJ) \ + readHex$(OBJ) \ + writeHex$(OBJ) \ + $(OBJS_WRITECASE) \ + testLoops_common$(OBJ) \ + $(OBJS_TEST) \ + +uint128$(OBJ): $(SOURCE_DIR)/uint128.h +fail$(OBJ): $(SOURCE_DIR)/fail.h +functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h +functionInfos$(OBJ): $(SOURCE_DIR)/functions.h +standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h +random$(OBJ): $(SOURCE_DIR)/random.h +genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h +$(OBJS_GENCASES): \ + $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h +genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h +genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h +verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h +verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h +readHex$(OBJ): $(SOURCE_DIR)/readHex.h +writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h +$(OBJS_WRITECASE): \ + $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h +testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h +$(OBJS_TEST): \ + $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ + $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h +$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c + $(COMPILE_C) $(SOURCE_DIR)/$*.c +testfloat$(LIB): $(OBJS_LIB) + $(MAKELIB) $^ + +OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) + +slowfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c + $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c +testsoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c + +testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) + +timesoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c + +timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) + +genLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/genLoops.c + $(COMPILE_C) $(SOURCE_DIR)/genLoops.c +testfloat_gen$(OBJ): \ + $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/testfloat_gen.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c + +testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) + +verLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c + $(COMPILE_C) $(SOURCE_DIR)/verLoops.c +testfloat_ver$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ + $(SOURCE_DIR)/testfloat_ver.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c + +testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) + +subjfloat$(OBJ): \ + platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ + $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c + $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c +subjfloat_functions$(OBJ): \ + platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c + $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c +testfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat.c + +testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +.PHONY: clean +clean: + $(DELETE) $(OBJS_LIB) testfloat$(LIB) + $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) + $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) + $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) + diff --git a/src/libs/softfloat-3e/testfloat/build/Linux-386-SSE2-GCC/platform.h b/src/libs/softfloat-3e/testfloat/build/Linux-386-SSE2-GCC/platform.h new file mode 100644 index 00000000..8b0de318 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Linux-386-SSE2-GCC/platform.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, 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. + +=============================================================================*/ + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#define LITTLEENDIAN 1 + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef __GNUC_STDC_INLINE__ +#define INLINE inline +#else +#define INLINE extern inline +#endif + diff --git a/src/libs/softfloat-3e/testfloat/build/Linux-ARM-VFPv2-GCC/Makefile b/src/libs/softfloat-3e/testfloat/build/Linux-ARM-VFPv2-GCC/Makefile new file mode 100644 index 00000000..2f0698d7 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Linux-ARM-VFPv2-GCC/Makefile @@ -0,0 +1,353 @@ + +#============================================================================= +# +# This Makefile 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. +# +#============================================================================= + +SOURCE_DIR ?= ../../source +SOFTFLOAT_DIR ?= ../../../SoftFloat-3e +PLATFORM ?= Linux-ARM-VFPv2-GCC + +SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C +SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include + +SOFTFLOAT_H = \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h +SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) + +TESTFLOAT_OPTS ?= -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD + +DELETE = rm -f +C_INCLUDES = \ + -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) +COMPILE_C = \ + gcc -std=c99 -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O2 -o $@ +COMPILE_SLOWFLOAT_C = \ + gcc -std=c99 -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O3 -o $@ +MAKELIB = ar crs $@ +LINK = gcc -o $@ +OTHER_LIBS = -lm + +OBJ = .o +LIB = .a +EXE = + +.PHONY: all +all: \ + testsoftfloat$(EXE) \ + timesoftfloat$(EXE) \ + testfloat_gen$(EXE) \ + testfloat_ver$(EXE) \ + testfloat$(EXE) \ + +OBJS_GENCASES = \ + genCases_ui32$(OBJ) \ + genCases_ui64$(OBJ) \ + genCases_i32$(OBJ) \ + genCases_i64$(OBJ) \ + genCases_f16$(OBJ) \ + genCases_f32$(OBJ) \ + genCases_f64$(OBJ) \ + genCases_extF80$(OBJ) \ + genCases_f128$(OBJ) \ + +OBJS_WRITECASE = \ + writeCase_a_ui32$(OBJ) \ + writeCase_a_ui64$(OBJ) \ + writeCase_a_f16$(OBJ) \ + writeCase_ab_f16$(OBJ) \ + writeCase_abc_f16$(OBJ) \ + writeCase_a_f32$(OBJ) \ + writeCase_ab_f32$(OBJ) \ + writeCase_abc_f32$(OBJ) \ + writeCase_a_f64$(OBJ) \ + writeCase_ab_f64$(OBJ) \ + writeCase_abc_f64$(OBJ) \ + writeCase_a_extF80M$(OBJ) \ + writeCase_ab_extF80M$(OBJ) \ + writeCase_a_f128M$(OBJ) \ + writeCase_ab_f128M$(OBJ) \ + writeCase_abc_f128M$(OBJ) \ + writeCase_z_bool$(OBJ) \ + writeCase_z_ui32$(OBJ) \ + writeCase_z_ui64$(OBJ) \ + writeCase_z_f16$(OBJ) \ + writeCase_z_f32$(OBJ) \ + writeCase_z_f64$(OBJ) \ + writeCase_z_extF80M$(OBJ) \ + writeCase_z_f128M$(OBJ) \ + +OBJS_TEST = \ + test_a_ui32_z_f16$(OBJ) \ + test_a_ui32_z_f32$(OBJ) \ + test_a_ui32_z_f64$(OBJ) \ + test_a_ui32_z_extF80$(OBJ) \ + test_a_ui32_z_f128$(OBJ) \ + test_a_ui64_z_f16$(OBJ) \ + test_a_ui64_z_f32$(OBJ) \ + test_a_ui64_z_f64$(OBJ) \ + test_a_ui64_z_extF80$(OBJ) \ + test_a_ui64_z_f128$(OBJ) \ + test_a_i32_z_f16$(OBJ) \ + test_a_i32_z_f32$(OBJ) \ + test_a_i32_z_f64$(OBJ) \ + test_a_i32_z_extF80$(OBJ) \ + test_a_i32_z_f128$(OBJ) \ + test_a_i64_z_f16$(OBJ) \ + test_a_i64_z_f32$(OBJ) \ + test_a_i64_z_f64$(OBJ) \ + test_a_i64_z_extF80$(OBJ) \ + test_a_i64_z_f128$(OBJ) \ + test_a_f16_z_ui32_rx$(OBJ) \ + test_a_f16_z_ui64_rx$(OBJ) \ + test_a_f16_z_i32_rx$(OBJ) \ + test_a_f16_z_i64_rx$(OBJ) \ + test_a_f16_z_ui32_x$(OBJ) \ + test_a_f16_z_ui64_x$(OBJ) \ + test_a_f16_z_i32_x$(OBJ) \ + test_a_f16_z_i64_x$(OBJ) \ + test_a_f16_z_f32$(OBJ) \ + test_a_f16_z_f64$(OBJ) \ + test_a_f16_z_extF80$(OBJ) \ + test_a_f16_z_f128$(OBJ) \ + test_az_f16$(OBJ) \ + test_az_f16_rx$(OBJ) \ + test_abz_f16$(OBJ) \ + test_abcz_f16$(OBJ) \ + test_ab_f16_z_bool$(OBJ) \ + test_a_f32_z_ui32_rx$(OBJ) \ + test_a_f32_z_ui64_rx$(OBJ) \ + test_a_f32_z_i32_rx$(OBJ) \ + test_a_f32_z_i64_rx$(OBJ) \ + test_a_f32_z_ui32_x$(OBJ) \ + test_a_f32_z_ui64_x$(OBJ) \ + test_a_f32_z_i32_x$(OBJ) \ + test_a_f32_z_i64_x$(OBJ) \ + test_a_f32_z_f16$(OBJ) \ + test_a_f32_z_f64$(OBJ) \ + test_a_f32_z_extF80$(OBJ) \ + test_a_f32_z_f128$(OBJ) \ + test_az_f32$(OBJ) \ + test_az_f32_rx$(OBJ) \ + test_abz_f32$(OBJ) \ + test_abcz_f32$(OBJ) \ + test_ab_f32_z_bool$(OBJ) \ + test_a_f64_z_ui32_rx$(OBJ) \ + test_a_f64_z_ui64_rx$(OBJ) \ + test_a_f64_z_i32_rx$(OBJ) \ + test_a_f64_z_i64_rx$(OBJ) \ + test_a_f64_z_ui32_x$(OBJ) \ + test_a_f64_z_ui64_x$(OBJ) \ + test_a_f64_z_i32_x$(OBJ) \ + test_a_f64_z_i64_x$(OBJ) \ + test_a_f64_z_f16$(OBJ) \ + test_a_f64_z_f32$(OBJ) \ + test_a_f64_z_extF80$(OBJ) \ + test_a_f64_z_f128$(OBJ) \ + test_az_f64$(OBJ) \ + test_az_f64_rx$(OBJ) \ + test_abz_f64$(OBJ) \ + test_abcz_f64$(OBJ) \ + test_ab_f64_z_bool$(OBJ) \ + test_a_extF80_z_ui32_rx$(OBJ) \ + test_a_extF80_z_ui64_rx$(OBJ) \ + test_a_extF80_z_i32_rx$(OBJ) \ + test_a_extF80_z_i64_rx$(OBJ) \ + test_a_extF80_z_ui32_x$(OBJ) \ + test_a_extF80_z_ui64_x$(OBJ) \ + test_a_extF80_z_i32_x$(OBJ) \ + test_a_extF80_z_i64_x$(OBJ) \ + test_a_extF80_z_f16$(OBJ) \ + test_a_extF80_z_f32$(OBJ) \ + test_a_extF80_z_f64$(OBJ) \ + test_a_extF80_z_f128$(OBJ) \ + test_az_extF80$(OBJ) \ + test_az_extF80_rx$(OBJ) \ + test_abz_extF80$(OBJ) \ + test_ab_extF80_z_bool$(OBJ) \ + test_a_f128_z_ui32_rx$(OBJ) \ + test_a_f128_z_ui64_rx$(OBJ) \ + test_a_f128_z_i32_rx$(OBJ) \ + test_a_f128_z_i64_rx$(OBJ) \ + test_a_f128_z_ui32_x$(OBJ) \ + test_a_f128_z_ui64_x$(OBJ) \ + test_a_f128_z_i32_x$(OBJ) \ + test_a_f128_z_i64_x$(OBJ) \ + test_a_f128_z_f16$(OBJ) \ + test_a_f128_z_f32$(OBJ) \ + test_a_f128_z_f64$(OBJ) \ + test_a_f128_z_extF80$(OBJ) \ + test_az_f128$(OBJ) \ + test_az_f128_rx$(OBJ) \ + test_abz_f128$(OBJ) \ + test_abcz_f128$(OBJ) \ + test_ab_f128_z_bool$(OBJ) \ + +OBJS_LIB = \ + uint128_inline$(OBJ) \ + uint128$(OBJ) \ + fail$(OBJ) \ + functions_common$(OBJ) \ + functionInfos$(OBJ) \ + standardFunctionInfos$(OBJ) \ + random$(OBJ) \ + genCases_common$(OBJ) \ + $(OBJS_GENCASES) \ + genCases_writeTestsTotal$(OBJ) \ + verCases_inline$(OBJ) \ + verCases_common$(OBJ) \ + verCases_writeFunctionName$(OBJ) \ + readHex$(OBJ) \ + writeHex$(OBJ) \ + $(OBJS_WRITECASE) \ + testLoops_common$(OBJ) \ + $(OBJS_TEST) \ + +uint128$(OBJ): $(SOURCE_DIR)/uint128.h +fail$(OBJ): $(SOURCE_DIR)/fail.h +functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h +functionInfos$(OBJ): $(SOURCE_DIR)/functions.h +standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h +random$(OBJ): $(SOURCE_DIR)/random.h +genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h +$(OBJS_GENCASES): \ + $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h +genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h +genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h +verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h +verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h +readHex$(OBJ): $(SOURCE_DIR)/readHex.h +writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h +$(OBJS_WRITECASE): \ + $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h +testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h +$(OBJS_TEST): \ + $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ + $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h +$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c + $(COMPILE_C) $(SOURCE_DIR)/$*.c +testfloat$(LIB): $(OBJS_LIB) + $(MAKELIB) $^ + +OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) + +slowfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c + $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c +testsoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c + +testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) + +timesoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c + +timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) + +genLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/genLoops.c + $(COMPILE_C) $(SOURCE_DIR)/genLoops.c +testfloat_gen$(OBJ): \ + $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/testfloat_gen.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c + +testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) + +verLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c + $(COMPILE_C) $(SOURCE_DIR)/verLoops.c +testfloat_ver$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ + $(SOURCE_DIR)/testfloat_ver.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c + +testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) + +subjfloat$(OBJ): \ + platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ + $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c + $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c +subjfloat_functions$(OBJ): \ + platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c + $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c +testfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat.c + +testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +.PHONY: clean +clean: + $(DELETE) $(OBJS_LIB) testfloat$(LIB) + $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) + $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) + $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) + diff --git a/src/libs/softfloat-3e/testfloat/build/Linux-ARM-VFPv2-GCC/platform.h b/src/libs/softfloat-3e/testfloat/build/Linux-ARM-VFPv2-GCC/platform.h new file mode 100644 index 00000000..8b0de318 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Linux-ARM-VFPv2-GCC/platform.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, 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. + +=============================================================================*/ + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#define LITTLEENDIAN 1 + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef __GNUC_STDC_INLINE__ +#define INLINE inline +#else +#define INLINE extern inline +#endif + diff --git a/src/libs/softfloat-3e/testfloat/build/Linux-x86_64-GCC/Makefile b/src/libs/softfloat-3e/testfloat/build/Linux-x86_64-GCC/Makefile new file mode 100644 index 00000000..73eca95b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Linux-x86_64-GCC/Makefile @@ -0,0 +1,355 @@ + +#============================================================================= +# +# This Makefile 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. +# +#============================================================================= + +SOURCE_DIR ?= ../../source +SOFTFLOAT_DIR ?= ../../../SoftFloat-3e +PLATFORM ?= Linux-x86_64-GCC + +SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C +SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include + +SOFTFLOAT_H = \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h +SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) + +TESTFLOAT_OPTS ?= \ + -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD \ + -DLONG_DOUBLE_IS_EXTFLOAT80 + +DELETE = rm -f +C_INCLUDES = \ + -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) +COMPILE_C = \ + gcc -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O2 -o $@ +COMPILE_SLOWFLOAT_C = \ + gcc -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O3 -o $@ +MAKELIB = ar crs $@ +LINK = gcc -o $@ +OTHER_LIBS = -lm + +OBJ = .o +LIB = .a +EXE = + +.PHONY: all +all: \ + testsoftfloat$(EXE) \ + timesoftfloat$(EXE) \ + testfloat_gen$(EXE) \ + testfloat_ver$(EXE) \ + testfloat$(EXE) \ + +OBJS_GENCASES = \ + genCases_ui32$(OBJ) \ + genCases_ui64$(OBJ) \ + genCases_i32$(OBJ) \ + genCases_i64$(OBJ) \ + genCases_f16$(OBJ) \ + genCases_f32$(OBJ) \ + genCases_f64$(OBJ) \ + genCases_extF80$(OBJ) \ + genCases_f128$(OBJ) \ + +OBJS_WRITECASE = \ + writeCase_a_ui32$(OBJ) \ + writeCase_a_ui64$(OBJ) \ + writeCase_a_f16$(OBJ) \ + writeCase_ab_f16$(OBJ) \ + writeCase_abc_f16$(OBJ) \ + writeCase_a_f32$(OBJ) \ + writeCase_ab_f32$(OBJ) \ + writeCase_abc_f32$(OBJ) \ + writeCase_a_f64$(OBJ) \ + writeCase_ab_f64$(OBJ) \ + writeCase_abc_f64$(OBJ) \ + writeCase_a_extF80M$(OBJ) \ + writeCase_ab_extF80M$(OBJ) \ + writeCase_a_f128M$(OBJ) \ + writeCase_ab_f128M$(OBJ) \ + writeCase_abc_f128M$(OBJ) \ + writeCase_z_bool$(OBJ) \ + writeCase_z_ui32$(OBJ) \ + writeCase_z_ui64$(OBJ) \ + writeCase_z_f16$(OBJ) \ + writeCase_z_f32$(OBJ) \ + writeCase_z_f64$(OBJ) \ + writeCase_z_extF80M$(OBJ) \ + writeCase_z_f128M$(OBJ) \ + +OBJS_TEST = \ + test_a_ui32_z_f16$(OBJ) \ + test_a_ui32_z_f32$(OBJ) \ + test_a_ui32_z_f64$(OBJ) \ + test_a_ui32_z_extF80$(OBJ) \ + test_a_ui32_z_f128$(OBJ) \ + test_a_ui64_z_f16$(OBJ) \ + test_a_ui64_z_f32$(OBJ) \ + test_a_ui64_z_f64$(OBJ) \ + test_a_ui64_z_extF80$(OBJ) \ + test_a_ui64_z_f128$(OBJ) \ + test_a_i32_z_f16$(OBJ) \ + test_a_i32_z_f32$(OBJ) \ + test_a_i32_z_f64$(OBJ) \ + test_a_i32_z_extF80$(OBJ) \ + test_a_i32_z_f128$(OBJ) \ + test_a_i64_z_f16$(OBJ) \ + test_a_i64_z_f32$(OBJ) \ + test_a_i64_z_f64$(OBJ) \ + test_a_i64_z_extF80$(OBJ) \ + test_a_i64_z_f128$(OBJ) \ + test_a_f16_z_ui32_rx$(OBJ) \ + test_a_f16_z_ui64_rx$(OBJ) \ + test_a_f16_z_i32_rx$(OBJ) \ + test_a_f16_z_i64_rx$(OBJ) \ + test_a_f16_z_ui32_x$(OBJ) \ + test_a_f16_z_ui64_x$(OBJ) \ + test_a_f16_z_i32_x$(OBJ) \ + test_a_f16_z_i64_x$(OBJ) \ + test_a_f16_z_f32$(OBJ) \ + test_a_f16_z_f64$(OBJ) \ + test_a_f16_z_extF80$(OBJ) \ + test_a_f16_z_f128$(OBJ) \ + test_az_f16$(OBJ) \ + test_az_f16_rx$(OBJ) \ + test_abz_f16$(OBJ) \ + test_abcz_f16$(OBJ) \ + test_ab_f16_z_bool$(OBJ) \ + test_a_f32_z_ui32_rx$(OBJ) \ + test_a_f32_z_ui64_rx$(OBJ) \ + test_a_f32_z_i32_rx$(OBJ) \ + test_a_f32_z_i64_rx$(OBJ) \ + test_a_f32_z_ui32_x$(OBJ) \ + test_a_f32_z_ui64_x$(OBJ) \ + test_a_f32_z_i32_x$(OBJ) \ + test_a_f32_z_i64_x$(OBJ) \ + test_a_f32_z_f16$(OBJ) \ + test_a_f32_z_f64$(OBJ) \ + test_a_f32_z_extF80$(OBJ) \ + test_a_f32_z_f128$(OBJ) \ + test_az_f32$(OBJ) \ + test_az_f32_rx$(OBJ) \ + test_abz_f32$(OBJ) \ + test_abcz_f32$(OBJ) \ + test_ab_f32_z_bool$(OBJ) \ + test_a_f64_z_ui32_rx$(OBJ) \ + test_a_f64_z_ui64_rx$(OBJ) \ + test_a_f64_z_i32_rx$(OBJ) \ + test_a_f64_z_i64_rx$(OBJ) \ + test_a_f64_z_ui32_x$(OBJ) \ + test_a_f64_z_ui64_x$(OBJ) \ + test_a_f64_z_i32_x$(OBJ) \ + test_a_f64_z_i64_x$(OBJ) \ + test_a_f64_z_f16$(OBJ) \ + test_a_f64_z_f32$(OBJ) \ + test_a_f64_z_extF80$(OBJ) \ + test_a_f64_z_f128$(OBJ) \ + test_az_f64$(OBJ) \ + test_az_f64_rx$(OBJ) \ + test_abz_f64$(OBJ) \ + test_abcz_f64$(OBJ) \ + test_ab_f64_z_bool$(OBJ) \ + test_a_extF80_z_ui32_rx$(OBJ) \ + test_a_extF80_z_ui64_rx$(OBJ) \ + test_a_extF80_z_i32_rx$(OBJ) \ + test_a_extF80_z_i64_rx$(OBJ) \ + test_a_extF80_z_ui32_x$(OBJ) \ + test_a_extF80_z_ui64_x$(OBJ) \ + test_a_extF80_z_i32_x$(OBJ) \ + test_a_extF80_z_i64_x$(OBJ) \ + test_a_extF80_z_f16$(OBJ) \ + test_a_extF80_z_f32$(OBJ) \ + test_a_extF80_z_f64$(OBJ) \ + test_a_extF80_z_f128$(OBJ) \ + test_az_extF80$(OBJ) \ + test_az_extF80_rx$(OBJ) \ + test_abz_extF80$(OBJ) \ + test_ab_extF80_z_bool$(OBJ) \ + test_a_f128_z_ui32_rx$(OBJ) \ + test_a_f128_z_ui64_rx$(OBJ) \ + test_a_f128_z_i32_rx$(OBJ) \ + test_a_f128_z_i64_rx$(OBJ) \ + test_a_f128_z_ui32_x$(OBJ) \ + test_a_f128_z_ui64_x$(OBJ) \ + test_a_f128_z_i32_x$(OBJ) \ + test_a_f128_z_i64_x$(OBJ) \ + test_a_f128_z_f16$(OBJ) \ + test_a_f128_z_f32$(OBJ) \ + test_a_f128_z_f64$(OBJ) \ + test_a_f128_z_extF80$(OBJ) \ + test_az_f128$(OBJ) \ + test_az_f128_rx$(OBJ) \ + test_abz_f128$(OBJ) \ + test_abcz_f128$(OBJ) \ + test_ab_f128_z_bool$(OBJ) \ + +OBJS_LIB = \ + uint128_inline$(OBJ) \ + uint128$(OBJ) \ + fail$(OBJ) \ + functions_common$(OBJ) \ + functionInfos$(OBJ) \ + standardFunctionInfos$(OBJ) \ + random$(OBJ) \ + genCases_common$(OBJ) \ + $(OBJS_GENCASES) \ + genCases_writeTestsTotal$(OBJ) \ + verCases_inline$(OBJ) \ + verCases_common$(OBJ) \ + verCases_writeFunctionName$(OBJ) \ + readHex$(OBJ) \ + writeHex$(OBJ) \ + $(OBJS_WRITECASE) \ + testLoops_common$(OBJ) \ + $(OBJS_TEST) \ + +uint128$(OBJ): $(SOURCE_DIR)/uint128.h +fail$(OBJ): $(SOURCE_DIR)/fail.h +functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h +functionInfos$(OBJ): $(SOURCE_DIR)/functions.h +standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h +random$(OBJ): $(SOURCE_DIR)/random.h +genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h +$(OBJS_GENCASES): \ + $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h +genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h +genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h +verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h +verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h +readHex$(OBJ): $(SOURCE_DIR)/readHex.h +writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h +$(OBJS_WRITECASE): \ + $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h +testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h +$(OBJS_TEST): \ + $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ + $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h +$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c + $(COMPILE_C) $(SOURCE_DIR)/$*.c +testfloat$(LIB): $(OBJS_LIB) + $(MAKELIB) $^ + +OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) + +slowfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c + $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c +testsoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c + +testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) + +timesoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c + +timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) + +genLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/genLoops.c + $(COMPILE_C) $(SOURCE_DIR)/genLoops.c +testfloat_gen$(OBJ): \ + $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/testfloat_gen.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c + +testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) + +verLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c + $(COMPILE_C) $(SOURCE_DIR)/verLoops.c +testfloat_ver$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ + $(SOURCE_DIR)/testfloat_ver.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c + +testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) + +subjfloat$(OBJ): \ + platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ + $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c + $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c +subjfloat_functions$(OBJ): \ + platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c + $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c +testfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat.c + +testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +.PHONY: clean +clean: + $(DELETE) $(OBJS_LIB) testfloat$(LIB) + $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) + $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) + $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) + diff --git a/src/libs/softfloat-3e/testfloat/build/Linux-x86_64-GCC/platform.h b/src/libs/softfloat-3e/testfloat/build/Linux-x86_64-GCC/platform.h new file mode 100644 index 00000000..8b0de318 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Linux-x86_64-GCC/platform.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, 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. + +=============================================================================*/ + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#define LITTLEENDIAN 1 + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef __GNUC_STDC_INLINE__ +#define INLINE inline +#else +#define INLINE extern inline +#endif + diff --git a/src/libs/softfloat-3e/testfloat/build/Win32-MinGW/Makefile b/src/libs/softfloat-3e/testfloat/build/Win32-MinGW/Makefile new file mode 100644 index 00000000..ca6e9625 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Win32-MinGW/Makefile @@ -0,0 +1,355 @@ + +#============================================================================= +# +# This Makefile 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. +# +#============================================================================= + +SOURCE_DIR ?= ../../source +SOFTFLOAT_DIR ?= ../../../SoftFloat-3e +PLATFORM ?= Win32-MinGW + +SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C +SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include + +SOFTFLOAT_H = \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h +SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) + +TESTFLOAT_OPTS ?= \ + -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD \ + -DLONG_DOUBLE_IS_EXTFLOAT80 + +DELETE = rm -f +C_INCLUDES = \ + -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) +COMPILE_C = \ + gcc -std=c99 -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O2 -o $@ +COMPILE_SLOWFLOAT_C = \ + gcc -std=c99 -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O3 -o $@ +MAKELIB = ar crs $@ +LINK = gcc -o $@ +OTHER_LIBS = -lm + +OBJ = .o +LIB = .a +EXE = .exe + +.PHONY: all +all: \ + testsoftfloat$(EXE) \ + timesoftfloat$(EXE) \ + testfloat_gen$(EXE) \ + testfloat_ver$(EXE) \ + testfloat$(EXE) \ + +OBJS_GENCASES = \ + genCases_ui32$(OBJ) \ + genCases_ui64$(OBJ) \ + genCases_i32$(OBJ) \ + genCases_i64$(OBJ) \ + genCases_f16$(OBJ) \ + genCases_f32$(OBJ) \ + genCases_f64$(OBJ) \ + genCases_extF80$(OBJ) \ + genCases_f128$(OBJ) \ + +OBJS_WRITECASE = \ + writeCase_a_ui32$(OBJ) \ + writeCase_a_ui64$(OBJ) \ + writeCase_a_f16$(OBJ) \ + writeCase_ab_f16$(OBJ) \ + writeCase_abc_f16$(OBJ) \ + writeCase_a_f32$(OBJ) \ + writeCase_ab_f32$(OBJ) \ + writeCase_abc_f32$(OBJ) \ + writeCase_a_f64$(OBJ) \ + writeCase_ab_f64$(OBJ) \ + writeCase_abc_f64$(OBJ) \ + writeCase_a_extF80M$(OBJ) \ + writeCase_ab_extF80M$(OBJ) \ + writeCase_a_f128M$(OBJ) \ + writeCase_ab_f128M$(OBJ) \ + writeCase_abc_f128M$(OBJ) \ + writeCase_z_bool$(OBJ) \ + writeCase_z_ui32$(OBJ) \ + writeCase_z_ui64$(OBJ) \ + writeCase_z_f16$(OBJ) \ + writeCase_z_f32$(OBJ) \ + writeCase_z_f64$(OBJ) \ + writeCase_z_extF80M$(OBJ) \ + writeCase_z_f128M$(OBJ) \ + +OBJS_TEST = \ + test_a_ui32_z_f16$(OBJ) \ + test_a_ui32_z_f32$(OBJ) \ + test_a_ui32_z_f64$(OBJ) \ + test_a_ui32_z_extF80$(OBJ) \ + test_a_ui32_z_f128$(OBJ) \ + test_a_ui64_z_f16$(OBJ) \ + test_a_ui64_z_f32$(OBJ) \ + test_a_ui64_z_f64$(OBJ) \ + test_a_ui64_z_extF80$(OBJ) \ + test_a_ui64_z_f128$(OBJ) \ + test_a_i32_z_f16$(OBJ) \ + test_a_i32_z_f32$(OBJ) \ + test_a_i32_z_f64$(OBJ) \ + test_a_i32_z_extF80$(OBJ) \ + test_a_i32_z_f128$(OBJ) \ + test_a_i64_z_f16$(OBJ) \ + test_a_i64_z_f32$(OBJ) \ + test_a_i64_z_f64$(OBJ) \ + test_a_i64_z_extF80$(OBJ) \ + test_a_i64_z_f128$(OBJ) \ + test_a_f16_z_ui32_rx$(OBJ) \ + test_a_f16_z_ui64_rx$(OBJ) \ + test_a_f16_z_i32_rx$(OBJ) \ + test_a_f16_z_i64_rx$(OBJ) \ + test_a_f16_z_ui32_x$(OBJ) \ + test_a_f16_z_ui64_x$(OBJ) \ + test_a_f16_z_i32_x$(OBJ) \ + test_a_f16_z_i64_x$(OBJ) \ + test_a_f16_z_f32$(OBJ) \ + test_a_f16_z_f64$(OBJ) \ + test_a_f16_z_extF80$(OBJ) \ + test_a_f16_z_f128$(OBJ) \ + test_az_f16$(OBJ) \ + test_az_f16_rx$(OBJ) \ + test_abz_f16$(OBJ) \ + test_abcz_f16$(OBJ) \ + test_ab_f16_z_bool$(OBJ) \ + test_a_f32_z_ui32_rx$(OBJ) \ + test_a_f32_z_ui64_rx$(OBJ) \ + test_a_f32_z_i32_rx$(OBJ) \ + test_a_f32_z_i64_rx$(OBJ) \ + test_a_f32_z_ui32_x$(OBJ) \ + test_a_f32_z_ui64_x$(OBJ) \ + test_a_f32_z_i32_x$(OBJ) \ + test_a_f32_z_i64_x$(OBJ) \ + test_a_f32_z_f16$(OBJ) \ + test_a_f32_z_f64$(OBJ) \ + test_a_f32_z_extF80$(OBJ) \ + test_a_f32_z_f128$(OBJ) \ + test_az_f32$(OBJ) \ + test_az_f32_rx$(OBJ) \ + test_abz_f32$(OBJ) \ + test_abcz_f32$(OBJ) \ + test_ab_f32_z_bool$(OBJ) \ + test_a_f64_z_ui32_rx$(OBJ) \ + test_a_f64_z_ui64_rx$(OBJ) \ + test_a_f64_z_i32_rx$(OBJ) \ + test_a_f64_z_i64_rx$(OBJ) \ + test_a_f64_z_ui32_x$(OBJ) \ + test_a_f64_z_ui64_x$(OBJ) \ + test_a_f64_z_i32_x$(OBJ) \ + test_a_f64_z_i64_x$(OBJ) \ + test_a_f64_z_f16$(OBJ) \ + test_a_f64_z_f32$(OBJ) \ + test_a_f64_z_extF80$(OBJ) \ + test_a_f64_z_f128$(OBJ) \ + test_az_f64$(OBJ) \ + test_az_f64_rx$(OBJ) \ + test_abz_f64$(OBJ) \ + test_abcz_f64$(OBJ) \ + test_ab_f64_z_bool$(OBJ) \ + test_a_extF80_z_ui32_rx$(OBJ) \ + test_a_extF80_z_ui64_rx$(OBJ) \ + test_a_extF80_z_i32_rx$(OBJ) \ + test_a_extF80_z_i64_rx$(OBJ) \ + test_a_extF80_z_ui32_x$(OBJ) \ + test_a_extF80_z_ui64_x$(OBJ) \ + test_a_extF80_z_i32_x$(OBJ) \ + test_a_extF80_z_i64_x$(OBJ) \ + test_a_extF80_z_f16$(OBJ) \ + test_a_extF80_z_f32$(OBJ) \ + test_a_extF80_z_f64$(OBJ) \ + test_a_extF80_z_f128$(OBJ) \ + test_az_extF80$(OBJ) \ + test_az_extF80_rx$(OBJ) \ + test_abz_extF80$(OBJ) \ + test_ab_extF80_z_bool$(OBJ) \ + test_a_f128_z_ui32_rx$(OBJ) \ + test_a_f128_z_ui64_rx$(OBJ) \ + test_a_f128_z_i32_rx$(OBJ) \ + test_a_f128_z_i64_rx$(OBJ) \ + test_a_f128_z_ui32_x$(OBJ) \ + test_a_f128_z_ui64_x$(OBJ) \ + test_a_f128_z_i32_x$(OBJ) \ + test_a_f128_z_i64_x$(OBJ) \ + test_a_f128_z_f16$(OBJ) \ + test_a_f128_z_f32$(OBJ) \ + test_a_f128_z_f64$(OBJ) \ + test_a_f128_z_extF80$(OBJ) \ + test_az_f128$(OBJ) \ + test_az_f128_rx$(OBJ) \ + test_abz_f128$(OBJ) \ + test_abcz_f128$(OBJ) \ + test_ab_f128_z_bool$(OBJ) \ + +OBJS_LIB = \ + uint128_inline$(OBJ) \ + uint128$(OBJ) \ + fail$(OBJ) \ + functions_common$(OBJ) \ + functionInfos$(OBJ) \ + standardFunctionInfos$(OBJ) \ + random$(OBJ) \ + genCases_common$(OBJ) \ + $(OBJS_GENCASES) \ + genCases_writeTestsTotal$(OBJ) \ + verCases_inline$(OBJ) \ + verCases_common$(OBJ) \ + verCases_writeFunctionName$(OBJ) \ + readHex$(OBJ) \ + writeHex$(OBJ) \ + $(OBJS_WRITECASE) \ + testLoops_common$(OBJ) \ + $(OBJS_TEST) \ + +uint128$(OBJ): $(SOURCE_DIR)/uint128.h +fail$(OBJ): $(SOURCE_DIR)/fail.h +functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h +functionInfos$(OBJ): $(SOURCE_DIR)/functions.h +standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h +random$(OBJ): $(SOURCE_DIR)/random.h +genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h +$(OBJS_GENCASES): \ + $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h +genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h +genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h +verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h +verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h +readHex$(OBJ): $(SOURCE_DIR)/readHex.h +writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h +$(OBJS_WRITECASE): \ + $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h +testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h +$(OBJS_TEST): \ + $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ + $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h +$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c + $(COMPILE_C) $(SOURCE_DIR)/$*.c +testfloat$(LIB): $(OBJS_LIB) + $(MAKELIB) $^ + +OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) + +slowfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c + $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c +testsoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c + +testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) + +timesoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c + +timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) + +genLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/genLoops.c + $(COMPILE_C) $(SOURCE_DIR)/genLoops.c +testfloat_gen$(OBJ): \ + $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/testfloat_gen.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c + +testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) + +verLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c + $(COMPILE_C) $(SOURCE_DIR)/verLoops.c +testfloat_ver$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ + $(SOURCE_DIR)/testfloat_ver.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c + +testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) + +subjfloat$(OBJ): \ + platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ + $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c + $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c +subjfloat_functions$(OBJ): \ + platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c + $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c +testfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat.c + +testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +.PHONY: clean +clean: + $(DELETE) $(OBJS_LIB) testfloat$(LIB) + $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) + $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) + $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) + diff --git a/src/libs/softfloat-3e/testfloat/build/Win32-MinGW/platform.h b/src/libs/softfloat-3e/testfloat/build/Win32-MinGW/platform.h new file mode 100644 index 00000000..8b0de318 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Win32-MinGW/platform.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, 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. + +=============================================================================*/ + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#define LITTLEENDIAN 1 + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef __GNUC_STDC_INLINE__ +#define INLINE inline +#else +#define INLINE extern inline +#endif + diff --git a/src/libs/softfloat-3e/testfloat/build/Win32-SSE2-MinGW/Makefile b/src/libs/softfloat-3e/testfloat/build/Win32-SSE2-MinGW/Makefile new file mode 100644 index 00000000..a8a2894b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Win32-SSE2-MinGW/Makefile @@ -0,0 +1,355 @@ + +#============================================================================= +# +# This Makefile 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. +# +#============================================================================= + +SOURCE_DIR ?= ../../source +SOFTFLOAT_DIR ?= ../../../SoftFloat-3e +PLATFORM ?= Win32-SSE2-MinGW + +SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C +SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include + +SOFTFLOAT_H = \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h +SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) + +TESTFLOAT_OPTS ?= \ + -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD \ + -DLONG_DOUBLE_IS_EXTFLOAT80 + +DELETE = rm -f +C_INCLUDES = \ + -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) +COMPILE_C = \ + gcc -std=c99 -c -Werror-implicit-function-declaration -msse2 -mfpmath=sse \ + $(TESTFLOAT_OPTS) $(C_INCLUDES) -O2 -o $@ +COMPILE_SLOWFLOAT_C = \ + gcc -std=c99 -c -Werror-implicit-function-declaration $(TESTFLOAT_OPTS) \ + $(C_INCLUDES) -O3 -o $@ +MAKELIB = ar crs $@ +LINK = gcc -o $@ +OTHER_LIBS = -lm + +OBJ = .o +LIB = .a +EXE = .exe + +.PHONY: all +all: \ + testsoftfloat$(EXE) \ + timesoftfloat$(EXE) \ + testfloat_gen$(EXE) \ + testfloat_ver$(EXE) \ + testfloat$(EXE) \ + +OBJS_GENCASES = \ + genCases_ui32$(OBJ) \ + genCases_ui64$(OBJ) \ + genCases_i32$(OBJ) \ + genCases_i64$(OBJ) \ + genCases_f16$(OBJ) \ + genCases_f32$(OBJ) \ + genCases_f64$(OBJ) \ + genCases_extF80$(OBJ) \ + genCases_f128$(OBJ) \ + +OBJS_WRITECASE = \ + writeCase_a_ui32$(OBJ) \ + writeCase_a_ui64$(OBJ) \ + writeCase_a_f16$(OBJ) \ + writeCase_ab_f16$(OBJ) \ + writeCase_abc_f16$(OBJ) \ + writeCase_a_f32$(OBJ) \ + writeCase_ab_f32$(OBJ) \ + writeCase_abc_f32$(OBJ) \ + writeCase_a_f64$(OBJ) \ + writeCase_ab_f64$(OBJ) \ + writeCase_abc_f64$(OBJ) \ + writeCase_a_extF80M$(OBJ) \ + writeCase_ab_extF80M$(OBJ) \ + writeCase_a_f128M$(OBJ) \ + writeCase_ab_f128M$(OBJ) \ + writeCase_abc_f128M$(OBJ) \ + writeCase_z_bool$(OBJ) \ + writeCase_z_ui32$(OBJ) \ + writeCase_z_ui64$(OBJ) \ + writeCase_z_f16$(OBJ) \ + writeCase_z_f32$(OBJ) \ + writeCase_z_f64$(OBJ) \ + writeCase_z_extF80M$(OBJ) \ + writeCase_z_f128M$(OBJ) \ + +OBJS_TEST = \ + test_a_ui32_z_f16$(OBJ) \ + test_a_ui32_z_f32$(OBJ) \ + test_a_ui32_z_f64$(OBJ) \ + test_a_ui32_z_extF80$(OBJ) \ + test_a_ui32_z_f128$(OBJ) \ + test_a_ui64_z_f16$(OBJ) \ + test_a_ui64_z_f32$(OBJ) \ + test_a_ui64_z_f64$(OBJ) \ + test_a_ui64_z_extF80$(OBJ) \ + test_a_ui64_z_f128$(OBJ) \ + test_a_i32_z_f16$(OBJ) \ + test_a_i32_z_f32$(OBJ) \ + test_a_i32_z_f64$(OBJ) \ + test_a_i32_z_extF80$(OBJ) \ + test_a_i32_z_f128$(OBJ) \ + test_a_i64_z_f16$(OBJ) \ + test_a_i64_z_f32$(OBJ) \ + test_a_i64_z_f64$(OBJ) \ + test_a_i64_z_extF80$(OBJ) \ + test_a_i64_z_f128$(OBJ) \ + test_a_f16_z_ui32_rx$(OBJ) \ + test_a_f16_z_ui64_rx$(OBJ) \ + test_a_f16_z_i32_rx$(OBJ) \ + test_a_f16_z_i64_rx$(OBJ) \ + test_a_f16_z_ui32_x$(OBJ) \ + test_a_f16_z_ui64_x$(OBJ) \ + test_a_f16_z_i32_x$(OBJ) \ + test_a_f16_z_i64_x$(OBJ) \ + test_a_f16_z_f32$(OBJ) \ + test_a_f16_z_f64$(OBJ) \ + test_a_f16_z_extF80$(OBJ) \ + test_a_f16_z_f128$(OBJ) \ + test_az_f16$(OBJ) \ + test_az_f16_rx$(OBJ) \ + test_abz_f16$(OBJ) \ + test_abcz_f16$(OBJ) \ + test_ab_f16_z_bool$(OBJ) \ + test_a_f32_z_ui32_rx$(OBJ) \ + test_a_f32_z_ui64_rx$(OBJ) \ + test_a_f32_z_i32_rx$(OBJ) \ + test_a_f32_z_i64_rx$(OBJ) \ + test_a_f32_z_ui32_x$(OBJ) \ + test_a_f32_z_ui64_x$(OBJ) \ + test_a_f32_z_i32_x$(OBJ) \ + test_a_f32_z_i64_x$(OBJ) \ + test_a_f32_z_f16$(OBJ) \ + test_a_f32_z_f64$(OBJ) \ + test_a_f32_z_extF80$(OBJ) \ + test_a_f32_z_f128$(OBJ) \ + test_az_f32$(OBJ) \ + test_az_f32_rx$(OBJ) \ + test_abz_f32$(OBJ) \ + test_abcz_f32$(OBJ) \ + test_ab_f32_z_bool$(OBJ) \ + test_a_f64_z_ui32_rx$(OBJ) \ + test_a_f64_z_ui64_rx$(OBJ) \ + test_a_f64_z_i32_rx$(OBJ) \ + test_a_f64_z_i64_rx$(OBJ) \ + test_a_f64_z_ui32_x$(OBJ) \ + test_a_f64_z_ui64_x$(OBJ) \ + test_a_f64_z_i32_x$(OBJ) \ + test_a_f64_z_i64_x$(OBJ) \ + test_a_f64_z_f16$(OBJ) \ + test_a_f64_z_f32$(OBJ) \ + test_a_f64_z_extF80$(OBJ) \ + test_a_f64_z_f128$(OBJ) \ + test_az_f64$(OBJ) \ + test_az_f64_rx$(OBJ) \ + test_abz_f64$(OBJ) \ + test_abcz_f64$(OBJ) \ + test_ab_f64_z_bool$(OBJ) \ + test_a_extF80_z_ui32_rx$(OBJ) \ + test_a_extF80_z_ui64_rx$(OBJ) \ + test_a_extF80_z_i32_rx$(OBJ) \ + test_a_extF80_z_i64_rx$(OBJ) \ + test_a_extF80_z_ui32_x$(OBJ) \ + test_a_extF80_z_ui64_x$(OBJ) \ + test_a_extF80_z_i32_x$(OBJ) \ + test_a_extF80_z_i64_x$(OBJ) \ + test_a_extF80_z_f16$(OBJ) \ + test_a_extF80_z_f32$(OBJ) \ + test_a_extF80_z_f64$(OBJ) \ + test_a_extF80_z_f128$(OBJ) \ + test_az_extF80$(OBJ) \ + test_az_extF80_rx$(OBJ) \ + test_abz_extF80$(OBJ) \ + test_ab_extF80_z_bool$(OBJ) \ + test_a_f128_z_ui32_rx$(OBJ) \ + test_a_f128_z_ui64_rx$(OBJ) \ + test_a_f128_z_i32_rx$(OBJ) \ + test_a_f128_z_i64_rx$(OBJ) \ + test_a_f128_z_ui32_x$(OBJ) \ + test_a_f128_z_ui64_x$(OBJ) \ + test_a_f128_z_i32_x$(OBJ) \ + test_a_f128_z_i64_x$(OBJ) \ + test_a_f128_z_f16$(OBJ) \ + test_a_f128_z_f32$(OBJ) \ + test_a_f128_z_f64$(OBJ) \ + test_a_f128_z_extF80$(OBJ) \ + test_az_f128$(OBJ) \ + test_az_f128_rx$(OBJ) \ + test_abz_f128$(OBJ) \ + test_abcz_f128$(OBJ) \ + test_ab_f128_z_bool$(OBJ) \ + +OBJS_LIB = \ + uint128_inline$(OBJ) \ + uint128$(OBJ) \ + fail$(OBJ) \ + functions_common$(OBJ) \ + functionInfos$(OBJ) \ + standardFunctionInfos$(OBJ) \ + random$(OBJ) \ + genCases_common$(OBJ) \ + $(OBJS_GENCASES) \ + genCases_writeTestsTotal$(OBJ) \ + verCases_inline$(OBJ) \ + verCases_common$(OBJ) \ + verCases_writeFunctionName$(OBJ) \ + readHex$(OBJ) \ + writeHex$(OBJ) \ + $(OBJS_WRITECASE) \ + testLoops_common$(OBJ) \ + $(OBJS_TEST) \ + +uint128$(OBJ): $(SOURCE_DIR)/uint128.h +fail$(OBJ): $(SOURCE_DIR)/fail.h +functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h +functionInfos$(OBJ): $(SOURCE_DIR)/functions.h +standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h +random$(OBJ): $(SOURCE_DIR)/random.h +genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h +$(OBJS_GENCASES): \ + $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h +genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h +genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h +verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h +verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h +readHex$(OBJ): $(SOURCE_DIR)/readHex.h +writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h +$(OBJS_WRITECASE): \ + $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h +testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h +$(OBJS_TEST): \ + $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ + $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h +$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c + $(COMPILE_C) $(SOURCE_DIR)/$*.c +testfloat$(LIB): $(OBJS_LIB) + $(MAKELIB) $^ + +OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) + +slowfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c + $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c +testsoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c + +testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) + +timesoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c + +timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) + +genLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/genLoops.c + $(COMPILE_C) $(SOURCE_DIR)/genLoops.c +testfloat_gen$(OBJ): \ + $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/testfloat_gen.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c + +testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) + +verLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c + $(COMPILE_C) $(SOURCE_DIR)/verLoops.c +testfloat_ver$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ + $(SOURCE_DIR)/testfloat_ver.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c + +testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) + +subjfloat$(OBJ): \ + platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ + $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c + $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c +subjfloat_functions$(OBJ): \ + platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c + $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c +testfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat.c + +testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +.PHONY: clean +clean: + $(DELETE) $(OBJS_LIB) testfloat$(LIB) + $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) + $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) + $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) + diff --git a/src/libs/softfloat-3e/testfloat/build/Win32-SSE2-MinGW/platform.h b/src/libs/softfloat-3e/testfloat/build/Win32-SSE2-MinGW/platform.h new file mode 100644 index 00000000..8b0de318 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Win32-SSE2-MinGW/platform.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, 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. + +=============================================================================*/ + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#define LITTLEENDIAN 1 + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef __GNUC_STDC_INLINE__ +#define INLINE inline +#else +#define INLINE extern inline +#endif + diff --git a/src/libs/softfloat-3e/testfloat/build/Win64-MinGW-w64/Makefile b/src/libs/softfloat-3e/testfloat/build/Win64-MinGW-w64/Makefile new file mode 100644 index 00000000..5c46a71e --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Win64-MinGW-w64/Makefile @@ -0,0 +1,355 @@ + +#============================================================================= +# +# This Makefile 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. +# +#============================================================================= + +SOURCE_DIR ?= ../../source +SOFTFLOAT_DIR ?= ../../../SoftFloat-3e +PLATFORM ?= Win64-MinGW-w64 + +SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C +SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include + +SOFTFLOAT_H = \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ + $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h +SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) + +TESTFLOAT_OPTS ?= \ + -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD \ + -DLONG_DOUBLE_IS_EXTFLOAT80 + +DELETE = rm -f +C_INCLUDES = \ + -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) +COMPILE_C = \ + x86_64-w64-mingw32-gcc -std=c99 -c -Werror-implicit-function-declaration \ + $(TESTFLOAT_OPTS) $(C_INCLUDES) -O2 -o $@ +COMPILE_SLOWFLOAT_C = \ + x86_64-w64-mingw32-gcc -std=c99 -c -Werror-implicit-function-declaration \ + $(TESTFLOAT_OPTS) $(C_INCLUDES) -O3 -o $@ +MAKELIB = x86_64-w64-mingw32-ar crs $@ +LINK = x86_64-w64-mingw32-gcc -o $@ +OTHER_LIBS = -lm + +OBJ = .o +LIB = .a +EXE = .exe + +.PHONY: all +all: \ + testsoftfloat$(EXE) \ + timesoftfloat$(EXE) \ + testfloat_gen$(EXE) \ + testfloat_ver$(EXE) \ + testfloat$(EXE) \ + +OBJS_GENCASES = \ + genCases_ui32$(OBJ) \ + genCases_ui64$(OBJ) \ + genCases_i32$(OBJ) \ + genCases_i64$(OBJ) \ + genCases_f16$(OBJ) \ + genCases_f32$(OBJ) \ + genCases_f64$(OBJ) \ + genCases_extF80$(OBJ) \ + genCases_f128$(OBJ) \ + +OBJS_WRITECASE = \ + writeCase_a_ui32$(OBJ) \ + writeCase_a_ui64$(OBJ) \ + writeCase_a_f16$(OBJ) \ + writeCase_ab_f16$(OBJ) \ + writeCase_abc_f16$(OBJ) \ + writeCase_a_f32$(OBJ) \ + writeCase_ab_f32$(OBJ) \ + writeCase_abc_f32$(OBJ) \ + writeCase_a_f64$(OBJ) \ + writeCase_ab_f64$(OBJ) \ + writeCase_abc_f64$(OBJ) \ + writeCase_a_extF80M$(OBJ) \ + writeCase_ab_extF80M$(OBJ) \ + writeCase_a_f128M$(OBJ) \ + writeCase_ab_f128M$(OBJ) \ + writeCase_abc_f128M$(OBJ) \ + writeCase_z_bool$(OBJ) \ + writeCase_z_ui32$(OBJ) \ + writeCase_z_ui64$(OBJ) \ + writeCase_z_f16$(OBJ) \ + writeCase_z_f32$(OBJ) \ + writeCase_z_f64$(OBJ) \ + writeCase_z_extF80M$(OBJ) \ + writeCase_z_f128M$(OBJ) \ + +OBJS_TEST = \ + test_a_ui32_z_f16$(OBJ) \ + test_a_ui32_z_f32$(OBJ) \ + test_a_ui32_z_f64$(OBJ) \ + test_a_ui32_z_extF80$(OBJ) \ + test_a_ui32_z_f128$(OBJ) \ + test_a_ui64_z_f16$(OBJ) \ + test_a_ui64_z_f32$(OBJ) \ + test_a_ui64_z_f64$(OBJ) \ + test_a_ui64_z_extF80$(OBJ) \ + test_a_ui64_z_f128$(OBJ) \ + test_a_i32_z_f16$(OBJ) \ + test_a_i32_z_f32$(OBJ) \ + test_a_i32_z_f64$(OBJ) \ + test_a_i32_z_extF80$(OBJ) \ + test_a_i32_z_f128$(OBJ) \ + test_a_i64_z_f16$(OBJ) \ + test_a_i64_z_f32$(OBJ) \ + test_a_i64_z_f64$(OBJ) \ + test_a_i64_z_extF80$(OBJ) \ + test_a_i64_z_f128$(OBJ) \ + test_a_f16_z_ui32_rx$(OBJ) \ + test_a_f16_z_ui64_rx$(OBJ) \ + test_a_f16_z_i32_rx$(OBJ) \ + test_a_f16_z_i64_rx$(OBJ) \ + test_a_f16_z_ui32_x$(OBJ) \ + test_a_f16_z_ui64_x$(OBJ) \ + test_a_f16_z_i32_x$(OBJ) \ + test_a_f16_z_i64_x$(OBJ) \ + test_a_f16_z_f32$(OBJ) \ + test_a_f16_z_f64$(OBJ) \ + test_a_f16_z_extF80$(OBJ) \ + test_a_f16_z_f128$(OBJ) \ + test_az_f16$(OBJ) \ + test_az_f16_rx$(OBJ) \ + test_abz_f16$(OBJ) \ + test_abcz_f16$(OBJ) \ + test_ab_f16_z_bool$(OBJ) \ + test_a_f32_z_ui32_rx$(OBJ) \ + test_a_f32_z_ui64_rx$(OBJ) \ + test_a_f32_z_i32_rx$(OBJ) \ + test_a_f32_z_i64_rx$(OBJ) \ + test_a_f32_z_ui32_x$(OBJ) \ + test_a_f32_z_ui64_x$(OBJ) \ + test_a_f32_z_i32_x$(OBJ) \ + test_a_f32_z_i64_x$(OBJ) \ + test_a_f32_z_f16$(OBJ) \ + test_a_f32_z_f64$(OBJ) \ + test_a_f32_z_extF80$(OBJ) \ + test_a_f32_z_f128$(OBJ) \ + test_az_f32$(OBJ) \ + test_az_f32_rx$(OBJ) \ + test_abz_f32$(OBJ) \ + test_abcz_f32$(OBJ) \ + test_ab_f32_z_bool$(OBJ) \ + test_a_f64_z_ui32_rx$(OBJ) \ + test_a_f64_z_ui64_rx$(OBJ) \ + test_a_f64_z_i32_rx$(OBJ) \ + test_a_f64_z_i64_rx$(OBJ) \ + test_a_f64_z_ui32_x$(OBJ) \ + test_a_f64_z_ui64_x$(OBJ) \ + test_a_f64_z_i32_x$(OBJ) \ + test_a_f64_z_i64_x$(OBJ) \ + test_a_f64_z_f16$(OBJ) \ + test_a_f64_z_f32$(OBJ) \ + test_a_f64_z_extF80$(OBJ) \ + test_a_f64_z_f128$(OBJ) \ + test_az_f64$(OBJ) \ + test_az_f64_rx$(OBJ) \ + test_abz_f64$(OBJ) \ + test_abcz_f64$(OBJ) \ + test_ab_f64_z_bool$(OBJ) \ + test_a_extF80_z_ui32_rx$(OBJ) \ + test_a_extF80_z_ui64_rx$(OBJ) \ + test_a_extF80_z_i32_rx$(OBJ) \ + test_a_extF80_z_i64_rx$(OBJ) \ + test_a_extF80_z_ui32_x$(OBJ) \ + test_a_extF80_z_ui64_x$(OBJ) \ + test_a_extF80_z_i32_x$(OBJ) \ + test_a_extF80_z_i64_x$(OBJ) \ + test_a_extF80_z_f16$(OBJ) \ + test_a_extF80_z_f32$(OBJ) \ + test_a_extF80_z_f64$(OBJ) \ + test_a_extF80_z_f128$(OBJ) \ + test_az_extF80$(OBJ) \ + test_az_extF80_rx$(OBJ) \ + test_abz_extF80$(OBJ) \ + test_ab_extF80_z_bool$(OBJ) \ + test_a_f128_z_ui32_rx$(OBJ) \ + test_a_f128_z_ui64_rx$(OBJ) \ + test_a_f128_z_i32_rx$(OBJ) \ + test_a_f128_z_i64_rx$(OBJ) \ + test_a_f128_z_ui32_x$(OBJ) \ + test_a_f128_z_ui64_x$(OBJ) \ + test_a_f128_z_i32_x$(OBJ) \ + test_a_f128_z_i64_x$(OBJ) \ + test_a_f128_z_f16$(OBJ) \ + test_a_f128_z_f32$(OBJ) \ + test_a_f128_z_f64$(OBJ) \ + test_a_f128_z_extF80$(OBJ) \ + test_az_f128$(OBJ) \ + test_az_f128_rx$(OBJ) \ + test_abz_f128$(OBJ) \ + test_abcz_f128$(OBJ) \ + test_ab_f128_z_bool$(OBJ) \ + +OBJS_LIB = \ + uint128_inline$(OBJ) \ + uint128$(OBJ) \ + fail$(OBJ) \ + functions_common$(OBJ) \ + functionInfos$(OBJ) \ + standardFunctionInfos$(OBJ) \ + random$(OBJ) \ + genCases_common$(OBJ) \ + $(OBJS_GENCASES) \ + genCases_writeTestsTotal$(OBJ) \ + verCases_inline$(OBJ) \ + verCases_common$(OBJ) \ + verCases_writeFunctionName$(OBJ) \ + readHex$(OBJ) \ + writeHex$(OBJ) \ + $(OBJS_WRITECASE) \ + testLoops_common$(OBJ) \ + $(OBJS_TEST) \ + +uint128$(OBJ): $(SOURCE_DIR)/uint128.h +fail$(OBJ): $(SOURCE_DIR)/fail.h +functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h +functionInfos$(OBJ): $(SOURCE_DIR)/functions.h +standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h +random$(OBJ): $(SOURCE_DIR)/random.h +genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h +$(OBJS_GENCASES): \ + $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h +genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h +genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h +verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h +verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h +readHex$(OBJ): $(SOURCE_DIR)/readHex.h +writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h +$(OBJS_WRITECASE): \ + $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h +testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h +$(OBJS_TEST): \ + $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ + $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h +$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c + $(COMPILE_C) $(SOURCE_DIR)/$*.c +testfloat$(LIB): $(OBJS_LIB) + $(MAKELIB) $^ + +OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) + +slowfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c + $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c +testsoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c + +testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) + +timesoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c + +timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) + +genLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/genLoops.c + $(COMPILE_C) $(SOURCE_DIR)/genLoops.c +testfloat_gen$(OBJ): \ + $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/testfloat_gen.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c + +testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) + +verLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c + $(COMPILE_C) $(SOURCE_DIR)/verLoops.c +testfloat_ver$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ + $(SOURCE_DIR)/testfloat_ver.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c + +testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) + +subjfloat$(OBJ): \ + platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ + $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c + $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c +subjfloat_functions$(OBJ): \ + platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c + $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c +testfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat.c + +testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +.PHONY: clean +clean: + $(DELETE) $(OBJS_LIB) testfloat$(LIB) + $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) + $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) + $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) + diff --git a/src/libs/softfloat-3e/testfloat/build/Win64-MinGW-w64/platform.h b/src/libs/softfloat-3e/testfloat/build/Win64-MinGW-w64/platform.h new file mode 100644 index 00000000..8b0de318 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/Win64-MinGW-w64/platform.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, 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. + +=============================================================================*/ + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#define LITTLEENDIAN 1 + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +#ifdef __GNUC_STDC_INLINE__ +#define INLINE inline +#else +#define INLINE extern inline +#endif + diff --git a/src/libs/softfloat-3e/testfloat/build/template/Makefile b/src/libs/softfloat-3e/testfloat/build/template/Makefile new file mode 100644 index 00000000..5ec8f849 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/template/Makefile @@ -0,0 +1,353 @@ + +#============================================================================= +# +# This Makefile template 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. +# +#============================================================================= + +# Edit lines marked with `==>'. See "TestFloat-source.html". + +==> SOURCE_DIR ?= ../../source +==> SOFTFLOAT_DIR ?= ../../../SoftFloat-3e +==> PLATFORM ?= Win32-MinGW + +==> SUBJ_SOURCE_DIR = $(SOURCE_DIR)/subj-C +==> SOFTFLOAT_INCLUDE_DIR = $(SOFTFLOAT_DIR)/source/include + +==> SOFTFLOAT_H = \ +==> $(SOFTFLOAT_INCLUDE_DIR)/softfloat_types.h \ +==> $(SOFTFLOAT_INCLUDE_DIR)/softfloat.h +==> SOFTFLOAT_LIB = $(SOFTFLOAT_DIR)/build/$(PLATFORM)/softfloat$(LIB) + +==> TESTFLOAT_OPTS ?= \ +==> -DFLOAT16 -DFLOAT64 -DEXTFLOAT80 -DFLOAT128 -DFLOAT_ROUND_ODD \ +==> -DLONG_DOUBLE_IS_EXTFLOAT80 + +==> DELETE = rm -f +==> C_INCLUDES = \ +==> -I. -I$(SUBJ_SOURCE_DIR) -I$(SOURCE_DIR) -I$(SOFTFLOAT_INCLUDE_DIR) +==> COMPILE_C = cc -c $(TESTFLOAT_OPTS) $(C_INCLUDES) -O2 -o $@ +==> COMPILE_SLOWFLOAT_C = cc -c $(TESTFLOAT_OPTS) $(C_INCLUDES) -O3 -o $@ +==> MAKELIB = ar crs $@ +==> LINK = ld -o $@ +==> OTHER_LIBS = -lm + +==> OBJ = .o +==> LIB = .a +==> EXE = .exe + +.PHONY: all +all: \ + testsoftfloat$(EXE) \ + timesoftfloat$(EXE) \ + testfloat_gen$(EXE) \ + testfloat_ver$(EXE) \ + testfloat$(EXE) \ + +OBJS_GENCASES = \ + genCases_ui32$(OBJ) \ + genCases_ui64$(OBJ) \ + genCases_i32$(OBJ) \ + genCases_i64$(OBJ) \ + genCases_f16$(OBJ) \ + genCases_f32$(OBJ) \ + genCases_f64$(OBJ) \ + genCases_extF80$(OBJ) \ + genCases_f128$(OBJ) \ + +OBJS_WRITECASE = \ + writeCase_a_ui32$(OBJ) \ + writeCase_a_ui64$(OBJ) \ + writeCase_a_f16$(OBJ) \ + writeCase_ab_f16$(OBJ) \ + writeCase_abc_f16$(OBJ) \ + writeCase_a_f32$(OBJ) \ + writeCase_ab_f32$(OBJ) \ + writeCase_abc_f32$(OBJ) \ + writeCase_a_f64$(OBJ) \ + writeCase_ab_f64$(OBJ) \ + writeCase_abc_f64$(OBJ) \ + writeCase_a_extF80M$(OBJ) \ + writeCase_ab_extF80M$(OBJ) \ + writeCase_a_f128M$(OBJ) \ + writeCase_ab_f128M$(OBJ) \ + writeCase_abc_f128M$(OBJ) \ + writeCase_z_bool$(OBJ) \ + writeCase_z_ui32$(OBJ) \ + writeCase_z_ui64$(OBJ) \ + writeCase_z_f16$(OBJ) \ + writeCase_z_f32$(OBJ) \ + writeCase_z_f64$(OBJ) \ + writeCase_z_extF80M$(OBJ) \ + writeCase_z_f128M$(OBJ) \ + +OBJS_TEST = \ + test_a_ui32_z_f16$(OBJ) \ + test_a_ui32_z_f32$(OBJ) \ + test_a_ui32_z_f64$(OBJ) \ + test_a_ui32_z_extF80$(OBJ) \ + test_a_ui32_z_f128$(OBJ) \ + test_a_ui64_z_f16$(OBJ) \ + test_a_ui64_z_f32$(OBJ) \ + test_a_ui64_z_f64$(OBJ) \ + test_a_ui64_z_extF80$(OBJ) \ + test_a_ui64_z_f128$(OBJ) \ + test_a_i32_z_f16$(OBJ) \ + test_a_i32_z_f32$(OBJ) \ + test_a_i32_z_f64$(OBJ) \ + test_a_i32_z_extF80$(OBJ) \ + test_a_i32_z_f128$(OBJ) \ + test_a_i64_z_f16$(OBJ) \ + test_a_i64_z_f32$(OBJ) \ + test_a_i64_z_f64$(OBJ) \ + test_a_i64_z_extF80$(OBJ) \ + test_a_i64_z_f128$(OBJ) \ + test_a_f16_z_ui32_rx$(OBJ) \ + test_a_f16_z_ui64_rx$(OBJ) \ + test_a_f16_z_i32_rx$(OBJ) \ + test_a_f16_z_i64_rx$(OBJ) \ + test_a_f16_z_ui32_x$(OBJ) \ + test_a_f16_z_ui64_x$(OBJ) \ + test_a_f16_z_i32_x$(OBJ) \ + test_a_f16_z_i64_x$(OBJ) \ + test_a_f16_z_f32$(OBJ) \ + test_a_f16_z_f64$(OBJ) \ + test_a_f16_z_extF80$(OBJ) \ + test_a_f16_z_f128$(OBJ) \ + test_az_f16$(OBJ) \ + test_az_f16_rx$(OBJ) \ + test_abz_f16$(OBJ) \ + test_abcz_f16$(OBJ) \ + test_ab_f16_z_bool$(OBJ) \ + test_a_f32_z_ui32_rx$(OBJ) \ + test_a_f32_z_ui64_rx$(OBJ) \ + test_a_f32_z_i32_rx$(OBJ) \ + test_a_f32_z_i64_rx$(OBJ) \ + test_a_f32_z_ui32_x$(OBJ) \ + test_a_f32_z_ui64_x$(OBJ) \ + test_a_f32_z_i32_x$(OBJ) \ + test_a_f32_z_i64_x$(OBJ) \ + test_a_f32_z_f16$(OBJ) \ + test_a_f32_z_f64$(OBJ) \ + test_a_f32_z_extF80$(OBJ) \ + test_a_f32_z_f128$(OBJ) \ + test_az_f32$(OBJ) \ + test_az_f32_rx$(OBJ) \ + test_abz_f32$(OBJ) \ + test_abcz_f32$(OBJ) \ + test_ab_f32_z_bool$(OBJ) \ + test_a_f64_z_ui32_rx$(OBJ) \ + test_a_f64_z_ui64_rx$(OBJ) \ + test_a_f64_z_i32_rx$(OBJ) \ + test_a_f64_z_i64_rx$(OBJ) \ + test_a_f64_z_ui32_x$(OBJ) \ + test_a_f64_z_ui64_x$(OBJ) \ + test_a_f64_z_i32_x$(OBJ) \ + test_a_f64_z_i64_x$(OBJ) \ + test_a_f64_z_f16$(OBJ) \ + test_a_f64_z_f32$(OBJ) \ + test_a_f64_z_extF80$(OBJ) \ + test_a_f64_z_f128$(OBJ) \ + test_az_f64$(OBJ) \ + test_az_f64_rx$(OBJ) \ + test_abz_f64$(OBJ) \ + test_abcz_f64$(OBJ) \ + test_ab_f64_z_bool$(OBJ) \ + test_a_extF80_z_ui32_rx$(OBJ) \ + test_a_extF80_z_ui64_rx$(OBJ) \ + test_a_extF80_z_i32_rx$(OBJ) \ + test_a_extF80_z_i64_rx$(OBJ) \ + test_a_extF80_z_ui32_x$(OBJ) \ + test_a_extF80_z_ui64_x$(OBJ) \ + test_a_extF80_z_i32_x$(OBJ) \ + test_a_extF80_z_i64_x$(OBJ) \ + test_a_extF80_z_f16$(OBJ) \ + test_a_extF80_z_f32$(OBJ) \ + test_a_extF80_z_f64$(OBJ) \ + test_a_extF80_z_f128$(OBJ) \ + test_az_extF80$(OBJ) \ + test_az_extF80_rx$(OBJ) \ + test_abz_extF80$(OBJ) \ + test_ab_extF80_z_bool$(OBJ) \ + test_a_f128_z_ui32_rx$(OBJ) \ + test_a_f128_z_ui64_rx$(OBJ) \ + test_a_f128_z_i32_rx$(OBJ) \ + test_a_f128_z_i64_rx$(OBJ) \ + test_a_f128_z_ui32_x$(OBJ) \ + test_a_f128_z_ui64_x$(OBJ) \ + test_a_f128_z_i32_x$(OBJ) \ + test_a_f128_z_i64_x$(OBJ) \ + test_a_f128_z_f16$(OBJ) \ + test_a_f128_z_f32$(OBJ) \ + test_a_f128_z_f64$(OBJ) \ + test_a_f128_z_extF80$(OBJ) \ + test_az_f128$(OBJ) \ + test_az_f128_rx$(OBJ) \ + test_abz_f128$(OBJ) \ + test_abcz_f128$(OBJ) \ + test_ab_f128_z_bool$(OBJ) \ + +OBJS_LIB = \ + uint128_inline$(OBJ) \ + uint128$(OBJ) \ + fail$(OBJ) \ + functions_common$(OBJ) \ + functionInfos$(OBJ) \ + standardFunctionInfos$(OBJ) \ + random$(OBJ) \ + genCases_common$(OBJ) \ + $(OBJS_GENCASES) \ + genCases_writeTestsTotal$(OBJ) \ + verCases_inline$(OBJ) \ + verCases_common$(OBJ) \ + verCases_writeFunctionName$(OBJ) \ + readHex$(OBJ) \ + writeHex$(OBJ) \ + $(OBJS_WRITECASE) \ + testLoops_common$(OBJ) \ + $(OBJS_TEST) \ + +uint128$(OBJ): $(SOURCE_DIR)/uint128.h +fail$(OBJ): $(SOURCE_DIR)/fail.h +functions_common$(OBJ): $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h +functionInfos$(OBJ): $(SOURCE_DIR)/functions.h +standardFunctionInfos$(OBJ): $(SOURCE_DIR)/functions.h +random$(OBJ): $(SOURCE_DIR)/random.h +genCases_common$(OBJ): $(SOURCE_DIR)/fail.h $(SOURCE_DIR)/genCases.h +$(OBJS_GENCASES): \ + $(SOURCE_DIR)/random.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h +genCases_f128$(OBJ): $(SOURCE_DIR)/uint128.h +genCases_writeTestsTotal$(OBJ): $(SOURCE_DIR)/genCases.h +verCases_common$(OBJ): $(SOURCE_DIR)/verCases.h +verCases_writeFunctionName$(OBJ): $(SOURCE_DIR)/verCases.h +readHex$(OBJ): $(SOURCE_DIR)/readHex.h +writeHex$(OBJ): $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h +$(OBJS_WRITECASE): \ + $(SOFTFLOAT_H) $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/writeCase.h +testLoops_common$(OBJ): $(SOURCE_DIR)/testLoops.h +$(OBJS_TEST): \ + $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) $(SOURCE_DIR)/genCases.h \ + $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/testLoops.h +$(OBJS_LIB): %$(OBJ): platform.h $(SOURCE_DIR)/%.c + $(COMPILE_C) $(SOURCE_DIR)/$*.c +testfloat$(LIB): $(OBJS_LIB) + $(MAKELIB) $^ + +OBJS_TESTSOFTFLOAT = slowfloat$(OBJ) testsoftfloat$(OBJ) + +slowfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/slowfloat.c + $(COMPILE_SLOWFLOAT_C) $(SOURCE_DIR)/slowfloat.c +testsoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/slowfloat.h $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testsoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testsoftfloat.c + +testsoftfloat$(EXE): $(OBJS_TESTSOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TIMESOFTFLOAT = timesoftfloat$(OBJ) + +timesoftfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/timesoftfloat.c + $(COMPILE_C) $(SOURCE_DIR)/timesoftfloat.c + +timesoftfloat$(EXE): $(OBJS_TIMESOFTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_GEN = genLoops$(OBJ) testfloat_gen$(OBJ) + +genLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/writeHex.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/genLoops.c + $(COMPILE_C) $(SOURCE_DIR)/genLoops.c +testfloat_gen$(OBJ): \ + $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) $(SOURCE_DIR)/functions.h \ + $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/genLoops.h \ + $(SOURCE_DIR)/testfloat_gen.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_gen.c + +testfloat_gen$(EXE): $(OBJS_TESTFLOAT_GEN) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT_VER = verLoops$(OBJ) testfloat_ver$(OBJ) + +verLoops$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/readHex.h $(SOURCE_DIR)/verCases.h $(SOURCE_DIR)/writeCase.h \ + $(SOURCE_DIR)/verLoops.h $(SOURCE_DIR)/verLoops.c + $(COMPILE_C) $(SOURCE_DIR)/verLoops.c +testfloat_ver$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/writeCase.h $(SOURCE_DIR)/verLoops.h \ + $(SOURCE_DIR)/testfloat_ver.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat_ver.c + +testfloat_ver$(EXE): $(OBJS_TESTFLOAT_VER) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +OBJS_TESTFLOAT = subjfloat$(OBJ) subjfloat_functions$(OBJ) testfloat$(OBJ) + +subjfloat$(OBJ): \ + platform.h $(SOFTFLOAT_H) $(SUBJ_SOURCE_DIR)/subjfloat_config.h \ + $(SOURCE_DIR)/subjfloat.h $(SUBJ_SOURCE_DIR)/subjfloat.c + $(COMPILE_C) $(SUBJ_SOURCE_DIR)/subjfloat.c +subjfloat_functions$(OBJ): \ + platform.h $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/subjfloat_functions.c + $(COMPILE_C) $(SOURCE_DIR)/subjfloat_functions.c +testfloat$(OBJ): \ + platform.h $(SOURCE_DIR)/uint128.h $(SOURCE_DIR)/fail.h $(SOFTFLOAT_H) \ + $(SUBJ_SOURCE_DIR)/subjfloat_config.h $(SOURCE_DIR)/subjfloat.h \ + $(SOURCE_DIR)/functions.h $(SOURCE_DIR)/genCases.h $(SOURCE_DIR)/verCases.h \ + $(SOURCE_DIR)/testLoops.h $(SOURCE_DIR)/testfloat.c + $(COMPILE_C) $(SOURCE_DIR)/testfloat.c + +testfloat$(EXE): $(OBJS_TESTFLOAT) testfloat$(LIB) $(SOFTFLOAT_LIB) + $(LINK) $^ $(OTHER_LIBS) + +.PHONY: clean +clean: + $(DELETE) $(OBJS_LIB) testfloat$(LIB) + $(DELETE) $(OBJS_TESTSOFTFLOAT) testsoftfloat$(EXE) + $(DELETE) $(OBJS_TIMESOFTFLOAT) timesoftfloat$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_GEN) testfloat_gen$(EXE) + $(DELETE) $(OBJS_TESTFLOAT_VER) testfloat_ver$(EXE) + $(DELETE) $(OBJS_TESTFLOAT) testfloat$(EXE) + diff --git a/src/libs/softfloat-3e/testfloat/build/template/platform.h b/src/libs/softfloat-3e/testfloat/build/template/platform.h new file mode 100644 index 00000000..45042e64 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/build/template/platform.h @@ -0,0 +1,51 @@ + +/*============================================================================ + +This C header template 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. + +=============================================================================*/ + +// Edit lines marked with `==>'. See "TestFloat-source.html". + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +==> #define LITTLEENDIAN 1 + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +==> #define INLINE inline + +/*---------------------------------------------------------------------------- +*----------------------------------------------------------------------------*/ +==> #define THREAD_LOCAL _Thread_local + diff --git a/src/libs/softfloat-3e/testfloat/doc/TestFloat-general.html b/src/libs/softfloat-3e/testfloat/doc/TestFloat-general.html new file mode 100644 index 00000000..55f67d71 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/doc/TestFloat-general.html @@ -0,0 +1,1148 @@ + +<HTML> + +<HEAD> +<TITLE>Berkeley TestFloat General Documentation</TITLE> +</HEAD> + +<BODY> + +<H1>Berkeley TestFloat Release 3e: General Documentation</H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + + +<H2>Contents</H2> + +<BLOCKQUOTE> +<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0> +<COL WIDTH=25> +<COL WIDTH=*> +<TR><TD COLSPAN=2>1. Introduction</TD></TR> +<TR><TD COLSPAN=2>2. Limitations</TD></TR> +<TR><TD COLSPAN=2>3. Acknowledgments and License</TD></TR> +<TR><TD COLSPAN=2>4. What TestFloat Does</TD></TR> +<TR><TD COLSPAN=2>5. Executing TestFloat</TD></TR> +<TR><TD COLSPAN=2>6. Operations Tested by TestFloat</TD></TR> +<TR><TD></TD><TD>6.1. Conversion Operations</TD></TR> +<TR><TD></TD><TD>6.2. Basic Arithmetic Operations</TD></TR> +<TR><TD></TD><TD>6.3. Fused Multiply-Add Operations</TD></TR> +<TR><TD></TD><TD>6.4. Remainder Operations</TD></TR> +<TR><TD></TD><TD>6.5. Round-to-Integer Operations</TD></TR> +<TR><TD></TD><TD>6.6. Comparison Operations</TD></TR> +<TR><TD COLSPAN=2>7. Interpreting TestFloat Output</TD></TR> +<TR> + <TD COLSPAN=2>8. Variations Allowed by the IEEE Floating-Point Standard</TD> +</TR> +<TR><TD></TD><TD>8.1. Underflow</TD></TR> +<TR><TD></TD><TD>8.2. NaNs</TD></TR> +<TR><TD></TD><TD>8.3. Conversions to Integer</TD></TR> +<TR><TD COLSPAN=2>9. Contact Information</TD></TR> +</TABLE> +</BLOCKQUOTE> + + +<H2>1. Introduction</H2> + +<P> +Berkeley TestFloat is a small collection of programs for testing that an +implementation of binary floating-point conforms to the IEEE Standard for +Floating-Point Arithmetic. +All operations required by the original 1985 version of the IEEE Floating-Point +Standard can be tested, except for conversions to and from decimal. +With the current release, the following binary formats can be tested: +<NOBR>16-bit</NOBR> half-precision, <NOBR>32-bit</NOBR> single-precision, +<NOBR>64-bit</NOBR> double-precision, <NOBR>80-bit</NOBR> +double-extended-precision, and/or <NOBR>128-bit</NOBR> quadruple-precision. +TestFloat cannot test decimal floating-point. +</P> + +<P> +Included in the TestFloat package are the <CODE>testsoftfloat</CODE> and +<CODE>timesoftfloat</CODE> programs for testing the Berkeley SoftFloat software +implementation of floating-point and for measuring its speed. +Information about SoftFloat can be found at the SoftFloat Web page, +<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></NOBR></A>. +The <CODE>testsoftfloat</CODE> and <CODE>timesoftfloat</CODE> programs are +expected to be of interest only to people compiling the SoftFloat sources. +</P> + +<P> +This document explains how to use the TestFloat programs. +It does not attempt to define or explain much of the IEEE Floating-Point +Standard. +Details about the standard are available elsewhere. +</P> + +<P> +The current version of TestFloat is <NOBR>Release 3e</NOBR>. +This version differs from earlier releases 3b through 3d in only minor ways. +Compared to the original <NOBR>Release 3</NOBR>: +<UL> +<LI> +<NOBR>Release 3b</NOBR> added the ability to test the <NOBR>16-bit</NOBR> +half-precision format. +<LI> +<NOBR>Release 3c</NOBR> added the ability to test a rarely used rounding mode, +<I>round to odd</I>, also known as <I>jamming</I>. +<LI> +<NOBR>Release 3d</NOBR> modified the code for testing C arithmetic to +potentially include testing newer library functions <CODE>sqrtf</CODE>, +<CODE>sqrtl</CODE>, <CODE>fmaf</CODE>, <CODE>fma</CODE>, and <CODE>fmal</CODE>. +</UL> +This release adds a few more small improvements, including modifying the +expected behavior of rounding mode <CODE>odd</CODE> and fixing a minor bug in +the all-in-one <CODE>testfloat</CODE> program. +</P> + +<P> +Compared to Release 2c and earlier, the set of TestFloat programs, as well as +the programs’ arguments and behavior, changed some with +<NOBR>Release 3</NOBR>. +For more about the evolution of TestFloat releases, see +<A HREF="TestFloat-history.html"><NOBR><CODE>TestFloat-history.html</CODE></NOBR></A>. +</P> + + +<H2>2. Limitations</H2> + +<P> +TestFloat output is not always easily interpreted. +Detailed knowledge of the IEEE Floating-Point Standard and its vagaries is +needed to use TestFloat responsibly. +</P> + +<P> +TestFloat performs relatively simple tests designed to check the fundamental +soundness of the floating-point under test. +TestFloat may also at times manage to find rarer and more subtle bugs, but it +will probably only find such bugs by chance. +Software that purposefully seeks out various kinds of subtle floating-point +bugs can be found through links posted on the TestFloat Web page, +<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></NOBR></A>. +</P> + + +<H2>3. Acknowledgments and License</H2> + +<P> +The TestFloat package was written by me, <NOBR>John R.</NOBR> Hauser. +<NOBR>Release 3</NOBR> of TestFloat was a completely new implementation +supplanting earlier releases. +The project to create <NOBR>Release 3</NOBR> (now <NOBR>through 3e</NOBR>) was +done in the employ of the University of California, Berkeley, within the +Department of Electrical Engineering and Computer Sciences, first for the +Parallel Computing Laboratory (Par Lab) and then for the ASPIRE Lab. +The work was officially overseen by Prof. Krste Asanovic, with funding provided +by these sources: +<BLOCKQUOTE> +<TABLE> +<COL> +<COL WIDTH=10> +<COL> +<TR> +<TD VALIGN=TOP><NOBR>Par Lab:</NOBR></TD> +<TD></TD> +<TD> +Microsoft (Award #024263), Intel (Award #024894), and U.C. Discovery +(Award #DIG07-10227), with additional support from Par Lab affiliates Nokia, +NVIDIA, Oracle, and Samsung. +</TD> +</TR> +<TR> +<TD VALIGN=TOP><NOBR>ASPIRE Lab:</NOBR></TD> +<TD></TD> +<TD> +DARPA PERFECT program (Award #HR0011-12-2-0016), with additional support from +ASPIRE industrial sponsor Intel and ASPIRE affiliates Google, Nokia, NVIDIA, +Oracle, and Samsung. +</TD> +</TR> +</TABLE> +</BLOCKQUOTE> +</P> + +<P> +The following applies to the whole of TestFloat <NOBR>Release 3e</NOBR> as well +as to each source file individually. +</P> + +<P> +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. +All rights reserved. +</P> + +<P> +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +<OL> + +<LI> +<P> +Redistributions of source code must retain the above copyright notice, this +list of conditions, and the following disclaimer. +</P> + +<LI> +<P> +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. +</P> + +<LI> +<P> +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. +</P> + +</OL> +</P> + +<P> +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. +</P> + + +<H2>4. What TestFloat Does</H2> + +<P> +TestFloat is designed to test a floating-point implementation by comparing its +behavior with that of TestFloat’s own internal floating-point implemented +in software. +For each operation to be tested, the TestFloat programs can generate a large +number of test cases, made up of simple pattern tests intermixed with weighted +random inputs. +The cases generated should be adequate for testing carry chain propagations, +and the rounding of addition, subtraction, multiplication, and simple +operations like conversions. +TestFloat makes a point of checking all boundary cases of the arithmetic, +including underflows, overflows, invalid operations, subnormal inputs, zeros +(positive and negative), infinities, and NaNs. +For the interesting operations like addition and multiplication, millions of +test cases may be checked. +</P> + +<P> +TestFloat is not remarkably good at testing difficult rounding cases for +division and square root. +It also makes no attempt to find bugs specific to SRT division and the like +(such as the infamous Pentium division bug). +Software that tests for such failures can be found through links on the +TestFloat Web page, +<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></NOBR></A>. +</P> + +<P> +NOTE!<BR> +It is the responsibility of the user to verify that the discrepancies TestFloat +finds actually represent faults in the implementation being tested. +Advice to help with this task is provided later in this document. +Furthermore, even if TestFloat finds no fault with a floating-point +implementation, that in no way guarantees that the implementation is bug-free. +</P> + +<P> +For each operation, TestFloat can test all five rounding modes defined by the +IEEE Floating-Point Standard, plus possibly a sixth mode, <I>round to odd</I> +(depending on the options selected when TestFloat was built). +TestFloat verifies not only that the numeric results of an operation are +correct, but also that the proper floating-point exception flags are raised. +All five exception flags are tested, including the <I>inexact</I> flag. +TestFloat does not attempt to verify that the floating-point exception flags +are actually implemented as sticky flags. +</P> + +<P> +For the <NOBR>80-bit</NOBR> double-extended-precision format, TestFloat can +test the addition, subtraction, multiplication, division, and square root +operations at all three of the standard rounding precisions. +The rounding precision can be set to <NOBR>32 bits</NOBR>, equivalent to +single-precision, to <NOBR>64 bits</NOBR>, equivalent to double-precision, or +to the full <NOBR>80 bits</NOBR> of the double-extended-precision. +Rounding precision control can be applied only to the double-extended-precision +format and only for the five basic arithmetic operations: addition, +subtraction, multiplication, division, and square root. +Other operations can be tested only at full precision. +</P> + +<P> +As a rule, TestFloat is not particular about the bit patterns of NaNs that +appear as operation results. +Any NaN is considered as good a result as another. +This laxness can be overridden so that TestFloat checks for particular bit +patterns within NaN results. +See <NOBR>section 8</NOBR> below, <I>Variations Allowed by the IEEE +Floating-Point Standard</I>, plus the <CODE>-checkNaNs</CODE> and +<CODE>-checkInvInts</CODE> options documented for programs +<CODE>testfloat_ver</CODE> and <CODE>testfloat</CODE>. +</P> + +<P> +TestFloat normally compares an implementation of floating-point against the +Berkeley SoftFloat software implementation of floating-point, also created by +me. +The SoftFloat functions are linked into each TestFloat program’s +executable. +Information about SoftFloat can be found at the Web page +<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></NOBR></A>. +</P> + +<P> +For testing SoftFloat itself, the TestFloat package includes a +<CODE>testsoftfloat</CODE> program that compares SoftFloat’s +floating-point against <EM>another</EM> software floating-point implementation. +The second software floating-point is simpler and slower than SoftFloat, and is +completely independent of SoftFloat. +Although the second software floating-point cannot be guaranteed to be +bug-free, the chance that it would mimic any of SoftFloat’s bugs is low. +Consequently, an error in one or the other floating-point version should appear +as an unexpected difference between the two implementations. +Note that testing SoftFloat should be necessary only when compiling a new +TestFloat executable or when compiling SoftFloat for some other reason. +</P> + + +<H2>5. Executing TestFloat</H2> + +<P> +The TestFloat package consists of five programs, all intended to be executed +from a command-line interpreter: +<BLOCKQUOTE> +<TABLE> +<TR> +<TD> +<A HREF="testfloat_gen.html"><CODE>testfloat_gen</CODE></A><CODE> </CODE> +</TD> +<TD> +Generates test cases for a specific floating-point operation. +</TD> +</TR> +<TR> +<TD> +<A HREF="testfloat_ver.html"><CODE>testfloat_ver</CODE></A> +</TD> +<TD> +Verifies whether the results from executing a floating-point operation are as +expected. +</TD> +</TR> +<TR> +<TD> +<A HREF="testfloat.html"><CODE>testfloat</CODE></A> +</TD> +<TD> +An all-in-one program that generates test cases, executes floating-point +operations, and verifies whether the results match expectations. +</TD> +</TR> +<TR> +<TD> +<A HREF="testsoftfloat.html"><CODE>testsoftfloat</CODE></A><CODE> </CODE> +</TD> +<TD> +Like <CODE>testfloat</CODE>, but for testing SoftFloat. +</TD> +</TR> +<TR> +<TD> +<A HREF="timesoftfloat.html"><CODE>timesoftfloat</CODE></A><CODE> </CODE> +</TD> +<TD> +A program for measuring the speed of SoftFloat (included in the TestFloat +package for convenience). +</TD> +</TR> +</TABLE> +</BLOCKQUOTE> +Each program has its own page of documentation that can be opened through the +links in the table above. +</P> + +<P> +To test a floating-point implementation other than SoftFloat, one of three +different methods can be used. +The first method pipes output from <CODE>testfloat_gen</CODE> to a program +that: +<NOBR>(a) reads</NOBR> the incoming test cases, <NOBR>(b) invokes</NOBR> the +floating-point operation being tested, and <NOBR>(c) writes</NOBR> the +operation results to output. +These results can then be piped to <CODE>testfloat_ver</CODE> to be checked for +correctness. +Assuming a vertical bar (<CODE>|</CODE>) indicates a pipe between programs, the +complete process could be written as a single command like so: +<BLOCKQUOTE> +<PRE> +testfloat_gen ... <<I>type</I>> | <<I>program-that-invokes-op</I>> | testfloat_ver ... <<I>function</I>> +</PRE> +</BLOCKQUOTE> +The program in the middle is not supplied by TestFloat but must be created +independently. +If for some reason this program cannot take command-line arguments, the +<CODE>-prefix</CODE> option of <CODE>testfloat_gen</CODE> can communicate +parameters through the pipe. +</P> + +<P> +A second method for running TestFloat is similar but has +<CODE>testfloat_gen</CODE> supply not only the test inputs but also the +expected results for each case. +With this additional information, the job done by <CODE>testfloat_ver</CODE> +can be folded into the invoking program to give the following command: +<BLOCKQUOTE> +<PRE> +testfloat_gen ... <<I>function</I>> | <<I>program-that-invokes-op-and-compares-results</I>> +</PRE> +</BLOCKQUOTE> +Again, the program that actually invokes the floating-point operation is not +supplied by TestFloat but must be created independently. +Depending on circumstance, it may be preferable either to let +<CODE>testfloat_ver</CODE> check and report suspected errors (first method) or +to include this step in the invoking program (second method). +</P> + +<P> +The third way to use TestFloat is the all-in-one <CODE>testfloat</CODE> +program. +This program can perform all the steps of creating test cases, invoking the +floating-point operation, checking the results, and reporting suspected errors. +However, for this to be possible, <CODE>testfloat</CODE> must be compiled to +contain the method for invoking the floating-point operations to test. +Each build of <CODE>testfloat</CODE> is therefore capable of testing +<EM>only</EM> the floating-point implementation it was built to invoke. +To test a new implementation of floating-point, a new <CODE>testfloat</CODE> +must be created, linked to that specific implementation. +By comparison, the <CODE>testfloat_gen</CODE> and <CODE>testfloat_ver</CODE> +programs are entirely generic; +one instance is usable for testing any floating-point implementation, because +implementation-specific details are segregated in the custom program that +follows <CODE>testfloat_gen</CODE>. +</P> + +<P> +Program <CODE>testsoftfloat</CODE> is another all-in-one program specifically +for testing SoftFloat. +</P> + +<P> +Programs <CODE>testfloat_ver</CODE>, <CODE>testfloat</CODE>, and +<CODE>testsoftfloat</CODE> all report status and error information in a common +way. +As it executes, each of these programs writes status information to the +standard error output, which should be the screen by default. +In order for this status to be displayed properly, the standard error stream +should not be redirected to a file. +Any discrepancies that are found are written to the standard output stream, +which is easily redirected to a file if desired. +Unless redirected, reported errors will appear intermixed with the ongoing +status information in the output. +</P> + + +<H2>6. Operations Tested by TestFloat</H2> + +<P> +TestFloat can test all operations required by the original 1985 IEEE +Floating-Point Standard except for conversions to and from decimal. +These operations are: +<UL> +<LI> +conversions among the supported floating-point formats, and also between +integers (<NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR>, signed and unsigned) and +any of the floating-point formats; +<LI> +for each floating-point format, the usual addition, subtraction, +multiplication, division, and square root operations; +<LI> +for each format, the floating-point remainder operation defined by the IEEE +Standard; +<LI> +for each format, a “round to integer” operation that rounds to the +nearest integer value in the same format; and +<LI> +comparisons between two values in the same floating-point format. +</UL> +In addition, TestFloat can also test +<UL> +<LI> +for each floating-point format except <NOBR>80-bit</NOBR> +double-extended-precision, the fused multiply-add operation defined by the 2008 +IEEE Standard. +</UL> +</P> + +<P> +More information about all these operations is given below. +In the operation names used by TestFloat, <NOBR>16-bit</NOBR> half-precision is +called <CODE>f16</CODE>, <NOBR>32-bit</NOBR> single-precision is +<CODE>f32</CODE>, <NOBR>64-bit</NOBR> double-precision is <CODE>f64</CODE>, +<NOBR>80-bit</NOBR> double-extended-precision is <CODE>extF80</CODE>, and +<NOBR>128-bit</NOBR> quadruple-precision is <CODE>f128</CODE>. +TestFloat generally uses the same names for operations as Berkeley SoftFloat, +except that TestFloat’s names never include the <CODE>M</CODE> that +SoftFloat uses to indicate that values are passed through pointers. +</P> + +<H3>6.1. Conversion Operations</H3> + +<P> +All conversions among the floating-point formats and all conversions between a +floating-point format and <NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR> integers +can be tested. +The conversion operations are: +<BLOCKQUOTE> +<PRE> +ui32_to_f16 ui64_to_f16 i32_to_f16 i64_to_f16 +ui32_to_f32 ui64_to_f32 i32_to_f32 i64_to_f32 +ui32_to_f64 ui64_to_f64 i32_to_f64 i64_to_f64 +ui32_to_extF80 ui64_to_extF80 i32_to_extF80 i64_to_extF80 +ui32_to_f128 ui64_to_f128 i32_to_f128 i64_to_f128 + +f16_to_ui32 f32_to_ui32 f64_to_ui32 extF80_to_ui32 f128_to_ui32 +f16_to_ui64 f32_to_ui64 f64_to_ui64 extF80_to_ui64 f128_to_ui64 +f16_to_i32 f32_to_i32 f64_to_i32 extF80_to_i32 f128_to_i32 +f16_to_i64 f32_to_i64 f64_to_i64 extF80_to_i64 f128_to_i64 + +f16_to_f32 f32_to_f16 f64_to_f16 extF80_to_f16 f128_to_f16 +f16_to_f64 f32_to_f64 f64_to_f32 extF80_to_f32 f128_to_f32 +f16_to_extF80 f32_to_extF80 f64_to_extF80 extF80_to_f64 f128_to_f64 +f16_to_f128 f32_to_f128 f64_to_f128 extF80_to_f128 f128_to_extF80 +</PRE> +</BLOCKQUOTE> +Abbreviations <CODE>ui32</CODE> and <CODE>ui64</CODE> indicate +<NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR> unsigned integer types, while +<CODE>i32</CODE> and <CODE>i64</CODE> indicate their signed counterparts. +These conversions all round according to the current rounding mode as relevant. +Conversions from a smaller to a larger floating-point format are always exact +and so require no rounding. +Likewise, conversions from <NOBR>32-bit</NOBR> integers to <NOBR>64-bit</NOBR> +double-precision or to any larger floating-point format are also exact, as are +conversions from <NOBR>64-bit</NOBR> integers to <NOBR>80-bit</NOBR> +double-extended-precision and <NOBR>128-bit</NOBR> quadruple-precision. +</P> + +<P> +For the all-in-one <CODE>testfloat</CODE> program, this list of conversion +operations requires amendment. +For <CODE>testfloat</CODE> only, conversions to an integer type have names that +explicitly specify the rounding mode and treatment of inexactness. +Thus, instead of +<BLOCKQUOTE> +<PRE> +<<I>float</I>>_to_<<I>int</I>> +</PRE> +</BLOCKQUOTE> +as listed above, operations converting to integer type have names of these +forms: +<BLOCKQUOTE> +<PRE> +<<I>float</I>>_to_<<I>int</I>>_r_<<I>round</I>> +<<I>float</I>>_to_<<I>int</I>>_rx_<<I>round</I>> +</PRE> +</BLOCKQUOTE> +The <CODE><<I>round</I>></CODE> component is one of +‘<CODE>near_even</CODE>’, ‘<CODE>near_maxMag</CODE>’, +‘<CODE>minMag</CODE>’, ‘<CODE>min</CODE>’, or +‘<CODE>max</CODE>’, choosing the rounding mode. +Any other indication of rounding mode is ignored. +The operations with ‘<CODE>_r_</CODE>’ in their names never raise +the <I>inexact</I> exception, while those with ‘<CODE>_rx_</CODE>’ +raise the <I>inexact</I> exception whenever the result is not exact. +</P> + +<P> +TestFloat assumes that conversions from floating-point to an integer type +should raise the <I>invalid</I> exception if the input cannot be rounded to an +integer representable in the result format. +In such a circumstance: +<UL> + +<LI> +<P> +If the result type is an unsigned integer, TestFloat normally expects the +result of the operation to be the type’s largest integer value. +In the case that the input is a negative number (not a NaN), a zero result may +also be accepted. +</P> + +<LI> +<P> +If the result type is a signed integer and the input is a number (not a NaN), +TestFloat expects the result to be the largest-magnitude integer with the same +sign as the input. +When a NaN is converted to a signed integer type, TestFloat allows either the +largest postive or largest-magnitude negative integer to be returned. +</P> + +</UL> +Conversions to integer types are expected never to raise the <I>overflow</I> +exception. +</P> + +<H3>6.2. Basic Arithmetic Operations</H3> + +<P> +The following standard arithmetic operations can be tested: +<BLOCKQUOTE> +<PRE> +f16_add f16_sub f16_mul f16_div f16_sqrt +f32_add f32_sub f32_mul f32_div f32_sqrt +f64_add f64_sub f64_mul f64_div f64_sqrt +extF80_add extF80_sub extF80_mul extF80_div extF80_sqrt +f128_add f128_sub f128_mul f128_div f128_sqrt +</PRE> +</BLOCKQUOTE> +The double-extended-precision (<CODE>extF80</CODE>) operations can be rounded +to reduced precision under rounding precision control. +</P> + +<H3>6.3. Fused Multiply-Add Operations</H3> + +<P> +For all floating-point formats except <NOBR>80-bit</NOBR> +double-extended-precision, TestFloat can test the fused multiply-add operation +defined by the 2008 IEEE Floating-Point Standard. +The fused multiply-add operations are: +<BLOCKQUOTE> +<PRE> +f16_mulAdd +f32_mulAdd +f64_mulAdd +f128_mulAdd +</PRE> +</BLOCKQUOTE> +</P> + +<P> +If one of the multiplication operands is infinite and the other is zero, +TestFloat expects the fused multiply-add operation to raise the <I>invalid</I> +exception even if the third operand is a quiet NaN. +</P> + +<H3>6.4. Remainder Operations</H3> + +<P> +For each format, TestFloat can test the IEEE Standard’s remainder +operation. +These operations are: +<BLOCKQUOTE> +<PRE> +f16_rem +f32_rem +f64_rem +extF80_rem +f128_rem +</PRE> +</BLOCKQUOTE> +The remainder operations are always exact and so require no rounding. +</P> + +<H3>6.5. Round-to-Integer Operations</H3> + +<P> +For each format, TestFloat can test the IEEE Standard’s round-to-integer +operation. +For most TestFloat programs, these operations are: +<BLOCKQUOTE> +<PRE> +f16_roundToInt +f32_roundToInt +f64_roundToInt +extF80_roundToInt +f128_roundToInt +</PRE> +</BLOCKQUOTE> +</P> + +<P> +Just as for conversions to integer types (<NOBR>section 6.1</NOBR> above), the +all-in-one <CODE>testfloat</CODE> program is again an exception. +For <CODE>testfloat</CODE> only, the round-to-integer operations have names of +these forms: +<BLOCKQUOTE> +<PRE> +<<I>float</I>>_roundToInt_r_<<I>round</I>> +<<I>float</I>>_roundToInt_x +</PRE> +</BLOCKQUOTE> +For the ‘<CODE>_r_</CODE>’ versions, the <I>inexact</I> exception +is never raised, and the <CODE><<I>round</I>></CODE> component specifies +the rounding mode as one of ‘<CODE>near_even</CODE>’, +‘<CODE>near_maxMag</CODE>’, ‘<CODE>minMag</CODE>’, +‘<CODE>min</CODE>’, or ‘<CODE>max</CODE>’. +The usual indication of rounding mode is ignored. +In contrast, the ‘<CODE>_x</CODE>’ versions accept the usual +indication of rounding mode and raise the <I>inexact</I> exception whenever the +result is not exact. +This irregular system follows the IEEE Standard’s particular +specification for the round-to-integer operations. +</P> + +<H3>6.6. Comparison Operations</H3> + +<P> +The following floating-point comparison operations can be tested: +<BLOCKQUOTE> +<PRE> +f16_eq f16_le f16_lt +f32_eq f32_le f32_lt +f64_eq f64_le f64_lt +extF80_eq extF80_le extF80_lt +f128_eq f128_le f128_lt +</PRE> +</BLOCKQUOTE> +The abbreviation <CODE>eq</CODE> stands for “equal” (=), +<CODE>le</CODE> stands for “less than or equal” (≤), and +<CODE>lt</CODE> stands for “less than” (<). +</P> + +<P> +The IEEE Standard specifies that, by default, the less-than-or-equal and +less-than comparisons raise the <I>invalid</I> exception if either input is any +kind of NaN. +The equality comparisons, on the other hand, are defined by default to raise +the <I>invalid</I> exception only for signaling NaNs, not for quiet NaNs. +For completeness, the following additional operations can be tested if +supported: +<BLOCKQUOTE> +<PRE> +f16_eq_signaling f16_le_quiet f16_lt_quiet +f32_eq_signaling f32_le_quiet f32_lt_quiet +f64_eq_signaling f64_le_quiet f64_lt_quiet +extF80_eq_signaling extF80_le_quiet extF80_lt_quiet +f128_eq_signaling f128_le_quiet f128_lt_quiet +</PRE> +</BLOCKQUOTE> +The <CODE>signaling</CODE> equality comparisons are identical to the standard +operations except that the <I>invalid</I> exception should be raised for any +NaN input. +Similarly, the <CODE>quiet</CODE> comparison operations should be identical to +their counterparts except that the <I>invalid</I> exception is not raised for +quiet NaNs. +</P> + +<P> +Obviously, no comparison operations ever require rounding. +Any rounding mode is ignored. +</P> + + +<H2>7. Interpreting TestFloat Output</H2> + +<P> +The “errors” reported by TestFloat programs may or may not really +represent errors in the system being tested. +For each test case tried, the results from the floating-point implementation +being tested could differ from the expected results for several reasons: +<UL> +<LI> +The IEEE Floating-Point Standard allows for some variation in how conforming +floating-point behaves. +Two implementations can sometimes give different results without either being +incorrect. +<LI> +The trusted floating-point emulation could be faulty. +This could be because there is a bug in the way the emulation is coded, or +because a mistake was made when the code was compiled for the current system. +<LI> +The TestFloat program may not work properly, reporting differences that do not +exist. +<LI> +Lastly, the floating-point being tested could actually be faulty. +</UL> +It is the responsibility of the user to determine the causes for the +discrepancies that are reported. +Making this determination can require detailed knowledge about the IEEE +Standard. +Assuming TestFloat is working properly, any differences found will be due to +either the first or last of the reasons above. +Variations in the IEEE Standard that could lead to false error reports are +discussed in <NOBR>section 8</NOBR>, <I>Variations Allowed by the IEEE +Floating-Point Standard</I>. +</P> + +<P> +For each reported error (or apparent error), a line of text is written to the +default output. +If a line would be longer than 79 characters, it is divided. +The first part of each error line begins in the leftmost column, and any +subsequent “continuation” lines are indented with a tab. +</P> + +<P> +Each error reported is of the form: +<BLOCKQUOTE> +<PRE> +<<I>inputs</I>> => <<I>observed-output</I>> expected: <<I>expected-output</I>> +</PRE> +</BLOCKQUOTE> +The <CODE><<I>inputs</I>></CODE> are the inputs to the operation. +Each output (observed or expected) is shown as a pair: the result value first, +followed by the exception flags. +</P> + +<P> +For example, two typical error lines could be +<BLOCKQUOTE> +<PRE> +-00.7FFF00 -7F.000100 => +01.000000 ...ux expected: +01.000000 ....x ++81.000004 +00.1FFFFF => +01.000000 ...ux expected: +01.000000 ....x +</PRE> +</BLOCKQUOTE> +In the first line, the inputs are <CODE>-00.7FFF00</CODE> and +<CODE>-7F.000100</CODE>, and the observed result is <CODE>+01.000000</CODE> +with flags <CODE>...ux</CODE>. +The trusted emulation result is the same but with different flags, +<CODE>....x</CODE>. +Items such as <CODE>-00.7FFF00</CODE> composed of a sign character +<NOBR>(<CODE>+</CODE>/<CODE>-</CODE>)</NOBR>, hexadecimal digits, and a single +period represent floating-point values (here <NOBR>32-bit</NOBR> +single-precision). +The two instances above were reported as errors because the exception flag +results differ. +</P> + +<P> +Aside from the exception flags, there are ten data types that may be +represented. +Five are floating-point types: <NOBR>16-bit</NOBR> half-precision, +<NOBR>32-bit</NOBR> single-precision, <NOBR>64-bit</NOBR> double-precision, +<NOBR>80-bit</NOBR> double-extended-precision, and <NOBR>128-bit</NOBR> +quadruple-precision. +The remaining five types are <NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR> +unsigned integers, <NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR> +two’s-complement signed integers, and Boolean values (the results of +comparison operations). +Boolean values are represented as a single character, either a <CODE>0</CODE> +(false) or a <CODE>1</CODE> (true). +A <NOBR>32-bit</NOBR> integer is represented as 8 hexadecimal digits. +Thus, for a signed <NOBR>32-bit</NOBR> integer, <CODE>FFFFFFFF</CODE> is +−1, and <CODE>7FFFFFFF</CODE> is the largest positive value. +<NOBR>64-bit</NOBR> integers are the same except with 16 hexadecimal digits. +</P> + +<P> +Floating-point values are written decomposed into their sign, encoded exponent, +and encoded significand. +First is the sign character <NOBR>(<CODE>+</CODE> or <CODE>-</CODE>),</NOBR> +followed by the encoded exponent in hexadecimal, then a period +(<CODE>.</CODE>), and lastly the encoded significand in hexadecimal. +</P> + +<P> +For <NOBR>16-bit</NOBR> half-precision, notable values include: +<BLOCKQUOTE> +<TABLE CELLSPACING=0 CELLPADDING=0> +<TR><TD><CODE>+00.000 </CODE></TD><TD>+0</TD></TR> +<TR><TD><CODE>+0F.000</CODE></TD><TD> 1</TD></TR> +<TR><TD><CODE>+10.000</CODE></TD><TD> 2</TD></TR> +<TR><TD><CODE>+1E.3FF</CODE></TD><TD>maximum finite value</TD></TR> +<TR><TD><CODE>+1F.000</CODE></TD><TD>+infinity</TD></TR> +<TR><TD> </TD></TR> +<TR><TD><CODE>-00.000</CODE></TD><TD>−0</TD></TR> +<TR><TD><CODE>-0F.000</CODE></TD><TD>−1</TD></TR> +<TR><TD><CODE>-10.000</CODE></TD><TD>−2</TD></TR> +<TR> + <TD><CODE>-1E.3FF</CODE></TD> + <TD>minimum finite value (largest magnitude, but negative)</TD> +</TR> +<TR><TD><CODE>-1F.000</CODE></TD><TD>−infinity</TD></TR> +</TABLE> +</BLOCKQUOTE> +Certain categories are easily distinguished (assuming the <CODE>x</CODE>s are +not all 0): +<BLOCKQUOTE> +<TABLE CELLSPACING=0 CELLPADDING=0> +<TR> + <TD><CODE>+00.xxx </CODE></TD> + <TD>positive subnormal numbers</TD> +</TR> +<TR><TD><CODE>+1F.xxx</CODE></TD><TD>positive NaNs</TD></TR> +<TR><TD><CODE>-00.xxx</CODE></TD><TD>negative subnormal numbers</TD></TR> +<TR><TD><CODE>-1F.xxx</CODE></TD><TD>negative NaNs</TD></TR> +</TABLE> +</BLOCKQUOTE> +</P> + +<P> +Likewise for other formats: +<BLOCKQUOTE> +<TABLE CELLSPACING=0 CELLPADDING=0> +<TR><TD>32-bit single</TD><TD>64-bit double</TD><TD>128-bit quadruple</TD></TR> +<TR><TD> </TD></TR> +<TR> +<TD><CODE>+00.000000 </CODE></TD> +<TD><CODE>+000.0000000000000 </CODE></TD> +<TD><CODE>+0000.0000000000000000000000000000 </CODE></TD> +<TD>+0</TD> +</TR> +<TR> +<TD><CODE>+7F.000000</CODE></TD> +<TD><CODE>+3FF.0000000000000</CODE></TD> +<TD><CODE>+3FFF.0000000000000000000000000000</CODE></TD> +<TD> 1</TD> +</TR> +<TR> +<TD><CODE>+80.000000</CODE></TD> +<TD><CODE>+400.0000000000000</CODE></TD> +<TD><CODE>+4000.0000000000000000000000000000</CODE></TD> +<TD> 2</TD> +</TR> +<TR> +<TD><CODE>+FE.7FFFFF</CODE></TD> +<TD><CODE>+7FE.FFFFFFFFFFFFF</CODE></TD> +<TD><CODE>+7FFE.FFFFFFFFFFFFFFFFFFFFFFFFFFFF</CODE></TD> +<TD>maximum finite value</TD> +</TR> +<TR> +<TD><CODE>+FF.000000</CODE></TD> +<TD><CODE>+7FF.0000000000000</CODE></TD> +<TD><CODE>+7FFF.0000000000000000000000000000</CODE></TD> +<TD>+infinity</TD> +</TR> +<TR><TD> </TD></TR> +<TR> +<TD><CODE>-00.000000 </CODE></TD> +<TD><CODE>-000.0000000000000 </CODE></TD> +<TD><CODE>-0000.0000000000000000000000000000 </CODE></TD> +<TD>−0</TD> +</TR> +<TR> +<TD><CODE>-7F.000000</CODE></TD> +<TD><CODE>-3FF.0000000000000</CODE></TD> +<TD><CODE>-3FFF.0000000000000000000000000000</CODE></TD> +<TD>−1</TD> +</TR> +<TR> +<TD><CODE>-80.000000</CODE></TD> +<TD><CODE>-400.0000000000000</CODE></TD> +<TD><CODE>-4000.0000000000000000000000000000</CODE></TD> +<TD>−2</TD> +</TR> +<TR> +<TD><CODE>-FE.7FFFFF</CODE></TD> +<TD><CODE>-7FE.FFFFFFFFFFFFF</CODE></TD> +<TD><CODE>-7FFE.FFFFFFFFFFFFFFFFFFFFFFFFFFFF</CODE></TD> +<TD>minimum finite value</TD> +</TR> +<TR> +<TD><CODE>-FF.000000</CODE></TD> +<TD><CODE>-7FF.0000000000000</CODE></TD> +<TD><CODE>-7FFF.0000000000000000000000000000</CODE></TD> +<TD>−infinity</TD> +</TR> +<TR><TD> </TD></TR> +<TR> +<TD><CODE>+00.xxxxxx</CODE></TD> +<TD><CODE>+000.xxxxxxxxxxxxx</CODE></TD> +<TD><CODE>+0000.xxxxxxxxxxxxxxxxxxxxxxxxxxxx</CODE></TD> +<TD>positive subnormals</TD> +</TR> +<TR> +<TD><CODE>+FF.xxxxxx</CODE></TD> +<TD><CODE>+7FF.xxxxxxxxxxxxx</CODE></TD> +<TD><CODE>+7FFF.xxxxxxxxxxxxxxxxxxxxxxxxxxxx</CODE></TD> +<TD>positive NaNs</TD> +</TR> +<TR> +<TD><CODE>-00.xxxxxx</CODE></TD> +<TD><CODE>-000.xxxxxxxxxxxxx</CODE></TD> +<TD><CODE>-0000.xxxxxxxxxxxxxxxxxxxxxxxxxxxx</CODE></TD> +<TD>negative subnormals</TD> +</TR> +<TR> +<TD><CODE>-FF.xxxxxx</CODE></TD> +<TD><CODE>-7FF.xxxxxxxxxxxxx</CODE></TD> +<TD><CODE>-7FFF.xxxxxxxxxxxxxxxxxxxxxxxxxxxx</CODE></TD> +<TD>negative NaNs</TD> +</TR> +</TABLE> +</BLOCKQUOTE> +</P> + +<P> +The <NOBR>80-bit</NOBR> double-extended-precision values are a little unusual +in that the leading bit of precision is not hidden as with other formats. +When canonically encoded, the leading significand bit of an <NOBR>80-bit</NOBR> +double-extended-precision value will be 0 if the value is zero or subnormal, +and will be 1 otherwise. +Hence, the same values listed above appear in <NOBR>80-bit</NOBR> +double-extended-precision as follows (note the leading <CODE>8</CODE> digit in +the significands): +<BLOCKQUOTE> +<TABLE CELLSPACING=0 CELLPADDING=0> +<TR> + <TD><CODE>+0000.0000000000000000 </CODE></TD> + <TD>+0</TD> +</TR> +<TR><TD><CODE>+3FFF.8000000000000000</CODE></TD><TD> 1</TD></TR> +<TR><TD><CODE>+4000.8000000000000000</CODE></TD><TD> 2</TD></TR> +<TR> + <TD><CODE>+7FFE.FFFFFFFFFFFFFFFF</CODE></TD> + <TD>maximum finite value</TD> +</TR> +<TR><TD><CODE>+7FFF.8000000000000000</CODE></TD><TD>+infinity</TD></TR> +<TR><TD> </TD></TR> +<TR><TD><CODE>-0000.0000000000000000</CODE></TD><TD>−0</TD></TR> +<TR><TD><CODE>-3FFF.8000000000000000</CODE></TD><TD>−1</TD></TR> +<TR><TD><CODE>-4000.8000000000000000</CODE></TD><TD>−2</TD></TR> +<TR> + <TD><CODE>-7FFE.FFFFFFFFFFFFFFFF</CODE></TD> + <TD>minimum finite value</TD> +</TR> +<TR><TD><CODE>-7FFF.8000000000000000</CODE></TD><TD>−infinity</TD></TR> +</TABLE> +</BLOCKQUOTE> +</P> + +<P> +Lastly, exception flag values are represented by five characters, one character +per flag. +Each flag is written as either a letter or a period (<CODE>.</CODE>) according +to whether the flag was set or not by the operation. +A period indicates the flag was not set. +The letter used to indicate a set flag depends on the flag: +<BLOCKQUOTE> +<TABLE CELLSPACING=0 CELLPADDING=0> +<TR> + <TD><CODE>v </CODE></TD> + <TD><I>invalid</I> exception</TD> +</TR> +<TR> + <TD><CODE>i</CODE></TD> + <TD><I>infinite</I> exception (“divide by zero”)</TD> +</TR> +<TR><TD><CODE>o</CODE></TD><TD><I>overflow</I> exception</TD></TR> +<TR><TD><CODE>u</CODE></TD><TD><I>underflow</I> exception</TD></TR> +<TR><TD><CODE>x</CODE></TD><TD><I>inexact</I> exception</TD></TR> +</TABLE> +</BLOCKQUOTE> +For example, the notation <CODE>...ux</CODE> indicates that the +<I>underflow</I> and <I>inexact</I> exception flags were set and that the other +three flags (<I>invalid</I>, <I>infinite</I>, and <I>overflow</I>) were not +set. +The exception flags are always written following the value returned as the +result of the operation. +</P> + + +<H2>8. Variations Allowed by the IEEE Floating-Point Standard</H2> + +<P> +The IEEE Floating-Point Standard admits some variation among conforming +implementations. +Because TestFloat expects the two implementations being compared to deliver +bit-for-bit identical results under most circumstances, this leeway in the +standard can result in false errors being reported if the two implementations +do not make the same choices everywhere the standard provides an option. +</P> + +<H3>8.1. Underflow</H3> + +<P> +The standard specifies that the <I>underflow</I> exception flag is to be raised +when two conditions are met simultaneously: +<NOBR>(1) <I>tininess</I></NOBR> and <NOBR>(2) <I>loss of accuracy</I></NOBR>. +</P> + +<P> +A result is tiny when its magnitude is nonzero yet smaller than any normalized +floating-point number. +The standard allows tininess to be determined either before or after a result +is rounded to the destination precision. +If tininess is detected before rounding, some borderline cases will be flagged +as underflows even though the result after rounding actually lies within the +normal floating-point range. +By detecting tininess after rounding, a system can avoid some unnecessary +signaling of underflow. +All the TestFloat programs support options <CODE>-tininessbefore</CODE> and +<CODE>-tininessafter</CODE> to control whether TestFloat expects tininess on +underflow to be detected before or after rounding. +One or the other is selected as the default when TestFloat is compiled, but +these command options allow the default to be overridden. +</P> + +<P> +Loss of accuracy occurs when the subnormal format is not sufficient to +represent an underflowed result accurately. +The original 1985 version of the IEEE Standard allowed loss of accuracy to be +detected either as an <I>inexact result</I> or as a +<I>denormalization loss</I>; +however, few if any systems ever chose the latter. +The latest standard requires that loss of accuracy be detected as an inexact +result, and TestFloat can test only for this case. +</P> + +<H3>8.2. NaNs</H3> + +<P> +The IEEE Standard gives the floating-point formats a large number of NaN +encodings and specifies that NaNs are to be returned as results under certain +conditions. +However, the standard allows an implementation almost complete freedom over +<EM>which</EM> NaN to return in each situation. +</P> + +<P> +By default, TestFloat does not check the bit patterns of NaN results. +When the result of an operation should be a NaN, any NaN is considered as good +as another. +This laxness can be overridden with the <CODE>-checkNaNs</CODE> option of +programs <CODE>testfloat_ver</CODE> and <CODE>testfloat</CODE>. +In order for this option to be sensible, TestFloat must have been compiled so +that its internal floating-point implementation (SoftFloat) generates the +proper NaN results for the system being tested. +</P> + +<H3>8.3. Conversions to Integer</H3> + +<P> +Conversion of a floating-point value to an integer format will fail if the +source value is a NaN or if it is too large. +The IEEE Standard does not specify what value should be returned as the integer +result in these cases. +Moreover, according to the standard, the <I>invalid</I> exception can be raised +or an unspecified alternative mechanism may be used to signal such cases. +</P> + +<P> +TestFloat assumes that conversions to integer will raise the <I>invalid</I> +exception if the source value cannot be rounded to a representable integer. +In such cases, TestFloat expects the result value to be the largest-magnitude +positive or negative integer or zero, as detailed earlier in +<NOBR>section 6.1</NOBR>, <I>Conversion Operations</I>. +If option <CODE>-checkInvInts</CODE> is selected with programs +<CODE>testfloat_ver</CODE> and <CODE>testfloat</CODE>, integer results of +invalid operations are checked for an exact match. +In order for this option to be sensible, TestFloat must have been compiled so +that its internal floating-point implementation (SoftFloat) generates the +proper integer results for the system being tested. +</P> + + +<H2>9. Contact Information</H2> + +<P> +At the time of this writing, the most up-to-date information about TestFloat +and the latest release can be found at the Web page +<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></NOBR></A>. +</P> + + +</BODY> + diff --git a/src/libs/softfloat-3e/testfloat/doc/TestFloat-history.html b/src/libs/softfloat-3e/testfloat/doc/TestFloat-history.html new file mode 100644 index 00000000..1c247de0 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/doc/TestFloat-history.html @@ -0,0 +1,272 @@ + +<HTML> + +<HEAD> +<TITLE>Berkeley TestFloat History</TITLE> +</HEAD> + +<BODY> + +<H1>History of Berkeley TestFloat, to Release 3e</H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + + +<P> +Releases of Berkeley TestFloat normally parallel those of Berkeley SoftFloat, +on which TestFloat is based. +Each TestFloat release necessarily incorporates all bug fixes from the +corresponding release of SoftFloat. +</P> + + +<H3>Release 3e (2018 January)</H3> + +<UL> + +<LI> +Fixed a problem with the all-in-one <CODE>testfloat</CODE> program whereby +function set <CODE>-all1</CODE> incorrectly also tested the three-operand fused +multiply-add operations. + +<LI> +Modified the expected behavior of rounding mode <CODE>odd</CODE> (jamming) when +rounding to an integer value (either conversion to an integer format or a +‘<CODE>roundToInt</CODE>’ function). +Previously, for those cases only, rounding mode <CODE>odd</CODE> was expected +to act the same as rounding to minimum magnitude. +Now, when rounding to an integer value, the nearest odd integer is expected, +consistent with the round-to-odd result of other operations. + +<LI> +Added options <CODE>-checkInvInts</CODE> and <CODE>-checkAll</CODE> to programs +<CODE>testfloat_ver</CODE> and <CODE>testfloat</CODE>. + +<LI> +Improved the checking of integer results of invalid operations. + +</UL> + + +<H3>Release 3d (2017 August)</H3> + +<UL> + +<LI> +When the all-in-one <CODE>testfloat</CODE> program is compiled to test the C +language’s arithmetic, added the ability to test library functions +<CODE>sqrtf</CODE>, <CODE>sqrtl</CODE>, <CODE>fmaf</CODE>, <CODE>fma</CODE>, +and <CODE>fmal</CODE>, which were added to the <NOBR>C Standard</NOBR> in 1999. + +</UL> + + +<H3>Release 3c (2017 February)</H3> + +<UL> + +<LI> +Added support for testing rounding mode <CODE>odd</CODE> (jamming). + +<LI> +Made support for testing <NOBR>64-bit</NOBR> double-precistion floating-point +be subject to macro <CODE>FLOAT64</CODE> (akin to macros <CODE>FLOAT16</CODE>, +<CODE>EXTFLOAT80</CODE>, and <CODE>FLOAT128</CODE> from before). + +<LI> +Fixed some bugs that caused compilation to fail with certain combinations of +option macro settings. + +<LI> +Corrected the types of two internal variables to be <CODE>sig_atomic_t</CODE> +instead of <CODE>bool</CODE>. + +<LI> +Improved the formatting of some error reports (concerning where lines are +broken when they exceed 79 characters in length). + +</UL> + + +<H3>Release 3b (2016 July)</H3> + +<UL> + +<LI> +Added the ability to test the common <NOBR>16-bit</NOBR> +“half-precision” floating-point format. + +<LI> +Added a <CODE>-seed</CODE> option to programs <CODE>testfloat_gen</CODE>, +<CODE>testfloat</CODE>, and <CODE>testsoftfloat</CODE> for setting the seed for +the pseudo-random number generator used to generate test cases. + +<LI> +Where a specific choice is needed for how tininess is detected on underflow, +changed the default to be the detection of tininess after rounding +(<CODE>-tininessafter</CODE>) instead of before rounding +(<CODE>-tininessbefore</CODE>). + +<LI> +Modified the format of reported discrepancies to show the signs of +floating-point values using <CODE>+</CODE> and <CODE>-</CODE> characters. + +<LI> +Documented the use of the <CODE>INLINE</CODE> macro, and fixed the sources for +the case that function inlining is not supported by the C compiler. + +<LI> +Documented the possible need to define macro <CODE>THREAD_LOCAL</CODE> to match +how the SoftFloat library was built. + +<LI> +Modified the provided Makefiles to allow some options to be overridden from the +<CODE>make</CODE> command. + +</UL> + + +<H3>Release 3a (2015 October)</H3> + +<UL> + +<LI> +Replaced the license text supplied by the University of California, Berkeley, +and fixed some minor build problems. + +</UL> + + +<H3>Release 3 (2015 February)</H3> + +<UL> + +<LI> +Complete rewrite, funded by the University of California, Berkeley, and +consequently having a different use license than earlier releases. +Visible changes included different names for testable functions and command +options. + +<LI> +Reinstated separate programs for generating test cases +(<CODE>testfloat_ver</CODE>) and verifying test results +(<CODE>testfloat_gen</CODE>), as alternatives to the all-in-one +<CODE>testfloat</CODE> program (which remained supported). + +<LI> +Added support for testing conversions between floating-point and unsigned +integers, both <NOBR>32-bit</NOBR> and <NOBR>64-bit</NOBR>. + +<LI> +Added support for testing a fused multiply-add operation, for all testable +floating-point formats except <NOBR>80-bit</NOBR> double-extended-precision. + +<LI> +Added support for testing a fifth rounding mode, <CODE>near_maxMag</CODE> +(round to nearest, with ties to maximum magnitude, away from zero). + +<LI> +Added <CODE>timesoftfloat</CODE> (previously found in the Berkeley SoftFloat +package). + +</UL> + + +<H3>Release 2c (2015 January)</H3> + +<UL> + +<LI> +Fixed mistakes affecting some <NOBR>64-bit</NOBR> processors. + +<LI> +Made minor updates to the documentation, including improved wording for the +legal restrictions on using TestFloat releases <NOBR>through 2c</NOBR> (not +applicable to <NOBR>Release 3</NOBR> or later). + +</UL> + + +<P> +There was never a <NOBR>Release 2b</NOBR>. +</P> + + +<H3>Release 2a (1998 December)</H3> + +<UL> + +<LI> +Added support for testing conversions between floating-point and +<NOBR>64-bit</NOBR> signed integers. + +<LI> +Improved the Makefiles. + +</UL> + + +<H3>Release 2 (1997 June)</H3> + +<UL> + +<LI> +Integrated the generation of test cases and the checking of system results into +a single program. +(Before they were separate programs, normally joined by explicit command-line +pipes.) + +<LI> +Improved the sequence of test cases. + +<LI> +Added support for testing <NOBR>80-bit</NOBR> double-extended-precision and +<NOBR>128-bit</NOBR> quadruple precision. + +<LI> +Made program output more readable, and added new command arguments. + +<LI> +Reduced dependence on the quality of the standard <CODE>rand</CODE> function +for generating test cases. +(Previously naively expected <CODE>rand</CODE> to be able to generate good +random bits for the entire machine word width.) + +<LI> +Created <CODE>testsoftfloat</CODE>, with its own simpler complete software +floating-point (“slowfloat”) for comparison purposes. + +<LI> +Made some changes to the source file structure, including renaming +<CODE>environment.h</CODE> to <CODE>milieu.h</CODE> (to avoid confusion with +environment variables). + +</UL> + + +<H3>Release 1a (1996 July)</H3> + +<UL> + +<LI> +Added the <CODE>-tininessbefore</CODE> and <CODE>-tininessafter</CODE> options +to control whether tininess should be detected before or after rounding. + +</UL> + + +<H3>Release 1 (1996 July)</H3> + +<UL> + +<LI> +Original release. + +</UL> + + +</BODY> + diff --git a/src/libs/softfloat-3e/testfloat/doc/TestFloat-source.html b/src/libs/softfloat-3e/testfloat/doc/TestFloat-source.html new file mode 100644 index 00000000..24fb5946 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/doc/TestFloat-source.html @@ -0,0 +1,639 @@ + +<HTML> + +<HEAD> +<TITLE>Berkeley TestFloat Source Documentation</TITLE> +</HEAD> + +<BODY> + +<H1>Berkeley TestFloat Release 3e: Source Documentation</H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + + +<H2>Contents</H2> + +<BLOCKQUOTE> +<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0> +<COL WIDTH=25> +<COL WIDTH=*> +<TR><TD COLSPAN=2>1. Introduction</TD></TR> +<TR><TD COLSPAN=2>2. Limitations</TD></TR> +<TR><TD COLSPAN=2>3. Acknowledgments and License</TD></TR> +<TR><TD COLSPAN=2>4. TestFloat Package Directory Structure</TD></TR> +<TR><TD COLSPAN=2>5. Dependence on Berkeley SoftFloat</TD></TR> +<TR><TD COLSPAN=2>6. Issues for Porting TestFloat to a New Target</TD></TR> +<TR> + <TD></TD> + <TD>6.1. Standard Headers <CODE><stdbool.h></CODE> and + <CODE><stdint.h></CODE></TD> +</TR> +<TR><TD></TD><TD>6.2. Standard Header <CODE><fenv.h></CODE></TD></TR> +<TR><TD></TD><TD>6.3. Macros for Build Options</TD></TR> +<TR><TD></TD><TD>6.4. Specializing the <CODE>testfloat</CODE> Program</TD></TR> +<TR><TD></TD><TD>6.5. Improving the Random Number Functions</TD></TR> +<TR><TD COLSPAN=2>7. Contact Information</TD></TR> +</TABLE> +</BLOCKQUOTE> + + +<H2>1. Introduction</H2> + +<P> +This document gives information needed for compiling and/or porting Berkeley +TestFloat, a small collection of programs for testing that an implementation of +binary floating-point conforms to the IEEE Standard for Floating-Point +Arithmetic. +For basic documentation about TestFloat refer to +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + +<P> +The source code for TestFloat is intended to be relatively machine-independent. +Most programs in the TestFloat package should be compilable with any +ISO-Standard C compiler that also supports <NOBR>64-bit</NOBR> integers. +If the all-in-one <CODE>testfloat</CODE> program will be used to test a new +floating-point implementation, additional effort will likely be required to +retarget that program to invoke the new floating-point operations. +TestFloat has been successfully compiled with the GNU C Compiler +(<CODE>gcc</CODE>) for several platforms. +</P> + +<P> +<NOBR>Release 3</NOBR> of TestFloat was a complete rewrite relative to +<NOBR>Release 2c</NOBR> or earlier. +The current version of TestFloat is <NOBR>Release 3e</NOBR>. +</P> + +<P> +TestFloat depends on Berkeley SoftFloat, which is a software implementation of +binary floating-point that conforms to the IEEE Standard for Floating-Point +Arithmetic. +SoftFloat is not included with the TestFloat sources. +It can be obtained from the Web page +<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></NOBR></A>. +</P> + + +<H2>2. Limitations</H2> + +<P> +TestFloat assumes the computer has an addressable byte size of either 8 or +<NOBR>16 bits</NOBR>. +(Nearly all computers in use today have <NOBR>8-bit</NOBR> bytes.) +</P> + +<P> +TestFloat is written entirely <NOBR>in C</NOBR>. +The C compiler used must conform at a minimum to the 1989 ANSI standard for the +C language (same as the 1990 ISO standard) and must in addition support basic +arithmetic on <NOBR>64-bit</NOBR> integers. +Earlier releases of TestFloat were capable of testing <NOBR>32-bit</NOBR> +single-precision and <NOBR>64-bit</NOBR> double-precision floating-point +without requiring compiler support for <NOBR>64-bit</NOBR> integers, but this +option is not supported starting with <NOBR>Release 3</NOBR>. +Since 1999, ISO standards for C have mandated compiler support for +<NOBR>64-bit</NOBR> integers. +A compiler conforming to the 1999 C Standard or later is recommended but not +strictly required. +</P> + +<P> +<NOBR>C Standard</NOBR> header files <CODE><stdbool.h></CODE> and +<CODE><stdint.h></CODE> are required for defining standard Boolean and +integer types. +If these headers are not supplied with the C compiler, minimal substitutes must +be provided. +TestFloat’s dependence on these headers is detailed later in +<NOBR>section 6.1</NOBR>, <I>Standard Headers <CODE><stdbool.h></CODE> +and <CODE><stdint.h></CODE></I>. +</P> + + +<H2>3. Acknowledgments and License</H2> + +<P> +The TestFloat package was written by me, <NOBR>John R.</NOBR> Hauser. +<NOBR>Release 3</NOBR> of TestFloat was a completely new implementation +supplanting earlier releases. +The project to create <NOBR>Release 3</NOBR> (now <NOBR>through 3e</NOBR>) was +done in the employ of the University of California, Berkeley, within the +Department of Electrical Engineering and Computer Sciences, first for the +Parallel Computing Laboratory (Par Lab) and then for the ASPIRE Lab. +The work was officially overseen by Prof. Krste Asanovic, with funding provided +by these sources: +<BLOCKQUOTE> +<TABLE> +<COL> +<COL WIDTH=10> +<COL> +<TR> +<TD VALIGN=TOP><NOBR>Par Lab:</NOBR></TD> +<TD></TD> +<TD> +Microsoft (Award #024263), Intel (Award #024894), and U.C. Discovery +(Award #DIG07-10227), with additional support from Par Lab affiliates Nokia, +NVIDIA, Oracle, and Samsung. +</TD> +</TR> +<TR> +<TD VALIGN=TOP><NOBR>ASPIRE Lab:</NOBR></TD> +<TD></TD> +<TD> +DARPA PERFECT program (Award #HR0011-12-2-0016), with additional support from +ASPIRE industrial sponsor Intel and ASPIRE affiliates Google, Nokia, NVIDIA, +Oracle, and Samsung. +</TD> +</TR> +</TABLE> +</BLOCKQUOTE> +</P> + +<P> +The following applies to the whole of TestFloat <NOBR>Release 3e</NOBR> as well +as to each source file individually. +</P> + +<P> +Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the +University of California. +All rights reserved. +</P> + +<P> +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +<OL> + +<LI> +<P> +Redistributions of source code must retain the above copyright notice, this +list of conditions, and the following disclaimer. +</P> + +<LI> +<P> +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. +</P> + +<LI> +<P> +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. +</P> + +</OL> +</P> + +<P> +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. +</P> + + +<H2>4. TestFloat Package Directory Structure</H2> + +<P> +Because TestFloat is targeted to multiple platforms, its source code is +slightly scattered between target-specific and target-independent directories +and files. +The supplied directory structure is as follows: +<BLOCKQUOTE> +<PRE> +doc +source + subj-C +build + template + Linux-386-GCC + Linux-386-SSE2-GCC + Linux-x86_64-GCC + Linux-ARM-VFPv2-GCC + Win32-MinGW + Win32-SSE2-MinGW + Win64-MinGW-w64 +</PRE> +</BLOCKQUOTE> +The majority of the TestFloat sources are provided in the <CODE>source</CODE> +directory. +The <NOBR><CODE>subj-C</CODE></NOBR> subdirectory contains the sources that +configure the all-in-one <CODE>testfloat</CODE> program to test the C +compiler’s implementation of the standard C types <CODE>float</CODE>, +<CODE>double</CODE>, and possibly <CODE>long</CODE> <CODE>double</CODE>. +The ‘<CODE>subj</CODE>’ in <NOBR><CODE>subj-C</CODE></NOBR> is an +abbreviation of <I>subject</I>, referring to the floating-point that is the +subject of the test. +If <CODE>testfloat</CODE> is retargeted to test other floating-point +implementations, the corresponding source files would be expected to be in +other subdirectories alongside <NOBR><CODE>subj-C</CODE></NOBR>, with names of +the form <NOBR><CODE>subj-<<I>target</I>></CODE></NOBR>. +More about retargeting <CODE>testfloat</CODE> is found in +<NOBR>section 6.4</NOBR>, <I>Specializing the <CODE>testfloat</CODE> +Program</I>. +</P> + +<P> +The <CODE>build</CODE> directory is intended to contain a subdirectory for each +target platform for which builds of the TestFloat programs may be created. +For each build target, the target’s subdirectory is where all derived +object files and the completed TestFloat executables are created. +The <CODE>template</CODE> subdirectory is not an actual build target but +contains sample files for creating new target directories. +</P> + +<P> +Ignoring the <CODE>template</CODE> directory, the supplied target directories +are intended to follow a naming system of +<NOBR><CODE><<I>execution-environment</I>>-<<I>compiler</I>></CODE></NOBR>. +For the example targets, +<NOBR><CODE><<I>execution-environment</I>></CODE></NOBR> is +<NOBR><CODE>Linux-386</CODE></NOBR>, <NOBR><CODE>Linux-386-SSE2</CODE></NOBR>, +<NOBR><CODE>Linux-x86_64</CODE></NOBR>, +<NOBR><CODE>Linux-ARM-VFPv2</CODE></NOBR>, <CODE>Win32</CODE>, +<NOBR><CODE>Win32-SSE2</CODE></NOBR>, or <CODE>Win64</CODE>, and +<NOBR><CODE><<I>compiler</I>></CODE></NOBR> is <CODE>GCC</CODE>, +<CODE>MinGW</CODE>, or <NOBR><CODE>MinGW-w64</CODE></NOBR>. +</P> + +<P> +All of the supplied target directories are merely examples that may or may not +be correct for compiling on any particular system. +There are currently no plans to include and maintain in the TestFloat package +the build files needed for a great many users’ compilation environments, +which can span a huge range of operating systems, compilers, and other tools. +</P> + +<P> +As supplied, each target directory contains two files: +<BLOCKQUOTE> +<PRE> +Makefile +platform.h +</PRE> +</BLOCKQUOTE> +The provided <CODE>Makefile</CODE> is written for GNU <CODE>make</CODE>. +A build of TestFloat for the specific target is begun by executing the +<CODE>make</CODE> command with the target directory as the current directory. +A completely different build tool can be used if an appropriate +<CODE>Makefile</CODE> equivalent is created. +</P> + +<P> +The <CODE>platform.h</CODE> header file exists to provide a location for +additional C declarations specific to the build target. +Every C source file of TestFloat contains a <CODE>#include</CODE> for +<CODE>platform.h</CODE>. +In many cases, the contents of <CODE>platform.h</CODE> can be as simple as one +or two lines of code. +If the target’s compiler or library has bugs or other shortcomings, +workarounds for these issues may be possible with target-specific declarations +in <CODE>platform.h</CODE>, without the need to modify the main TestFloat +sources. +</P> + +<P> +It may not be necessary to build all of the TestFloat programs. +For testing a floating-point implementation, typically +<CODE>testfloat_gen</CODE> and <CODE>testfloat</CODE> will not both be used, +and <CODE>testfloat_ver</CODE> may not be needed either. +The Makefile (or equivalent) can be modified not to create unneeded programs. +This may be especially relevant for the all-in-one test program +<CODE>testfloat</CODE>, which might not build without special attention. +</P> + + +<H2>5. Dependence on Berkeley SoftFloat</H2> + +<P> +In addition to the distributed sources, TestFloat depends on the existence of a +compatible Berkeley SoftFloat library and the corresponding header file +<CODE>softfloat.h</CODE>. +As mentioned earlier, SoftFloat is a separate package available at Web page +<A HREF="http://www.jhauser.us/arithmetic/SoftFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/SoftFloat.html</CODE></NOBR></A>. +The SoftFloat library must be compiled before the TestFloat programs can be +built. +In the example Makefiles, the locations of the SoftFloat header files and +pre-compiled library are specified by these macros: +<BLOCKQUOTE> +<DL> +<DT><CODE>SOFTFLOAT_INCLUDE_DIR</CODE> +<DD> +The path of the directory containing <CODE>softfloat.h</CODE>, as well as other +nonstandard header files referenced by <CODE>softfloat.h</CODE>, if any. +<DT><CODE>SOFTFLOAT_H</CODE> +<DD> +A list of the full paths of all SoftFloat header files needed by SoftFloat +clients. This list must include <CODE>softfloat.h</CODE> and may also include +other header files referenced by <CODE>softfloat.h</CODE>, such as +<CODE>softfloat_types.h</CODE>. +This macro is used only to establish build dependencies between the SoftFloat +header files and TestFloat’s source files, in case the SoftFloat header +files are changed. +<DT><CODE>SOFTFLOAT_LIB</CODE> +<DD> +The full path of the compiled SoftFloat library (usually +<CODE>softfloat.a</CODE> or <CODE>libsoftfloat.a</CODE>). +</DL> +</BLOCKQUOTE> +</P> + + +<H2>6. Issues for Porting TestFloat to a New Target</H2> + +<H3>6.1. Standard Headers <CODE><stdbool.h></CODE> and <CODE><stdint.h></CODE></H3> + +<P> +The TestFloat sources make use of standard headers +<CODE><stdbool.h></CODE> and <CODE><stdint.h></CODE>, which have +been part of the ISO C Standard Library since 1999. +With any recent compiler, these standard headers are likely to be supported, +even if the compiler does not claim complete conformance to the latest ISO C +Standard. +For older or nonstandard compilers, substitutes for +<CODE><stdbool.h></CODE> and <CODE><stdint.h></CODE> may need to be +created. +TestFloat depends on these names from <CODE><stdbool.h></CODE>: +<BLOCKQUOTE> +<PRE> +bool +true +false +</PRE> +</BLOCKQUOTE> +and on these names from <CODE><stdint.h></CODE>: +<BLOCKQUOTE> +<PRE> +uint16_t +uint32_t +uint64_t +int32_t +int64_t +UINT64_C +INT64_C +uint_least8_t +uint_fast8_t +uint_fast16_t +uint_fast32_t +uint_fast64_t +int_fast8_t +int_fast16_t +int_fast32_t +int_fast64_t +</PRE> +</BLOCKQUOTE> +</P> + + +<H3>6.2. Standard Header <CODE><fenv.h></CODE></H3> + +<P> +Because the supplied all-in-one <CODE>testfloat</CODE> program tests the +floating-point operations of the C language, it uses the facilities provided by +standard C header <CODE><fenv.h></CODE> to access the floating-point +environment of C, in particular to set the rounding mode and to access the +floating-point exception flags. +Like <CODE><stdbool.h></CODE> and <CODE><stdint.h></CODE>, +<CODE><fenv.h></CODE> has been part of the ISO C Standard Library since +1999, but older or nonstandard C compilers may not support it. +</P> + +<P> +Some form of standard header <CODE><fenv.h></CODE> is needed only if the +<CODE>testfloat</CODE> program is wanted <EM>and</EM> the program will not be +retargeted to invoke a floating-point implementation in a way that bypasses the +standard C environment. +Typically, if <CODE>testfloat</CODE> is wanted, it will be retargeted to invoke +a new floating-point implementation directly, making +<CODE><fenv.h></CODE> irrelevant. +For more about retargeting <CODE>testfloat</CODE>, see <NOBR>section 6.4</NOBR> +below, <I>Specializing the <CODE>testfloat</CODE> Program</I>. +</P> + + +<H3>6.3. Macros for Build Options</H3> + +<P> +The TestFloat source files are affected by several C preprocessor macros: +<BLOCKQUOTE> +<DL> +<DT><CODE>LITTLEENDIAN</CODE> +<DD> +Must be defined for little-endian machines; +must not be defined for big-endian machines. +<DT><CODE>INLINE</CODE> +<DD> +Can be defined to a sequence of tokens used to indicate that a C function +should be inlined. +If the compiler does not support the inlining of functions, this macro must not +be defined. +For compilers that conform to the C Standard’s rules for inline +functions, this macro can be defined as the single keyword <CODE>inline</CODE>. +For other compilers that follow a convention pre-dating the standardization of +<CODE>inline</CODE>, this macro may need to be defined to <CODE>extern</CODE> +<CODE>inline</CODE>. +<DT><CODE>THREAD_LOCAL</CODE> +<DD> +Can be defined to a sequence of tokens that, when appearing at the start of a +variable declaration, indicates to the C compiler that the variable is +<I>per-thread</I>, meaning that each execution thread gets its own separate +instance of the variable. +This macro is used in the supplied version of Berkeley SoftFloat’s header +<CODE>softfloat.h</CODE>, in the declarations of variables +<CODE>softfloat_roundingMode</CODE>, <CODE>softfloat_detectTininess</CODE>, +<CODE>extF80_roundingPrecision</CODE>, and +<CODE>softfloat_exceptionFlags</CODE>. +To use the supplied, unmodified header <CODE>softfloat.h</CODE>, this macro +must be defined (or not defined) the same as when the SoftFloat library was +built. +</DL> +<DL> +<DT><CODE>FLOAT16</CODE> +<DD> +Must be defined if the TestFloat programs are to support the +<NOBR>16-bit</NOBR> half-precision floating-point format. +<DT><CODE>FLOAT64</CODE> +<DD> +Must be defined if the TestFloat programs are to support the +<NOBR>64-bit</NOBR> double-precision floating-point format. +<DT><CODE>EXTFLOAT80</CODE> +<DD> +Must be defined if the TestFloat programs are to support the +<NOBR>80-bit</NOBR> double-extended-precision floating-point format. +<DT><CODE>FLOAT128</CODE> +<DD> +Must be defined if the TestFloat programs are to support the +<NOBR>128-bit</NOBR> quadruple-precision floating-point format. +<DT><CODE>FLOAT_ROUND_ODD</CODE> +<DD> +Must be defined if the TestFloat programs are to support rounding to odd +(jamming). +To be useful, this option also requires that the Berkeley SoftFloat library was +compiled with macro <CODE>SOFTFLOAT_ROUND_ODD</CODE> defined. +</DL> +</BLOCKQUOTE> +Following the usual custom <NOBR>for C</NOBR>, for all the macros except +<CODE>INLINE</CODE> and <CODE>THREAD_LOCAL</CODE>, the content of a +macro’s definition is irrelevant; +what matters is a macro’s effect on <CODE>#ifdef</CODE> directives. +</P> + +<P> +It is recommended that any definition of macros <CODE>LITTLEENDIAN</CODE>, +<CODE>INLINE</CODE>, and <CODE>THREAD_LOCAL</CODE> be made in a build +target’s <CODE>platform.h</CODE> header file, because these macros are +expected to be determined inflexibly by the target machine and compiler. +The other five macros select build options, and hence might be better located +in the target’s Makefile (or its equivalent). +</P> + + +<H3>6.4. Specializing the <CODE>testfloat</CODE> Program</H3> + +<P> +The supplied sources for the all-in-one <CODE>testfloat</CODE> program cause +<CODE>testfloat</CODE> to test the C compiler’s <CODE>float</CODE> and +<CODE>double</CODE> types for C operations <CODE>+</CODE>, <CODE>-</CODE>, +<CODE>*</CODE>, <CODE>/</CODE>, etc. +The supplied version is also capable of testing C type <CODE>long</CODE> +<CODE>double</CODE> if the sources are compiled with one of these macros +defined: +<BLOCKQUOTE> +<DL> +<DT><CODE>LONG_DOUBLE_IS_EXTFLOAT80</CODE> +<DD> +Indicates that type <CODE>long</CODE> <CODE>double</CODE> is +<NOBR>80-bit</NOBR> double-extended-precision floating-point. +<DT><CODE>LONG_DOUBLE_IS_FLOAT128</CODE> +<DD> +Indicates that type <CODE>long</CODE> <CODE>double</CODE> is +<NOBR>128-bit</NOBR> quadruple-precision floating-point. +</DL> +</BLOCKQUOTE> +By default, <CODE>testfloat</CODE> assumes that only the IEEE Standard’s +original four rounding modes (<CODE>near_even</CODE>, <CODE>minMag</CODE>, +<CODE>min</CODE>, and <CODE>max</CODE>) are supported by the floating-point +being tested. +For other rounding modes, additional macro can be defined: +<BLOCKQUOTE> +<DL> +<DT><CODE>SUBJFLOAT_ROUND_NEAR_MAXMAG</CODE> +<DD> +Indicates that the subject floating-point supports rounding mode +<CODE>near_maxMag</CODE> (nearest/away). +<DT><CODE>SUBJFLOAT_ROUND_ODD</CODE> +<DD> +Indicates that the subject floating-point supports rounding mode +<CODE>odd</CODE> (jamming). +</DL> +</BLOCKQUOTE> +</P> + +<P> +To test a new and/or different implementation of floating-point, +<CODE>testfloat</CODE> must normally be retargeted to invoke this other +floating-point instead of C’s floating-point. +Two source files define the functions that <CODE>testfloat</CODE> uses to +invoke floating-point operations for testing: +<BLOCKQUOTE> +<PRE> +subjfloat_config.h +subjfloat.c +</PRE> +</BLOCKQUOTE> +For the default target of testing C’s floating-point, these files are +contained in directory <NOBR><CODE>source/subj-C</CODE></NOBR> as discussed +earlier. +For a different subject floating-point, it is recommended that appropriate +versions of <CODE>subjfloat_config.h</CODE> and <CODE>subjfloat.c</CODE> be +stored in a sibling <NOBR><CODE>subj-<<I>target</I>></CODE></NOBR> +directory, where <CODE><<I>target</I>></CODE> names the particular +target. +</P> + +<P> +Header file <CODE>subjfloat_config.h</CODE> defines a macro of the form +<CODE>SUBJ_*</CODE> for each subject function supported. +For example, if function <CODE>subj_f32_add</CODE> exists to perform +<NOBR>32-bit</NOBR> floating-point addition, then +<CODE>subjfloat_config.h</CODE> should have a definition for macro +<CODE>SUBJ_F32_ADD</CODE>. +The actual function <CODE>subj_f32_add</CODE> is expected to be defined in +<CODE>subjfloat.c</CODE>, along with all other subject functions. +A common header file, <CODE>subjfloat.h</CODE>, (not target-specific) provides +prototype declarations for all possible subject functions that +<CODE>testfloat</CODE> may be compiled to test, whether actually existing or +not. +(There is no penalty for the header to declare prototypes of nonexistent +functions that are never called.) +For a specific build of <CODE>testfloat</CODE>, the <CODE>-list</CODE> option +will list all subject functions that the <CODE>testfloat</CODE> program is able +to invoke and thus test. +</P> + +<P> +In the source code as supplied, macros <CODE>LONG_DOUBLE_IS_EXTFLOAT80</CODE> +and <CODE>LONG_DOUBLE_IS_FLOAT128</CODE> affect only the target-specific source +files in <NOBR><CODE>source/subj-C</CODE></NOBR>, so these macros can be +ignored for any other subject floating-point that does not depend on them. +On the other hand, macros <CODE>SUBJFLOAT_ROUND_NEAR_MAXMAG</CODE> and +<CODE>SUBJFLOAT_ROUND_ODD</CODE> always determine whether the +<CODE>testfloat</CODE> program attempts to test rounding modes +<CODE>near_maxMag</CODE> and <CODE>odd</CODE>, regardless of the subject +floating-point. +</P> + + +<H3>6.5. Improving the Random Number Functions</H3> + +<P> +If you are serious about using TestFloat for testing floating-point, you should +consider replacing the random number functions in <CODE>random.c</CODE>. +The supplied random number functions are built on top of the standard C +<CODE>rand</CODE> function. +Because function <CODE>rand</CODE> is rather poor on some systems, the +functions in <CODE>random.c</CODE> assume very little about the quality of +<CODE>rand</CODE>. +As a result, <CODE>rand</CODE> is called more frequently than it might need to +be, shortening the time before random number sequences repeat, and possibly +wasting time as well. +If <CODE>rand</CODE> is better on a given target platform, or if another, +better random number generator is available (such as <CODE>rand48</CODE> on +UNIX-derived systems), TestFloat can be improved by overriding the given +<CODE>random.c</CODE> with a target-specific one. +</P> + +<P> +Rather than modifying the supplied file <CODE>random.c</CODE>, it is +recommended instead that a new, alternate file be created and the +target’s Makefile be modified to refer to that alternate file in place of +<CODE>random.c</CODE>. +</P> + + +<H2>7. Contact Information</H2> + +<P> +At the time of this writing, the most up-to-date information about TestFloat +and the latest release can be found at the Web page +<A HREF="http://www.jhauser.us/arithmetic/TestFloat.html"><NOBR><CODE>http://www.jhauser.us/arithmetic/TestFloat.html</CODE></NOBR></A>. +</P> + + +</BODY> + diff --git a/src/libs/softfloat-3e/testfloat/doc/testfloat.html b/src/libs/softfloat-3e/testfloat/doc/testfloat.html new file mode 100644 index 00000000..f9404e04 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/doc/testfloat.html @@ -0,0 +1,286 @@ + +<HTML> + +<HEAD> +<TITLE>testfloat</TITLE> +</HEAD> + +<BODY> + +<H1>Berkeley TestFloat Release 3e: <CODE>testfloat</CODE></H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + + +<H2>Overview</H2> + +<P> +The <CODE>testfloat</CODE> program tests an implementation of floating-point +arithmetic for conformity to the IEEE Standard for Binary Floating-Point +Arithmetic. +<CODE>testfloat</CODE> is part of the Berkeley TestFloat package, a small +collection of programs for performing such tests. +For general information about TestFloat, see file +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + +<P> +The <CODE>testfloat</CODE> program is an all-in-one tool for testing +floating-point arithmetic. +It generates test operand values, invokes a floating-point operation with the +generated operands, and examines the corresponding computed results, reporting +unexpected results as likely errors. +While the processes of generating inputs and examining results are generic, a +particular build of <CODE>testfloat</CODE> is limited to testing only the one +implementation of floating-point it has been compiled to invoke. +For example, while one instance of <CODE>testfloat</CODE> might be compiled to +execute a computer’s hardware instruction for floating-point addition, a +different version might be compiled to call a subroutine called +<CODE>myAddFloat</CODE> that is linked into the <CODE>testfloat</CODE> program. +To test a new implementation of floating-point (a new set of machine +instructions or a new set of subroutines), a new <CODE>testfloat</CODE> must be +compiled containing the code needed to invoke the new floating-point. +</P> + +<P> +The default build of <CODE>testfloat</CODE> assumes that C types +<CODE>float</CODE> and <CODE>double</CODE> are <NOBR>32-bit</NOBR> and +<NOBR>64-bit</NOBR> binary floating-point types conforming to the IEEE +Standard, and tests the C operations of <CODE>+</CODE>, <CODE>-</CODE>, +<CODE>*</CODE>, <CODE>/</CODE>, type conversions, etc. +This tests the floating-point arithmetic seen by C programs. +Depending on the compiler and the options selected during compilation, this may +or may not be the same as the computer’s floating-point hardware, if any. +</P> + +<P> +The <CODE>testfloat</CODE> program will ordinarily test an operation for all +five rounding modes defined by the IEEE Floating-Point Standard, one after the +other, plus possibly a sixth mode, <I>round to odd</I> (depending on the +options selected when <CODE>testfloat</CODE> was compiled). +If the rounding mode is not supposed to have any affect on the +results—for instance, some operations do not require rounding—only +the nearest/even rounding mode is checked. +For double-extended-precision operations affected by rounding precision +control, <CODE>testfloat</CODE> also tests all three rounding precision modes, +one after the other. +Testing can be limited to a single rounding mode and/or rounding precision with +appropriate command-line options. +</P> + +<P> +For more about the operation of <CODE>testfloat</CODE> and how to interpret its +output, refer to +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + + +<H2>Command Syntax</H2> + +<P> +The <CODE>testfloat</CODE> program is executed as a command with this syntax: +<BLOCKQUOTE> +<PRE> +testfloat [<<I>option</I>>...] <<I>function</I>> +</PRE> +</BLOCKQUOTE> +Square brackets (<CODE>[ ]</CODE>) denote optional arguments, +<CODE><<I>option</I>></CODE> is a supported option, and +<CODE><<I>function</I>></CODE> is the name of either a testable operation +or a function set. +The available options and function sets are documented below. +The <CODE>-list</CODE> option can be used to obtain a list of all testable +operations for a given build of <CODE>testfloat</CODE>. +If <CODE>testfloat</CODE> is executed without any arguments, a summary of usage +is written. +</P> + + +<H2>Options</H2> + +<P> +The <CODE>testfloat</CODE> program accepts several command options. +If mutually contradictory options are given, the last one has priority. +</P> + +<H3><CODE>-help</CODE></H3> + +<P> +The <CODE>-help</CODE> option causes a summary of program usage to be written, +after which the program exits. +</P> + +<H3><CODE>-list</CODE></H3> + +<P> +The <CODE>-list</CODE> option causes a list of testable operations to be +written, after which the program exits. +An operation is testable by <CODE>testfloat</CODE> if the program knows some +way to invoke the operation. +</P> + +<H3><CODE>-seed <<I>num</I>></CODE></H3> + +<P> +The <CODE>-seed</CODE> option sets the seed for the pseudo-random number +generator used for generating test cases. +The argument to <CODE>-seed</CODE> is a nonnegative integer. +Executing the same compiled <CODE>testfloat</CODE> program with the same +arguments (including the same pseudo-random number seed) should always perform +the same sequence of tests, whereas changing the pseudo-random number seed +should result in a different sequence of tests. +The default seed number <NOBR>is 1</NOBR>. +</P> + +<H3><CODE>-level <<I>num</I>></CODE></H3> + +<P> +The <CODE>-level</CODE> option sets the level of testing. +The argument to <CODE>-level</CODE> can be either 1 <NOBR>or 2</NOBR>. +The default is <NOBR>level 1</NOBR>. +Level 2 performs many more tests than <NOBR>level 1</NOBR> and thus can reveal +bugs not found by <NOBR>level 1</NOBR>. +</P> + +<H3><CODE>-errors <<I>num</I>></CODE></H3> + +<P> +The <CODE>-errors</CODE> option instructs <CODE>testfloat</CODE> to report no +more than the specified number of errors for any combination of operation, +rounding mode, etc. +The argument to <CODE>-errors</CODE> must be a nonnegative decimal integer. +Once the specified number of error reports has been generated, +<CODE>testfloat</CODE> ends the current test and begins the next one, if any. +The default is <NOBR><CODE>-errors</CODE> <CODE>20</CODE></NOBR>. +</P> + +<P> +Against intuition, <NOBR><CODE>-errors</CODE> <CODE>0</CODE></NOBR> causes +<CODE>testfloat</CODE> to report every error it finds. +</P> + +<H3><CODE>-errorstop</CODE></H3> + +<P> +The <CODE>-errorstop</CODE> option causes the program to exit after the first +operation for which any errors are reported. +</P> + +<H3><CODE>-forever</CODE></H3> + +<P> +The <CODE>-forever</CODE> option causes a single operation to be repeatedly +tested. +Only one rounding mode and/or rounding precision can be tested in a single +execution. +If not specified, the rounding mode defaults to nearest/even. +For <NOBR>80-bit</NOBR> double-extended-precision operations, the rounding +precision defaults to full double-extended precision. +The testing level is set to 2 by this option. +</P> + +<H3><CODE>-checkNaNs</CODE></H3> + +<P> +The <CODE>-checkNaNs</CODE> option causes <CODE>testfloat</CODE> to verify the +bitwise correctness of NaN results. +In order for this option to be sensible, <CODE>testfloat</CODE> must have been +compiled so that its internal reference implementation of floating-point +(Berkeley SoftFloat) generates the proper NaN results for the system being +tested. +</P> + +<H3><CODE>-checkInvInts</CODE></H3> + +<P> +The <CODE>-checkInvInts</CODE> option causes <CODE>testfloat</CODE> to verify +the bitwise correctness of integer results of invalid operations. +In order for this option to be sensible, <CODE>testfloat</CODE> must have been +compiled so that its internal reference implementation of floating-point +(Berkeley SoftFloat) generates the proper integer results for the system being +tested. +</P> + +<H3><CODE>-checkAll</CODE></H3> + +<P> +Enables both <CODE>-checkNaNs</CODE> and <CODE>-checkInvInts</CODE>. +</P> + +<H3><CODE>-precision32, -precision64, -precision80</CODE></H3> + +<P> +For <NOBR>80-bit</NOBR> double-extended-precision operations affected by +rounding precision control, the <CODE>-precision32</CODE> option restricts +testing to only the cases in which the rounding precision is +<NOBR>32 bits</NOBR>, equivalent to <NOBR>32-bit</NOBR> single-precision. +The other rounding precision choices are not tested. +Likewise, <CODE>-precision64</CODE> fixes the rounding precision to +<NOBR>64 bits</NOBR>, equivalent to <NOBR>64-bit</NOBR> double-precision, and +<CODE>-precision80</CODE> fixes the rounding precision to the full +<NOBR>80 bits</NOBR> of the double-extended-precision format. +All these options are ignored for operations not affected by rounding precision +control. +</P> + +<P> +The precision-control options may not be supported at all if no +double-extended-precision operations are testable. +</P> + +<H3><CODE>-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd</CODE></H3> + +<P> +The <CODE>-rnear_even</CODE> option restricts testing to only the cases in +which the rounding mode is nearest/even. +The other rounding mode choices are not tested. +Likewise, <CODE>-rnear_maxMag</CODE> forces rounding to nearest/maximum +magnitude (nearest-away), <CODE>-rminMag</CODE> forces rounding to minimum +magnitude (toward zero), <CODE>-rmin</CODE> forces rounding to minimum (down, +toward negative infinity), <CODE>-rmax</CODE> forces rounding to maximum (up, +toward positive infinity), and <CODE>-rodd</CODE>, if supported, forces +rounding to odd. +These options are ignored for operations that are exact and thus do not round, +or that have the rounding mode included in the function name (such as +<CODE>f32_to_i32_r_near_maxMag</CODE>). +</P> + +<H3><CODE>-tininessbefore, -tininessafter</CODE></H3> + +<P> +The <CODE>-tininessbefore</CODE> option indicates that the floating-point +implementation being tested detects tininess on underflow before rounding. +The <CODE>-tininessafter</CODE> option indicates that tininess is detected +after rounding. +The <CODE>testfloat</CODE> program alters its expectations accordingly. +These options override the default selected when <CODE>testfloat</CODE> was +compiled. +Choosing the wrong one of these two options should cause error reports for some +(but not all) operations. +</P> + + +<H2>Function Sets</H2> + +<P> +Just as <CODE>testfloat</CODE> can test an operation for all five or six +rounding modes in sequence, multiple operations can be tested with a single +execution of <CODE>testfloat</CODE>. +Two sets are recognized: <CODE>-all1</CODE> and <CODE>-all2</CODE>. +The set <CODE>-all1</CODE> is all one-operand operations, while +<CODE>-all2</CODE> is all two-operand operations. +A function set is used in place of an operation name in the +<CODE>testfloat</CODE> command line, such as +<BLOCKQUOTE> +<PRE> +testfloat [<<I>option</I>>...] -all1 +</PRE> +</BLOCKQUOTE> +</P> + + +</BODY> + diff --git a/src/libs/softfloat-3e/testfloat/doc/testfloat_gen.html b/src/libs/softfloat-3e/testfloat/doc/testfloat_gen.html new file mode 100644 index 00000000..5190567c --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/doc/testfloat_gen.html @@ -0,0 +1,367 @@ + +<HTML> + +<HEAD> +<TITLE>testfloat_gen</TITLE> +</HEAD> + +<BODY> + +<H1>Berkeley TestFloat Release 3e: <CODE>testfloat_gen</CODE></H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + + +<H2>Overview</H2> + +<P> +The <CODE>testfloat_gen</CODE> program generates test cases for testing that an +implementation of floating-point arithmetic conforms to the IEEE Standard for +Binary Floating-Point Arithmetic. +<CODE>testfloat_gen</CODE> is part of the Berkeley TestFloat package, a small +collection of programs for performing such tests. +For general information about TestFloat, see file +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + +<P> +A single execution of <CODE>testfloat_gen</CODE> generates test cases for only +a single floating-point operation and associated options. +The <CODE>testfloat_gen</CODE> program must be repeatedly executed to generate +test cases for each operation to be tested. +</P> + +<P> +The <CODE>testfloat_gen</CODE> program writes the test cases it generates to +standard output. +This output can either be captured in a file through redirection, or be piped +to another program that exercises a floating-point operation using the test +cases as they are supplied. +Depending on use, the total output from <CODE>testfloat_gen</CODE> can be +large, so piping to another program may be the best choice to avoid using +inordinate file space. +The format of <CODE>testfloat_gen</CODE>’s output is raw hexadecimal +text, described in the section below titled <I>Output Format</I>. +</P> + + +<H2>Command Syntax</H2> + +<P> +The <CODE>testfloat_gen</CODE> program is executed as a command in one of these +forms: +<BLOCKQUOTE> +<PRE> +testfloat_gen [<<I>option</I>>...] <<I>type</I>> +testfloat_gen [<<I>option</I>>...] <<I>function</I>> +</PRE> +</BLOCKQUOTE> +Square brackets (<CODE>[ ]</CODE>) denote optional arguments, and +<CODE><<I>option</I>></CODE> is a supported option, documented below. +A <CODE>testfloat_gen</CODE> command expects either a +<CODE><<I>type</I>></CODE> specifying the type and number of outputs or a +<CODE><<I>function</I>></CODE> naming a floating-point operation. +If <CODE>testfloat_gen</CODE> is executed without any arguments, a summary of +usage is written. +</P> + +<P> +A <CODE><<I>type</I>></CODE> can be one of the following: +<BLOCKQUOTE> +<TABLE CELLSPACING=0 CELLPADDING=0> +<TR> +<TD><CODE>ui32</CODE></TD> +<TD>unsigned <NOBR>32-bit</NOBR> integers</TD> +</TR> +<TR> +<TD><CODE>ui64</CODE></TD> +<TD>unsigned <NOBR>64-bit</NOBR> integers</TD> +</TR> +<TR> +<TD><CODE>i32</CODE></TD> +<TD>signed <NOBR>32-bit</NOBR> integers</TD> +</TR> +<TR> +<TD><CODE>i64</CODE></TD> +<TD>signed <NOBR>64-bit</NOBR> integers</TD> +</TR> +<TR> +<TD><CODE>f16 [<<I>num</I>>]</CODE></TD> +<TD>one or more <NOBR>16-bit</NOBR> half-precision floating-point values</TD> +</TR> +<TR> +<TD><CODE>f32 [<<I>num</I>>]</CODE></TD> +<TD>one or more <NOBR>32-bit</NOBR> single-precision floating-point values</TD> +</TR> +<TR> +<TD><CODE>f64 [<<I>num</I>>]</CODE></TD> +<TD>one or more <NOBR>64-bit</NOBR> double-precision floating-point values</TD> +</TR> +<TR> +<TD><CODE>extF80 [<<I>num</I>>] </CODE></TD> +<TD>one or more <NOBR>80-bit</NOBR> double-extended-precision floating-point +values</TD> +</TR> +<TR> +<TD><CODE>f128 [<<I>num</I>>]</CODE></TD> +<TD>one or more <NOBR>128-bit</NOBR> quadruple-precision floating-point +values</TD> +</TR> +</TABLE> +</BLOCKQUOTE> +Optional <CODE><<I>num</I>></CODE> is one of 1, 2, <NOBR>or 3</NOBR>. +If a <CODE><<I>type</I>></CODE> is given without +<CODE><<I>num</I>></CODE> (such as <CODE>ui32</CODE> or +<CODE>f64</CODE>), <CODE>testfloat_gen</CODE> outputs a list of values of the +specified type, one value per line, appropriate for testing a floating-point +operation with exactly one operand of the given type. +If a floating-point type and number are given (such as +<NOBR><CODE>f32</CODE> <CODE>2</CODE></NOBR> or +<NOBR><CODE>extF80</CODE> <CODE>1</CODE></NOBR>), <CODE>testfloat_gen</CODE> +outputs the specified number of values per line, appropriate for testing a +floating-point operation with that number of operands. +Although the exact operation being tested is not specified, the test cases +output by <CODE>testfloat_gen</CODE> cover all standard floating-point +operations, to the degree explained in +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + +<P> +If a <CODE><<I>function</I>></CODE> operation name is given, then each +line of output from <CODE>testfloat_gen</CODE> contains not only the operands +for that operation (as would be generated by an appropriate +<CODE><<I>type</I>></CODE> argument) but also the expected results as +determined by <CODE>testfloat_gen</CODE>’s internal floating-point +emulation (Berkeley SoftFloat). +The available operation names are listed in +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +In all cases, floating-point operations have two results: +first, a value, which may be floating-point, integer, or Boolean, and, second, +the floating-point exception flags raised by the operation. +If the output from a tested floating-point operation does not match the +expected output specified by <CODE>testfloat_gen</CODE>, this may or may not +indicate an error in the floating-point operation. +For further explanation, see +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>, +especially the section titled <I>Variations Allowed by the IEEE Floating-Point +Standard</I>. +</P> + + +<H2>Options</H2> + +<P> +The <CODE>testfloat_gen</CODE> program accepts several command options. +If mutually contradictory options are given, the last one has priority. +</P> + +<H3><CODE>-help</CODE></H3> + +<P> +The <CODE>-help</CODE> option causes a summary of program usage to be written, +after which the program exits. +</P> + +<H3><CODE>-prefix <<I>text</I>></CODE></H3> + +<P> +The <CODE>-prefix</CODE> option causes <CODE>testfloat_gen</CODE> to write the +supplied text argument verbatim as the first line of output before any test +cases. +This can be used, for example, to indicate to a downstream program what kind of +test to perform for the test cases that follow. +</P> + +<H3><CODE>-seed <<I>num</I>></CODE></H3> + +<P> +The <CODE>-seed</CODE> option sets the seed for the pseudo-random number +generator used for generating test cases. +The argument to <CODE>-seed</CODE> is a nonnegative integer. +Executing the same <CODE>testfloat_gen</CODE> program with the same arguments +(including the same pseudo-random number seed) should always generate the same +sequence of test cases, whereas changing the pseudo-random number seed should +result in a different sequence of test cases. +The default seed number <NOBR>is 1</NOBR>. +</P> + +<H3><CODE>-level <<I>num</I>></CODE></H3> + +<P> +The <CODE>-level</CODE> option sets the level of testing. +The argument to <CODE>-level</CODE> can be either 1 <NOBR>or 2</NOBR>. +The default is <NOBR>level 1</NOBR>. +<NOBR>Level 2</NOBR> causes many more test cases to be generated, with better +coverage, than <NOBR>level 1</NOBR>. +</P> + +<H3><CODE>-n <<I>num</I>></CODE></H3> + +<P> +Option <CODE>-n</CODE> specifies the number of test cases to generate. +For each <CODE><<I>type</I>></CODE> or +<CODE><<I>function</I>></CODE> and each testing level (set by +<CODE>-level</CODE>), there is a minimum value that <CODE>testfloat_gen</CODE> +will accept for <CODE><<I>num</I>></CODE>. +If no <CODE>-n</CODE> option is given, the number of test cases generated by +<CODE>testfloat_gen</CODE> equals the minimum value acceptable for the +<CODE>-n</CODE> argument. +Option <CODE>-n</CODE> cannot be used to reduce this number, but can increase +it, without changing the testing level. +</P> + +<H3><CODE>-forever</CODE></H3> + +<P> +The <CODE>-forever</CODE> option causes test cases to be generated +indefinitely, without limit (until the program is terminated by some external +cause). +The testing level is set to 2 by this option. +</P> + +<H3><CODE>-precision32, -precision64, -precision80</CODE></H3> + +<P> +When a <CODE><<I>function</I>></CODE> is specified that is an +<NOBR>80-bit</NOBR> double-extended-precision operation affected by rounding +precision control, the <CODE>-precision32</CODE> option sets the rounding +precision to <NOBR>32 bits</NOBR>, equivalent to <NOBR>32-bit</NOBR> +single-precision. +Likewise, <CODE>-precision64</CODE> sets the rounding precision to +<NOBR>64 bits</NOBR>, equivalent to <NOBR>64-bit</NOBR> double-precision, and +<CODE>-precision80</CODE> sets the rounding precision to the full +<NOBR>80 bits</NOBR> of the double-extended-precision format. +All these options are ignored for operations not affected by rounding precision +control. +When rounding precision is applicable but not specified, the default is the +full <NOBR>80 bits</NOBR>, same as <CODE>-precision80</CODE>. +</P> + +<H3><CODE>-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd</CODE></H3> + +<P> +When a <CODE><<I>function</I>></CODE> is specified that requires +rounding, the <CODE>-rnear_even</CODE> option sets the rounding mode to +nearest/even; +<CODE>-rnear_maxMag</CODE> sets rounding to nearest/maximum magnitude +(nearest-away); +<CODE>-rminMag</CODE> sets rounding to minimum magnitude (toward zero); +<CODE>-rmin</CODE> sets rounding to minimum (down, toward negative infinity); +<CODE>-rmax</CODE> sets rounding to maximum (up, toward positive infinity); +and <CODE>-rodd</CODE>, if supported, sets rounding to odd. +These options are ignored for operations that are exact and thus do not round. +When rounding mode is relevant but not specified, the default is to round to +nearest/even, same as <CODE>-rnear_even</CODE>. +</P> + +<H3><CODE>-tininessbefore, -tininessafter</CODE></H3> + +<P> +When a <CODE><<I>function</I>></CODE> is specified that requires +rounding, the <CODE>-tininessbefore</CODE> option indicates that tininess on +underflow will be detected before rounding, while <CODE>-tininessafter</CODE> +indicates that tininess on underflow will be detected after rounding. +These options are ignored for operations that are exact and thus do not round. +When the method of tininess detection matters but is not specified, the default +is to detect tininess on underflow after rounding, same as +<CODE>-tininessafter</CODE>. +</P> + +<H3><CODE>-notexact, -exact</CODE></H3> + +<P> +When a <CODE><<I>function</I>></CODE> is specified that rounds to an +integer (either conversion to an integer type or a <CODE>roundToInt</CODE> +operation), the <CODE>-notexact</CODE> option indicates that the <I>inexact</I> +exception flag is never raised, while <CODE>-exact</CODE> indicates that the +<I>inexact</I> exception flag is to be raised if the result is inexact. +For other operations, these options are ignored. +If neither option is specified, the default is not to raise the <I>inexact</I> +exception flag when rounding to an integer, same as <CODE>-notexact</CODE>. +</P> + + +<H2>Output Format</H2> + +<P> +For each test case generated, <CODE>testfloat_gen</CODE> writes a single line +of text to standard output. +When the <CODE>testfloat_gen</CODE> command is given a +<CODE><<I>type</I>></CODE> argument, each test case consists of either +one integer value or one, two, or three floating-point values. +Each value is written to output as a raw hexadecimal number. +When there is more than one value per line, they are separated by spaces. +For example, output from executing +<BLOCKQUOTE> +<PRE> +testfloat_gen f64 2 +</PRE> +</BLOCKQUOTE> +might look like this: +<BLOCKQUOTE> +<PRE> +3F90EB5825D6851E C3E0080080000000 +41E3C00000000000 C182024F8AE474A8 +7FD80FFFFFFFFFFF 7FEFFFFFFFFFFF80 +3FFFED6A25C534BE 3CA1000000020000 +... +</PRE> +</BLOCKQUOTE> +with each hexadecimal number being one <NOBR>64-bit</NOBR> floating-point +value. +Note that, for floating-point values, the sign and exponent are at the +most-significant end of the number. +Thus, for the first number on the first line above, the leading hexadecimal +digits <CODE>3F9</CODE> are the sign and encoded exponent of the +<NOBR>64-bit</NOBR> floating-point value, and the remaining digits are the +encoded significand. +</P> + +<P> +When <CODE>testfloat_gen</CODE> is given a <CODE><<I>function</I>></CODE> +operation name, each line of output has not only the operands for the operation +but also the expected output, consisting of a result value and the exception +flags that are raised. +For example, the output from +<BLOCKQUOTE> +<PRE> +testfloat_gen f64_add +</PRE> +</BLOCKQUOTE> +could include these lines: +<BLOCKQUOTE> +<PRE> +3F90EB5825D6851E C3E0080080000000 C3E0080080000000 01 +41E3C00000000000 C182024F8AE474A8 41E377F6C1D46E2D 01 +7FD80FFFFFFFFFFF 7FEFFFFFFFFFFF80 7FF0000000000000 05 +3FFFED6A25C534BE 3CA1000000020000 3FFFED6A25C534BF 01 +... +</PRE> +</BLOCKQUOTE> +On each line, the first two numbers are the operands for the floating-point +addition, and the third and fourth numbers are the expected floating-point +result (the sum) and the exception flags raised. +Exception flags are encoded with one bit per flag as follows: +<BLOCKQUOTE> +<TABLE CELLSPACING=0 CELLPADDING=0> +<TR> + <TD>bit 0<CODE> </CODE></TD> + <TD><I>inexact</I> exception</TD> +</TR> +<TR><TD>bit 1</TD><TD><I>underflow</I> exception</TD></TR> +<TR><TD>bit 2</TD><TD><I>overflow</I> exception</TD></TR> +<TR> + <TD>bit 3</TD> + <TD><I>infinite</I> exception (“divide by zero”)</TD> +</TR> +<TR><TD>bit 4</TD><TD><I>invalid</I> exception</TD></TR> +</TABLE> +</BLOCKQUOTE> +</P> + + +</BODY> + diff --git a/src/libs/softfloat-3e/testfloat/doc/testfloat_ver.html b/src/libs/softfloat-3e/testfloat/doc/testfloat_ver.html new file mode 100644 index 00000000..0790896b --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/doc/testfloat_ver.html @@ -0,0 +1,270 @@ + +<HTML> + +<HEAD> +<TITLE>testfloat_ver</TITLE> +</HEAD> + +<BODY> + +<H1>Berkeley TestFloat Release 3e: <CODE>testfloat_ver</CODE></H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + + +<H2>Overview</H2> + +<P> +The <CODE>testfloat_ver</CODE> program accepts test-case results obtained from +exercising an implementation of floating-point arithmetic and verifies that +those results conform to the IEEE Standard for Binary Floating-Point +Arithmetic. +<CODE>testfloat_ver</CODE> is part of the Berkeley TestFloat package, a small +collection of programs for performing such tests. +For general information about TestFloat, see file +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + +<P> +A single execution of <CODE>testfloat_ver</CODE> verifies results for only a +single floating-point operation and associated options. +The <CODE>testfloat_ver</CODE> program must be repeatedly executed to verify +results for each operation to be tested. +</P> + +<P> +The test cases to be verified are read by <CODE>testfloat_ver</CODE> from +standard input. +This input will typically be piped from another program that, for each test +case, invokes the floating-point operation and writes out the results. +The format of <CODE>testfloat_ver</CODE>’s input is raw hexadecimal text, +described in the section below titled <I>Input Format</I>. +</P> + +<P> +For each test case given to it, <CODE>testfloat_ver</CODE> examines the +computed results and reports any unexpected results as likely errors. + +For more about the operation of <CODE>testfloat_ver</CODE> and how to interpret +its output, refer to +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + + +<H2>Command Syntax</H2> + +<P> +The <CODE>testfloat_ver</CODE> program is executed as a command with this +syntax: +<BLOCKQUOTE> +<PRE> +testfloat_ver [<<I>option</I>>...] <<I>function</I>> +</PRE> +</BLOCKQUOTE> +Square brackets (<CODE>[ ]</CODE>) denote optional arguments, +<CODE><<I>option</I>></CODE> is a supported option, and +<CODE><<I>function</I>></CODE> is the name of a testable operation. +The available options are documented below. +The testable operation names are listed in +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +If <CODE>testfloat_ver</CODE> is executed without any arguments, a summary of +usage is written. +</P> + + +<H2>Options</H2> + +<P> +The <CODE>testfloat_ver</CODE> program accepts several command options. +If mutually contradictory options are given, the last one has priority. +</P> + +<H3><CODE>-help</CODE></H3> + +<P> +The <CODE>-help</CODE> option causes a summary of program usage to be written, +after which the program exits. +</P> + +<H3><CODE>-errors <<I>num</I>></CODE></H3> + +<P> +The <CODE>-errors</CODE> option instructs <CODE>testfloat_ver</CODE> to report +no more than the specified number of errors. +The argument to <CODE>-errors</CODE> must be a nonnegative decimal integer. +Once the specified number of error reports has been generated, the program +exits. +The default is <NOBR><CODE>-errors</CODE> <CODE>20</CODE></NOBR>. +</P> + +<P> +Against intuition, <NOBR><CODE>-errors</CODE> <CODE>0</CODE></NOBR> causes +<CODE>testfloat_ver</CODE> to continue for any number of errors. +</P> + +<H3><CODE>-checkNaNs</CODE></H3> + +<P> +The <CODE>-checkNaNs</CODE> option causes <CODE>testfloat_ver</CODE> to verify +the bitwise correctness of NaN results. +In order for this option to be sensible, <CODE>testfloat_ver</CODE> must have +been compiled so that its internal reference implementation of floating-point +(Berkeley SoftFloat) generates the proper NaN results for the system being +tested. +</P> + +<H3><CODE>-checkInvInts</CODE></H3> + +<P> +The <CODE>-checkInvInts</CODE> option causes <CODE>testfloat_ver</CODE> to +verify the bitwise correctness of integer results of invalid operations. +In order for this option to be sensible, <CODE>testfloat_ver</CODE> must have +been compiled so that its internal reference implementation of floating-point +(Berkeley SoftFloat) generates the proper integer results for the system being +tested. +</P> + +<H3><CODE>-checkAll</CODE></H3> + +<P> +Enables both <CODE>-checkNaNs</CODE> and <CODE>-checkInvInts</CODE>. +</P> + +<H3><CODE>-precision32, -precision64, -precision80</CODE></H3> + +<P> +When <CODE><<I>function</I>></CODE> is an <NOBR>80-bit</NOBR> +double-extended-precision operation affected by rounding precision control, the +<CODE>-precision32</CODE> option indicates that the rounding precision should +be <NOBR>32 bits</NOBR>, equivalent to <NOBR>32-bit</NOBR> single-precision. +Likewise, <CODE>-precision64</CODE> indicates that the rounding precision +should be <NOBR>64 bits</NOBR>, equivalent to <NOBR>64-bit</NOBR> +double-precision, and <CODE>-precision80</CODE> indicates that the rounding +precision should be the full <NOBR>80 bits</NOBR> of the +double-extended-precision format. +All these options are ignored for operations not affected by rounding precision +control. +When rounding precision is applicable but not specified, the default assumption +is the full <NOBR>80 bits</NOBR>, same as <CODE>-precision80</CODE>. +</P> + +<H3><CODE>-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd</CODE></H3> + +<P> +When <CODE><<I>function</I>></CODE> is an operation that requires +rounding, the <CODE>-rnear_even</CODE> option indicates that rounding should be +to nearest/even, <CODE>-rnear_maxMag</CODE> indicates rounding to +nearest/maximum magnitude (nearest-away), <CODE>-rminMag</CODE> indicates +rounding to minimum magnitude (toward zero), <CODE>-rmin</CODE> indicates +rounding to minimum (down, toward negative infinity), <CODE>-rmax</CODE> +indicates rounding to maximum (up, toward positive infinity), and +<CODE>-rodd</CODE>, if supported, indicates rounding to odd. +These options are ignored for operations that are exact and thus do not round. +When rounding mode is relevant but not specified, the default assumption is +rounding to nearest/even, same as <CODE>-rnear_even</CODE>. +</P> + +<H3><CODE>-tininessbefore, -tininessafter</CODE></H3> + +<P> +When <CODE><<I>function</I>></CODE> is an operation that requires +rounding, the <CODE>-tininessbefore</CODE> option indicates that tininess on +underflow should be detected before rounding, while <CODE>-tininessafter</CODE> +indicates that tininess on underflow should be detected after rounding. +These options are ignored for operations that are exact and thus do not round. +When the method of tininess detection matters but is not specified, the default +assumption is that tininess should be detected after rounding, same as +<CODE>-tininessafter</CODE>. +</P> + +<H3><CODE>-notexact, -exact</CODE></H3> + +<P> +When <CODE><<I>function</I>></CODE> is an operation that rounds to an +integer (either conversion to an integer type or a <CODE>roundToInt</CODE> +operation), the <CODE>-notexact</CODE> option indicates that the <I>inexact</I> +exception flag should never be raised, while <CODE>-exact</CODE> indicates that +the <I>inexact</I> exception flag should be raised when the result is inexact. +For other operations, these options are ignored. +If neither option is specified, the default assumption is that the +<I>inexact</I> exception flag should not be raised when rounding to an integer, +same as <CODE>-notexact</CODE>. +</P> + + +<H2>Input Format</H2> + +<P> +For a given <CODE><<I>function</I>></CODE> argument, the input format +expected by <CODE>testfloat_ver</CODE> is the same as the output generated by +program +<A HREF="testfloat_gen.html"><NOBR><CODE>testfloat_gen</CODE></NOBR></A> for +the same argument. +</P> + +<P> +Input to <CODE>testfloat_ver</CODE> is expected to be text, with each line +containing the data for one test case. +The number of input lines thus equals the number of test cases. +A single test case is organized as follows: first are the operands for the +operation, next is the result value obtained, and last is a number indicating +the exception flags that were raised. +These values are all expected to be provided as raw hexadecimal numbers +separated on the line by spaces. +For example, for the command +<BLOCKQUOTE> +<PRE> +testfloat_ver f64_add +</PRE> +</BLOCKQUOTE> +valid input could include these lines: +<BLOCKQUOTE> +<PRE> +3F90EB5825D6851E C3E0080080000000 C3E0080080000000 01 +41E3C00000000000 C182024F8AE474A8 41E377F6C1D46E2D 01 +7FD80FFFFFFFFFFF 7FEFFFFFFFFFFF80 7FF0000000000000 05 +3FFFED6A25C534BE 3CA1000000020000 3FFFED6A25C534BF 01 +... +</PRE> +</BLOCKQUOTE> +On each line above, the first two hexadecimal numbers represent the +<NOBR>64-bit</NOBR> floating-point operands, the third hexadecimal number is +the <NOBR>64-bit</NOBR> floating-point result of the operation (the sum), and +the last hexadecimal number gives the exception flags that were raised by the +operation. +</P> + +<P> +Note that, for floating-point values, the sign and exponent are at the +most-significant end of the number. +Thus, for the first number on the first line above, the leading hexadecimal +digits <CODE>3F9</CODE> are the sign and encoded exponent of the +<NOBR>64-bit</NOBR> floating-point value, and the remaining digits are the +encoded significand. +</P> + +<P> +Exception flags are encoded with one bit per flag as follows: +<BLOCKQUOTE> +<TABLE CELLSPACING=0 CELLPADDING=0> +<TR> + <TD>bit 0<CODE> </CODE></TD> + <TD><I>inexact</I> exception</TD> +</TR> +<TR><TD>bit 1</TD><TD><I>underflow</I> exception</TD></TR> +<TR><TD>bit 2</TD><TD><I>overflow</I> exception</TD></TR> +<TR> + <TD>bit 3</TD> + <TD><I>infinite</I> exception (“divide by zero”)</TD> +</TR> +<TR><TD>bit 4</TD><TD><I>invalid</I> exception</TD></TR> +</TABLE> +</BLOCKQUOTE> +</P> + + +</BODY> + diff --git a/src/libs/softfloat-3e/testfloat/doc/testsoftfloat.html b/src/libs/softfloat-3e/testfloat/doc/testsoftfloat.html new file mode 100644 index 00000000..09e488b1 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/doc/testsoftfloat.html @@ -0,0 +1,236 @@ + +<HTML> + +<HEAD> +<TITLE>testsoftfloat</TITLE> +</HEAD> + +<BODY> + +<H1>Berkeley TestFloat Release 3e: <CODE>testsoftfloat</CODE></H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + + +<H2>Overview</H2> + +<P> +The <CODE>testsoftfloat</CODE> program tests that a build of the Berkeley +SoftFloat library conforms to the IEEE Standard for Binary Floating-Point +Arithmetic as expected. +Program <CODE>testsoftfloat</CODE> is part of the Berkeley TestFloat package, a +small collection of programs for performing such tests. +For general information about TestFloat, as well as for basics about the +operation of <CODE>testsoftfloat</CODE> and how to interpret its output, see +file +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + +<P> +Note that, even if there are no bugs in the source code for SoftFloat (not +guaranteed), a build of SoftFloat might still fail due to an issue with the +build process, such as an incompatible compiler option or a compiler bug. +</P> + +<P> +The <CODE>testsoftfloat</CODE> program will ordinarily test a function for all +five rounding modes defined by the IEEE Floating-Point Standard, one after the +other, plus possibly a sixth mode, <I>round to odd</I> (depending on the +options selected when <CODE>testsoftfloat</CODE> was compiled). +If an operation is not supposed to require rounding, it will by default be +tested only with the rounding mode set to <CODE>near_even</CODE> +(nearest/even). +In the same way, if an operation is affected by the way in which underflow +tininess is detected, <CODE>testsoftfloat</CODE> tests the function with +tininess detected both before rounding and after rounding. +For <NOBR>80-bit</NOBR> double-extended-precision operations affected by +rounding precision control, <CODE>testsoftfloat</CODE> also tests the function +for all three rounding precision modes, one after the other. +Testing can be limited to a single rounding mode, a single tininess mode, +and/or a single rounding precision with appropriate command-line options. +</P> + + +<H2>Command Syntax</H2> + +<P> +The <CODE>testsoftfloat</CODE> program is executed as a command with this +syntax: +<BLOCKQUOTE> +<PRE> +testsoftfloat [<<I>option</I>>...] <<I>function</I>> +</PRE> +</BLOCKQUOTE> +Square brackets (<CODE>[ ]</CODE>) denote optional arguments, +<CODE><<I>option</I>></CODE> is a supported option, and +<CODE><<I>function</I>></CODE> is the name of either a testable function +or a function set. +The available options and function sets are documented below. +If <CODE>testsoftfloat</CODE> is executed without any arguments, a summary of +usage is written. +</P> + + +<H2>Options</H2> + +<P> +The <CODE>testsoftfloat</CODE> program accepts several command options. +If mutually contradictory options are given, the last one has priority. +</P> + +<H3><CODE>-help</CODE></H3> + +<P> +The <CODE>-help</CODE> option causes a summary of program usage to be written, +after which the program exits. +</P> + +<H3><CODE>-seed <<I>num</I>></CODE></H3> + +<P> +The <CODE>-seed</CODE> option sets the seed for the pseudo-random number +generator used for generating test cases. +The argument to <CODE>-seed</CODE> is a nonnegative integer. +Executing the same <CODE>testsoftfloat</CODE> program with the same arguments +(including the same pseudo-random number seed) should always perform the same +sequence of tests, whereas changing the pseudo-random number seed should result +in a different sequence of tests. +The default seed number <NOBR>is 1</NOBR>. +</P> + +<H3><CODE>-level <<I>num</I>></CODE></H3> + +<P> +The <CODE>-level</CODE> option sets the level of testing. +The argument to <CODE>-level</CODE> can be either 1 <NOBR>or 2</NOBR>. +The default is <NOBR>level 1</NOBR>. +Level 2 performs many more tests than <NOBR>level 1</NOBR> and thus can reveal +bugs not found by <NOBR>level 1</NOBR>. +</P> + +<H3><CODE>-errors <<I>num</I>></CODE></H3> + +<P> +The <CODE>-errors</CODE> option instructs <CODE>testsoftfloat</CODE> to report +no more than the specified number of errors for any combination of function, +rounding mode, etc. +The argument to <CODE>-errors</CODE> must be a nonnegative decimal integer. +Once the specified number of error reports has been generated, +<CODE>testsoftfloat</CODE> ends the current test and begins the next one, if +any. +The default is <NOBR><CODE>-errors</CODE> <CODE>20</CODE></NOBR>. +</P> + +<P> +Against intuition, <NOBR><CODE>-errors</CODE> <CODE>0</CODE></NOBR> causes +<CODE>testsoftfloat</CODE> to report every error it finds. +</P> + +<H3><CODE>-errorstop</CODE></H3> + +<P> +The <CODE>-errorstop</CODE> option causes the program to exit after the first +function for which any errors are reported. +</P> + +<H3><CODE>-forever</CODE></H3> + +<P> +The <CODE>-forever</CODE> option causes a single function to be repeatedly +tested. +Only one rounding mode and/or rounding precision can be tested in a single +execution. +If not specified, the rounding mode defaults to nearest/even. +For <NOBR>80-bit</NOBR> double-extended-precision functions, the rounding +precision defaults to full double-extended precision. +The testing level is set to 2 by this option. +</P> + +<H3><CODE>-precision32, -precision64, -precision80</CODE></H3> + +<P> +For <NOBR>80-bit</NOBR> double-extended-precision funcions affected by +rounding precision control, the <CODE>-precision32</CODE> option restricts +testing to only the cases in which the rounding precision is +<NOBR>32 bits</NOBR>, equivalent to <NOBR>32-bit</NOBR> single-precision. +The other rounding precision choices are not tested. +Likewise, <CODE>-precision64</CODE> fixes the rounding precision to +<NOBR>64 bits</NOBR>, equivalent to <NOBR>64-bit</NOBR> double-precision; +and <CODE>-precision80</CODE> fixes the rounding precision to the full +<NOBR>80 bits</NOBR> of the double-extended-precision format. +All these options are ignored for operations not affected by rounding precision +control. +</P> + +<H3><CODE>-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd</CODE></H3> + +<P> +The <CODE>-rnear_even</CODE> option restricts testing to only the cases in +which the rounding mode is nearest/even. +The other rounding mode choices are not tested. +Likewise, <CODE>-rnear_maxMag</CODE> forces rounding to nearest/maximum +magnitude (nearest-away), <CODE>-rminMag</CODE> forces rounding to minimum +magnitude (toward zero), <CODE>-rmin</CODE> forces rounding to minimum (down, +toward negative infinity), <CODE>-rmax</CODE> forces rounding to maximum (up, +toward positive infinity), and <CODE>-rodd</CODE>, if supported, forces +rounding to odd. +These options are ignored for operations that are exact and thus do not round. +</P> + +<H3><CODE>-tininessbefore, -tininessafter</CODE></H3> + +<P> +The <CODE>-tininessbefore</CODE> option restricts testing to only the cases in +which tininess on underflow is detected before rounding. +Likewise, <CODE>-tininessafter</CODE> restricts testing to only the cases in +which tininess on underflow is detected after rounding. +</P> + +<H3><CODE>-notexact, -exact</CODE></H3> + +<P> +For functions that round to an integer (conversions to integer types and the +<CODE>roundToInt</CODE> functions), the <CODE>-notexact</CODE> option restricts +testing to only the cases for which the <CODE><I>exact</I></CODE> operand +(specifying whether the <I>inexact</I> exception flag may be raised) is +<CODE>false</CODE>. +Likewise, the <CODE>-exact</CODE> option restricts testing to only the cases +for which the <CODE><I>exact</I></CODE> operand is <CODE>true</CODE>. +</P> + + +<H2>Function Sets</H2> + +<P> +Just as <CODE>testsoftfloat</CODE> can test a function for all five or six +rounding modes in sequence, multiple functions can be tested with a single +execution of <CODE>testsoftfloat</CODE>. +Two sets are recognized: <CODE>-all1</CODE> and <CODE>-all2</CODE>. +The set <CODE>-all1</CODE> is all one-operand operations, while +<CODE>-all2</CODE> is all two-operand operations. +A function set is used in place of a function name in the +<CODE>testsoftfloat</CODE> command line, such as +<BLOCKQUOTE> +<PRE> +testsoftfloat [<<I>option</I>>...] -all1 +</PRE> +</BLOCKQUOTE> +</P> + +<P> +For the purpose of deciding the number of operands of an operation, any +<CODE><I>roundingMode</I></CODE> and <CODE><I>exact</I></CODE> arguments are +ignored. +(Such arguments specify the rounding mode and whether the <I>inexact</I> +exception flag may be raised, respectively.) +Thus, functions that convert to integer type and the <CODE>roundToInt</CODE> +functions are included in the set of one-operand operations tested by +<CODE>-all1</CODE>. +</P> + + +</BODY> + diff --git a/src/libs/softfloat-3e/testfloat/doc/timesoftfloat.html b/src/libs/softfloat-3e/testfloat/doc/timesoftfloat.html new file mode 100644 index 00000000..8808fe61 --- /dev/null +++ b/src/libs/softfloat-3e/testfloat/doc/timesoftfloat.html @@ -0,0 +1,196 @@ + +<HTML> + +<HEAD> +<TITLE>timesoftfloat</TITLE> +</HEAD> + +<BODY> + +<H1>Berkeley TestFloat Release 3e: <CODE>timesoftfloat</CODE></H1> + +<P> +John R. Hauser<BR> +2018 January 20<BR> +</P> + + +<H2>Overview</H2> + +<P> +The <CODE>timesoftfloat</CODE> program provides a simple way to evaluate the +speed of the floating-point operations of the Berkeley SoftFloat library. +Program <CODE>timesoftfloat</CODE> is included with the Berkeley TestFloat +package, a small collection of programs for testing that an implementation of +floating-point conforms to the IEEE Standard for Binary Floating-Point +Arithmetic. +Although <CODE>timesoftfloat</CODE> does not test floating-point correctness +like the other TestFloat programs, nevertheless <CODE>timesoftfloat</CODE> is a +partner to TestFloat’s <CODE>testsoftfloat</CODE> program. +For more about TestFloat generally and <CODE>testsoftfloat</CODE> specifically, +see file +<A HREF="TestFloat-general.html"><NOBR><CODE>TestFloat-general.html</CODE></NOBR></A>. +</P> + +<P> +Ordinarily, <CODE>timesoftfloat</CODE> will measure a function’s speed +separately for each of the five rounding modes defined by the IEEE +Floating-Point Standard, one after the other, plus possibly a sixth mode, +<I>round to odd</I> (depending on the options selected when +<CODE>timesoftfloat</CODE> was compiled). +If an operation is not supposed to require rounding, it will by default be +timed only with the rounding mode set to <CODE>near_even</CODE> (nearest/even). +In the same way, if an operation is affected by the way in which underflow +tininess is detected, <CODE>timesoftfloat</CODE> times the function with +tininess detected both before rounding and after rounding. +For <NOBR>80-bit</NOBR> double-extended-precision operations affected by +rounding precision control, <CODE>timesoftfloat</CODE> also times the function +for each of the three rounding precision modes, one after the other. +Evaluation of a function can be limited to a single rounding mode, a single +tininess mode, and/or a single rounding precision with appropriate command-line +options. +</P> + +<P> +For each function and mode evaluated, <CODE>timesoftfloat</CODE> reports the +measured speed of the function in Mop/s, or “millions of operations per +second”. +The speeds reported by <CODE>timesoftfloat</CODE> may be affected somewhat by +other software executing at the same time as <CODE>timesoftfloat</CODE>. +Be aware also that the exact execution time of any SoftFloat function depends +partly on the values of arguments and the state of the processor’s caches +at the time the function is called. +Your actual experience with SoftFloat may differ from the speeds reported by +<CODE>timesoftfloat</CODE> for all these reasons. +</P> + +<P> +Note that the remainder operations for larger formats (<CODE>f64_rem</CODE>, +<CODE>extF80_rem</CODE>, and <CODE>f128_rem</CODE>) can be markedly slower than +other operations, particularly for double-extended-precision +(<CODE>extF80_rem</CODE>) and quadruple precision (<CODE>f128_rem</CODE>). +This is inherent to the remainder operation itself and is not a failing of the +SoftFloat implementation. +</P> + + +<H2>Command Syntax</H2> + +<P> +The <CODE>timesoftfloat</CODE> program is executed as a command with this +syntax: +<BLOCKQUOTE> +<PRE> +timesoftfloat [<<I>option</I>>...] <<I>function</I>> +</PRE> +</BLOCKQUOTE> +Square brackets (<CODE>[ ]</CODE>) denote optional arguments, +<CODE><<I>option</I>></CODE> is a supported option, and +<CODE><<I>function</I>></CODE> is the name of either a testable function +or a function set. +The available options and function sets are documented below. +If <CODE>timesoftfloat</CODE> is executed without any arguments, a summary of +usage is written. +</P> + + +<H2>Options</H2> + +<P> +The <CODE>timesoftfloat</CODE> program accepts several command options. +If mutually contradictory options are given, the last one has priority. +</P> + +<H3><CODE>-help</CODE></H3> + +<P> +The <CODE>-help</CODE> option causes a summary of program usage to be written, +after which the program exits. +</P> + +<H3><CODE>-precision32, -precision64, -precision80</CODE></H3> + +<P> +For <NOBR>80-bit</NOBR> double-extended-precision funcions affected by +rounding precision control, the <CODE>-precision32</CODE> option restricts +timing of an operation to only the cases in which the rounding precision is +<NOBR>32 bits</NOBR>, equivalent to <NOBR>32-bit</NOBR> single-precision. +Other rounding precision choices are not timed. +Likewise, <CODE>-precision64</CODE> fixes the rounding precision to +<NOBR>64 bits</NOBR>, equivalent to <NOBR>64-bit</NOBR> double-precision; +and <CODE>-precision80</CODE> fixes the rounding precision to the full +<NOBR>80 bits</NOBR> of the double-extended-precision format. +All these options are ignored for operations not affected by rounding precision +control. +</P> + +<H3><CODE>-rnear_even, -rnear_maxMag, -rminMag, -rmin, -rmax, -rodd</CODE></H3> + +<P> +The <CODE>-rnear_even</CODE> option restricts timing of an operation to only +the cases in which the rounding mode is nearest/even. +Other rounding mode choices are not timed. +Likewise, <CODE>-rnear_maxMag</CODE> forces rounding to nearest/maximum +magnitude (nearest-away), <CODE>-rminMag</CODE> forces rounding to minimum +magnitude (toward zero), <CODE>-rmin</CODE> forces rounding to minimum (down, +toward negative infinity), <CODE>-rmax</CODE> forces rounding to maximum (up, +toward positive infinity), and <CODE>-rodd</CODE>, if supported, forces +rounding to odd. +These options are ignored for operations that are exact and thus do not round. +</P> + +<H3><CODE>-tininessbefore, -tininessafter</CODE></H3> + +<P> +The <CODE>-tininessbefore</CODE> option restricts timing of an operation to +only the cases in which tininess on underflow is detected before rounding. +Likewise, <CODE>-tininessafter</CODE> restricts measurement to only the cases +in which tininess on underflow is detected after rounding. +</P> + +<H3><CODE>-notexact, -exact</CODE></H3> + +<P> +For functions that round to an integer (conversions to integer types and the +<CODE>roundToInt</CODE> functions), the <CODE>-notexact</CODE> option restricts +timing of an operation to only the cases for which the +<CODE><I>exact</I></CODE> operand (specifying whether the <I>inexact</I> +exception flag may be raised) is <CODE>false</CODE>. +Likewise, the <CODE>-exact</CODE> option restricts measurement to only the +cases for which the <CODE><I>exact</I></CODE> operand is <CODE>true</CODE>. +</P> + + +<H2>Function Sets</H2> + +<P> +Just as <CODE>timesoftfloat</CODE> can time a function for all five or six +rounding modes in sequence, multiple functions can be timed with a single +execution of <CODE>timesoftfloat</CODE>. +Three sets are recognized: +<CODE>-all1</CODE>, <CODE>-all2</CODE>, and <CODE>-all</CODE>. +The set <CODE>-all1</CODE> is all one-operand operations, <CODE>-all2</CODE> is +all two-operand operations, and <CODE>-all</CODE> is obviously all operations. +A function set is used in place of a function name in the +<CODE>timesoftfloat</CODE> command line, such as +<BLOCKQUOTE> +<PRE> +timesoftfloat [<<I>option</I>>...] -all1 +</PRE> +</BLOCKQUOTE> +</P> + +<P> +For the purpose of deciding the number of operands of an operation, any +<CODE><I>roundingMode</I></CODE> and <CODE><I>exact</I></CODE> arguments are +ignored. +(Such arguments specify the rounding mode and whether the <I>inexact</I> +exception flag may be raised, respectively.) +Thus, functions that convert to integer type and the <CODE>roundToInt</CODE> +functions are included in the set of one-operand operations timed by +<CODE>-all1</CODE>. +</P> + + +</BODY> + 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 ); + |