about summary refs log tree commit diff
path: root/sysdeps/m68k/fpu
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-06 05:23:42 +0000
committerRoland McGrath <roland@gnu.org>1996-06-06 05:23:42 +0000
commit8f30ca23f7c7d9181fc532be00e22da67e38a0bf (patch)
tree8fe5e0221f947526a47441e4ac4862c3be8dbcba /sysdeps/m68k/fpu
parentf127cd28b5f758a512fcd09e317e720c16bce3b4 (diff)
downloadglibc-8f30ca23f7c7d9181fc532be00e22da67e38a0bf.tar.gz
glibc-8f30ca23f7c7d9181fc532be00e22da67e38a0bf.tar.xz
glibc-8f30ca23f7c7d9181fc532be00e22da67e38a0bf.zip
Tue Jun 4 22:03:02 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
	* sysdeps/m68k/fpu/__math.h: Define long double versions of
	the inline functions.

	* sysdeps/m68k/fpu/e_asinl.c, sysdeps/m68k/fpu/e_atanl.c,
	sysdeps/m68k/fpu/e_acosl.c, sysdeps/m68k/fpu/e_expl.c,
	sysdeps/m68k/fpu/e_fmodl.c, sysdeps/m68k/fpu/e_log10l.c,
	sysdeps/m68k/fpu/e_logl.c, sysdeps/m68k/fpu/e_powl.c,
	sysdeps/m68k/fpu/e_remainderl.c, sysdeps/m68k/fpu/e_scalbl.c,
	sysdeps/m68k/fpu/e_sinhl.c, sysdeps/m68k/fpu/e_sqrtl.c,
	sysdeps/m68k/fpu/k_cosl.c, sysdeps/m68k/fpu/k_sinl.c,
	sysdeps/m68k/fpu/k_tanl.c, sysdeps/m68k/fpu/s_atanl.c,
	sysdeps/m68k/fpu/s_ceill.c, sysdeps/m68k/fpu/s_cosl.c,
	sysdeps/m68k/fpu/s_expm1l.c, sysdeps/m68k/fpu/s_fabsl.c,
	sysdeps/m68k/fpu/s_finitel.c, sysdeps/m68k/fpu/s_floorl.c,
	sysdeps/m68k/fpu/s_frexpl.c, sysdeps/m68k/fpu/s_ilogbl.c,
	sysdeps/m68k/fpu/s_isinfl.c, sysdeps/m68k/fpu/s_isnanl.c,
	sysdeps/m68k/fpu/s_ldexpl.c, sysdeps/m68k/fpu/s_log1pl.c,
	sysdeps/m68k/fpu/s_logbl.c, sysdeps/m68k/fpu/s_modfl.c,
	sysdeps/m68k/fpu/s_rintl.c, sysdeps/m68k/fpu/s_scalbnl.c,
	sysdeps/m68k/fpu/s_significandl.c, sysdeps/m68k/fpu/s_sinl.c,
	sysdeps/m68k/fpu/s_tanhl.c, sysdeps/m68k/fpu/s_tanl.c: New files.

	* sysdeps/m68k/fpu/e_acos.c, sysdeps/m68k/fpu/e_fmod.c,
 	sysdeps/m68k/fpu/k_cos.c, sysdeps/m68k/fpu/k_sin.c,
 	sysdeps/m68k/fpu/k_tan.c, sysdeps/m68k/fpu/s_atan.c,
 	sysdeps/m68k/fpu/s_frexp.c, sysdeps/m68k/fpu/s_ilogb.c,
 	sysdeps/m68k/fpu/s_isinf.c, sysdeps/m68k/fpu/s_ldexp.c,
 	sysdeps/m68k/fpu/s_modf.c: Define generic functions using FUNC and
 	float_type with appropriate defaults.

	* sysdeps/m68k/fpu/e_acosf.c, sysdeps/m68k/fpu/e_fmodf.c,
	sysdeps/m68k/fpu/k_cosf.c, sysdeps/m68k/fpu/k_sinf.c,
	sysdeps/m68k/fpu/k_tanf.c, sysdeps/m68k/fpu/s_atanf.c,
	sysdeps/m68k/fpu/s_frexpf.c, sysdeps/m68k/fpu/s_ilogbf.c,
	sysdeps/m68k/fpu/s_isinff.c, sysdeps/m68k/fpu/s_ldexpf.c,
	sysdeps/m68k/fpu/s_modff.c: Include the corresponding double
	versions with appropriate definitions to get float functions,
	instead of defining them directly.

	* sysdeps/m68k/fpu/acos.c: File removed.
	* sysdeps/m68k/fpu/asin.c: File removed.
	* sysdeps/m68k/fpu/atan.c: File removed.
	* sysdeps/m68k/fpu/atan2.c: File removed.
	* sysdeps/m68k/fpu/atanh.c: File removed.
	* sysdeps/m68k/fpu/ceil.c: File removed.
	* sysdeps/m68k/fpu/cos.c: File removed.
	* sysdeps/m68k/fpu/cosh.c: File removed.
	* sysdeps/m68k/fpu/drem.c: File removed.
	* sysdeps/m68k/fpu/exp.c: File removed.
	* sysdeps/m68k/fpu/expm1.c: File removed.
	* sysdeps/m68k/fpu/fabs.c: File removed.
	* sysdeps/m68k/fpu/fl.h: File removed.
	* sysdeps/m68k/fpu/floor.c: File removed.
	* sysdeps/m68k/fpu/fmod.c: File removed.
	* sysdeps/m68k/fpu/frexp.c: File removed.
	* sysdeps/m68k/fpu/isinf.c: File removed.
	* sysdeps/m68k/fpu/isinfl.c: File removed.
	* sysdeps/m68k/fpu/isnan.c: File removed.
	* sysdeps/m68k/fpu/isnanl.c: File removed.
	* sysdeps/m68k/fpu/ldexp.c: File removed.
	* sysdeps/m68k/fpu/log.c: File removed.
	* sysdeps/m68k/fpu/log10.c: File removed.
	* sysdeps/m68k/fpu/log1p.c: File removed.
	* sysdeps/m68k/fpu/logb.c: File removed.
	* sysdeps/m68k/fpu/pow.c: File removed.
	* sysdeps/m68k/fpu/rint.c: File removed.
	* sysdeps/m68k/fpu/sin.c: File removed.
	* sysdeps/m68k/fpu/sinh.c: File removed.
	* sysdeps/m68k/fpu/sqrt.c: File removed.
	* sysdeps/m68k/fpu/tan.c: File removed.
	* sysdeps/m68k/fpu/tanh.c: File removed.

	* sysdeps/unix/sysv/linux/syscalls.list: Add select (the syscall name
	is _newselect).
	* sysdeps/unix/sysv/linux/select.S: File removed.

	* sysdeps/unix/sysv/linux/m68k/select.S: File removed; obsolete with
	current kernels, generic linux version is fine.
