git: 36670fa153a8 - stable/13 - test: remove remainder of testfloat
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 06 Aug 2023 20:36:22 UTC
The branch stable/13 has been updated by marius:
URL: https://cgit.FreeBSD.org/src/commit/?id=36670fa153a8dfc2c898217a0d5429675e342f35
commit 36670fa153a8dfc2c898217a0d5429675e342f35
Author: Marius Strobl <marius@FreeBSD.org>
AuthorDate: 2023-06-30 20:36:39 +0000
Commit: Marius Strobl <marius@FreeBSD.org>
CommitDate: 2023-08-06 17:11:42 +0000
test: remove remainder of testfloat
These bits are unused since the sparc64-specific glue has been deleted
in f33b14f0.
(cherry picked from commit eb33b693b364a4547dfcfd21c159ffc4fb339bc2)
---
tools/test/testfloat/README.txt | 50 -
tools/test/testfloat/fail.c | 46 -
tools/test/testfloat/fail.h | 29 -
tools/test/testfloat/random.c | 63 -
tools/test/testfloat/random.h | 32 -
tools/test/testfloat/slowfloat-32.c | 1183 ---------
tools/test/testfloat/slowfloat-64.c | 2109 ----------------
tools/test/testfloat/slowfloat.c | 35 -
tools/test/testfloat/slowfloat.h | 167 --
tools/test/testfloat/systemBugs.txt | 323 ---
tools/test/testfloat/systflags.h | 33 -
tools/test/testfloat/systfloat.c | 553 -----
tools/test/testfloat/systmodes.h | 42 -
tools/test/testfloat/testCases.c | 3682 ----------------------------
tools/test/testfloat/testCases.h | 69 -
tools/test/testfloat/testFunction.c | 1149 ---------
tools/test/testfloat/testFunction.h | 135 -
tools/test/testfloat/testLoops.c | 2713 --------------------
tools/test/testfloat/testLoops.h | 143 --
tools/test/testfloat/testfloat-history.txt | 57 -
tools/test/testfloat/testfloat-source.txt | 444 ----
tools/test/testfloat/testfloat.c | 299 ---
tools/test/testfloat/testfloat.txt | 771 ------
tools/test/testfloat/testsoftfloat.c | 1044 --------
tools/test/testfloat/writeHex.c | 183 --
tools/test/testfloat/writeHex.h | 42 -
26 files changed, 15396 deletions(-)
diff --git a/tools/test/testfloat/README.txt b/tools/test/testfloat/README.txt
deleted file mode 100644
index fe99fd95d641..000000000000
--- a/tools/test/testfloat/README.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-
-Package Overview for TestFloat Release 2a
-
-John R. Hauser
-1998 December 16
-
-
-TestFloat is a program for testing that a floating-point implementation
-conforms to the IEC/IEEE Standard for Binary Floating-Point Arithmetic.
-TestFloat is distributed in the form of C source code. The TestFloat
-package actually provides two related programs:
-
--- The `testfloat' program tests a system's floating-point for conformance
- to the IEC/IEEE Standard. This program uses the SoftFloat software
- floating-point implementation as a basis for comparison.
-
--- The `testsoftfloat' program tests SoftFloat itself for conformance to
- the IEC/IEEE Standard. These tests are performed by comparing against a
- separate, slower software floating-point that is included in the TestFloat
- package.
-
-TestFloat depends on SoftFloat, but SoftFloat is not included in the
-TestFloat package. SoftFloat can be obtained through the Web page `http://
-HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/SoftFloat.html'.
-
-TestFloat is documented in three text files:
-
- testfloat.txt Documentation for using the TestFloat programs
- (both `testfloat' and `testsoftfloat').
- testfloat-source.txt Documentation for porting and compiling TestFloat.
- testfloat-history.txt History of major changes to TestFloat.
-
-The following file is also provided:
-
- systemBugs.txt Information about processor bugs found using
- TestFloat.
-
-Other files in the package comprise the source code for TestFloat.
-
-Please be aware that some work is involved in porting this software to other
-targets. It is not just a matter of getting `make' to complete without
-error messages. I would have written the code that way if I could, but
-there are fundamental differences between systems that I can't make go away.
-You should not attempt to compile the TestFloat sources without first
-reading `testfloat-source.txt'.
-
-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 `http://
-HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
-
diff --git a/tools/test/testfloat/fail.c b/tools/test/testfloat/fail.c
deleted file mode 100644
index 30bbea6bd7d7..000000000000
--- a/tools/test/testfloat/fail.c
+++ /dev/null
@@ -1,46 +0,0 @@
-
-/*
-===============================================================================
-
-This C source file is part of TestFloat, Release 2a, a package of programs
-for testing the correctness of floating-point arithmetic complying to the
-IEC/IEEE Standard for Floating-Point.
-
-Written by John R. Hauser. More information is available through the Web
-page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include "milieu.h"
-#include "fail.h"
-
-char *fail_programName = "";
-
-void fail( const char *message, ... )
-{
- va_list varArgs;
-
- fprintf( stderr, "%s: ", fail_programName );
- va_start( varArgs, message );
- vfprintf( stderr, message, varArgs );
- va_end( varArgs );
- fputs( ".\n", stderr );
- exit( EXIT_FAILURE );
-
-}
-
diff --git a/tools/test/testfloat/fail.h b/tools/test/testfloat/fail.h
deleted file mode 100644
index 9c338da260aa..000000000000
--- a/tools/test/testfloat/fail.h
+++ /dev/null
@@ -1,29 +0,0 @@
-
-/*
-===============================================================================
-
-This C header file is part of TestFloat, Release 2a, a package of programs
-for testing the correctness of floating-point arithmetic complying to the
-IEC/IEEE Standard for Floating-Point.
-
-Written by John R. Hauser. More information is available through the Web
-page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-extern char *fail_programName;
-
-void fail( const char *, ... );
-
diff --git a/tools/test/testfloat/random.c b/tools/test/testfloat/random.c
deleted file mode 100644
index 21326c1ff23f..000000000000
--- a/tools/test/testfloat/random.c
+++ /dev/null
@@ -1,63 +0,0 @@
-
-/*
-===============================================================================
-
-This C source file is part of TestFloat, Release 2a, a package of programs
-for testing the correctness of floating-point arithmetic complying to the
-IEC/IEEE Standard for Floating-Point.
-
-Written by John R. Hauser. More information is available through the Web
-page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <stdlib.h>
-#include "milieu.h"
-#include "random.h"
-
-uint8 randomUint8( void )
-{
-
- return (bits8) ( random()>>4 );
-
-}
-
-uint16 randomUint16( void )
-{
-
- return ( random() & 0x0000ffff );
-
-}
-
-uint32 randomUint32( void )
-{
-
- return ( ( (uint32) random()<<16) | ( (uint32) random() & 0x0000ffff) );
-}
-
-#ifdef BITS64
-
-uint64 randomUint64( void )
-{
-
- return ( ( (uint64) randomUint32() )<<32 ) | randomUint32();
-
-}
-
-#endif
-
diff --git a/tools/test/testfloat/random.h b/tools/test/testfloat/random.h
deleted file mode 100644
index 7375499ea965..000000000000
--- a/tools/test/testfloat/random.h
+++ /dev/null
@@ -1,32 +0,0 @@
-
-/*
-===============================================================================
-
-This C header file is part of TestFloat, Release 2a, a package of programs
-for testing the correctness of floating-point arithmetic complying to the
-IEC/IEEE Standard for Floating-Point.
-
-Written by John R. Hauser. More information is available through the Web
-page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-uint8 randomUint8( void );
-uint16 randomUint16( void );
-uint32 randomUint32( void );
-#ifdef BITS64
-uint64 randomUint64( void );
-#endif
-
diff --git a/tools/test/testfloat/slowfloat-32.c b/tools/test/testfloat/slowfloat-32.c
deleted file mode 100644
index 549654b05e63..000000000000
--- a/tools/test/testfloat/slowfloat-32.c
+++ /dev/null
@@ -1,1183 +0,0 @@
-
-/*
-===============================================================================
-
-This C source file is part of TestFloat, Release 2a, a package of programs
-for testing the correctness of floating-point arithmetic complying to the
-IEC/IEEE Standard for Floating-Point.
-
-Written by John R. Hauser. More information is available through the Web
-page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-int8 slow_float_rounding_mode;
-int8 slow_float_exception_flags;
-int8 slow_float_detect_tininess;
-
-typedef struct {
- bits32 a0, a1;
-} bits64X;
-
-typedef struct {
- flag isNaN;
- flag isInf;
- flag isZero;
- flag sign;
- int16 exp;
- bits64X sig;
-} floatX;
-
-static const floatX floatXNaN = { TRUE, FALSE, FALSE, FALSE, 0, { 0, 0 } };
-static const floatX floatXPositiveZero =
- { FALSE, FALSE, TRUE, FALSE, 0, { 0, 0 } };
-static const floatX floatXNegativeZero =
- { FALSE, FALSE, TRUE, TRUE, 0, { 0, 0 } };
-
-static bits64X shortShift64Left( bits64X a, int8 shiftCount )
-{
- int8 negShiftCount;
-
- negShiftCount = ( - shiftCount & 31 );
- a.a0 = ( a.a0<<shiftCount ) | ( a.a1>>negShiftCount );
- a.a1 <<= shiftCount;
- return a;
-
-}
-
-static bits64X shortShift64RightJamming( bits64X a, int8 shiftCount )
-{
- int8 negShiftCount;
- bits32 extra;
-
- negShiftCount = ( - shiftCount & 31 );
- extra = a.a1<<negShiftCount;
- a.a1 = ( a.a0<<negShiftCount ) | ( a.a1>>shiftCount ) | ( extra != 0 );
- a.a0 >>= shiftCount;
- return a;
-
-}
-
-static bits64X neg64( bits64X a )
-{
-
- if ( a.a1 == 0 ) {
- a.a0 = - a.a0;
- }
- else {
- a.a1 = - a.a1;
- a.a0 = ~ a.a0;
- }
- return a;
-
-}
-
-static bits64X add64( bits64X a, bits64X b )
-{
-
- a.a1 += b.a1;
- a.a0 += b.a0 + ( a.a1 < b.a1 );
- return a;
-
-}
-
-static flag eq64( bits64X a, bits64X b )
-{
-
- return ( a.a0 == b.a0 ) && ( a.a1 == b.a1 );
-
-}
-
-static flag le64( bits64X a, bits64X b )
-{
-
- return ( a.a0 < b.a0 ) || ( ( a.a0 == b.a0 ) && ( a.a1 <= b.a1 ) );
-
-}
-
-static flag lt64( bits64X a, bits64X b )
-{
-
- return ( a.a0 < b.a0 ) || ( ( a.a0 == b.a0 ) && ( a.a1 < b.a1 ) );
-
-}
-
-static floatX roundFloatXTo24( flag isTiny, floatX zx )
-{
-
- if ( zx.sig.a1 ) {
- slow_float_exception_flags |= float_flag_inexact;
- if ( isTiny ) slow_float_exception_flags |= float_flag_underflow;
- switch ( slow_float_rounding_mode ) {
- case float_round_nearest_even:
- if ( zx.sig.a1 < 0x80000000 ) goto noIncrement;
- if ( ( zx.sig.a1 == 0x80000000 ) && ! ( zx.sig.a0 & 1 ) ) {
- goto noIncrement;
- }
- break;
- case float_round_to_zero:
- goto noIncrement;
- case float_round_down:
- if ( ! zx.sign ) goto noIncrement;
- break;
- case float_round_up:
- if ( zx.sign ) goto noIncrement;
- break;
- }
- ++zx.sig.a0;
- if ( zx.sig.a0 == 0x01000000 ) {
- zx.sig.a0 = 0x00800000;
- ++zx.exp;
- }
- }
- noIncrement:
- zx.sig.a1 = 0;
- return zx;
-
-}
-
-static floatX roundFloatXTo53( flag isTiny, floatX zx )
-{
- int8 roundBits;
-
- roundBits = zx.sig.a1 & 7;
- zx.sig.a1 -= roundBits;
- if ( roundBits ) {
- slow_float_exception_flags |= float_flag_inexact;
- if ( isTiny ) slow_float_exception_flags |= float_flag_underflow;
- switch ( slow_float_rounding_mode ) {
- case float_round_nearest_even:
- if ( roundBits < 4 ) goto noIncrement;
- if ( ( roundBits == 4 ) && ! ( zx.sig.a1 & 8 ) ) goto noIncrement;
- break;
- case float_round_to_zero:
- goto noIncrement;
- case float_round_down:
- if ( ! zx.sign ) goto noIncrement;
- break;
- case float_round_up:
- if ( zx.sign ) goto noIncrement;
- break;
- }
- zx.sig.a1 += 8;
- zx.sig.a0 += ( zx.sig.a1 == 0 );
- if ( zx.sig.a0 == 0x01000000 ) {
- zx.sig.a0 = 0x00800000;
- ++zx.exp;
- }
- }
- noIncrement:
- return zx;
-
-}
-
-static floatX int32ToFloatX( int32 a )
-{
- floatX ax;
-
- ax.isNaN = FALSE;
- ax.isInf = FALSE;
- ax.sign = ( a < 0 );
- ax.sig.a1 = ax.sign ? - a : a;
- ax.sig.a0 = 0;
- if ( a == 0 ) {
- ax.isZero = TRUE;
- return ax;
- }
- ax.isZero = FALSE;
- ax.sig = shortShift64Left( ax.sig, 23 );
- ax.exp = 32;
- while ( ax.sig.a0 < 0x00800000 ) {
- ax.sig = shortShift64Left( ax.sig, 1 );
- --ax.exp;
- }
- return ax;
-
-}
-
-static int32 floatXToInt32( floatX ax )
-{
- int8 savedExceptionFlags;
- int16 shiftCount;
- int32 z;
-
- if ( ax.isInf || ax.isNaN ) {
- slow_float_exception_flags |= float_flag_invalid;
- return ( ax.isInf & ax.sign ) ? 0x80000000 : 0x7FFFFFFF;
- }
- if ( ax.isZero ) return 0;
- savedExceptionFlags = slow_float_exception_flags;
- shiftCount = 52 - ax.exp;
- if ( 56 < shiftCount ) {
- ax.sig.a1 = 1;
- ax.sig.a0 = 0;
- }
- else {
- while ( 0 < shiftCount ) {
- ax.sig = shortShift64RightJamming( ax.sig, 1 );
- --shiftCount;
- }
- }
- ax = roundFloatXTo53( FALSE, ax );
- ax.sig = shortShift64RightJamming( ax.sig, 3 );
- z = ax.sig.a1;
- if ( ax.sign ) z = - z;
- if ( ( shiftCount < 0 )
- || ax.sig.a0
- || ( ( z != 0 ) && ( ( ax.sign ^ ( z < 0 ) ) != 0 ) )
- ) {
- slow_float_exception_flags = savedExceptionFlags | float_flag_invalid;
- return ax.sign ? 0x80000000 : 0x7FFFFFFF;
- }
- return z;
-
-}
-
-static floatX float32ToFloatX( float32 a )
-{
- int16 expField;
- floatX ax;
-
- ax.isNaN = FALSE;
- ax.isInf = FALSE;
- ax.isZero = FALSE;
- ax.sign = ( ( a & 0x80000000 ) != 0 );
- expField = ( a>>23 ) & 0xFF;
- ax.sig.a1 = 0;
- ax.sig.a0 = a & 0x007FFFFF;
- if ( expField == 0 ) {
- if ( ax.sig.a0 == 0 ) {
- ax.isZero = TRUE;
- }
- else {
- expField = 1 - 0x7F;
- do {
- ax.sig.a0 <<= 1;
- --expField;
- } while ( ax.sig.a0 < 0x00800000 );
- ax.exp = expField;
- }
- }
- else if ( expField == 0xFF ) {
- if ( ax.sig.a0 == 0 ) {
- ax.isInf = TRUE;
- }
- else {
- ax.isNaN = TRUE;
- }
- }
- else {
- ax.sig.a0 |= 0x00800000;
- ax.exp = expField - 0x7F;
- }
- return ax;
-
-}
-
-static float32 floatXToFloat32( floatX zx )
-{
- floatX savedZ;
- flag isTiny;
- int16 expField;
- float32 z;
-
- if ( zx.isZero ) return zx.sign ? 0x80000000 : 0;
- if ( zx.isInf ) return zx.sign ? 0xFF800000 : 0x7F800000;
- if ( zx.isNaN ) return 0xFFFFFFFF;
- while ( 0x01000000 <= zx.sig.a0 ) {
- zx.sig = shortShift64RightJamming( zx.sig, 1 );
- ++zx.exp;
- }
- while ( zx.sig.a0 < 0x00800000 ) {
- zx.sig = shortShift64Left( zx.sig, 1 );
- --zx.exp;
- }
- savedZ = zx;
- isTiny =
- ( slow_float_detect_tininess == float_tininess_before_rounding )
- && ( zx.exp + 0x7F <= 0 );
- zx = roundFloatXTo24( isTiny, zx );
- expField = zx.exp + 0x7F;
- if ( 0xFF <= expField ) {
- slow_float_exception_flags |=
- float_flag_overflow | float_flag_inexact;
- if ( zx.sign ) {
- switch ( slow_float_rounding_mode ) {
- case float_round_nearest_even:
- case float_round_down:
- z = 0xFF800000;
- break;
- case float_round_to_zero:
- case float_round_up:
- z = 0xFF7FFFFF;
- break;
- }
- }
- else {
- switch ( slow_float_rounding_mode ) {
- case float_round_nearest_even:
- case float_round_up:
- z = 0x7F800000;
- break;
- case float_round_to_zero:
- case float_round_down:
- z = 0x7F7FFFFF;
- break;
- }
- }
- return z;
- }
- if ( expField <= 0 ) {
- isTiny = TRUE;
- zx = savedZ;
- expField = zx.exp + 0x7F;
- if ( expField < -27 ) {
- zx.sig.a1 = ( zx.sig.a0 != 0 ) || ( zx.sig.a1 != 0 );
- zx.sig.a0 = 0;
- }
- else {
- while ( expField <= 0 ) {
- zx.sig = shortShift64RightJamming( zx.sig, 1 );
- ++expField;
- }
- }
- zx = roundFloatXTo24( isTiny, zx );
- expField = ( 0x00800000 <= zx.sig.a0 ) ? 1 : 0;
- }
- z = expField;
- z <<= 23;
- if ( zx.sign ) z |= 0x80000000;
- z |= zx.sig.a0 & 0x007FFFFF;
- return z;
-
-}
-
-static floatX float64ToFloatX( float64 a )
-{
- int16 expField;
- floatX ax;
-
- ax.isNaN = FALSE;
- ax.isInf = FALSE;
- ax.isZero = FALSE;
-#ifdef BITS64
- ax.sign = ( ( a & LIT64( 0x8000000000000000 ) ) != 0 );
- expField = ( a>>52 ) & 0x7FF;
- ax.sig.a1 = a;
- ax.sig.a0 = ( a>>32 ) & 0x000FFFFF;
-#else
- ax.sign = ( ( a.high & 0x80000000 ) != 0 );
- expField = ( a.high>>( 52 - 32 ) ) & 0x7FF;
- ax.sig.a1 = a.low;
- ax.sig.a0 = a.high & 0x000FFFFF;
-#endif
- if ( expField == 0 ) {
- if ( ( ax.sig.a0 == 0 ) && ( ax.sig.a1 == 0 ) ) {
- ax.isZero = TRUE;
- }
- else {
- expField = 1 - 0x3FF;
- do {
- ax.sig = shortShift64Left( ax.sig, 1 );
- --expField;
- } while ( ax.sig.a0 < 0x00100000 );
- ax.exp = expField;
- }
- }
- else if ( expField == 0x7FF ) {
- if ( ( ax.sig.a0 == 0 ) && ( ax.sig.a1 == 0 ) ) {
- ax.isInf = TRUE;
- }
- else {
- ax.isNaN = TRUE;
- }
- }
- else {
- ax.exp = expField - 0x3FF;
- ax.sig.a0 |= 0x00100000;
- }
- ax.sig = shortShift64Left( ax.sig, 3 );
- return ax;
-
-}
-
-static float64 floatXToFloat64( floatX zx )
-{
- floatX savedZ;
- flag isTiny;
- int16 expField;
- float64 z;
-
-#ifdef BITS64
- if ( zx.isZero ) return zx.sign ? LIT64( 0x8000000000000000 ) : 0;
- if ( zx.isInf ) {
- return
- zx.sign ? LIT64( 0xFFF0000000000000 )
- : LIT64( 0x7FF0000000000000 );
- }
- if ( zx.isNaN ) return LIT64( 0xFFFFFFFFFFFFFFFF );
-#else
- if ( zx.isZero ) {
- z.low = 0;
- z.high = zx.sign ? 0x80000000 : 0;
- return z;
- }
- if ( zx.isInf ) {
- z.low = 0;
- z.high = zx.sign ? 0xFFF00000 : 0x7FF00000;
- return z;
- }
- if ( zx.isNaN ) {
- z.high = z.low = 0xFFFFFFFF;
- return z;
- }
-#endif
- while ( 0x01000000 <= zx.sig.a0 ) {
- zx.sig = shortShift64RightJamming( zx.sig, 1 );
- ++zx.exp;
- }
- while ( zx.sig.a0 < 0x00800000 ) {
- zx.sig = shortShift64Left( zx.sig, 1 );
- --zx.exp;
- }
- savedZ = zx;
- isTiny =
- ( slow_float_detect_tininess == float_tininess_before_rounding )
- && ( zx.exp + 0x3FF <= 0 );
- zx = roundFloatXTo53( isTiny, zx );
- expField = zx.exp + 0x3FF;
- if ( 0x7FF <= expField ) {
- slow_float_exception_flags |=
- float_flag_overflow | float_flag_inexact;
-#ifdef BITS64
- if ( zx.sign ) {
- switch ( slow_float_rounding_mode ) {
- case float_round_nearest_even:
- case float_round_down:
- z = LIT64( 0xFFF0000000000000 );
- break;
- case float_round_to_zero:
- case float_round_up:
- z = LIT64( 0xFFEFFFFFFFFFFFFF );
- break;
- }
- }
- else {
- switch ( slow_float_rounding_mode ) {
- case float_round_nearest_even:
- case float_round_up:
- z = LIT64( 0x7FF0000000000000 );
- break;
- case float_round_to_zero:
- case float_round_down:
- z = LIT64( 0x7FEFFFFFFFFFFFFF );
- break;
- }
- }
-#else
- if ( zx.sign ) {
- switch ( slow_float_rounding_mode ) {
- case float_round_nearest_even:
- case float_round_down:
- z.low = 0;
- z.high = 0xFFF00000;
- break;
- case float_round_to_zero:
- case float_round_up:
- z.low = 0xFFFFFFFF;
- z.high = 0xFFEFFFFF;
- break;
- }
- }
- else {
- switch ( slow_float_rounding_mode ) {
- case float_round_nearest_even:
- case float_round_up:
- z.low = 0;
- z.high = 0x7FF00000;
- break;
- case float_round_to_zero:
- case float_round_down:
- z.low = 0xFFFFFFFF;
- z.high = 0x7FEFFFFF;
- break;
- }
- }
-#endif
- return z;
- }
- if ( expField <= 0 ) {
- isTiny = TRUE;
- zx = savedZ;
- expField = zx.exp + 0x3FF;
- if ( expField < -56 ) {
- zx.sig.a1 = ( zx.sig.a0 != 0 ) || ( zx.sig.a1 != 0 );
- zx.sig.a0 = 0;
- }
- else {
- while ( expField <= 0 ) {
- zx.sig = shortShift64RightJamming( zx.sig, 1 );
- ++expField;
- }
- }
- zx = roundFloatXTo53( isTiny, zx );
- expField = ( 0x00800000 <= zx.sig.a0 ) ? 1 : 0;
- }
- zx.sig = shortShift64RightJamming( zx.sig, 3 );
-#ifdef BITS64
- z = expField;
- z <<= 52;
- if ( zx.sign ) z |= LIT64( 0x8000000000000000 );
- z |= ( ( (bits64) ( zx.sig.a0 & 0x000FFFFF ) )<<32 ) | zx.sig.a1;
-#else
- z.low = zx.sig.a1;
- z.high = expField;
- z.high <<= 52 - 32;
- if ( zx.sign ) z.high |= 0x80000000;
- z.high |= zx.sig.a0 & 0x000FFFFF;
-#endif
- return z;
-
-}
-
-static floatX floatXInvalid( void )
-{
-
- slow_float_exception_flags |= float_flag_invalid;
- return floatXNaN;
-
-}
-
-static floatX floatXRoundToInt( floatX ax )
-{
- int16 shiftCount, i;
-
- if ( ax.isNaN || ax.isInf ) return ax;
- shiftCount = 52 - ax.exp;
- if ( shiftCount <= 0 ) return ax;
- if ( 55 < shiftCount ) {
- ax.exp = 52;
- ax.sig.a1 = ! ax.isZero;
- ax.sig.a0 = 0;
- }
- else {
- while ( 0 < shiftCount ) {
- ax.sig = shortShift64RightJamming( ax.sig, 1 );
- ++ax.exp;
- --shiftCount;
- }
- }
- ax = roundFloatXTo53( FALSE, ax );
- if ( ( ax.sig.a0 == 0 ) && ( ax.sig.a1 == 0 ) ) ax.isZero = TRUE;
- return ax;
-
-}
-
-static floatX floatXAdd( floatX ax, floatX bx )
-{
- int16 expDiff;
- floatX zx;
-
- if ( ax.isNaN ) return ax;
- if ( bx.isNaN ) return bx;
- if ( ax.isInf && bx.isInf ) {
- if ( ax.sign == bx.sign ) return ax;
- return floatXInvalid();
- }
- if ( ax.isInf ) return ax;
- if ( bx.isInf ) return bx;
- if ( ax.isZero && bx.isZero ) {
- if ( ax.sign == bx.sign ) return ax;
- goto completeCancellation;
- }
- if ( ( ax.sign != bx.sign )
- && ( ax.exp == bx.exp )
- && eq64( ax.sig, bx.sig )
- ) {
- completeCancellation:
- return
- ( slow_float_rounding_mode == float_round_down ) ?
- floatXNegativeZero
- : floatXPositiveZero;
- }
- if ( ax.isZero ) return bx;
- if ( bx.isZero ) return ax;
- expDiff = ax.exp - bx.exp;
- if ( expDiff < 0 ) {
- zx = ax;
- zx.exp = bx.exp;
- if ( expDiff < -56 ) {
- zx.sig.a1 = 1;
- zx.sig.a0 = 0;
- }
- else {
- while ( expDiff < 0 ) {
- zx.sig = shortShift64RightJamming( zx.sig, 1 );
- ++expDiff;
- }
- }
- if ( ax.sign != bx.sign ) zx.sig = neg64( zx.sig );
- zx.sign = bx.sign;
- zx.sig = add64( zx.sig, bx.sig );
- }
- else {
- zx = bx;
- zx.exp = ax.exp;
- if ( 56 < expDiff ) {
- zx.sig.a1 = 1;
- zx.sig.a0 = 0;
- }
- else {
- while ( 0 < expDiff ) {
- zx.sig = shortShift64RightJamming( zx.sig, 1 );
- --expDiff;
- }
- }
- if ( ax.sign != bx.sign ) zx.sig = neg64( zx.sig );
- zx.sign = ax.sign;
- zx.sig = add64( zx.sig, ax.sig );
- }
- if ( zx.sig.a0 & 0x80000000 ) {
- zx.sig = neg64( zx.sig );
- zx.sign = ! zx.sign;
- }
- return zx;
-
-}
-
-static floatX floatXMul( floatX ax, floatX bx )
-{
- int8 bitNum;
- floatX zx;
-
- if ( ax.isNaN ) return ax;
- if ( bx.isNaN ) return bx;
- if ( ax.isInf ) {
- if ( bx.isZero ) return floatXInvalid();
- if ( bx.sign ) ax.sign = ! ax.sign;
- return ax;
- }
- if ( bx.isInf ) {
- if ( ax.isZero ) return floatXInvalid();
- if ( ax.sign ) bx.sign = ! bx.sign;
- return bx;
- }
- zx = ax;
- zx.sign ^= bx.sign;
- if ( ax.isZero || bx.isZero ) {
- return zx.sign ? floatXNegativeZero : floatXPositiveZero;
- }
- zx.exp += bx.exp + 1;
- zx.sig.a1 = 0;
- zx.sig.a0 = 0;
- for ( bitNum = 0; bitNum < 55; ++bitNum ) {
- if ( bx.sig.a1 & 2 ) zx.sig = add64( zx.sig, ax.sig );
*** 14610 LINES SKIPPED ***