Issue #5792: Extend short float repr support to x86 platforms using suncc or icc.

Many thanks Stefan Krah for help and OpenSolaris testing.
This commit is contained in:
Mark Dickinson 2009-11-15 13:12:43 +00:00
parent 009ae861f2
commit a548deeb29
2 changed files with 29 additions and 31 deletions

27
configure vendored
View File

@ -23626,15 +23626,15 @@ fi
# correctly-rounded string <-> double conversion functions from # correctly-rounded string <-> double conversion functions from
# Python/dtoa.c, which in turn require that the FPU uses 53-bit # Python/dtoa.c, which in turn require that the FPU uses 53-bit
# rounding; this is a problem on x86, where the x87 FPU has a default # rounding; this is a problem on x86, where the x87 FPU has a default
# rounding precision of 64 bits. For gcc/x86, we try to fix this by # rounding precision of 64 bits. For gcc/x86, we can fix this by
# using inline assembler to get and set the x87 FPU control word. # using inline assembler to get and set the x87 FPU control word.
if test "$GCC" = yes && test -n "`$CC -dM -E - </dev/null | grep i386`"
then # This inline assembler syntax may also work for suncc and icc,
# Check that it's okay to use gcc inline assembler to get and set # so we try it on all platforms.
# x87 control word. It should be, but you never know...
{ echo "$as_me:$LINENO: checking whether we can use gcc inline assembler to get and set x87 control word" >&5 { echo "$as_me:$LINENO: checking whether we can use gcc inline assembler to get and set x87 control word" >&5
echo $ECHO_N "checking whether we can use gcc inline assembler to get and set x87 control word... $ECHO_C" >&6; } echo $ECHO_N "checking whether we can use gcc inline assembler to get and set x87 control word... $ECHO_C" >&6; }
cat >conftest.$ac_ext <<_ACEOF cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */ /* confdefs.h. */
_ACEOF _ACEOF
cat confdefs.h >>conftest.$ac_ext cat confdefs.h >>conftest.$ac_ext
@ -23645,9 +23645,9 @@ int
main () main ()
{ {
unsigned short cw; unsigned short cw;
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw)); __asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
__asm__ __volatile__ ("fldcw %0" : : "m" (cw)); __asm__ __volatile__ ("fldcw %0" : : "m" (cw));
; ;
return 0; return 0;
@ -23679,16 +23679,15 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ echo "$as_me:$LINENO: result: $have_gcc_asm_for_x87" >&5 { echo "$as_me:$LINENO: result: $have_gcc_asm_for_x87" >&5
echo "${ECHO_T}$have_gcc_asm_for_x87" >&6; } echo "${ECHO_T}$have_gcc_asm_for_x87" >&6; }
if test "$have_gcc_asm_for_x87" = yes if test "$have_gcc_asm_for_x87" = yes
then then
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define HAVE_GCC_ASM_FOR_X87 1 #define HAVE_GCC_ASM_FOR_X87 1
_ACEOF _ACEOF
fi
fi fi
# Detect whether system arithmetic is subject to x87-style double # Detect whether system arithmetic is subject to x87-style double

View File

@ -3320,25 +3320,24 @@ fi
# correctly-rounded string <-> double conversion functions from # correctly-rounded string <-> double conversion functions from
# Python/dtoa.c, which in turn require that the FPU uses 53-bit # Python/dtoa.c, which in turn require that the FPU uses 53-bit
# rounding; this is a problem on x86, where the x87 FPU has a default # rounding; this is a problem on x86, where the x87 FPU has a default
# rounding precision of 64 bits. For gcc/x86, we try to fix this by # rounding precision of 64 bits. For gcc/x86, we can fix this by
# using inline assembler to get and set the x87 FPU control word. # using inline assembler to get and set the x87 FPU control word.
if test "$GCC" = yes && test -n "`$CC -dM -E - </dev/null | grep i386`"
# This inline assembler syntax may also work for suncc and icc,
# so we try it on all platforms.
AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
AC_TRY_COMPILE([], [
unsigned short cw;
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
__asm__ __volatile__ ("fldcw %0" : : "m" (cw));
],
[have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
AC_MSG_RESULT($have_gcc_asm_for_x87)
if test "$have_gcc_asm_for_x87" = yes
then then
# Check that it's okay to use gcc inline assembler to get and set AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
# x87 control word. It should be, but you never know... [Define if we can use gcc inline assembler to get and set x87 control word])
AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
AC_TRY_COMPILE([], [
unsigned short cw;
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
__asm__ __volatile__ ("fldcw %0" : : "m" (cw));
],
[have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
AC_MSG_RESULT($have_gcc_asm_for_x87)
if test "$have_gcc_asm_for_x87" = yes
then
AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
[Define if we can use gcc inline assembler to get and set x87 control word])
fi
fi fi
# Detect whether system arithmetic is subject to x87-style double # Detect whether system arithmetic is subject to x87-style double