about summary refs log tree commit diff
path: root/sysdeps/m68k/fpu/__math.h
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/__math.h
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/__math.h')
-rw-r--r--sysdeps/m68k/fpu/__math.h178
1 files changed, 178 insertions, 0 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.  */