about summary refs log tree commit diff
path: root/REORG.TODO/sysdeps/m68k/coldfire/fpu
diff options
context:
space:
mode:
Diffstat (limited to 'REORG.TODO/sysdeps/m68k/coldfire/fpu')
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/bits/mathinline.h44
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/e_sqrt.c24
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/e_sqrtf.c25
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/fraiseexcpt.c68
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/libm-test-ulps228
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/libm-test-ulps-name1
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/math_private.h10
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/s_fabs.c28
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/s_fabsf.c24
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/s_lrint.c29
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/s_lrintf.c25
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/s_rint.c28
-rw-r--r--REORG.TODO/sysdeps/m68k/coldfire/fpu/s_rintf.c25
13 files changed, 559 insertions, 0 deletions
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/bits/mathinline.h b/REORG.TODO/sysdeps/m68k/coldfire/fpu/bits/mathinline.h
new file mode 100644
index 0000000000..7dbfe37ee1
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/bits/mathinline.h
@@ -0,0 +1,44 @@
+/* Inline math functions for Coldfire.
+   Copyright (C) 2012-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _MATH_H
+# error "Never use <bits/mathinline.h> directly; include <math.h> instead."
+#endif
+
+#ifndef __extern_always_inline
+# define __MATH_INLINE __inline
+#else
+# define __MATH_INLINE __extern_always_inline
+#endif
+
+#if defined __USE_ISOC99 && defined __GNUC__
+
+/* Test for negative number.  Used in the signbit macro.  */
+__MATH_INLINE int
+__NTH (__signbitf (float __x))
+{
+  return __builtin_signbitf (__x);
+}
+
+__MATH_INLINE int
+__NTH (__signbit (double __x))
+{
+  return __builtin_signbit (__x);
+}
+
+#endif
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/e_sqrt.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/e_sqrt.c
new file mode 100644
index 0000000000..6e54475f88
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/e_sqrt.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+double
+__ieee754_sqrt (double x)
+{
+  asm ("fdsqrt.d %1,%0" : "=f" (x) : "fm" (x));
+  return x;
+}
+strong_alias (__ieee754_sqrt, __sqrt_finite)
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/e_sqrtf.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/e_sqrtf.c
new file mode 100644
index 0000000000..64d26f87a7
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/e_sqrtf.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+float
+__ieee754_sqrtf (float x)
+{
+  double result;
+  asm ("fssqrt.s %1,%0" : "=f" (result) : "dm" (x));
+  return result;
+}
+strong_alias (__ieee754_sqrtf, __sqrtf_finite)
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/fraiseexcpt.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/fraiseexcpt.c
new file mode 100644
index 0000000000..4220a6b877
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/fraiseexcpt.c
@@ -0,0 +1,68 @@
+/* Raise given exceptions.
+   Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <fenv.h>
+#include <float.h>
+#include <math.h>
+
+int
+__feraiseexcept (int excepts)
+{
+  /* Raise exceptions represented by EXCEPTS.  But we must raise only one
+     signal at a time.  It is important that if the overflow/underflow
+     exception and the divide by zero exception are given at the same
+     time, the overflow/underflow exception follows the divide by zero
+     exception.
+
+     The Coldfire FPU allows an exception to be raised by asserting
+     the associated EXC bit and then executing an arbitrary arithmetic
+     instruction.  fmove.l is classified as an arithmetic instruction
+     and suffices for this purpose.
+
+     We therefore raise an exception by setting both the EXC and AEXC
+     bit associated with the exception (the former being 6 bits to the
+     left of the latter) and then loading the longword at (%sp) into an
+     FP register.  */
+
+  inline void
+  raise_one_exception (int mask)
+  {
+    if (excepts & mask)
+      {
+	int fpsr;
+	double unused;
+
+	asm volatile ("fmove%.l %/fpsr,%0" : "=d" (fpsr));
+	fpsr |= (mask << 6) | mask;
+	asm volatile ("fmove%.l %0,%/fpsr" :: "d" (fpsr));
+	asm volatile ("fmove%.l (%%sp),%0" : "=f" (unused));
+      }
+  }
+
+  raise_one_exception (FE_INVALID);
+  raise_one_exception (FE_DIVBYZERO);
+  raise_one_exception (FE_OVERFLOW);
+  raise_one_exception (FE_UNDERFLOW);
+  raise_one_exception (FE_INEXACT);
+
+  /* Success.  */
+  return 0;
+}
+libm_hidden_def (__feraiseexcept)
+weak_alias (__feraiseexcept, feraiseexcept)
+libm_hidden_weak (feraiseexcept)
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/libm-test-ulps b/REORG.TODO/sysdeps/m68k/coldfire/fpu/libm-test-ulps
new file mode 100644
index 0000000000..fad7f8f068
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/libm-test-ulps
@@ -0,0 +1,228 @@
+# Begin of automatic generation
+
+# Maximal error of functions:
+Function: "atan2":
+float: 1
+ifloat: 1
+
+Function: "atanh":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "cacosh":
+float: 1
+ifloat: 1
+
+Function: Real part of "casin":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "casinh":
+double: 5
+float: 1
+idouble: 5
+ifloat: 1
+
+Function: Imaginary part of "casinh":
+double: 3
+float: 6
+idouble: 3
+ifloat: 6
+
+Function: Imaginary part of "catan":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "catanh":
+double: 4
+idouble: 4
+
+Function: "cbrt":
+double: 1
+idouble: 1
+
+Function: Real part of "ccos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccos":
+float: 1
+ifloat: 1
+
+Function: Real part of "ccosh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Imaginary part of "ccosh":
+float: 1
+ifloat: 1
+
+Function: Real part of "cexp":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "cexp":
+float: 1
+ifloat: 1
+
+Function: Real part of "clog":
+float: 1
+ifloat: 1
+
+Function: Real part of "clog10":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "clog10":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "cos":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: Real part of "cpow":
+double: 2
+float: 4
+idouble: 2
+ifloat: 4
+
+Function: Imaginary part of "cpow":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: Real part of "csinh":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "csinh":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: Real part of "csqrt":
+float: 1
+ifloat: 1
+
+Function: Imaginary part of "ctan":
+double: 1
+idouble: 1
+
+Function: Real part of "ctanh":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: Imaginary part of "ctanh":
+float: 1
+ifloat: 1
+
+Function: "erf":
+double: 1
+idouble: 1
+
+Function: "erfc":
+double: 1
+idouble: 1
+
+Function: "exp10":
+double: 6
+float: 2
+idouble: 6
+ifloat: 2
+
+Function: "expm1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "hypot":
+float: 1
+ifloat: 1
+
+Function: "j0":
+double: 2
+float: 2
+idouble: 2
+ifloat: 2
+
+Function: "j1":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "jn":
+double: 4
+float: 4
+idouble: 4
+ifloat: 4
+
+Function: "lgamma":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "log10":
+double: 1
+float: 2
+idouble: 1
+ifloat: 2
+
+Function: "log1p":
+float: 1
+ifloat: 1
+
+Function: "sincos":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "tan":
+double: 1
+idouble: 1
+
+Function: "tgamma":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+Function: "y0":
+double: 2
+float: 1
+idouble: 2
+ifloat: 1
+
+Function: "y1":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+Function: "yn":
+double: 3
+float: 2
+idouble: 3
+ifloat: 2
+
+# end of automatic generation
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/libm-test-ulps-name b/REORG.TODO/sysdeps/m68k/coldfire/fpu/libm-test-ulps-name
new file mode 100644
index 0000000000..d0b67ea9eb
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/libm-test-ulps-name
@@ -0,0 +1 @@
+ColdFire
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/math_private.h b/REORG.TODO/sysdeps/m68k/coldfire/fpu/math_private.h
new file mode 100644
index 0000000000..d306a508b4
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/math_private.h
@@ -0,0 +1,10 @@
+#ifndef COLDFIRE_MATH_PRIVATE_H
+#define COLDFIRE_MATH_PRIVATE_H 1
+
+/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
+   when built without long double support. */
+#define LDBL_CLASSIFY_COMPAT 1
+
+#include_next <math_private.h>
+
+#endif
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_fabs.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_fabs.c
new file mode 100644
index 0000000000..6c1a8dc344
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_fabs.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+double
+__fabs (double x)
+{
+  asm ("fdabs.d %1,%0" : "=f" (x) : "fm" (x));
+  return x;
+}
+weak_alias (__fabs, fabs)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fabs, __fabsl)
+weak_alias (__fabs, fabsl)
+#endif
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_fabsf.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_fabsf.c
new file mode 100644
index 0000000000..e134c102e9
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_fabsf.c
@@ -0,0 +1,24 @@
+/* Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+float
+__fabsf (float x)
+{
+  asm ("fsabs.s %1,%0" : "=f" (x) : "dm" (x));
+  return x;
+}
+weak_alias (__fabsf, fabsf)
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_lrint.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_lrint.c
new file mode 100644
index 0000000000..0cdad325d1
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_lrint.c
@@ -0,0 +1,29 @@
+/* Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+long int
+__lrint (double x)
+{
+  long int result;
+  asm ("fmove.l %1,%0" : "=dm" (result) : "f" (x));
+  return result;
+}
+weak_alias (__lrint, lrint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lrint, __lrintl)
+weak_alias (__lrint, lrintl)
+#endif
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_lrintf.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_lrintf.c
new file mode 100644
index 0000000000..7f5c9d04f2
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_lrintf.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+long int
+__lrintf (float x)
+{
+  long int result;
+  asm ("fmove.l %1,%0" : "=dm" (result) : "f" (x));
+  return result;
+}
+weak_alias (__lrintf, lrintf)
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_rint.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_rint.c
new file mode 100644
index 0000000000..e950630688
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_rint.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+double
+__rint (double x)
+{
+  asm ("fint.d %1,%0" : "=f" (x) : "fm" (x));
+  return x;
+}
+weak_alias (__rint, rint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__rint, __rintl)
+weak_alias (__rint, rintl)
+#endif
diff --git a/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_rintf.c b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_rintf.c
new file mode 100644
index 0000000000..ea244e8b88
--- /dev/null
+++ b/REORG.TODO/sysdeps/m68k/coldfire/fpu/s_rintf.c
@@ -0,0 +1,25 @@
+/* Copyright (C) 2006-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+float
+__rintf (float x)
+{
+  double result;
+  asm ("fint.s %1,%0" : "=f" (result) : "dm" (x));
+  return (float) result;
+}
+weak_alias (__rintf, rintf)