Skip to content

Commit a548dee

Browse files
committed
Issue #5792: Extend short float repr support to x86 platforms using suncc or icc.
Many thanks Stefan Krah for help and OpenSolaris testing.
1 parent 009ae86 commit a548dee

File tree

2 files changed

+30
-32
lines changed

2 files changed

+30
-32
lines changed

configure

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23626,15 +23626,15 @@ fi
2362623626
# correctly-rounded string <-> double conversion functions from
2362723627
# Python/dtoa.c, which in turn require that the FPU uses 53-bit
2362823628
# rounding; this is a problem on x86, where the x87 FPU has a default
23629-
# rounding precision of 64 bits. For gcc/x86, we try to fix this by
23629+
# rounding precision of 64 bits. For gcc/x86, we can fix this by
2363023630
# using inline assembler to get and set the x87 FPU control word.
23631-
if test "$GCC" = yes && test -n "`$CC -dM -E - </dev/null | grep i386`"
23632-
then
23633-
# Check that it's okay to use gcc inline assembler to get and set
23634-
# x87 control word. It should be, but you never know...
23635-
{ echo "$as_me:$LINENO: checking whether we can use gcc inline assembler to get and set x87 control word" >&5
23631+
23632+
# This inline assembler syntax may also work for suncc and icc,
23633+
# so we try it on all platforms.
23634+
23635+
{ echo "$as_me:$LINENO: checking whether we can use gcc inline assembler to get and set x87 control word" >&5
2363623636
echo $ECHO_N "checking whether we can use gcc inline assembler to get and set x87 control word... $ECHO_C" >&6; }
23637-
cat >conftest.$ac_ext <<_ACEOF
23637+
cat >conftest.$ac_ext <<_ACEOF
2363823638
/* confdefs.h. */
2363923639
_ACEOF
2364023640
cat confdefs.h >>conftest.$ac_ext
@@ -23645,9 +23645,9 @@ int
2364523645
main ()
2364623646
{
2364723647

23648-
unsigned short cw;
23649-
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
23650-
__asm__ __volatile__ ("fldcw %0" : : "m" (cw));
23648+
unsigned short cw;
23649+
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
23650+
__asm__ __volatile__ ("fldcw %0" : : "m" (cw));
2365123651

2365223652
;
2365323653
return 0;
@@ -23679,16 +23679,15 @@ sed 's/^/| /' conftest.$ac_ext >&5
2367923679
fi
2368023680

2368123681
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
23682-
{ echo "$as_me:$LINENO: result: $have_gcc_asm_for_x87" >&5
23682+
{ echo "$as_me:$LINENO: result: $have_gcc_asm_for_x87" >&5
2368323683
echo "${ECHO_T}$have_gcc_asm_for_x87" >&6; }
23684-
if test "$have_gcc_asm_for_x87" = yes
23685-
then
23684+
if test "$have_gcc_asm_for_x87" = yes
23685+
then
2368623686

2368723687
cat >>confdefs.h <<\_ACEOF
2368823688
#define HAVE_GCC_ASM_FOR_X87 1
2368923689
_ACEOF
2369023690

23691-
fi
2369223691
fi
2369323692

2369423693
# Detect whether system arithmetic is subject to x87-style double

configure.in

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3320,25 +3320,24 @@ fi
33203320
# correctly-rounded string <-> double conversion functions from
33213321
# Python/dtoa.c, which in turn require that the FPU uses 53-bit
33223322
# rounding; this is a problem on x86, where the x87 FPU has a default
3323-
# rounding precision of 64 bits. For gcc/x86, we try to fix this by
3323+
# rounding precision of 64 bits. For gcc/x86, we can fix this by
33243324
# using inline assembler to get and set the x87 FPU control word.
3325-
if test "$GCC" = yes && test -n "`$CC -dM -E - </dev/null | grep i386`"
3326-
then
3327-
# Check that it's okay to use gcc inline assembler to get and set
3328-
# x87 control word. It should be, but you never know...
3329-
AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3330-
AC_TRY_COMPILE([], [
3331-
unsigned short cw;
3332-
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3333-
__asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3334-
],
3335-
[have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
3336-
AC_MSG_RESULT($have_gcc_asm_for_x87)
3337-
if test "$have_gcc_asm_for_x87" = yes
3338-
then
3339-
AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3340-
[Define if we can use gcc inline assembler to get and set x87 control word])
3341-
fi
3325+
3326+
# This inline assembler syntax may also work for suncc and icc,
3327+
# so we try it on all platforms.
3328+
3329+
AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set x87 control word)
3330+
AC_TRY_COMPILE([], [
3331+
unsigned short cw;
3332+
__asm__ __volatile__ ("fnstcw %0" : "=m" (cw));
3333+
__asm__ __volatile__ ("fldcw %0" : : "m" (cw));
3334+
],
3335+
[have_gcc_asm_for_x87=yes], [have_gcc_asm_for_x87=no])
3336+
AC_MSG_RESULT($have_gcc_asm_for_x87)
3337+
if test "$have_gcc_asm_for_x87" = yes
3338+
then
3339+
AC_DEFINE(HAVE_GCC_ASM_FOR_X87, 1,
3340+
[Define if we can use gcc inline assembler to get and set x87 control word])
33423341
fi
33433342

33443343
# Detect whether system arithmetic is subject to x87-style double

0 commit comments

Comments
 (0)