summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-04-17 04:00:31 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-04-17 04:00:31 (GMT)
commit8bdeb1672ce1d0412e1fcc6cff0821bb66f02c1a (patch)
tree7b85e22dad6f12ebd3f33825d91c7d3855de38d2 /Include
parentaedff520eab83c48848d2346d6f55cc1579182ef (diff)
downloadcpython-8bdeb1672ce1d0412e1fcc6cff0821bb66f02c1a.zip
cpython-8bdeb1672ce1d0412e1fcc6cff0821bb66f02c1a.tar.gz
cpython-8bdeb1672ce1d0412e1fcc6cff0821bb66f02c1a.tar.bz2
support setting fpu precision on m68k (closes #20904)
Patch from Andreas Schwab.
Diffstat (limited to 'Include')
-rw-r--r--Include/pyport.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/Include/pyport.h b/Include/pyport.h
index c706213..69deb9f 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