diff options
Diffstat (limited to 'testfloat/386-Win32-gcc')
-rw-r--r-- | testfloat/386-Win32-gcc/Makefile | 64 | ||||
-rw-r--r-- | testfloat/386-Win32-gcc/milieu.h | 51 | ||||
-rw-r--r-- | testfloat/386-Win32-gcc/systflags.S | 41 | ||||
-rw-r--r-- | testfloat/386-Win32-gcc/systfloat.S | 332 | ||||
-rw-r--r-- | testfloat/386-Win32-gcc/systfloat.h | 181 | ||||
-rw-r--r-- | testfloat/386-Win32-gcc/systmodes.S | 82 |
6 files changed, 751 insertions, 0 deletions
diff --git a/testfloat/386-Win32-gcc/Makefile b/testfloat/386-Win32-gcc/Makefile new file mode 100644 index 0000000000000..bba8b9e5b1efc --- /dev/null +++ b/testfloat/386-Win32-gcc/Makefile @@ -0,0 +1,64 @@ + +PROCESSOR_H = ../../processors/386-gcc.h +SOFTFLOAT_VERSION = bits64 +TARGET = 386-Win32-gcc +SOFTFLOAT_DIR = ../../softfloat/$(SOFTFLOAT_VERSION)/$(TARGET) + +OBJ = .o +EXE = .exe +INCLUDES = -I. -I.. -I$(SOFTFLOAT_DIR) +COMPILE_ASM = gcc -c -o $@ +COMPILE_C = gcc -c -o $@ $(INCLUDES) -I- -O2 +COMPILE_SLOWFLOAT_C = gcc -c -o $@ $(INCLUDES) -I- -O3 +LINK = gcc -o $@ + +SOFTFLOAT_H = $(SOFTFLOAT_DIR)/softfloat.h +SOFTFLOAT_OBJ = $(SOFTFLOAT_DIR)/softfloat$(OBJ) + +ALL: testsoftfloat$(EXE) testfloat$(EXE) + +milieu.h: $(PROCESSOR_H) + touch milieu.h + +fail$(OBJ): milieu.h ../fail.h + $(COMPILE_C) ../fail.c + +random$(OBJ): milieu.h ../random.h + $(COMPILE_C) ../random.c + +testCases$(OBJ): milieu.h ../fail.h ../random.h $(SOFTFLOAT_H) ../testCases.h ../testCases.c + $(COMPILE_C) ../testCases.c + +writeHex$(OBJ): milieu.h $(SOFTFLOAT_H) ../writeHex.h ../writeHex.c + $(COMPILE_C) ../writeHex.c + +testLoops$(OBJ): milieu.h $(SOFTFLOAT_H) ../testCases.h ../writeHex.h ../testLoops.h ../testLoops.c + $(COMPILE_C) ../testLoops.c + +slowfloat$(OBJ): milieu.h $(SOFTFLOAT_H) ../slowfloat.h ../slowfloat-32.c ../slowfloat-64.c ../slowfloat.c + $(COMPILE_SLOWFLOAT_C) ../slowfloat.c + +testsoftfloat$(OBJ): milieu.h ../fail.h $(SOFTFLOAT_H) ../testCases.h ../testLoops.h ../slowfloat.h ../testsoftfloat.c + $(COMPILE_C) ../testsoftfloat.c + +testsoftfloat$(EXE): fail$(OBJ) random$(OBJ) $(SOFTFLOAT_OBJ) testCases$(OBJ) writeHex$(OBJ) testLoops$(OBJ) slowfloat$(OBJ) testsoftfloat$(OBJ) + $(LINK) fail$(OBJ) random$(OBJ) $(SOFTFLOAT_OBJ) testCases$(OBJ) writeHex$(OBJ) testLoops$(OBJ) slowfloat$(OBJ) testsoftfloat$(OBJ) + +systmodes$(OBJ): systmodes.S + $(COMPILE_ASM) systmodes.S + +systflags$(OBJ): systflags.S + $(COMPILE_ASM) systflags.S + +systfloat$(OBJ): systfloat.S + $(COMPILE_ASM) systfloat.S + +testFunction$(OBJ): milieu.h $(SOFTFLOAT_H) ../testCases.h ../testLoops.h ../systmodes.h ../systflags.h systfloat.h ../testFunction.h ../testFunction.c + $(COMPILE_C) ../testFunction.c + +testfloat$(OBJ): milieu.h ../fail.h $(SOFTFLOAT_H) ../testCases.h ../testLoops.h ../systflags.h ../testFunction.h ../testfloat.c + $(COMPILE_C) ../testfloat.c + +testfloat$(EXE): fail$(OBJ) random$(OBJ) $(SOFTFLOAT_OBJ) testCases$(OBJ) writeHex$(OBJ) testLoops$(OBJ) systmodes$(OBJ) systflags$(OBJ) systfloat$(OBJ) testFunction$(OBJ) testfloat$(OBJ) + $(LINK) fail$(OBJ) random$(OBJ) $(SOFTFLOAT_OBJ) testCases$(OBJ) writeHex$(OBJ) testLoops$(OBJ) systmodes$(OBJ) systflags$(OBJ) systfloat$(OBJ) testFunction$(OBJ) testfloat$(OBJ) + diff --git a/testfloat/386-Win32-gcc/milieu.h b/testfloat/386-Win32-gcc/milieu.h new file mode 100644 index 0000000000000..7f795dd939656 --- /dev/null +++ b/testfloat/386-Win32-gcc/milieu.h @@ -0,0 +1,51 @@ + +/* +=============================================================================== + +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. + +=============================================================================== +*/ + +/* +------------------------------------------------------------------------------- +Include common integer types and flags. +------------------------------------------------------------------------------- +*/ +#include "../../processors/386-gcc.h" + +/* +------------------------------------------------------------------------------- +If the `BITS64' macro is defined by the processor header file but the +version of SoftFloat being tested is the 32-bit one (`bits32'), the `BITS64' +macro must be undefined here. +------------------------------------------------------------------------------- +#undef BITS64 +*/ + +/* +------------------------------------------------------------------------------- +Symbolic Boolean literals. +------------------------------------------------------------------------------- +*/ +enum { + FALSE = 0, + TRUE = 1 +}; + diff --git a/testfloat/386-Win32-gcc/systflags.S b/testfloat/386-Win32-gcc/systflags.S new file mode 100644 index 0000000000000..b338e54be820a --- /dev/null +++ b/testfloat/386-Win32-gcc/systflags.S @@ -0,0 +1,41 @@ + +/* +=============================================================================== + +This GNU assembler 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. + +=============================================================================== +*/ + + .text + +/* +------------------------------------------------------------------------------- +Clears the system's IEC/IEEE floating-point exception flags. Returns the +previous value of the flags. +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_float_flags_clear +_syst_float_flags_clear: + fnstsw %ax + fnclex + andl $61,%eax + ret + diff --git a/testfloat/386-Win32-gcc/systfloat.S b/testfloat/386-Win32-gcc/systfloat.S new file mode 100644 index 0000000000000..01e8983e4945d --- /dev/null +++ b/testfloat/386-Win32-gcc/systfloat.S @@ -0,0 +1,332 @@ + +/* +=============================================================================== + +This GNU assembler 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. + +=============================================================================== +*/ + + .text + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_int32_to_floatx80 +_syst_int32_to_floatx80: + fildl 8(%esp) + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_int64_to_floatx80 +_syst_int64_to_floatx80: + fildq 8(%esp) + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_float32_to_floatx80 +_syst_float32_to_floatx80: + flds 8(%esp) + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_float64_to_floatx80 +_syst_float64_to_floatx80: + fldl 8(%esp) + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_to_int32 +_syst_floatx80_to_int32: + fldt 4(%esp) + subl $4,%esp + fistpl (%esp) + movl (%esp),%eax + addl $4,%esp + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_to_int64 +_syst_floatx80_to_int64: + fldt 4(%esp) + subl $8,%esp + fistpq (%esp) + movl (%esp),%eax + movl 4(%esp),%edx + addl $8,%esp + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_to_float32 +_syst_floatx80_to_float32: + fldt 4(%esp) + subl $4,%esp + fstps (%esp) + movl (%esp),%eax + addl $4,%esp + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_to_float64 +_syst_floatx80_to_float64: + fldt 4(%esp) + subl $8,%esp + fstpl (%esp) + movl 4(%esp),%edx + movl (%esp),%eax + addl $8,%esp + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_round_to_int +_syst_floatx80_round_to_int: + fldt 8(%esp) + frndint + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_add +_syst_floatx80_add: + fldt 8(%esp) + fldt 20(%esp) + faddp + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_sub +_syst_floatx80_sub: + fldt 8(%esp) + fldt 20(%esp) + fsubrp + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_mul +_syst_floatx80_mul: + fldt 8(%esp) + fldt 20(%esp) + fmulp + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_div +_syst_floatx80_div: + fldt 8(%esp) + fldt 20(%esp) + fdivrp + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_rem +_syst_floatx80_rem: + fldt 20(%esp) + fldt 8(%esp) +floatx80_rem_loop: + fprem1 + fnstsw %ax + btw $10,%ax + jc floatx80_rem_loop + movl 4(%esp),%eax + fstpt (%eax) + fstp %st(0) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_sqrt +_syst_floatx80_sqrt: + fldt 8(%esp) + fsqrt + movl 4(%esp),%eax + fstpt (%eax) + ret $4 + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_eq +_syst_floatx80_eq: + fldt 16(%esp) + fldt 4(%esp) + fucompp + fnstsw %ax + andw $17664,%ax + cmpw $16384,%ax + seteb %al + movzb %al,%eax + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_le +_syst_floatx80_le: + fldt 4(%esp) + fldt 16(%esp) + fcompp + fnstsw %ax + notl %eax + shrl $8,%eax + andl $1,%eax + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_lt +_syst_floatx80_lt: + fldt 4(%esp) + fldt 16(%esp) + fcompp + fnstsw %ax + andw $17664,%ax + setzb %al + movzb %al,%eax + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_eq_signaling +_syst_floatx80_eq_signaling: + fldt 16(%esp) + fldt 4(%esp) + fcompp + fnstsw %ax + andw $17664,%ax + cmpw $16384,%ax + seteb %al + movzb %al,%eax + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_le_quiet +_syst_floatx80_le_quiet: + fldt 4(%esp) + fldt 16(%esp) + fucompp + fnstsw %ax + notl %eax + shrl $8,%eax + andl $1,%eax + ret + +/* +------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +*/ + .align 2 +.globl _syst_floatx80_lt_quiet +_syst_floatx80_lt_quiet: + fldt 4(%esp) + fldt 16(%esp) + fucompp + fnstsw %ax + andw $17664,%ax + setzb %al + movzb %al,%eax + ret + diff --git a/testfloat/386-Win32-gcc/systfloat.h b/testfloat/386-Win32-gcc/systfloat.h new file mode 100644 index 0000000000000..167b9160203c1 --- /dev/null +++ b/testfloat/386-Win32-gcc/systfloat.h @@ -0,0 +1,181 @@ + +/* +=============================================================================== + +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. + +=============================================================================== +*/ + +/* +------------------------------------------------------------------------------- +The following macros are defined to indicate that the corresponding +functions exist. +------------------------------------------------------------------------------- +*/ +#define SYST_INT32_TO_FLOATX80 +#define SYST_INT64_TO_FLOATX80 +#define SYST_FLOAT32_TO_FLOATX80 +#define SYST_FLOAT64_TO_FLOATX80 +#define SYST_FLOATX80_TO_INT32 +#define SYST_FLOATX80_TO_INT64 +#define SYST_FLOATX80_TO_FLOAT32 +#define SYST_FLOATX80_TO_FLOAT64 +#define SYST_FLOATX80_ROUND_TO_INT +#define SYST_FLOATX80_ADD +#define SYST_FLOATX80_SUB +#define SYST_FLOATX80_MUL +#define SYST_FLOATX80_DIV +#define SYST_FLOATX80_REM +#define SYST_FLOATX80_SQRT +#define SYST_FLOATX80_EQ +#define SYST_FLOATX80_LE +#define SYST_FLOATX80_LT +#define SYST_FLOATX80_EQ_SIGNALING +#define SYST_FLOATX80_LE_QUIET +#define SYST_FLOATX80_LT_QUIET + +/* +------------------------------------------------------------------------------- +System function declarations. (Some of these functions may not exist.) +------------------------------------------------------------------------------- +*/ +float32 syst_int32_to_float32( int32 ); +float64 syst_int32_to_float64( int32 ); +#ifdef FLOATX80 +floatx80 syst_int32_to_floatx80( int32 ); +#endif +#ifdef FLOAT128 +float128 syst_int32_to_float128( int32 ); +#endif +#ifdef BITS64 +float32 syst_int64_to_float32( int64 ); +float64 syst_int64_to_float64( int64 ); +#ifdef FLOATX80 +floatx80 syst_int64_to_floatx80( int64 ); +#endif +#ifdef FLOAT128 +float128 syst_int64_to_float128( int64 ); +#endif +#endif +int32 syst_float32_to_int32( float32 ); +int32 syst_float32_to_int32_round_to_zero( float32 ); +#ifdef BITS64 +int64 syst_float32_to_int64( float32 ); +int64 syst_float32_to_int64_round_to_zero( float32 ); +#endif +float64 syst_float32_to_float64( float32 ); +#ifdef FLOATX80 +floatx80 syst_float32_to_floatx80( float32 ); +#endif +#ifdef FLOAT128 +float128 syst_float32_to_float128( float32 ); +#endif +float32 syst_float32_round_to_int( float32 ); +float32 syst_float32_add( float32, float32 ); +float32 syst_float32_sub( float32, float32 ); +float32 syst_float32_mul( float32, float32 ); +float32 syst_float32_div( float32, float32 ); +float32 syst_float32_rem( float32, float32 ); +float32 syst_float32_sqrt( float32 ); +flag syst_float32_eq( float32, float32 ); +flag syst_float32_le( float32, float32 ); +flag syst_float32_lt( float32, float32 ); +flag syst_float32_eq_signaling( float32, float32 ); +flag syst_float32_le_quiet( float32, float32 ); +flag syst_float32_lt_quiet( float32, float32 ); +int32 syst_float64_to_int32( float64 ); +int32 syst_float64_to_int32_round_to_zero( float64 ); +#ifdef BITS64 +int64 syst_float64_to_int64( float64 ); +int64 syst_float64_to_int64_round_to_zero( float64 ); +#endif +float32 syst_float64_to_float32( float64 ); +#ifdef FLOATX80 +floatx80 syst_float64_to_floatx80( float64 ); +#endif +#ifdef FLOAT128 +float128 syst_float64_to_float128( float64 ); +#endif +float64 syst_float64_round_to_int( float64 ); +float64 syst_float64_add( float64, float64 ); +float64 syst_float64_sub( float64, float64 ); +float64 syst_float64_mul( float64, float64 ); +float64 syst_float64_div( float64, float64 ); +float64 syst_float64_rem( float64, float64 ); +float64 syst_float64_sqrt( float64 ); +flag syst_float64_eq( float64, float64 ); +flag syst_float64_le( float64, float64 ); +flag syst_float64_lt( float64, float64 ); +flag syst_float64_eq_signaling( float64, float64 ); +flag syst_float64_le_quiet( float64, float64 ); +flag syst_float64_lt_quiet( float64, float64 ); +#ifdef FLOATX80 +int32 syst_floatx80_to_int32( floatx80 ); +int32 syst_floatx80_to_int32_round_to_zero( floatx80 ); +#ifdef BITS64 +int64 syst_floatx80_to_int64( floatx80 ); +int64 syst_floatx80_to_int64_round_to_zero( floatx80 ); +#endif +float32 syst_floatx80_to_float32( floatx80 ); +float64 syst_floatx80_to_float64( floatx80 ); +#ifdef FLOAT128 +float128 syst_floatx80_to_float128( floatx80 ); +#endif +floatx80 syst_floatx80_round_to_int( floatx80 ); +floatx80 syst_floatx80_add( floatx80, floatx80 ); +floatx80 syst_floatx80_sub( floatx80, floatx80 ); +floatx80 syst_floatx80_mul( floatx80, floatx80 ); +floatx80 syst_floatx80_div( floatx80, floatx80 ); +floatx80 syst_floatx80_rem( floatx80, floatx80 ); +floatx80 syst_floatx80_sqrt( floatx80 ); +flag syst_floatx80_eq( floatx80, floatx80 ); +flag syst_floatx80_le( floatx80, floatx80 ); +flag syst_floatx80_lt( floatx80, floatx80 ); +flag syst_floatx80_eq_signaling( floatx80, floatx80 ); +flag syst_floatx80_le_quiet( floatx80, floatx80 ); +flag syst_floatx80_lt_quiet( floatx80, floatx80 ); +#endif +#ifdef FLOAT128 +int32 syst_float128_to_int32( float128 ); +int32 syst_float128_to_int32_round_to_zero( float128 ); +#ifdef BITS64 +int64 syst_float128_to_int64( float128 ); +int64 syst_float128_to_int64_round_to_zero( float128 ); +#endif +float32 syst_float128_to_float32( float128 ); +float64 syst_float128_to_float64( float128 ); +#ifdef FLOATX80 +floatx80 syst_float128_to_floatx80( float128 ); +#endif +float128 syst_float128_round_to_int( float128 ); +float128 syst_float128_add( float128, float128 ); +float128 syst_float128_sub( float128, float128 ); +float128 syst_float128_mul( float128, float128 ); +float128 syst_float128_div( float128, float128 ); +float128 syst_float128_rem( float128, float128 ); +float128 syst_float128_sqrt( float128 ); +flag syst_float128_eq( float128, float128 ); +flag syst_float128_le( float128, float128 ); +flag syst_float128_lt( float128, float128 ); +flag syst_float128_eq_signaling( float128, float128 ); +flag syst_float128_le_quiet( float128, float128 ); +flag syst_float128_lt_quiet( float128, float128 ); +#endif + diff --git a/testfloat/386-Win32-gcc/systmodes.S b/testfloat/386-Win32-gcc/systmodes.S new file mode 100644 index 0000000000000..a8f3c8bc8891e --- /dev/null +++ b/testfloat/386-Win32-gcc/systmodes.S @@ -0,0 +1,82 @@ + +/* +=============================================================================== + +This GNU assembler 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. + +=============================================================================== +*/ + + .text + +/* +------------------------------------------------------------------------------- +Sets the system's IEC/IEEE floating-point rounding mode. Also disables all +system exception traps. +------------------------------------------------------------------------------- +*/ + .align 4 + .global _syst_float_set_rounding_mode +_syst_float_set_rounding_mode: + movb 4(%esp),%al + andb $3,%al + shlw $10,%ax + orw $63,%ax + subl $2,%esp + fnstcw 0(%esp) + andw $768,0(%esp) + orw %ax,0(%esp) + fldcw 0(%esp) + addl $2,%esp + ret + +/* +------------------------------------------------------------------------------- +Sets the rounding precision of subsequent extended double-precision +operations. The `precision' argument should be one of 0, 32, 64, or 80. +If `precision' is 32, the rounding precision is set equivalent to single +precision; else if `precision' is 64, the rounding precision is set +equivalent to double precision; else the rounding precision is set to full +extended double precision. +------------------------------------------------------------------------------- +*/ + .align 4 + .global _syst_float_set_rounding_precision +_syst_float_set_rounding_precision: + movb 4(%esp),%al + movb $0,%ah + cmpb $32,%al + je setRoundingPrecision + movb $2,%ah + cmpb $64,%al + je setRoundingPrecision + movb $3,%ah + cmpb $80,%al + je setRoundingPrecision + movb $0,%ah +setRoundingPrecision: + movb $0,%al + subl $2,%esp + fnstcw 0(%esp) + andw $64767,0(%esp) + orw %ax,0(%esp) + fldcw 0(%esp) + addl $2,%esp + ret + |