Changed .s files to .c files with gcc asm.

svn path=/trunk/; revision=300
This commit is contained in:
Boudewijn Dekker 1999-03-12 20:26:05 +00:00
parent ad037179b4
commit 98071efc7e
44 changed files with 564 additions and 529 deletions

View file

@ -1,22 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.text
LC0:
.double 0d1.00000000000000000000e+00
.globl _acos
_acos:
fldl 4(%esp)
fld1
fsubp %st(0),%st(1)
fsqrt
fldl 4(%esp)
fld1
faddp %st(0),%st(1)
fsqrt
fpatan
fld %st(0)
faddp
ret

View file

@ -0,0 +1,26 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <math.h>
double acos (double __x)
{
return atan2 (sqrt (1.0 - __x * __x), __x);
}

View file

@ -1,8 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <math.h>
double
acosh(double x)
{
return log(x + sqrt(x*x - 1));
}

View file

@ -1,14 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.globl _asin
_asin:
fldl 4(%esp)
fld %st(0)
fmulp
fld1
fsubp
fsqrt
fldl 4(%esp)
fxch %st(1)
fpatan
ret

View file

@ -0,0 +1,26 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <math.h>
double asin (double __x)
{
return atan2 (__x, sqrt (1.0 - __x * __x));
}

View file

@ -1,9 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <math.h>
double
asinh(double x)
{
return x>0 ? log(x + sqrt(x*x + 1)) : -log(sqrt(x*x+1)-x);
}

View file

@ -1,8 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.globl _atan
_atan:
fldl 4(%esp)
fld1
fpatan
ret

View file

