mirror of
https://github.com/python/cpython
synced 2024-09-05 08:17:45 +00:00
support setting fpu precision on m68k (closes #20904)
Patch from Andreas Schwab.
This commit is contained in:
parent
aedff520ea
commit
8bdeb1672c
|
@ -588,6 +588,25 @@ extern "C" {
|
|||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GCC_ASM_FOR_MC68881
|
||||
#define HAVE_PY_SET_53BIT_PRECISION 1
|
||||
#define _Py_SET_53BIT_PRECISION_HEADER \
|
||||
unsigned int old_fpcr, new_fpcr
|
||||
#define _Py_SET_53BIT_PRECISION_START \
|
||||
do { \
|
||||
__asm__ ("fmove.l %%fpcr,%0" : "=g" (old_fpcr)); \
|
||||
/* Set double precision / round to nearest. */ \
|
||||
new_fpcr = (old_fpcr & ~0xf0) | 0x80; \
|
||||
if (new_fpcr != old_fpcr) \
|
||||
__asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (new_fpcr)); \
|
||||
} while (0)
|
||||
#define _Py_SET_53BIT_PRECISION_END \
|
||||
do { \
|
||||
if (new_fpcr != old_fpcr) \
|
||||
__asm__ volatile ("fmove.l %0,%%fpcr" : : "g" (old_fpcr)); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/* default definitions are empty */
|
||||
#ifndef HAVE_PY_SET_53BIT_PRECISION
|
||||
#define _Py_SET_53BIT_PRECISION_HEADER
|
||||
|
|
|
@ -10,6 +10,8 @@ Release date: TBA
|
|||
Core and Builtins
|
||||
-----------------
|
||||
|
||||
- Issue #20904: Support setting FPU precision on m68k.
|
||||
|
||||
- Issue #21209: Fix sending tuples to custom generator objects with the yield
|
||||
from syntax.
|
||||
|
||||
|
|
32
configure
vendored
32
configure
vendored
|
@ -13244,6 +13244,38 @@ $as_echo "#define HAVE_GCC_ASM_FOR_X87 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can use gcc inline assembler to get and set mc68881 fpcr" >&5
|
||||
$as_echo_n "checking whether we can use gcc inline assembler to get and set mc68881 fpcr... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
unsigned int fpcr;
|
||||
__asm__ __volatile__ ("fmove.l %%fpcr,%0" : "=g" (fpcr));
|
||||
__asm__ __volatile__ ("fmove.l %0,%%fpcr" : : "g" (fpcr));
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
have_gcc_asm_for_mc68881=yes
|
||||
else
|
||||
have_gcc_asm_for_mc68881=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_asm_for_mc68881" >&5
|
||||
$as_echo "$have_gcc_asm_for_mc68881" >&6; }
|
||||
if test "$have_gcc_asm_for_mc68881" = yes
|
||||
then
|
||||
|
||||
$as_echo "#define HAVE_GCC_ASM_FOR_MC68881 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# Detect whether system arithmetic is subject to x87-style double
|
||||
# rounding issues. The result of this test has little meaning on non
|
||||
# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
|
||||
|
|
13
configure.ac
13
configure.ac
|
@ -3810,6 +3810,19 @@ then
|
|||
[Define if we can use gcc inline assembler to get and set x87 control word])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether we can use gcc inline assembler to get and set mc68881 fpcr)
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
unsigned int fpcr;
|
||||
__asm__ __volatile__ ("fmove.l %%fpcr,%0" : "=g" (fpcr));
|
||||
__asm__ __volatile__ ("fmove.l %0,%%fpcr" : : "g" (fpcr));
|
||||
]])],[have_gcc_asm_for_mc68881=yes],[have_gcc_asm_for_mc68881=no])
|
||||
AC_MSG_RESULT($have_gcc_asm_for_mc68881)
|
||||
if test "$have_gcc_asm_for_mc68881" = yes
|
||||
then
|
||||
AC_DEFINE(HAVE_GCC_ASM_FOR_MC68881, 1,
|
||||
[Define if we can use gcc inline assembler to get and set mc68881 fpcr])
|
||||
fi
|
||||
|
||||
# Detect whether system arithmetic is subject to x87-style double
|
||||
# rounding issues. The result of this test has little meaning on non
|
||||
# IEEE 754 platforms. On IEEE 754, test should return 1 if rounding
|
||||
|
|
|
@ -313,6 +313,9 @@
|
|||
/* Define to 1 if you have the `gamma' function. */
|
||||
#undef HAVE_GAMMA
|
||||
|
||||
/* Define if we can use gcc inline assembler to get and set mc68881 fpcr */
|
||||
#undef HAVE_GCC_ASM_FOR_MC68881
|
||||
|
||||
/* Define if we can use x64 gcc inline assembler */
|
||||
#undef HAVE_GCC_ASM_FOR_X64
|
||||
|
||||
|
|
Loading…
Reference in a new issue