Make 'fortran float sin(), cos();' work with gcc by replacing it with
authorDonn Seeley <donn@ucbvax.Berkeley.EDU>
Mon, 26 Feb 1990 11:52:56 +0000 (03:52 -0800)
committerDonn Seeley <donn@ucbvax.Berkeley.EDU>
Mon, 26 Feb 1990 11:52:56 +0000 (03:52 -0800)
asm() statements.  Not sure why I bothered...

SCCS-vsn: usr.bin/f77/libF77/r_tan.c 5.4

usr/src/usr.bin/f77/libF77/r_tan.c

index 5e2980e..221c0f6 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)r_tan.c     5.3     %G%
+ *     @(#)r_tan.c     5.4     %G%
  */
 
 #ifndef tahoe
  */
 
 #ifndef tahoe
@@ -29,12 +29,28 @@ return( tan(*x) );
 int    errno;
 static double invpi = 1.27323954473516268;  /* 4/pi */
 
 int    errno;
 static double invpi = 1.27323954473516268;  /* 4/pi */
 
+#ifndef __GNUC__
+fortran float sin(), cos();
+#else
+#define        sin(x) \
+({ \
+       float __result; \
+       asm("ldd %1; cvdf; sinf; stf %0" : "=rm" (__result) : "rm" (x)); \
+       __result; \
+})
+#define        cos(x) \
+({ \
+       float __result; \
+       asm("ldd %1; cvdf; cosf; stf %0" : "=rm" (__result) : "rm" (x)); \
+       __result; \
+})
+#endif
+
 float
 r_tan(parg)
 float *parg;
 {
        double arg;
 float
 r_tan(parg)
 float *parg;
 {
        double arg;
-       fortran float sin(), cos();
        double modf();
        float flmax_();
        double temp, e, x, xsq;
        double modf();
        float flmax_();
        double temp, e, x, xsq;