Diffstat (limited to 'sysdeps/m68k/fpu')
-rw-r--r--sysdeps/m68k/fpu/__math.h178
-rw-r--r--sysdeps/m68k/fpu/acos.c32
-rw-r--r--sysdeps/m68k/fpu/asin.c2
-rw-r--r--sysdeps/m68k/fpu/atan.c2
-rw-r--r--sysdeps/m68k/fpu/atan2.c71
-rw-r--r--sysdeps/m68k/fpu/atanh.c2
-rw-r--r--sysdeps/m68k/fpu/ceil.c4
-rw-r--r--sysdeps/m68k/fpu/cos.c2
-rw-r--r--sysdeps/m68k/fpu/cosh.c2
-rw-r--r--sysdeps/m68k/fpu/drem.c31
-rw-r--r--sysdeps/m68k/fpu/e_acos.c7
-rw-r--r--sysdeps/m68k/fpu/e_acosf.c29
-rw-r--r--sysdeps/m68k/fpu/e_asinl.c2
-rw-r--r--sysdeps/m68k/fpu/e_expl.c2
-rw-r--r--sysdeps/m68k/fpu/e_fmod.c7
-rw-r--r--sysdeps/m68k/fpu/e_fmodf.c29
-rw-r--r--sysdeps/m68k/fpu/e_fmodl.c5
-rw-r--r--sysdeps/m68k/fpu/e_log10l.c2
-rw-r--r--sysdeps/m68k/fpu/e_logl.c2
-rw-r--r--sysdeps/m68k/fpu/e_powl.c2
-rw-r--r--sysdeps/m68k/fpu/e_remainderl.c2
-rw-r--r--sysdeps/m68k/fpu/e_scalbl.c2
-rw-r--r--sysdeps/m68k/fpu/e_sinhl.c2
-rw-r--r--sysdeps/m68k/fpu/e_sqrtl.c2
-rw-r--r--sysdeps/m68k/fpu/exp.c3
-rw-r--r--sysdeps/m68k/fpu/expm1.c3
-rw-r--r--sysdeps/m68k/fpu/fabs.c3
-rw-r--r--sysdeps/m68k/fpu/fl.h41
-rw-r--r--sysdeps/m68k/fpu/floor.c3
-rw-r--r--sysdeps/m68k/fpu/fmod.c27
-rw-r--r--sysdeps/m68k/fpu/frexp.c27
-rw-r--r--sysdeps/m68k/fpu/isinf.c34
-rw-r--r--sysdeps/m68k/fpu/isinfl.c28
-rw-r--r--sysdeps/m68k/fpu/isnan.c4
-rw-r--r--sysdeps/m68k/fpu/isnanl.c28
-rw-r--r--sysdeps/m68k/fpu/k_cos.c15
-rw-r--r--sysdeps/m68k/fpu/k_cosf.c29
-rw-r--r--sysdeps/m68k/fpu/k_cosl.c3
-rw-r--r--sysdeps/m68k/fpu/k_sin.c16
-rw-r--r--sysdeps/m68k/fpu/k_sinf.c29
-rw-r--r--sysdeps/m68k/fpu/k_sinl.c3
-rw-r--r--sysdeps/m68k/fpu/k_tan.c18
-rw-r--r--sysdeps/m68k/fpu/k_tanf.c32
-rw-r--r--sysdeps/m68k/fpu/k_tanl.c3
-rw-r--r--sysdeps/m68k/fpu/ldexp.c27
-rw-r--r--sysdeps/m68k/fpu/log.c3
-rw-r--r--sysdeps/m68k/fpu/log10.c2
-rw-r--r--sysdeps/m68k/fpu/log1p.c2
-rw-r--r--sysdeps/m68k/fpu/logb.c46
-rw-r--r--sysdeps/m68k/fpu/pow.c27
-rw-r--r--sysdeps/m68k/fpu/rint.c5
-rw-r--r--sysdeps/m68k/fpu/s_atan.c7
-rw-r--r--sysdeps/m68k/fpu/s_atanf.c34
-rw-r--r--sysdeps/m68k/fpu/s_atanl.c5
-rw-r--r--sysdeps/m68k/fpu/s_ceill.c2
-rw-r--r--sysdeps/m68k/fpu/s_cosl.c2
-rw-r--r--sysdeps/m68k/fpu/s_expm1l.c2
-rw-r--r--sysdeps/m68k/fpu/s_fabsl.c2
-rw-r--r--sysdeps/m68k/fpu/s_finitel.c2
-rw-r--r--sysdeps/m68k/fpu/s_floorl.c2
-rw-r--r--sysdeps/m68k/fpu/s_frexp.c18
-rw-r--r--sysdeps/m68k/fpu/s_frexpf.c30
-rw-r--r--sysdeps/m68k/fpu/s_frexpl.c3
-rw-r--r--sysdeps/m68k/fpu/s_ilogb.c16
-rw-r--r--sysdeps/m68k/fpu/s_ilogbf.c31
-rw-r--r--sysdeps/m68k/fpu/s_ilogbl.c3
-rw-r--r--sysdeps/m68k/fpu/s_isinf.c5
-rw-r--r--sysdeps/m68k/fpu/s_isinff.c34
-rw-r--r--sysdeps/m68k/fpu/s_isinfl.c5
-rw-r--r--sysdeps/m68k/fpu/s_isnanl.c2
-rw-r--r--sysdeps/m68k/fpu/s_ldexp.c7
-rw-r--r--sysdeps/m68k/fpu/s_ldexpf.c34
-rw-r--r--sysdeps/m68k/fpu/s_ldexpl.c5
-rw-r--r--sysdeps/m68k/fpu/s_log1pl.c2
-rw-r--r--sysdeps/m68k/fpu/s_logbl.c2
-rw-r--r--sysdeps/m68k/fpu/s_modf.c18
-rw-r--r--sysdeps/m68k/fpu/s_modff.c30
-rw-r--r--sysdeps/m68k/fpu/s_modfl.c3
-rw-r--r--sysdeps/m68k/fpu/s_rintl.c2
-rw-r--r--sysdeps/m68k/fpu/s_scalbnl.c2
-rw-r--r--sysdeps/m68k/fpu/s_significandl.c2
-rw-r--r--sysdeps/m68k/fpu/s_sinl.c2
-rw-r--r--sysdeps/m68k/fpu/s_tanhl.c2
-rw-r--r--sysdeps/m68k/fpu/s_tanl.c2
-rw-r--r--sysdeps/m68k/fpu/sin.c2
-rw-r--r--sysdeps/m68k/fpu/sinh.c2
-rw-r--r--sysdeps/m68k/fpu/sqrt.c2
-rw-r--r--sysdeps/m68k/fpu/tan.c2
-rw-r--r--sysdeps/m68k/fpu/tanh.c2
89 files changed, 396 insertions, 814 deletions
diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h
index f59c168e79..2cbb4ca388 100644
--- a/sysdeps/m68k/fpu/__math.h
+++ b/sysdeps/m68k/fpu/__math.h
@@ -54,6 +54,14 @@ Cambridge, MA 02139, USA.  */
     __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
     return __result;							      \
   }
+
+#define __inline_mathopl(func, op)					      \
+  __m81_defun (long double, func, (long double __mathop_x))		      \
+  {									      \
+    long double __result;						      \
+    __asm("f" __STRING(op) "%.x %1, %0" : "=f" (__result) : "f" (__mathop_x));\
+    return __result;							      \
+  }
   
 /* ieee style elementary functions */
 __inline_mathop(__ieee754_acos, acos)
@@ -77,6 +85,17 @@ __inline_mathopf(__ieee754_logf, logn)
 __inline_mathopf(__ieee754_sqrtf, sqrt)
 __inline_mathopf(__ieee754_atanhf, atan)
 
+/* ieee style elementary long double functions */
+__inline_mathopl(__ieee754_acosl, acos)
+__inline_mathopl(__ieee754_asinl, asin)
+__inline_mathopl(__ieee754_coshl, cosh)
+__inline_mathopl(__ieee754_sinhl, sinh)
+__inline_mathopl(__ieee754_expl, etox)
+__inline_mathopl(__ieee754_log10l, log10)
+__inline_mathopl(__ieee754_logl, logn)
+__inline_mathopl(__ieee754_sqrtl, sqrt)
+__inline_mathopl(__ieee754_atanhl, atan)
+
 __inline_mathop(__atan, atan)
 __inline_mathop(__cos, cos)
 __inline_mathop(__sin, sin)