@ -0,0 +1,32 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double atan (double __x);
double atan (double __x)
{
register double __value;
__asm __volatile__
("fld1\n\t"
"fpatan"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,35 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
.data
.align 2
nan:
.long 0xffffffff
.byte 0xff
.byte 0xff
.byte 0xff
.byte 0x7f
.text
.globl _atan2
_atan2:
fldl 4(%esp)
fldl 12(%esp)
ftst
fnstsw %ax
sahf
jne doit
fxch %st(1)
ftst
fnstsw %ax
sahf
je isanan
fxch %st(1)
doit:
fpatan
ret
isanan:
movl $1,_errno
fstp %st(0)
fstp %st(0)
fldl nan
ret

View file

@ -0,0 +1,12 @@
double atan2 (double __y, double __x);
double atan2 (double __y, double __x)
{
register double __value;
__asm __volatile__
("fpatan\n\t"
"fldl %%st(0)"
: "=t" (__value) : "0" (__x), "u" (__y));
return __value;
}

View file

@ -1,8 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <math.h>
double
atanh(double x)
{
return log((1+x)/(1-x)) / 2.0;
}

View file

@ -0,0 +1,10 @@
#include <math.h>
double _cabs( struct _complex z )
{
return hypot(z.x,z.y);
}

View file

@ -1,24 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
.globl _ceil
_ceil:
pushl %ebp
movl %esp,%ebp
subl $8,%esp /* -4 = old CW, -2 = new CW */
fstcw -4(%ebp)
fwait
movw -4(%ebp),%ax
andw $0xf3ff,%ax
orw $0x0800,%ax
movw %ax,-2(%ebp)
fldcww -2(%ebp)
fldl 8(%ebp)
frndint
fldcww -4(%ebp)
movl %ebp,%esp
popl %ebp
ret

View file

@ -0,0 +1,15 @@
double ceil (double __x);
double ceil (double __x)
{
register double __value;
__volatile unsigned short int __cw, __cwtmp;
__asm __volatile ("fnstcw %0" : "=m" (__cw));
__cwtmp = (__cw & 0xf3ff) | 0x0800; /* rounding up */
__asm __volatile ("fldcw %0" : : "m" (__cwtmp));
__asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
__asm __volatile ("fldcw %0" : : "m" (__cw));
return __value;
}

View file

@ -1,16 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
L0:
.quad 0xffffffffffffffff
.globl _cos
_cos:
fldl 4(%esp)
fcos
fstsw
sahf
jnp L1
fstp %st(0)
fldl L0
L1:
ret

View file

@ -0,0 +1,11 @@
double cos (double __x);
double cos (double __x)
{
register double __value;
__asm __volatile__
("fcos"
: "=t" (__value): "0" (__x));
return __value;
}

View file

@ -1,8 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <math.h>
double cosh(double x)
{
const double ebig = exp(fabs(x));
return (ebig + 1.0/ebig) / 2.0;
}

View file

@ -1,32 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.data
LCW1:
.word 0
LCW2:
.word 0
LC0:
.double 0d1.0e+00
.text
.globl _exp
_exp:
fldl 4(%esp)
fldl2e
fmulp
fstcww LCW1
fstcww LCW2
fwait
andw $0xf3ff,LCW2
orw $0x0400,LCW2
fldcww LCW2
fldl %st(0)
frndint
fldcww LCW1
fxch %st(1)
fsub %st(1),%st
f2xm1
faddl LC0
fscale
fstp %st(1)
ret

View file

@ -0,0 +1,42 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double exp (double __x);
double exp (double __x)
{
register double __value, __exponent;
__asm __volatile__
("fldl2e # e^x = 2^(x * log2(e))\n\t"
"fmul %%st(1) # x * log2(e)\n\t"
"fstl %%st(1)\n\t"
"frndint # int(x * log2(e))\n\t"
"fxch\n\t"
"fsub %%st(1) # fract(x * log2(e))\n\t"
"f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
: "=t" (__value), "=u" (__exponent) : "0" (__x));
__value += 1.0;
__asm __volatile__
("fscale"
: "=t" (__value) : "0" (__value), "u" (__exponent));
return __value;
}

View file

@ -1,6 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.globl _fabs
_fabs:
fldl 4(%esp)
fabs
ret

View file

@ -0,0 +1,32 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double fabs (double __x);
double fabs (double __x)
{
register double __value;
__asm __volatile__
("fabs"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,24 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
.globl _floor
_floor:
pushl %ebp
movl %esp,%ebp
subl $8,%esp /* -4 = old CW, -2 = new CW */
fstcw -4(%ebp)
fwait
movw -4(%ebp),%ax
andw $0xf3ff,%ax
orw $0x0400,%ax
movw %ax,-2(%ebp)
fldcww -2(%ebp)
fldl 8(%ebp)
frndint
fldcww -4(%ebp)
movl %ebp,%esp
popl %ebp
ret

View file

@ -0,0 +1,36 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double floor (double __x);
double floor (double __x)
{
register double __value;
__volatile unsigned short int __cw, __cwtmp;
__asm __volatile ("fnstcw %0" : "=m" (__cw));
__cwtmp = (__cw & 0xf3ff) | 0x0400; /* rounding down */
__asm __volatile ("fldcw %0" : : "m" (__cwtmp));
__asm __volatile ("frndint" : "=t" (__value) : "0" (__x));
__asm __volatile ("fldcw %0" : : "m" (__cw));
return __value;
}

View file

@ -1,29 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.data
LCW1:
.word 0
.align 4
.text
.globl _fmod
_fmod:
fldl 4(%esp)
fldl 12(%esp)
ftst
fnstsw %ax
fxch %st(1)
sahf
jnz next
fstpl %st(0)
jmp out
next:
fpreml
fnstsw %ax
sahf
jpe next
fstpl %st(1)
out:
ret

View file

@ -0,0 +1,35 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double fmod (double __x, double __y);
double fmod (double __x, double __y)
{
register double __value;
__asm __volatile__
("1: fprem\n\t"
"fstsw %%ax\n\t"
"sahf\n\t"
"jp 1b"
: "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc");
return __value;
}

View file

@ -1,3 +1,3 @@
long __cdecl ftol(double fl) {
return (long)fl;
}
}

View file

@ -1,32 +1,31 @@
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <math.h>
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
double
ldexp(double v, int e)
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double ldexp (double __x, int __y);
double ldexp (double __x, int __y)
{
double two = 2.0;
if (e < 0)
{
e = -e; /* This just might overflow on two-complement machines. */
if (e < 0) return 0.0;
while (e > 0)
{
if (e & 1) v /= two;
two *= two;
e >>= 1;
}
}
else if (e > 0)
{
while (e > 0)
{
if (e & 1) v *= two;
two *= two;
e >>= 1;
}
}
return v;
}
register double __value;
__asm __volatile__
("fscale"
: "=t" (__value) : "0" (__x), "u" ((double) __y));
return __value;
}

View file

@ -1,7 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.globl _log
_log:
fldln2
fldl 4(%esp)
fyl2x
ret

View file

@ -0,0 +1,33 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double log (double __x);
double log (double __x)
{
register double __value;
__asm __volatile__
("fldln2\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,7 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.globl _log10
_log10:
fldlg2
fldl 4(%esp)
fyl2x
ret

View file

@ -0,0 +1,34 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double log10 (double __x);
double log10 (double __x)
{
register double __value;
__asm __volatile__
("fldlg2\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,33 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.text
.globl _modf
_modf:
pushl %ebp
movl %esp,%ebp
subl $16,%esp
pushl %ebx
fnstcw -4(%ebp)
fwait
movw -4(%ebp),%ax
orw $0x0c3f,%ax
movw %ax,-8(%ebp)
fldcw -8(%ebp)
fwait
fldl 8(%ebp)
frndint
fstpl -16(%ebp)
fwait
movl -16(%ebp),%edx
movl -12(%ebp),%ecx
movl 16(%ebp),%ebx
movl %edx,(%ebx)
movl %ecx,4(%ebx)
fldl 8(%ebp)
fsubl -16(%ebp)
leal -20(%ebp),%esp
fclex
fldcw -4(%ebp)
fwait
popl %ebx
leave
ret

View file

@ -0,0 +1,14 @@
// from linux libc
#include <math.h>
/* Slooow version. */
double modf(double x,double *pint)
{
if (x >= 0)
*pint = floor(x);
else
*pint = ceil(x);
return x - *pint;
}

View file

@ -1,22 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.text
.globl ___modfl
___modfl:
pushl %ebp
movl %esp,%ebp
subl $4,%esp
fldt 8(%ebp)
movl 20(%ebp),%eax
fnstcw -2(%ebp)
movw -2(%ebp),%dx
orb $0x0c,%dh
movw %dx,-4(%ebp)
fldcw -4(%ebp)
fld %st(0)
frndint
fldcw -2(%ebp)
fld %st(0)
fstpt (%eax)
fsubrp %st,%st(1)
leave
ret

View file

@ -1,86 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.data
yint:
.word 0,0
LCW1:
.word 0
LCW2:
.word 0
.text
LC0:
.double 0d1.0e+00
frac:
fstcww LCW1
fstcww LCW2
fwait
andw $0xf3ff,LCW2
orw $0x0400,LCW2
fldcww LCW2
fldl %st(0)
frndint
fldcww LCW1
fxch %st(1)
fsub %st(1),%st
ret
Lpow2:
call frac
f2xm1
faddl LC0
fscale
fstp %st(1)
ret
.globl _pow
_pow:
fldl 12(%esp)
fldl 4(%esp)
ftst
fnstsww %ax
sahf
jbe xltez
fyl2x
jmp Lpow2
xltez:
jb xltz
fstp %st(0)
ftst
fnstsww %ax
sahf
ja ygtz
jb error
fstp %st(0)
fld1l
fchs
error:
fsqrt
ret
ygtz:
fstp %st(0)
fldzl
ret
xltz:
fabs
fxch %st(1)
call frac
ftst
fnstsww %ax
fstp %st(0)
sahf
je yisint
fstp %st(0)
fchs
jmp error
yisint:
fistl yint
fxch %st(1)
fyl2x
call Lpow2
andl $1,yint
jz yeven
fchs
yeven:
ret

View file

@ -0,0 +1,80 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double pow (double __x, double __y);
double __log2 (double __x);
double __log2 (double __x)
{
register double __value;
__asm __volatile__
("fld1\n\t"
"fxch\n\t"
"fyl2x"
: "=t" (__value) : "0" (__x));
return __value;
}
double pow (double __x, double __y)
{
register double __value, __exponent;
long __p = (long) __y;
if (__x == 0.0 && __y > 0.0)
return 0.0;
if (__y == (double) __p)
{
double __r = 1.0;
if (__p == 0)
return 1.0;
if (__p < 0)
{
__p = -__p;
__x = 1.0 / __x;
}
while (1)
{
if (__p & 1)
__r *= __x;
__p >>= 1;
if (__p == 0)
return __r;
__x *= __x;
}
/* NOTREACHED */
}
__asm __volatile__
("fmul %%st(1) # y * log2(x)\n\t"
"fstl %%st(1)\n\t"
"frndint # int(y * log2(x))\n\t"
"fxch\n\t"
"fsub %%st(1) # fract(y * log2(x))\n\t"
"f2xm1 # 2^(fract(y * log2(x))) - 1\n\t"
: "=t" (__value), "=u" (__exponent) : "0" (__log2 (__x)), "1" (__y));
__value += 1.0;
__asm __volatile__
("fscale"
: "=t" (__value) : "0" (__value), "u" (__exponent));
return __value;
}

View file

@ -1,32 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.data
LCW1:
.word 0
LCW2:
.word 0
LC0:
.double 0d1.0e+00
.text
.globl ___pow10
___pow10:
fldl 4(%esp)
fldl2t
fmulp
fstcww LCW1
fstcww LCW2
fwait
andw $0xf3ff,LCW2
orw $0x0400,LCW2
fldcww LCW2
fldl %st(0)
frndint
fldcww LCW1
fxch %st(1)
fsub %st(1),%st
f2xm1
faddl LC0
fscale
fstp %st(1)
ret

View file

@ -1,30 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
.data
LCW1:
.word 0
LCW2:
.word 0
LC0:
.double 0d1.0e+00
.text
.globl ___pow2
___pow2:
fldl 4(%esp)
fstcww LCW1
fstcww LCW2
fwait
andw $0xf3ff,LCW2
orw $0x0400,LCW2
fldcww LCW2
fldl %st(0)
frndint
fldcww LCW1
fxch %st(1)
fsub %st(1),%st
f2xm1
faddl LC0
fscale
fstp %st(1)
ret

View file

@ -1,16 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
L0:
.quad 0xffffffffffffffff
.globl _sin
_sin:
fldl 4(%esp)
fsin
fstsw
sahf
jnp L1
fstp %st(0)
fldl L0
L1:
ret

View file

@ -0,0 +1,32 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double sin (double __x);
double sin (double __x)
{
register double __value;
__asm __volatile__
("fsin"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,6 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
.globl _sqrt
_sqrt:
fldl 4(%esp)
fsqrt
ret

View file

@ -0,0 +1,32 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double sqrt (double __x);
double sqrt (double __x)
{
register double __value;
__asm __volatile__
("fsqrt"
: "=t" (__value) : "0" (__x));
return __value;
}

View file

@ -1,17 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
L0:
.quad 0xffffffffffffffff
.globl _tan
_tan:
fldl 4(%esp)
fptan
fstsw
fstp %st(0)
sahf
jnp L1
/* fstp %st(0) - if exception, there is nothing on the stack */
fldl L0
L1:
ret

View file

@ -0,0 +1,33 @@
/* Math functions for i387.
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
double tan (double __x);
double tan (double __x)
{
register double __value;
register double __value2 __attribute__ ((unused));
__asm __volatile__
("fptan"
: "=t" (__value2), "=u" (__value) : "0" (__x));
return __value;
}