set x87 FP explicitly to double-precision mode on some platforms

svn: r14459
This commit is contained in:
Matthew Flatt 2009-04-08 09:21:43 +00:00
parent 61cc7ae84a
commit 285dae4935
2 changed files with 16 additions and 0 deletions

View File

@ -155,6 +155,7 @@
# if defined(i386)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-linux"
# define REGISTER_POOR_MACHINE
# define ASM_DBLPREC_CONTROL_87
# endif
# if defined(powerpc)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "ppc-linux"
@ -178,6 +179,7 @@
# if defined(__x86_64__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-linux"
# define REGISTER_POOR_MACHINE
# define ASM_DBLPREC_CONTROL_87
# endif
# ifndef SCHEME_PLATFORM_LIBRARY_SUBPATH
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "unknown-linux"
@ -672,6 +674,7 @@
# define USE_CARBON_FP_PREDS
# define TRIG_ZERO_NEEDS_SIGN_CHECK
# define ASM_DBLPREC_CONTROL_87
# define USE_DYNAMIC_FDSET_SIZE
@ -1172,6 +1175,10 @@
converts (a == a) to TRUE, even if `a' is floating-point. Used
only when USE_[SCO_]IEEE_FP_PREDS is not defined. */
/* ASM_DBLPREC_CONTROL_87 uses inline assembly to set Intel '387
floating-point operations to double-precision instead of
extended-precision arithmetic. */
/* IGNORE_BY_BORLAND_CONTROL_87 turns off floating-point error for
Intel '387 with Borlad-style _control87. DONT_IGNORE_PIPE_SIGNAL
can be on or off. */

View File

@ -177,6 +177,15 @@ scheme_init_number (Scheme_Env *env)
flags |= IEEE_TRAP_ENABLE_MASK;
ieee_set_fp_control(flags);
}
#endif
#ifdef ASM_DBLPREC_CONTROL_87
{
/* Make x87 computations double-precision instead of
extended-precision, so that if/when the JIT generates
x87 instructions, it's consistent with everything else. */
int _dblprec = 0x27F;
asm ("fldcw %0" : : "m" (_dblprec));
}
#endif
END_XFORM_SKIP;