diff options
-rw-r--r-- | Include/pyport.h | 19 | ||||
-rw-r--r-- | Misc/NEWS | 2 | ||||
-rwxr-xr-x | configure | 32 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | pyconfig.h.in | 3 |
5 files changed, 69 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h index c706213c87..69deb9f8bf 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -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. @@ -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 diff --git a/configure.ac b/configure.ac index 457819b0a3..f2e4b1ce1b 100644 --- a/configure.ac +++ b/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 diff --git a/pyconfig.h.in b/pyconfig.h.in index 3574f67322..e469f6abe9 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -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 |