@@ -105,6 +124,20 @@ __inline_mathopf(__log1pf, lognp1)
 __inline_mathopf(__logbf, log2)
 __inline_mathopf(__significandf, getman)
 
+__inline_mathopl(__atanl, atan)
+__inline_mathopl(__cosl, cos)
+__inline_mathopl(__sinl, sin)
+__inline_mathopl(__tanl, tan)
+__inline_mathopl(__tanhl, tanh)
+__inline_mathopl(__fabsl, abs)
+__inline_mathopl(__sqrtl, sqrt)
+
+__inline_mathopl(__rintl, int)
+__inline_mathopl(__expm1l, etoxm1)
+__inline_mathopl(__log1pl, lognp1)
+__inline_mathopl(__logbl, log2)
+__inline_mathopl(__significandl, getman)
+
 __m81_defun (double, __ieee754_remainder, (double __x, double __y))
 {
   double __result;
@@ -427,6 +460,119 @@ __m81_defun (float, __scalbnf, (float __x, int __n))
   return __result;
 }
 
+__m81_defun (long double, __ieee754_remainderl, (long double __x,
+						 long double __y))
+{
+  long double __result;
+  __asm ("frem%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
+  return __result;
+}
+
+__m81_defun (long double, __ldexpl, (long double __x, int __e))
+{
+  long double __result;
+  long double __float_e = (long double) __e;
+  __asm ("fscale%.x %1, %0" : "=f" (__result) : "f" (__float_e), "0" (__x));
+  return __result;
+}
+
+__m81_defun (long double, __ieee754_fmodl, (long double __x, long double __y))
+{
+  long double __result;
+  __asm("fmod%.x %1, %0" : "=f" (__result) : "f" (__y), "0" (__x));
+  return __result;
+}
+
+__m81_inline long double
+__m81_u(__frexpl)(long double __value, int *__expptr)
+{
+  long double __mantissa, __exponent;
+  __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value));
+  __asm("fgetman%.x %1, %0" : "=f" (__mantissa) : "f" (__value));
+  *__expptr = (int) __exponent;
+  return __mantissa;
+}
+
+__m81_defun (long double, __floorl, (long double __x))
+{
+  long double __result;
+  unsigned long int __ctrl_reg;
+  __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg));
+  /* Set rounding towards negative infinity.  */
+  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */ 
+		      : "dmi" ((__ctrl_reg & ~0x10) | 0x20));
+  /* Convert X to an integer, using -Inf rounding.  */
+  __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x));
+  /* Restore the previous rounding mode.  */
+  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */
+		      : "dmi" (__ctrl_reg));
+  return __result;
+}
+
+__m81_defun (long double, __ieee754_powl, (long double __x, long double __y))
+{
+  long double __result;
+  if (__x == 0.0l)
+    {
+      if (__y <= 0.0l)
+	__result = 0.0l / 0.0l;
+      else
+	__result = 0.0l;
+    }
+  else if (__y == 0.0l || __x == 1.0l)
+    __result = 1.0;
+  else if (__y == 1.0l)
+    __result = __x;
+  else if (__y == 2.0l)
+    __result = __x * __x;
+  else if (__x == 10.0l)
+    __asm("ftentox%.x %1, %0" : "=f" (__result) : "f" (__y));
+  else if (__x == 2.0l)
+    __asm("ftwotox%.x %1, %0" : "=f" (__result) : "f" (__y));
+  else if (__x < 0.0l)
+    {
+      long double __temp = __m81_u(__rintl)(__y);
+      if (__y == __temp)
+	{
+	  int i = (int) __y;
+	  __result
+	    = __m81_u(__ieee754_expl)(__y * __m81_u(__ieee754_logl)(-__x));
+	  if (i & 1)
+	    __result = -__result;
+	}
+      else
+	__result = 0.0l / 0.0l;
+    }
+  else
+    __result = __m81_u(__ieee754_expl)(__y * __m81_u(__ieee754_logl)(__x));
+  return __result;
+}
+
+__m81_defun (long double, __ceill, (long double __x))
+{
+  long double __result;
+  unsigned long int __ctrl_reg;
+  __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg));
+  /* Set rounding towards positive infinity.  */
+  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */
+		      : "dmi" (__ctrl_reg | 0x30));
+  /* Convert X to an integer, using +Inf rounding.  */
+  __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x));
+  /* Restore the previous rounding mode.  */
+  __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs.  */
+		      : "dmi" (__ctrl_reg));
+  return __result;
+}
+
+__m81_inline long double
+__m81_u(__modfl)(long double __value, long double *__iptr)
+{
+  long double __modf_int;
+  __asm ("fintrz%.x %1, %0" : "=f" (__modf_int) : "f" (__value));
+  *__iptr = __modf_int;
+  return __value - __modf_int;
+}
+
 __m81_defun (int, __isinfl, (long double __value))
 {
   /* There is no branch-condition for infinity,
@@ -445,4 +591,36 @@ __m81_defun (int, __isnanl, (long double __value))
   return __result;
 }
 
+__m81_defun (int, __finitel, (long double __value))
+{
+  /* There is no branch-condition for infinity, so we must extract and
+     examine the condition codes manually.  */
+  unsigned long int __fpsr;
+  __asm ("ftst%.x %1\n"
+	 "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value));
+  return (__fpsr & (3 << 24)) == 0;
+}
+
+__m81_defun (int, __ilogbl, (long double __x))
+{
+  long double __result;
+  __asm("fgetexp%.x %1, %0" : "=f" (__result) : "f" (__x));
+  return (int) __result;
+}
+
+__m81_defun (long double, __ieee754_scalbl, (long double __x, long double __n))
+{
+  long double __result;
+  __asm ("fscale%.x %1, %0" : "=f" (__result) : "f" (__n), "0" (__x));
+  return __result;
+}
+
+__m81_defun (long double, __scalbnl, (long double __x, int __n))
+{
+  long double __result;
+  long double __float_n = (long double) __n;
+  __asm ("fscale%.x %1, %0" : "=f" (__result) : "f" (__float_n), "0" (__x));
+  return __result;
+}
+
 #endif	/* GCC.  */
diff --git a/sysdeps/m68k/fpu/acos.c b/sysdeps/m68k/fpu/acos.c
deleted file mode 100644
index 1481ce2cd9..0000000000
--- a/sysdeps/m68k/fpu/acos.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1991, 1994 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define	__NO_MATH_INLINES
-#include <math.h>
-
-#ifndef	FUNC
-#define	FUNC	acos
-#endif
-
-
-double
-DEFUN(FUNC, (x), double x)
-{
-  return __m81_u(FUNC)(x);
-}
diff --git a/sysdeps/m68k/fpu/asin.c b/sysdeps/m68k/fpu/asin.c
deleted file mode 100644
index 0e3e58f697..0000000000
--- a/sysdeps/m68k/fpu/asin.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	asin
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/atan.c b/sysdeps/m68k/fpu/atan.c
deleted file mode 100644
index b9d428e170..0000000000
--- a/sysdeps/m68k/fpu/atan.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	atan
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/atan2.c b/sysdeps/m68k/fpu/atan2.c
deleted file mode 100644
index 753b7f04af..0000000000
--- a/sysdeps/m68k/fpu/atan2.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright (C) 1991, 1992, 1994 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-#ifdef	__GNUC__
-
-double
-DEFUN(atan2, (y, x), double y AND double x)
-{
-  static CONST double one = 1.0, zero = 0.0;
-  double signx, signy;
-  double pi, PIo4, PIo2;
-
-  if (__isnan(x))
-    return x;
-  if (__isnan(y))
-    return y;
-
-  signy = __copysign(one, y);
-  signx = __copysign(one, x);
-
-  asm("fmovecr%.x %1, %0" : "=f" (pi) : "i" (0));
-  PIo2 = pi / 2;
-  PIo4 = pi / 4;
-
-  if (y == zero)
-    return signx == one ? y : __copysign(pi, signy);
-
-  if (x == zero)
-    return __copysign(PIo2, signy);
-
-  if (__isinf(x))
-    {
-      if (__isinf(y))
-	return __copysign(signx == one ? PIo4 : 3 * PIo4, signy);
-      else
-	return __copysign(signx == one ? zero : pi, signy);
-    }
-
-  if (__isinf(y))
-    return __copysign(PIo2, signy);
-
-  y = fabs(y);
-
-  if (x < 0.0)
-    /* X is negative.  */
-    return __copysign(pi - atan(y / -x), signy);
-
-  return __copysign(atan(y / x), signy);
-}
-
-#else
-#include <sysdeps/generic/atan2.c>
-#endif
diff --git a/sysdeps/m68k/fpu/atanh.c b/sysdeps/m68k/fpu/atanh.c
deleted file mode 100644
index d4636ec035..0000000000
--- a/sysdeps/m68k/fpu/atanh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	atanh
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/ceil.c b/sysdeps/m68k/fpu/ceil.c
deleted file mode 100644
index b4605e1b29..0000000000
--- a/sysdeps/m68k/fpu/ceil.c
+++ /dev/null
@@ -1,4 +0,0 @@
-
-#define	FUNC	ceil
-
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/cos.c b/sysdeps/m68k/fpu/cos.c
deleted file mode 100644
index fa50130af7..0000000000
--- a/sysdeps/m68k/fpu/cos.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	cos
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/cosh.c b/sysdeps/m68k/fpu/cosh.c
deleted file mode 100644
index 78a81943c6..0000000000
--- a/sysdeps/m68k/fpu/cosh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	cosh
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/drem.c b/sysdeps/m68k/fpu/drem.c
deleted file mode 100644
index 16caacfd81..0000000000
--- a/sysdeps/m68k/fpu/drem.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1991, 1992, 1994, 1995 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define	__NO_MATH_INLINES
-#include <math.h>
-
-#undef	drem
-
-double
-DEFUN(__drem, (x, y), double x AND double y)
-{
-  return ____drem(x, y);
-}
-
-weak_alias (__drem, drem)
diff --git a/sysdeps/m68k/fpu/e_acos.c b/sysdeps/m68k/fpu/e_acos.c
index 34dfc82cff..ae77dabf98 100644
--- a/sysdeps/m68k/fpu/e_acos.c
+++ b/sysdeps/m68k/fpu/e_acos.c
@@ -22,9 +22,12 @@ Cambridge, MA 02139, USA.  */
 #ifndef	FUNC
 #define	FUNC	__ieee754_acos
 #endif
+#ifndef float_type
+#define float_type double
+#endif
 
-double
-DEFUN(FUNC, (x), double x)
+float_type
+DEFUN(FUNC, (x), float_type x)
 {
   return __m81_u(FUNC)(x);
 }
diff --git a/sysdeps/m68k/fpu/e_acosf.c b/sysdeps/m68k/fpu/e_acosf.c
index 34da7ee163..90665082d3 100644
--- a/sysdeps/m68k/fpu/e_acosf.c
+++ b/sysdeps/m68k/fpu/e_acosf.c
@@ -1,30 +1,5 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
 #ifndef	FUNC
 #define	FUNC	__ieee754_acosf
 #endif
-
-float
-DEFUN(FUNC, (x), float x)
-{
-  return __m81_u(FUNC)(x);
-}
+#define float_type float
+#include <e_acos.c>
diff --git a/sysdeps/m68k/fpu/e_asinl.c b/sysdeps/m68k/fpu/e_asinl.c
new file mode 100644
index 0000000000..0dd89fb9da
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_asinl.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_asinl
+#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_expl.c b/sysdeps/m68k/fpu/e_expl.c
new file mode 100644
index 0000000000..8805a1b83a
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_expl.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_expl
+#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_fmod.c b/sysdeps/m68k/fpu/e_fmod.c
index 578fa3ce53..0b2468c06d 100644
--- a/sysdeps/m68k/fpu/e_fmod.c
+++ b/sysdeps/m68k/fpu/e_fmod.c
@@ -22,9 +22,12 @@ Cambridge, MA 02139, USA.  */
 #ifndef FUNC
 #define FUNC __ieee754_fmod
 #endif
+#ifndef float_type
+#define float_type double
+#endif
 
-double
-DEFUN(FUNC, (x, y), double x AND double y)
+float_type
+DEFUN(FUNC, (x, y), float_type x AND float_type y)
 {
   return __m81_u(FUNC)(x, y);
 }
diff --git a/sysdeps/m68k/fpu/e_fmodf.c b/sysdeps/m68k/fpu/e_fmodf.c
index b3c3eadddf..88c350ce9e 100644
--- a/sysdeps/m68k/fpu/e_fmodf.c
+++ b/sysdeps/m68k/fpu/e_fmodf.c
@@ -1,30 +1,5 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
 #ifndef FUNC
 #define FUNC __ieee754_fmodf
 #endif
-
-float
-DEFUN(FUNC, (x, y), float x AND float y)
-{
-  return __m81_u(FUNC)(x, y);
-}
+#define float_type float
+#include <e_fmod.c>
diff --git a/sysdeps/m68k/fpu/e_fmodl.c b/sysdeps/m68k/fpu/e_fmodl.c
new file mode 100644
index 0000000000..a46f19ea9d
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_fmodl.c
@@ -0,0 +1,5 @@
+#ifndef FUNC
+#define FUNC __ieee754_fmodl
+#endif
+#define float_type long double
+#include <e_fmod.c>
diff --git a/sysdeps/m68k/fpu/e_log10l.c b/sysdeps/m68k/fpu/e_log10l.c
new file mode 100644
index 0000000000..6dcfc5a101
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_log10l.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_log10l
+#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_logl.c b/sysdeps/m68k/fpu/e_logl.c
new file mode 100644
index 0000000000..03b1830759
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_logl.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_logl
+#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_powl.c b/sysdeps/m68k/fpu/e_powl.c
new file mode 100644
index 0000000000..0feec54fec
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_powl.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_powl
+#include <e_fmodl.c>
diff --git a/sysdeps/m68k/fpu/e_remainderl.c b/sysdeps/m68k/fpu/e_remainderl.c
new file mode 100644
index 0000000000..b9dc540cc5
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_remainderl.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_remainderl
+#include <e_fmodl.c>
diff --git a/sysdeps/m68k/fpu/e_scalbl.c b/sysdeps/m68k/fpu/e_scalbl.c
new file mode 100644
index 0000000000..92ab7a4ad1
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_scalbl.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_scalbl
+#include <e_fmodl.c>
diff --git a/sysdeps/m68k/fpu/e_sinhl.c b/sysdeps/m68k/fpu/e_sinhl.c
new file mode 100644
index 0000000000..2f42d96a38
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_sinhl.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_sinhl
+#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/e_sqrtl.c b/sysdeps/m68k/fpu/e_sqrtl.c
new file mode 100644
index 0000000000..fede1024a2
--- /dev/null
+++ b/sysdeps/m68k/fpu/e_sqrtl.c
@@ -0,0 +1,2 @@
+#define FUNC __ieee754_sqrtl
+#include <e_acosl.c>
diff --git a/sysdeps/m68k/fpu/exp.c b/sysdeps/m68k/fpu/exp.c
deleted file mode 100644
index 2649d72143..0000000000
--- a/sysdeps/m68k/fpu/exp.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define	FUNC	exp
-#define	OP	etox
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/expm1.c b/sysdeps/m68k/fpu/expm1.c
deleted file mode 100644
index 19f1802e56..0000000000
--- a/sysdeps/m68k/fpu/expm1.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define	FUNC	__expm1
-#define	OP	expm1
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/fabs.c b/sysdeps/m68k/fpu/fabs.c
deleted file mode 100644
index f9538a599c..0000000000
--- a/sysdeps/m68k/fpu/fabs.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define	FUNC	fabs
-#define	OP	abs
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/fl.h b/sysdeps/m68k/fpu/fl.h
deleted file mode 100644
index 098e880601..0000000000
--- a/sysdeps/m68k/fpu/fl.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Floating-point constants for the 68881.
-   Copyright (C) 1992 Free Software Foundation, Inc.  */
-
-/* IGNORE($ This is used internally in the library.  */
-#include <sysdeps/ieee754/fl.h>
-/* ansidecl.m4 here inserts the ieee file.  Kludge o rama.
-   $) ENDCOMMENT INCLUDE($sysdeps/ieee754/fl.h$) STARTCOMMENT */
-
-#ifndef	__need_HUGE_VAL
-
-#ifdef	__GNUC__
-
-#undef	FLT_ROUNDS
-
-/* Interrogate the 68881 to find the current rounding mode.  */
-
-static __const __inline int
-DEFUN_VOID(__flt_rounds)
-{
-  unsigned long int __fpcr;
-  __asm("fmove%.l fpcr, %0" : "=g" (__fpcr));
-  switch (__fpcr & (1 | 2))
-    {
-    case 0:
-      return _FLT_ROUNDS_TONEAREST;
-    case 1:
-      return _FLT_ROUNDS_TOZERO;
-    case 2:
-      return _FLT_ROUNDS_TONEGINF;
-    case 3:
-      return _FLT_ROUNDS_TOPOSINF;
-    default:
-      return _FLT_ROUNDS_INDETERMINATE;
-    }
-}
-
-#define	FLT_ROUNDS	(__flt_rounds())
-
-#endif	/* GCC.  */
-
-#endif	/* Don't need HUGE_VAL.  */
diff --git a/sysdeps/m68k/fpu/floor.c b/sysdeps/m68k/fpu/floor.c
deleted file mode 100644
index 92a2ca68bb..0000000000
--- a/sysdeps/m68k/fpu/floor.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define	FUNC	floor
-#define	OP	intrz
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/fmod.c b/sysdeps/m68k/fpu/fmod.c
deleted file mode 100644
index e3a2de0689..0000000000
--- a/sysdeps/m68k/fpu/fmod.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1991, 1994 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define	__NO_MATH_INLINES
-#include <math.h>
-
-double
-DEFUN(fmod, (x, y), double x AND double y)
-{
-  return __fmod(x, y);
-}
diff --git a/sysdeps/m68k/fpu/frexp.c b/sysdeps/m68k/fpu/frexp.c
deleted file mode 100644
index de74851de9..0000000000
--- a/sysdeps/m68k/fpu/frexp.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1991 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define	__NO_MATH_INLINES
-#include <math.h>
-
-double
-DEFUN(frexp, (value, expptr), double value AND int *expptr)
-{
-  return __frexp(value, expptr);
-}
diff --git a/sysdeps/m68k/fpu/isinf.c b/sysdeps/m68k/fpu/isinf.c
deleted file mode 100644
index ab2cf0bb03..0000000000
--- a/sysdeps/m68k/fpu/isinf.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1994, 1995 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define	__NO_MATH_INLINES
-#include <math.h>
-
-#ifndef	FUNC
-#define	FUNC	__isinf
-#endif
-
-
-int
-DEFUN(FUNC, (x), double x)
-{
-  return __m81_u(FUNC)(x);
-}
-
-weak_alias (__isinf, isinf)
diff --git a/sysdeps/m68k/fpu/isinfl.c b/sysdeps/m68k/fpu/isinfl.c
deleted file mode 100644
index 97b5983d0f..0000000000
--- a/sysdeps/m68k/fpu/isinfl.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-int
-DEFUN(__isinfl, (x), long double x)
-{
-  return __m81_u(__isinfl)(x);
-}
-
-weak_alias (__isinfl, isinfl)
diff --git a/sysdeps/m68k/fpu/isnan.c b/sysdeps/m68k/fpu/isnan.c
deleted file mode 100644
index d0984911d2..0000000000
--- a/sysdeps/m68k/fpu/isnan.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#define	FUNC	__isnan
-#include <isinf.c>
-
-weak_alias (__isnan, isnan)
diff --git a/sysdeps/m68k/fpu/isnanl.c b/sysdeps/m68k/fpu/isnanl.c
deleted file mode 100644
index e5e3db2171..0000000000
--- a/sysdeps/m68k/fpu/isnanl.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-int
-DEFUN(__isnanl, (x), long double x)
-{
-  return __m81_u(__isnanl)(x);
-}
-
-weak_alias (__isnanl, isnanl)
diff --git a/sysdeps/m68k/fpu/k_cos.c b/sysdeps/m68k/fpu/k_cos.c
index 1f508b4f40..28406e8cba 100644
--- a/sysdeps/m68k/fpu/k_cos.c
+++ b/sysdeps/m68k/fpu/k_cos.c
@@ -19,8 +19,17 @@ Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <math.h>
 
-double
-DEFUN(__kernel_cos, (x, y), double x AND double y)
+#ifndef FUNC
+#define FUNC cos
+#endif
+#ifndef float_type
+#define float_type double
+#endif
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
+float_type
+DEFUN(__CONCATX(__kernel_,FUNC), (x, y), float_type x AND float_type y)
 {
-  return __cos (x + y);
+  return __CONCATX(__,FUNC) (x + y);
 }
diff --git a/sysdeps/m68k/fpu/k_cosf.c b/sysdeps/m68k/fpu/k_cosf.c
index a6f0a26645..2a366d094b 100644
--- a/sysdeps/m68k/fpu/k_cosf.c
+++ b/sysdeps/m68k/fpu/k_cosf.c
@@ -1,26 +1,3 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-float
-DEFUN(__kernel_cosf, (x, y), float x AND float y)
-{
-  return __cosf (x + y);
-}
+#define FUNC cosf
+#define float_type float
+#include <k_cos.c>
diff --git a/sysdeps/m68k/fpu/k_cosl.c b/sysdeps/m68k/fpu/k_cosl.c
new file mode 100644
index 0000000000..983b66544c
--- /dev/null
+++ b/sysdeps/m68k/fpu/k_cosl.c
@@ -0,0 +1,3 @@
+#define FUNC cosl
+#define float_type long double
+#include <k_cos.c>
diff --git a/sysdeps/m68k/fpu/k_sin.c b/sysdeps/m68k/fpu/k_sin.c
index 10cfbb4400..8c6dfef720 100644
--- a/sysdeps/m68k/fpu/k_sin.c
+++ b/sysdeps/m68k/fpu/k_sin.c
@@ -19,8 +19,18 @@ Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <math.h>
 
-double
-DEFUN(__kernel_sin, (x, y, iy), double x AND double y AND int iy)
+#ifndef FUNC
+#define FUNC sin
+#endif
+#ifndef float_type
+#define float_type double
+#endif
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
+float_type
+DEFUN(__CONCATX(__kernel_,FUNC), (x, y, iy),
+      float_type x AND float_type y AND int iy)
 {
-  return __sin (x + y);
+  return __CONCATX(__,FUNC) (x + y);
 }
diff --git a/sysdeps/m68k/fpu/k_sinf.c b/sysdeps/m68k/fpu/k_sinf.c
index 245e86bd44..7050347c4b 100644
--- a/sysdeps/m68k/fpu/k_sinf.c
+++ b/sysdeps/m68k/fpu/k_sinf.c
@@ -1,26 +1,3 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-float
-DEFUN(__kernel_sinf, (x, y, iy), float x AND float y AND int iy)
-{
-  return __sinf (x + y);
-}
+#define FUNC sinf
+#define float_type float
+#include <k_sin.c>
diff --git a/sysdeps/m68k/fpu/k_sinl.c b/sysdeps/m68k/fpu/k_sinl.c
new file mode 100644
index 0000000000..5a647cafd7
--- /dev/null
+++ b/sysdeps/m68k/fpu/k_sinl.c
@@ -0,0 +1,3 @@
+#define FUNC sinl
+#define float_type long double
+#include <k_sin.c>
diff --git a/sysdeps/m68k/fpu/k_tan.c b/sysdeps/m68k/fpu/k_tan.c
index b18c9afbd8..c8fa9b780e 100644
--- a/sysdeps/m68k/fpu/k_tan.c
+++ b/sysdeps/m68k/fpu/k_tan.c
@@ -19,11 +19,21 @@ Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <math.h>
 
-double
-DEFUN(__kernel_tan, (x, y, iy), double x AND double y AND int iy)
+#ifndef FUNC
+#define FUNC tan
+#endif
+#ifndef float_type
+#define float_type double
+#endif
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
+float_type
+DEFUN(__CONCATX(__kernel_,FUNC), (x, y, iy),
+      float_type x AND float_type y AND int iy)
 {
   if (iy == 1)
-    return __tan (x + y);
+    return __CONCATX(__,FUNC) (x + y);
   else
-    return -1.0 / __tan (x + y);
+    return ((float_type) -1.0) / __CONCATX(__,FUNC) (x + y);
 }
diff --git a/sysdeps/m68k/fpu/k_tanf.c b/sysdeps/m68k/fpu/k_tanf.c
index 027a74a525..777af1bf13 100644
--- a/sysdeps/m68k/fpu/k_tanf.c
+++ b/sysdeps/m68k/fpu/k_tanf.c
@@ -1,29 +1,3 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-float
-DEFUN(__kernel_tanf, (x, y, iy), float x AND float y AND int iy)
-{
-  if (iy == 1)
-    return __tanf (x + y);
-  else
-    return -1.0 / __tanf (x + y);
-}
+#define FUNC tanf
+#define float_type float
+#include <k_tan.c>
diff --git a/sysdeps/m68k/fpu/k_tanl.c b/sysdeps/m68k/fpu/k_tanl.c
new file mode 100644
index 0000000000..f2570e681f
--- /dev/null
+++ b/sysdeps/m68k/fpu/k_tanl.c
@@ -0,0 +1,3 @@
+#define FUNC tanl
+#define float_type long double
+#include <k_tan.c>
diff --git a/sysdeps/m68k/fpu/ldexp.c b/sysdeps/m68k/fpu/ldexp.c
deleted file mode 100644
index 7e34882282..0000000000
--- a/sysdeps/m68k/fpu/ldexp.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1991, 1994 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define	__NO_MATH_INLINES
-#include <math.h>
-
-double
-DEFUN(ldexp, (x, exp), double x AND int exp)
-{
-  return __ldexp(x, exp);
-}
diff --git a/sysdeps/m68k/fpu/log.c b/sysdeps/m68k/fpu/log.c
deleted file mode 100644
index 4de3346545..0000000000
--- a/sysdeps/m68k/fpu/log.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define	FUNC	log
-#define	OP	logn
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/log10.c b/sysdeps/m68k/fpu/log10.c
deleted file mode 100644
index 246b69a364..0000000000
--- a/sysdeps/m68k/fpu/log10.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	log10
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/log1p.c b/sysdeps/m68k/fpu/log1p.c
deleted file mode 100644
index 028783819b..0000000000
--- a/sysdeps/m68k/fpu/log1p.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	log1p
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/logb.c b/sysdeps/m68k/fpu/logb.c
deleted file mode 100644
index 8619c908c8..0000000000
--- a/sysdeps/m68k/fpu/logb.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1991, 1992, 1993, 1994, 1995 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-#ifdef	__GNUC__
-
-/* Return the base 2 signed integral exponent of X.  */
-
-double
-DEFUN(__logb, (x), double x)
-{
-  if (__isnan (x))
-    return x;
-  if (__isinf (x))
-    return fabs (x);
-
-  if (x == 0.0)
-    asm ("flog2%.x %0, %0" : "=f" (x) : "0" (x));
-  else
-    asm ("fgetexp%.x %0, %0" : "=f" (x) : "0" (x));
-
-  return x;
-}
-
-weak_alias (__logb, logb)
-
-#else
-#include <sysdeps/ieee754/logb.c>
-#endif
diff --git a/sysdeps/m68k/fpu/pow.c b/sysdeps/m68k/fpu/pow.c
deleted file mode 100644
index 5ace4dad2f..0000000000
--- a/sysdeps/m68k/fpu/pow.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1991, 1994 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#define	__NO_MATH_INLINES
-#include <math.h>
-
-double
-DEFUN(pow, (x, y), double x AND double y)
-{
-  return __pow(x, y);
-}
diff --git a/sysdeps/m68k/fpu/rint.c b/sysdeps/m68k/fpu/rint.c
deleted file mode 100644
index f83a4e4c3f..0000000000
--- a/sysdeps/m68k/fpu/rint.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#define	FUNC	__rint
-#define	OP	intr
-#include <acos.c>
-
-weak_alias (__rint, rint)
diff --git a/sysdeps/m68k/fpu/s_atan.c b/sysdeps/m68k/fpu/s_atan.c
index 51916e12ff..29717d4395 100644
--- a/sysdeps/m68k/fpu/s_atan.c
+++ b/sysdeps/m68k/fpu/s_atan.c
@@ -22,11 +22,14 @@ Cambridge, MA 02139, USA.  */
 #ifndef FUNC
 #define FUNC atan
 #endif
+#ifndef float_type
+#define float_type double
+#endif
 
 #define __CONCATX(a,b) __CONCAT(a,b)
 
-double
-DEFUN(__CONCATX(__,FUNC), (x), double x)
+float_type
+DEFUN(__CONCATX(__,FUNC), (x), float_type x)
 {
   return __m81_u(__CONCATX(__,FUNC))(x);
 }
diff --git a/sysdeps/m68k/fpu/s_atanf.c b/sysdeps/m68k/fpu/s_atanf.c
index d26f83875b..c98559a8ba 100644
--- a/sysdeps/m68k/fpu/s_atanf.c
+++ b/sysdeps/m68k/fpu/s_atanf.c
@@ -1,35 +1,5 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
 #ifndef FUNC
 #define FUNC atanf
 #endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-float
-DEFUN(__CONCATX(__,FUNC), (x), float x)
-{
-  return __m81_u(__CONCATX(__,FUNC))(x);
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (__CONCATX(__,FUNC), FUNC)
+#define float_type float
+#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_atanl.c b/sysdeps/m68k/fpu/s_atanl.c
new file mode 100644
index 0000000000..b7e608addd
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_atanl.c
@@ -0,0 +1,5 @@
+#ifndef FUNC
+#define FUNC atanl
+#endif
+#define float_type long double
+#include <s_atan.c>
diff --git a/sysdeps/m68k/fpu/s_ceill.c b/sysdeps/m68k/fpu/s_ceill.c
new file mode 100644
index 0000000000..2bf95b00c6
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_ceill.c
@@ -0,0 +1,2 @@
+#define FUNC ceill
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_cosl.c b/sysdeps/m68k/fpu/s_cosl.c
new file mode 100644
index 0000000000..4198feef18
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_cosl.c
@@ -0,0 +1,2 @@
+#define FUNC cosl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_expm1l.c b/sysdeps/m68k/fpu/s_expm1l.c
new file mode 100644
index 0000000000..cd62cb3b21
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_expm1l.c
@@ -0,0 +1,2 @@
+#define FUNC expm1l
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_fabsl.c b/sysdeps/m68k/fpu/s_fabsl.c
new file mode 100644
index 0000000000..8ac14d5b8c
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_fabsl.c
@@ -0,0 +1,2 @@
+#define FUNC fabsl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_finitel.c b/sysdeps/m68k/fpu/s_finitel.c
new file mode 100644
index 0000000000..bd346a220c
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_finitel.c
@@ -0,0 +1,2 @@
+#define FUNC finitel
+#include <s_isinfl.c>
diff --git a/sysdeps/m68k/fpu/s_floorl.c b/sysdeps/m68k/fpu/s_floorl.c
new file mode 100644
index 0000000000..2c1ffd7d2c
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_floorl.c
@@ -0,0 +1,2 @@
+#define FUNC floorl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_frexp.c b/sysdeps/m68k/fpu/s_frexp.c
index 45c054016d..16f30394b2 100644
--- a/sysdeps/m68k/fpu/s_frexp.c
+++ b/sysdeps/m68k/fpu/s_frexp.c
@@ -19,9 +19,19 @@ Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <math.h>
 
-double
-DEFUN(__frexp, (value, expptr), double value AND int *expptr)
+#ifndef FUNC
+#define FUNC frexp
+#endif
+#ifndef float_type
+#define float_type double
+#endif
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
+float_type
+DEFUN(__CONCATX(__,FUNC), (value, expptr), float_type value AND int *expptr)
 {
-  return __m81_u(__frexp)(value, expptr);
+  return __m81_u(__CONCATX(__,FUNC))(value, expptr);
 }
-weak_alias (__frexp, frexp)
+#define weak_aliasx(a,b) weak_alias(a,b)
+weak_aliasx (__CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_frexpf.c b/sysdeps/m68k/fpu/s_frexpf.c
index dd30f6c39c..893b6ad3cf 100644
--- a/sysdeps/m68k/fpu/s_frexpf.c
+++ b/sysdeps/m68k/fpu/s_frexpf.c
@@ -1,27 +1,3 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-float
-DEFUN(__frexpf, (value, expptr), float value AND int *expptr)
-{
-  return __m81_u(__frexpf)(value, expptr);
-}
-weak_alias (__frexpf, frexpf)
+#define FUNC frexpf
+#define float_type float
+#include <s_frexp.c>
diff --git a/sysdeps/m68k/fpu/s_frexpl.c b/sysdeps/m68k/fpu/s_frexpl.c
new file mode 100644
index 0000000000..fe9466f3be
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_frexpl.c
@@ -0,0 +1,3 @@
+#define FUNC frexpl
+#define float_type long double
+#include <s_frexp.c>
diff --git a/sysdeps/m68k/fpu/s_ilogb.c b/sysdeps/m68k/fpu/s_ilogb.c
index 4119df968a..c80a288949 100644
--- a/sysdeps/m68k/fpu/s_ilogb.c
+++ b/sysdeps/m68k/fpu/s_ilogb.c
@@ -19,10 +19,20 @@ Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <math.h>
 
+#ifndef FUNC
+#define FUNC ilogb
+#endif
+#ifndef float_type
+#define float_type double
+#endif
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
 int
-DEFUN(__ilogb, (x), double x)
+DEFUN(__CONCATX(__,FUNC), (x), float_type x)
 {
-  return __m81_u(__ilogb)(x);
+  return __m81_u(__CONCATX(__,FUNC))(x);
 }
 
-weak_alias (__ilogb, ilogb)
+#define weak_aliasx(a,b) weak_alias(a,b)
+weak_aliasx (__CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_ilogbf.c b/sysdeps/m68k/fpu/s_ilogbf.c
index 8d9a027f22..c0c2ffd18d 100644
--- a/sysdeps/m68k/fpu/s_ilogbf.c
+++ b/sysdeps/m68k/fpu/s_ilogbf.c
@@ -1,28 +1,3 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-int
-DEFUN(__ilogbf, (x), float x)
-{
-  return __m81_u(__ilogbf)(x);
-}
-
-weak_alias (__ilogbf, ilogbf)
+#define FUNC ilogbf
+#define float_type float
+#include <s_ilogb.c>
diff --git a/sysdeps/m68k/fpu/s_ilogbl.c b/sysdeps/m68k/fpu/s_ilogbl.c
new file mode 100644
index 0000000000..c3554d5c58
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_ilogbl.c
@@ -0,0 +1,3 @@
+#define FUNC ilogbl
+#define float_type long double
+#include <s_ilogb.c>
diff --git a/sysdeps/m68k/fpu/s_isinf.c b/sysdeps/m68k/fpu/s_isinf.c
index eec07c7d3a..570a7ba7bb 100644
--- a/sysdeps/m68k/fpu/s_isinf.c
+++ b/sysdeps/m68k/fpu/s_isinf.c
@@ -22,11 +22,14 @@ Cambridge, MA 02139, USA.  */
 #ifndef FUNC
 #define FUNC isinf
 #endif
+#ifndef float_type
+#define float_type double
+#endif
 
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 int
-DEFUN(__CONCATX(__,FUNC), (x), double x)
+DEFUN(__CONCATX(__,FUNC), (x), float_type x)
 {
   return __m81_u(__CONCATX(__,FUNC))(x);
 }
diff --git a/sysdeps/m68k/fpu/s_isinff.c b/sysdeps/m68k/fpu/s_isinff.c
index 8f18db5b08..ebf4f2ae96 100644
--- a/sysdeps/m68k/fpu/s_isinff.c
+++ b/sysdeps/m68k/fpu/s_isinff.c
@@ -1,35 +1,5 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
 #ifndef FUNC
 #define FUNC isinff
 #endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-int
-DEFUN(__CONCATX(__,FUNC), (x), float x)
-{
-  return __m81_u(__CONCATX(__,FUNC))(x);
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (__CONCATX(__,FUNC), FUNC)
+#define float_type float
+#include <s_isinf.c>
diff --git a/sysdeps/m68k/fpu/s_isinfl.c b/sysdeps/m68k/fpu/s_isinfl.c
new file mode 100644
index 0000000000..963725ad77
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_isinfl.c
@@ -0,0 +1,5 @@
+#ifndef FUNC
+#define FUNC isinfl
+#endif
+#define float_type long double
+#include <s_isinf.c>
diff --git a/sysdeps/m68k/fpu/s_isnanl.c b/sysdeps/m68k/fpu/s_isnanl.c
new file mode 100644
index 0000000000..bbacb64f11
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_isnanl.c
@@ -0,0 +1,2 @@
+#define FUNC isnanl
+#include <s_isinfl.c>
diff --git a/sysdeps/m68k/fpu/s_ldexp.c b/sysdeps/m68k/fpu/s_ldexp.c
index 67513d4875..ea8bfbab88 100644
--- a/sysdeps/m68k/fpu/s_ldexp.c
+++ b/sysdeps/m68k/fpu/s_ldexp.c
@@ -22,11 +22,14 @@ Cambridge, MA 02139, USA.  */
 #ifndef FUNC
 #define FUNC ldexp
 #endif
+#ifndef float_type
+#define float_type double
+#endif
 
 #define __CONCATX(a,b) __CONCAT(a,b)
 
-double
-DEFUN(__CONCATX(__,FUNC), (x, exp), double x AND int exp)
+float_type
+DEFUN(__CONCATX(__,FUNC), (x, exp), float_type x AND int exp)
 {
   return __m81_u(__CONCATX(__,FUNC))(x, exp);
 }
diff --git a/sysdeps/m68k/fpu/s_ldexpf.c b/sysdeps/m68k/fpu/s_ldexpf.c
index 94abf25ac1..81a6b28acc 100644
--- a/sysdeps/m68k/fpu/s_ldexpf.c
+++ b/sysdeps/m68k/fpu/s_ldexpf.c
@@ -1,35 +1,5 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
 #ifndef FUNC
 #define FUNC ldexpf
 #endif
-
-#define __CONCATX(a,b) __CONCAT(a,b)
-
-float
-DEFUN(__CONCATX(__,FUNC), (x, exp), float x AND int exp)
-{
-  return __m81_u(__CONCATX(__,FUNC))(x, exp);
-}
-
-#define weak_aliasx(a,b) weak_alias(a,b)
-weak_aliasx (__CONCATX(__,FUNC), FUNC)
+#define float_type float
+#include <s_ldexp.c>
diff --git a/sysdeps/m68k/fpu/s_ldexpl.c b/sysdeps/m68k/fpu/s_ldexpl.c
new file mode 100644
index 0000000000..25796b75f4
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_ldexpl.c
@@ -0,0 +1,5 @@
+#ifndef FUNC
+#define FUNC ldexpl
+#endif
+#define float_type long double
+#include <s_ldexp.c>
diff --git a/sysdeps/m68k/fpu/s_log1pl.c b/sysdeps/m68k/fpu/s_log1pl.c
new file mode 100644
index 0000000000..8dbef89095
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_log1pl.c
@@ -0,0 +1,2 @@
+#define FUNC log1pl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_logbl.c b/sysdeps/m68k/fpu/s_logbl.c
new file mode 100644
index 0000000000..7d06ac13c4
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_logbl.c
@@ -0,0 +1,2 @@
+#define FUNC logbl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_modf.c b/sysdeps/m68k/fpu/s_modf.c
index ce70be8168..f704260e21 100644
--- a/sysdeps/m68k/fpu/s_modf.c
+++ b/sysdeps/m68k/fpu/s_modf.c
@@ -19,9 +19,19 @@ Cambridge, MA 02139, USA.  */
 #include <ansidecl.h>
 #include <math.h>
 
-double
-DEFUN(__modf, (x, exp), double x AND double *iptr)
+#ifndef FUNC
+#define FUNC modf
+#endif
+#ifndef float_type
+#define float_type double
+#endif
+
+#define __CONCATX(a,b) __CONCAT(a,b)
+
+float_type
+DEFUN(__CONCATX(__,FUNC), (x, iptr), float_type x AND float_type *iptr)
 {
-  return __m81_u(__modf)(x, iptr);
+  return __m81_u(__CONCATX(__,FUNC))(x, iptr);
 }
-weak_alias(__modf, modf)
+#define weak_aliasx(a,b) weak_alias(a,b)
+weak_aliasx(__CONCATX(__,FUNC), FUNC)
diff --git a/sysdeps/m68k/fpu/s_modff.c b/sysdeps/m68k/fpu/s_modff.c
index 04b51d5be1..37bff0022f 100644
--- a/sysdeps/m68k/fpu/s_modff.c
+++ b/sysdeps/m68k/fpu/s_modff.c
@@ -1,27 +1,3 @@
-/* Copyright (C) 1996 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 Library General Public License as
-published by the Free Software Foundation; either version 2 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
-
-#include <ansidecl.h>
-#include <math.h>
-
-float
-DEFUN(__modff, (x, exp), float x AND float *iptr)
-{
-  return __m81_u(__modff)(x, iptr);
-}
-weak_alias(__modff, modff)
+#define FUNC modff
+#define float_type float
+#include <s_modf.c>
diff --git a/sysdeps/m68k/fpu/s_modfl.c b/sysdeps/m68k/fpu/s_modfl.c
new file mode 100644
index 0000000000..51327dd1aa
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_modfl.c
@@ -0,0 +1,3 @@
+#define FUNC modfl
+#define float_type long double
+#include <s_modf.c>
diff --git a/sysdeps/m68k/fpu/s_rintl.c b/sysdeps/m68k/fpu/s_rintl.c
new file mode 100644
index 0000000000..305667b3a1
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_rintl.c
@@ -0,0 +1,2 @@
+#define FUNC rintl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_scalbnl.c b/sysdeps/m68k/fpu/s_scalbnl.c
new file mode 100644
index 0000000000..83e8bfefc1
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_scalbnl.c
@@ -0,0 +1,2 @@
+#define FUNC scalbnl
+#include <s_ldexpl.c>
diff --git a/sysdeps/m68k/fpu/s_significandl.c b/sysdeps/m68k/fpu/s_significandl.c
new file mode 100644
index 0000000000..8c6fc7e610
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_significandl.c
@@ -0,0 +1,2 @@
+#define FUNC significandl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_sinl.c b/sysdeps/m68k/fpu/s_sinl.c
new file mode 100644
index 0000000000..9ac532cb47
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_sinl.c
@@ -0,0 +1,2 @@
+#define FUNC sinl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_tanhl.c b/sysdeps/m68k/fpu/s_tanhl.c
new file mode 100644
index 0000000000..6e997911f2
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_tanhl.c
@@ -0,0 +1,2 @@
+#define FUNC tanhl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/s_tanl.c b/sysdeps/m68k/fpu/s_tanl.c
new file mode 100644
index 0000000000..64fcb54406
--- /dev/null
+++ b/sysdeps/m68k/fpu/s_tanl.c
@@ -0,0 +1,2 @@
+#define FUNC tanl
+#include <s_atanl.c>
diff --git a/sysdeps/m68k/fpu/sin.c b/sysdeps/m68k/fpu/sin.c
deleted file mode 100644
index 28ac9e50c3..0000000000
--- a/sysdeps/m68k/fpu/sin.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	sin
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/sinh.c b/sysdeps/m68k/fpu/sinh.c
deleted file mode 100644
index fae7c71459..0000000000
--- a/sysdeps/m68k/fpu/sinh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	sinh
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/sqrt.c b/sysdeps/m68k/fpu/sqrt.c
deleted file mode 100644
index 2365b61780..0000000000
--- a/sysdeps/m68k/fpu/sqrt.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	sqrt
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/tan.c b/sysdeps/m68k/fpu/tan.c
deleted file mode 100644
index 53b3b5342e..0000000000
--- a/sysdeps/m68k/fpu/tan.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	tan
-#include <acos.c>
diff --git a/sysdeps/m68k/fpu/tanh.c b/sysdeps/m68k/fpu/tanh.c
deleted file mode 100644
index cc6739539a..0000000000
--- a/sysdeps/m68k/fpu/tanh.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define	FUNC	tanh
-#include <acos.c>