about summary refs log tree commit diff
path: root/sysdeps/m68k
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/m68k')
-rw-r--r--sysdeps/m68k/fpu/k_cos.c12
-rw-r--r--sysdeps/m68k/fpu/k_sin.c16
-rw-r--r--sysdeps/m68k/fpu/k_tan.c16
3 files changed, 31 insertions, 13 deletions
diff --git a/sysdeps/m68k/fpu/k_cos.c b/sysdeps/m68k/fpu/k_cos.c
index 28406e8cba..61f566f6a1 100644
--- a/sysdeps/m68k/fpu/k_cos.c
+++ b/sysdeps/m68k/fpu/k_cos.c
@@ -16,7 +16,6 @@ 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
@@ -29,7 +28,14 @@ Cambridge, MA 02139, USA.  */
 #define __CONCATX(a,b) __CONCAT(a,b)
 
 float_type
-DEFUN(__CONCATX(__kernel_,FUNC), (x, y), float_type x AND float_type y)
+__CONCATX(__kernel_,FUNC) (x, y)
+     float_type x;
+     float_type y;
 {
-  return __CONCATX(__,FUNC) (x + y);
+  float_type sin_x, cos_x, sin_y, cos_y;
+  __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_x), "=f" (sin_x)
+			: "f" (x));
+  __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_y), "=f" (sin_y)
+			: "f" (y));
+  return cos_x * cos_y - sin_x * sin_y;
 }
diff --git a/sysdeps/m68k/fpu/k_sin.c b/sysdeps/m68k/fpu/k_sin.c
index 8c6dfef720..3eed1d466c 100644
--- a/sysdeps/m68k/fpu/k_sin.c
+++ b/sysdeps/m68k/fpu/k_sin.c
@@ -16,7 +16,6 @@ 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
@@ -29,8 +28,17 @@ Cambridge, MA 02139, USA.  */
 #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)
+__CONCATX(__kernel_,FUNC) (x, y, iy)
+     float_type x;
+     float_type y;
+     int iy;
 {
-  return __CONCATX(__,FUNC) (x + y);
+  float_type sin_x, cos_x, sin_y, cos_y;
+  if (iy == 0)
+    return __m81_u_(__CONCATX(__,FUNC)) (x);
+  __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_x), "=f" (sin_x)
+			: "f" (x));
+  __asm__ __volatile__ ("fsincosx %2,%0:%1" : "=f" (cos_y), "=f" (sin_y)
+			: "f" (y));
+  return sin_x * cos_y + cos_x * sin_y;
 }
diff --git a/sysdeps/m68k/fpu/k_tan.c b/sysdeps/m68k/fpu/k_tan.c
index c8fa9b780e..7f1b729b96 100644
--- a/sysdeps/m68k/fpu/k_tan.c
+++ b/sysdeps/m68k/fpu/k_tan.c
@@ -16,7 +16,6 @@ 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
@@ -29,11 +28,16 @@ Cambridge, MA 02139, USA.  */
 #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)
+__CONCATX(__kernel_,FUNC) (x, y, iy)
+     float_type x;
+     float_type y;
+     int iy;
 {
-  if (iy == 1)
-    return __CONCATX(__,FUNC) (x + y);
+  float_type tan_x, tan_y;
+  tan_x = __m81_u_(__CONCATX(__,FUNC)) (x);
+  tan_y = __m81_u_(__CONCATX(__,FUNC)) (y);
+  if (iy > 0)
+    return (tan_x + tan_y) / (1 - tan_x * tan_y);
   else
-    return ((float_type) -1.0) / __CONCATX(__,FUNC) (x + y);
+    return (tan_x * tan_y - 1) / (tan_x + tan_y);
 }