diff options
Diffstat (limited to 'sysdeps/libm-i387')
81 files changed, 1681 insertions, 111 deletions
diff --git a/sysdeps/libm-i387/e_acos.S b/sysdeps/libm-i387/e_acos.S index c9fa81006c..becae36d5e 100644 --- a/sysdeps/libm-i387/e_acos.S +++ b/sysdeps/libm-i387/e_acos.S @@ -18,4 +18,4 @@ ENTRY(__ieee754_acos) fxch %st(1) fpatan ret -PSEUDO_END (__ieee754_acos) +END (__ieee754_acos) diff --git a/sysdeps/libm-i387/e_acosf.S b/sysdeps/libm-i387/e_acosf.S new file mode 100644 index 0000000000..87ee2fb5bc --- /dev/null +++ b/sysdeps/libm-i387/e_acosf.S @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +/* acos = atan (sqrt(1 - x^2) / x) */ +ENTRY(__ieee754_acosf) + flds 4(%esp) /* x */ + fst %st(1) + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrt (1 - x^2) */ + fxch %st(1) + fpatan + ret +END (__ieee754_acosf) diff --git a/sysdeps/libm-i387/e_acosh.S b/sysdeps/libm-i387/e_acosh.S new file mode 100644 index 0000000000..a3397b365c --- /dev/null +++ b/sysdeps/libm-i387/e_acosh.S @@ -0,0 +1,105 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acosh) + movl 8(%esp), %ecx + cmpl $0x3ff00000, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + fldl 4(%esp) // x : log(2) + cmpl $0x41b00000, %ecx + ja 3f // x > 2^28 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^28 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acosh) diff --git a/sysdeps/libm-i387/e_acoshf.S b/sysdeps/libm-i387/e_acoshf.S new file mode 100644 index 0000000000..a4f50ba7ac --- /dev/null +++ b/sysdeps/libm-i387/e_acoshf.S @@ -0,0 +1,105 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acoshf) + movl 8(%esp), %ecx + cmpl $0x3f800000, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + flds 4(%esp) // x : log(2) + cmpl $0x47000000, %ecx + ja 3f // x > 2^14 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^14 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^28 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acoshf) diff --git a/sysdeps/libm-i387/e_acoshl.S b/sysdeps/libm-i387/e_acoshl.S new file mode 100644 index 0000000000..b0fa45c44e --- /dev/null +++ b/sysdeps/libm-i387/e_acoshl.S @@ -0,0 +1,111 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + /* Please note that we use double value for 1.0. This number + has an exact representation and so we don't get accuracy + problems. The advantage is that the code is simpler. */ + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_acoshl) + movl 12(%esp), %ecx + cmpl $0x3fff, %ecx + jl 5f // < 1 => invalid + fldln2 // log(2) + fldt 4(%esp) // x : log(2) + cmpl $0x4020, %ecx + ja 3f // x > 2^34 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x4000, %ecx + ja 4f // x > 2 + + // 1 <= x <= 2 => y = log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + fsubl MO(one) // x-1 : log(2) + fld %st // x-1 : x-1 : log(2) + fmul %st(1) // (x-1)^2 : x-1 : log(2) + fadd %st(1) // x-1+(x-1)^2 : x-1 : log(2) + fadd %st(1) // 2*(x-1)+(x-1)^2 : x-1 : log(2) + fsqrt // sqrt(2*(x-1)+(x-1)^2) : x-1 : log(2) + faddp // x-1+sqrt(2*(x-1)+(x-1)^2) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 2f + fyl2xp1 // log1p(x-1+sqrt(2*(x-1)+(x-1)^2)) + ret + +2: faddl MO(one) // x+sqrt(2*(x-1)+(x-1)^2) : log(2) + fyl2x // log(x+sqrt(2*(x-1)+(x-1)^2)) + ret + + // x > 2^34 => y = log(x) + log(2) + .align ALIGNARG(4) +3: fyl2x // log(x) + fldln2 // log(2) : log(x) + faddp // log(x)+log(2) + ret + + // 2^34 > x > 2 => y = log(2*x - 1/(x+sqrt(x*x-1))) + .align ALIGNARG(4) +4: fld %st // x : x : log(2) + fadd %st, %st(1) // x : 2*x : log(2) + fld %st // x : x : 2*x : log(2) + fmul %st(1) // x^2 : x : 2*x : log(2) + fsubl MO(one) // x^2-1 : x : 2*x : log(2) + fsqrt // sqrt(x^2-1) : x : 2*x : log(2) + faddp // x+sqrt(x^2-1) : 2*x : log(2) + fdivrl MO(one) // 1/(x+sqrt(x^2-1)) : 2*x : log(2) + fsubrp // 2*x+1/(x+sqrt(x^2)-1) : log(2) + fyl2x // log(2*x+1/(x+sqrt(x^2-1))) + ret + + // x < 1 => NaN + .align ALIGNARG(4) +5: fldz + fdiv %st, %st(0) + ret +END(__ieee754_acoshl) diff --git a/sysdeps/libm-i387/e_acosl.S b/sysdeps/libm-i387/e_acosl.S index 4cc56c0bb8..e8f97485de 100644 --- a/sysdeps/libm-i387/e_acosl.S +++ b/sysdeps/libm-i387/e_acosl.S @@ -19,4 +19,4 @@ ENTRY(__ieee754_acosl) fxch %st(1) fpatan ret -PSEUDO_END (__ieee754_acosl) +END (__ieee754_acosl) diff --git a/sysdeps/libm-i387/e_asin.S b/sysdeps/libm-i387/e_asin.S index cba41935d5..1202753d9b 100644 --- a/sysdeps/libm-i387/e_asin.S +++ b/sysdeps/libm-i387/e_asin.S @@ -17,4 +17,4 @@ ENTRY(__ieee754_asin) fsqrt /* sqrt (1 - x^2) */ fpatan ret -PSEUDO_END (__ieee754_asin) +END (__ieee754_asin) diff --git a/sysdeps/libm-i387/e_asinf.S b/sysdeps/libm-i387/e_asinf.S new file mode 100644 index 0000000000..d2159bac37 --- /dev/null +++ b/sysdeps/libm-i387/e_asinf.S @@ -0,0 +1,21 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +/* asin = atan (x / sqrt(1 - x^2)) */ +ENTRY(__ieee754_asinf) + flds 4(%esp) /* x */ + fst %st(1) + fmul %st(0) /* x^2 */ + fld1 + fsubp /* 1 - x^2 */ + fsqrt /* sqrt (1 - x^2) */ + fpatan + ret +END (__ieee754_asinf) diff --git a/sysdeps/libm-i387/e_asinl.S b/sysdeps/libm-i387/e_asinl.S index d4e254874e..ab421f3189 100644 --- a/sysdeps/libm-i387/e_asinl.S +++ b/sysdeps/libm-i387/e_asinl.S @@ -19,4 +19,4 @@ ENTRY(__ieee754_asinl) fsqrt /* sqrt (1 - x^2) */ fpatan ret -PSEUDO_END (__ieee754_asinl) +END (__ieee754_asinl) diff --git a/sysdeps/libm-i387/e_atan2.S b/sysdeps/libm-i387/e_atan2.S index 6f7fc74b65..8df04e485e 100644 --- a/sysdeps/libm-i387/e_atan2.S +++ b/sysdeps/libm-i387/e_atan2.S @@ -12,4 +12,4 @@ ENTRY(__ieee754_atan2) fldl 12(%esp) fpatan ret -PSEUDO_END (__ieee754_atan2) +END (__ieee754_atan2) diff --git a/sysdeps/libm-i387/e_atan2f.S b/sysdeps/libm-i387/e_atan2f.S index bb6d902172..fc6621f183 100644 --- a/sysdeps/libm-i387/e_atan2f.S +++ b/sysdeps/libm-i387/e_atan2f.S @@ -12,4 +12,4 @@ ENTRY(__ieee754_atan2f) flds 8(%esp) fpatan ret -PSEUDO_END (__ieee754_atan2f) +END (__ieee754_atan2f) diff --git a/sysdeps/libm-i387/e_atan2l.S b/sysdeps/libm-i387/e_atan2l.S index 860885ced1..f58eaa94a9 100644 --- a/sysdeps/libm-i387/e_atan2l.S +++ b/sysdeps/libm-i387/e_atan2l.S @@ -14,4 +14,4 @@ ENTRY(__ieee754_atan2l) fldt 16(%esp) fpatan ret -PSEUDO_END (__ieee754_atan2l) +END (__ieee754_atan2l) diff --git a/sysdeps/libm-i387/e_atanh.S b/sysdeps/libm-i387/e_atanh.S new file mode 100644 index 0000000000..231e96f57f --- /dev/null +++ b/sysdeps/libm-i387/e_atanh.S @@ -0,0 +1,101 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + ASM_TYPE_DIRECTIVE(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanh) + movl 8(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x80000000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 8(%esp) + fldl 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanh) diff --git a/sysdeps/libm-i387/e_atanhf.S b/sysdeps/libm-i387/e_atanhf.S new file mode 100644 index 0000000000..687d4c97fb --- /dev/null +++ b/sysdeps/libm-i387/e_atanhf.S @@ -0,0 +1,102 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanhf) + movl 4(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x80000000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 4(%esp) + flds 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st(0) // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanhf) diff --git a/sysdeps/libm-i387/e_atanhl.S b/sysdeps/libm-i387/e_atanhl.S new file mode 100644 index 0000000000..8a2bd11ce4 --- /dev/null +++ b/sysdeps/libm-i387/e_atanhl.S @@ -0,0 +1,108 @@ +/* ix87 specific implementation of arctanh function. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + /* Please note that we use double values for 0.5 and 1.0. These + numbers have exact representations and so we don't get accuracy + problems. The advantage is that the code is simpler. */ + ASM_TYPE_DIRECTIVE(half,@object) +half: .double 0.5 + ASM_SIZE_DIRECTIVE(half) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(ln2_2,@object) +ln2_2: .tfloat 0.3465735902799726547086160 + ASM_SIZE_DIRECTIVE(ln2_2) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_atanhl) + movl 12(%esp), %ecx + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + andl $0x8000, %ecx // ECX == 0 iff X >= 0 + + fldt MO(ln2_2) // 0.5*ln2 + xorl %ecx, 12(%esp) + fldt 4(%esp) // |x| : 0.5*ln2 + fcoml MO(half) // |x| : 0.5*ln2 + fld %st(0) // |x| : |x| : 0.5*ln2 + fnstsw // |x| : |x| : 0.5*ln2 + sahf + jae 2f + fadd %st, %st(1) // |x| : 2*|x| : 0.5*ln2 + fld %st // |x| : |x| : 2*|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : |x| : 2*|x| : 0.5*ln2 + fxch // |x| : 1-|x| : 2*|x| : 0.5*ln2 + fmul %st(2) // 2*|x|^2 : 1-|x| : 2*|x| : 0.5*ln2 + fdivp // (2*|x|^2)/(1-|x|) : 2*|x| : 0.5*ln2 + faddp // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fcoml MO(limit) // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fnstsw // 2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + sahf + jae 4f + fyl2xp1 // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +4: faddl MO(one) // 1+2*|x|+(2*|x|^2)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld(1+2*|x|+(2*|x|^2)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld(1+2*x+(2*x^2)/(1-x)) +3: ret + + .align ALIGNARG(4) +2: faddl MO(one) // 1+|x| : |x| : 0.5*ln2 + fxch // |x| : 1+|x| : 0.5*ln2 + fsubrl MO(one) // 1-|x| : 1+|x| : 0.5*ln2 + fdivrp // (1+|x|)/(1-|x|) : 0.5*ln2 + fyl2x // 0.5*ln2*ld((1+|x|)/(1-|x|)) + jecxz 3f + fchs // 0.5*ln2*ld((1+x)/(1-x)) +3: ret +END(__ieee754_atanhl) diff --git a/sysdeps/libm-i387/e_exp.S b/sysdeps/libm-i387/e_exp.S index 01c254ab51..4505ebd309 100644 --- a/sysdeps/libm-i387/e_exp.S +++ b/sysdeps/libm-i387/e_exp.S @@ -38,4 +38,4 @@ ENTRY(__ieee754_exp) jz .LpInf /* If positive, jump. */ fldz /* Set result to 0. */ .LpInf: ret -PSEUDO_END (__ieee754_exp) +END (__ieee754_exp) diff --git a/sysdeps/libm-i387/e_expf.S b/sysdeps/libm-i387/e_expf.S new file mode 100644 index 0000000000..c8233eba50 --- /dev/null +++ b/sysdeps/libm-i387/e_expf.S @@ -0,0 +1,42 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +/* e^x = 2^(x * log2(e)) */ +ENTRY(__ieee754_expf) + flds 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + sahf + jnc .LnoInfNaN /* No, jump. */ + jp .LisInf /* Is +-Inf, jump. */ +.LnoInfNaN: + fldl2e + fmulp /* x * log2(e) */ + fstl %st(1) + frndint /* int(x * log2(e)) */ + fstl %st(2) + fsubrp /* fract(x * log2(e)) */ + f2xm1 /* 2^(fract(x * log2(e))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(e))) */ + fscale /* e^x */ + fstp %st(1) + ret + +.LisInf: + andb $2, %ah /* Test sign. */ + jz .LpInf /* If positive, jump. */ + fldz /* Set result to 0. */ +.LpInf: ret +END (__ieee754_expf) diff --git a/sysdeps/libm-i387/e_expl.S b/sysdeps/libm-i387/e_expl.S index fc4a1832ca..9103a923aa 100644 --- a/sysdeps/libm-i387/e_expl.S +++ b/sysdeps/libm-i387/e_expl.S @@ -40,4 +40,4 @@ ENTRY(__ieee754_expl) jz .LpInf /* If positive, jump. */ fldz /* Set result to 0. */ .LpInf: ret -PSEUDO_END (__ieee754_expl) +END (__ieee754_expl) diff --git a/sysdeps/libm-i387/e_fmod.S b/sysdeps/libm-i387/e_fmod.S index c4d7535a7c..9c780b9791 100644 --- a/sysdeps/libm-i387/e_fmod.S +++ b/sysdeps/libm-i387/e_fmod.S @@ -16,4 +16,4 @@ ENTRY(__ieee754_fmod) jp 1b fstpl %st(1) ret -PSEUDO_END (__ieee754_fmod) +END (__ieee754_fmod) diff --git a/sysdeps/libm-i387/e_fmodf.S b/sysdeps/libm-i387/e_fmodf.S new file mode 100644 index 0000000000..fbb0c693e1 --- /dev/null +++ b/sysdeps/libm-i387/e_fmodf.S @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_fmodf) + flds 8(%esp) + flds 4(%esp) +1: fprem + fstsw %ax + sahf + jp 1b + fstpl %st(1) + ret +END(__ieee754_fmodf) diff --git a/sysdeps/libm-i387/e_fmodl.S b/sysdeps/libm-i387/e_fmodl.S index 8c2bd06b0a..f21082e0b4 100644 --- a/sysdeps/libm-i387/e_fmodl.S +++ b/sysdeps/libm-i387/e_fmodl.S @@ -18,4 +18,4 @@ ENTRY(__ieee754_fmodl) jp 1b fstpl %st(1) ret -PSEUDO_END (__ieee754_fmodl) +END (__ieee754_fmodl) diff --git a/sysdeps/libm-i387/e_log.S b/sysdeps/libm-i387/e_log.S index 2a51d7520c..43d430332c 100644 --- a/sysdeps/libm-i387/e_log.S +++ b/sysdeps/libm-i387/e_log.S @@ -1,15 +1,59 @@ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. */ #include <machine/asm.h> RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text ENTRY(__ieee754_log) - fldln2 - fldl 4(%esp) - fyl2x + fldln2 // log(2) + fldl 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log(2) + fsubl MO(one) // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl MO(limit) // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + sahf + ja 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fincstp // x : log(2) + fyl2x // log(x) ret -PSEUDO_END (__ieee754_log) +END (__ieee754_log) diff --git a/sysdeps/libm-i387/e_log10.S b/sysdeps/libm-i387/e_log10.S index 17b3067de5..95efc8f7a2 100644 --- a/sysdeps/libm-i387/e_log10.S +++ b/sysdeps/libm-i387/e_log10.S @@ -1,15 +1,59 @@ /* * Written by J.T. Conklin <jtc@netbsd.org>. * Public domain. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. */ #include <machine/asm.h> RCSID("$NetBSD: e_log10.S,v 1.4 1995/05/08 23:49:24 jtc Exp $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text ENTRY(__ieee754_log10) - fldlg2 - fldl 4(%esp) - fyl2x + fldlg2 // log10(2) + fldl 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + fsubl MO(one) // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl MO(limit) // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + sahf + ja 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fincstp // x : log10(2) + fyl2x // log10(x) ret -PSEUDO_END (__ieee754_log10) +END (__ieee754_log10) diff --git a/sysdeps/libm-i387/e_log10f.S b/sysdeps/libm-i387/e_log10f.S new file mode 100644 index 0000000000..bddb5011bc --- /dev/null +++ b/sysdeps/libm-i387/e_log10f.S @@ -0,0 +1,60 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_log10f) + fldlg2 // log10(2) + flds 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + fsubl MO(one) // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl MO(limit) // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + sahf + ja 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fincstp // x : log10(2) + fyl2x // log10(x) + ret +END (__ieee754_log10f) diff --git a/sysdeps/libm-i387/e_log10l.S b/sysdeps/libm-i387/e_log10l.S index cfddb5ce2a..f0b8f325a7 100644 --- a/sysdeps/libm-i387/e_log10l.S +++ b/sysdeps/libm-i387/e_log10l.S @@ -3,15 +3,59 @@ * Public domain. * * Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. */ #include <machine/asm.h> RCSID("$NetBSD: $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text ENTRY(__ieee754_log10l) - fldlg2 - fldt 4(%esp) - fyl2x + fldlg2 // log10(2) + fldt 4(%esp) // x : log10(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log10(2) + fsubl MO(one) // x-1 : x : log10(2) + fld %st // x-1 : x-1 : x : log10(2) + fabs // |x-1| : x-1 : x : log10(2) + fcompl MO(limit) // x-1 : x : log10(2) + fnstsw // x-1 : x : log10(2) + sahf + ja 2f + fstp %st(1) // x-1 : log10(2) + fyl2xp1 // log10(x) + ret + +2: fincstp // x : log10(2) + fyl2x // log10(x) ret -PSEUDO_END(__ieee754_log10l) +END(__ieee754_log10l) diff --git a/sysdeps/libm-i387/e_logf.S b/sysdeps/libm-i387/e_logf.S new file mode 100644 index 0000000000..b79f478cdf --- /dev/null +++ b/sysdeps/libm-i387/e_logf.S @@ -0,0 +1,60 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float by Ulrich Drepper <drepper@cygnus.com>. + * + * Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: e_log.S,v 1.4 1995/05/08 23:48:39 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__ieee754_logf) + fldln2 // log(2) + flds 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log(2) + fsubl MO(one) // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl MO(limit) // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + sahf + ja 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fincstp // x : log(2) + fyl2x // log(x) + ret +END (__ieee754_logf) diff --git a/sysdeps/libm-i387/e_logl.S b/sysdeps/libm-i387/e_logl.S index 4c1550e929..1657dfd5fb 100644 --- a/sysdeps/libm-i387/e_logl.S +++ b/sysdeps/libm-i387/e_logl.S @@ -9,9 +9,52 @@ RCSID("$NetBSD: $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text ENTRY(__ieee754_logl) - fldln2 - fldt 4(%esp) - fyl2x + fldln2 // log(2) + fldt 4(%esp) // x : log(2) +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + fld %st // x : x : log(2) + fsubl MO(one) // x-1 : x : log(2) + fld %st // x-1 : x-1 : x : log(2) + fabs // |x-1| : x-1 : x : log(2) + fcompl MO(limit) // x-1 : x : log(2) + fnstsw // x-1 : x : log(2) + sahf + ja 2f + fstp %st(1) // x-1 : log(2) + fyl2xp1 // log(x) + ret + +2: fincstp // x : log(2) + fyl2x // log(x) ret -PSEUDO_END(__ieee754_logl) +END (__ieee754_logl) diff --git a/sysdeps/libm-i387/e_remainder.S b/sysdeps/libm-i387/e_remainder.S index 287b616ff7..06cdddc9d1 100644 --- a/sysdeps/libm-i387/e_remainder.S +++ b/sysdeps/libm-i387/e_remainder.S @@ -16,4 +16,4 @@ ENTRY(__ieee754_remainder) jp 1b fstpl %st(1) ret -PSEUDO_END (__ieee754_remainder) +END (__ieee754_remainder) diff --git a/sysdeps/libm-i387/e_remainderf.S b/sysdeps/libm-i387/e_remainderf.S index cdc1ac8b6f..d313a55382 100644 --- a/sysdeps/libm-i387/e_remainderf.S +++ b/sysdeps/libm-i387/e_remainderf.S @@ -16,4 +16,4 @@ ENTRY(__ieee754_remainderf) jp 1b fstpl %st(1) ret -PSEUDO_END (__ieee754_remainderf) +END (__ieee754_remainderf) diff --git a/sysdeps/libm-i387/e_remainderl.S b/sysdeps/libm-i387/e_remainderl.S index 2c32550708..90a8da7633 100644 --- a/sysdeps/libm-i387/e_remainderl.S +++ b/sysdeps/libm-i387/e_remainderl.S @@ -17,4 +17,4 @@ ENTRY(__ieee754_remainderl) sahf jp 1b ret -PSEUDO_END (__ieee754_remainderl) +END (__ieee754_remainderl) diff --git a/sysdeps/libm-i387/e_scalb.S b/sysdeps/libm-i387/e_scalb.S index 0aed96d1c5..db63dde56e 100644 --- a/sysdeps/libm-i387/e_scalb.S +++ b/sysdeps/libm-i387/e_scalb.S @@ -12,4 +12,4 @@ ENTRY(__ieee754_scalb) fldl 4(%esp) fscale ret -PSEUDO_END(__ieee754_scalb) +END(__ieee754_scalb) diff --git a/sysdeps/libm-i387/e_scalbf.S b/sysdeps/libm-i387/e_scalbf.S new file mode 100644 index 0000000000..7de03db287 --- /dev/null +++ b/sysdeps/libm-i387/e_scalbf.S @@ -0,0 +1,16 @@ +/* + * Written by J.T. Conklin <jtc@netbsd.org>. + * Public domain. + * Adapted for float type by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +RCSID("$NetBSD: $") + +ENTRY(__ieee754_scalbf) + flds 8(%esp) + flds 4(%esp) + fscale + ret +END(__ieee754_scalbf) diff --git a/sysdeps/libm-i387/e_scalbl.S b/sysdeps/libm-i387/e_scalbl.S index 40d6ff028f..7b20cc6f9c 100644 --- a/sysdeps/libm-i387/e_scalbl.S +++ b/sysdeps/libm-i387/e_scalbl.S @@ -14,4 +14,4 @@ ENTRY(__ieee754_scalbl) fldt 4(%esp) fscale ret -PSEUDO_END(__ieee754_scalbl) +END(__ieee754_scalbl) diff --git a/sysdeps/libm-i387/e_sqrt.S b/sysdeps/libm-i387/e_sqrt.S index 170363fa87..6f253d51aa 100644 --- a/sysdeps/libm-i387/e_sqrt.S +++ b/sysdeps/libm-i387/e_sqrt.S @@ -11,4 +11,4 @@ ENTRY(__ieee754_sqrt) fldl 4(%esp) fsqrt ret -PSEUDO_END (__ieee754_sqrt) +END (__ieee754_sqrt) diff --git a/sysdeps/libm-i387/e_sqrtf.S b/sysdeps/libm-i387/e_sqrtf.S index f13c129aa0..5ce1ad0544 100644 --- a/sysdeps/libm-i387/e_sqrtf.S +++ b/sysdeps/libm-i387/e_sqrtf.S @@ -11,4 +11,4 @@ ENTRY(__ieee754_sqrtf) flds 4(%esp) fsqrt ret -PSEUDO_END (__ieee754_sqrtf) +END (__ieee754_sqrtf) diff --git a/sysdeps/libm-i387/e_sqrtl.S b/sysdeps/libm-i387/e_sqrtl.S index 56947e16f8..d47aae5cb5 100644 --- a/sysdeps/libm-i387/e_sqrtl.S +++ b/sysdeps/libm-i387/e_sqrtl.S @@ -13,4 +13,4 @@ ENTRY(__ieee754_sqrtl) fldt 4(%esp) fsqrt ret -PSEUDO_END (__ieee754_sqrtl) +END (__ieee754_sqrtl) diff --git a/sysdeps/libm-i387/s_asinh.S b/sysdeps/libm-i387/s_asinh.S new file mode 100644 index 0000000000..9b58eaa424 --- /dev/null +++ b/sysdeps/libm-i387/s_asinh.S @@ -0,0 +1,132 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .double 1e+300 + ASM_SIZE_DIRECTIVE(huge) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinh) + movl 8(%esp), %ecx + movl $0x7fffffff, %eax + andl %ecx, %eax + andl $0x80000000, %ecx + xorl %ecx, 8(%esp) + fldl 4(%esp) // |x| + cmpl $0x3e300000, %eax + jb 2f // |x| < 2^-28 + fldln2 // log(2) : |x| + cmpl $0x41b00000, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^28 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %eax + ja 5f // |x| > 2 + + // 2^-28 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-28 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + faddl MO(huge) // huge+x : x + fincstp // x + ret + + // |x| > 2^28 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinh) +weak_alias (__asinh, asinh) diff --git a/sysdeps/libm-i387/s_asinhf.S b/sysdeps/libm-i387/s_asinhf.S new file mode 100644 index 0000000000..d0a99a9461 --- /dev/null +++ b/sysdeps/libm-i387/s_asinhf.S @@ -0,0 +1,132 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .double 1e+36 + ASM_SIZE_DIRECTIVE(huge) + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinhf) + movl 4(%esp), %ecx + movl $0x7fffffff, %eax + andl %ecx, %eax + andl $0x80000000, %ecx + xorl %ecx, 8(%esp) + flds 4(%esp) // |x| + cmpl $0x38000000, %eax + jb 2f // |x| < 2^-14 + fldln2 // log(2) : |x| + cmpl $0x47000000, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^14 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x40000000, %eax + ja 5f // |x| > 2 + + // 2^-14 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-14 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + faddl MO(huge) // huge+x : x + fincstp // x + ret + + // |x| > 2^14 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinhf) +weak_alias (__asinhf, asinhf) diff --git a/sysdeps/libm-i387/s_asinhl.S b/sysdeps/libm-i387/s_asinhl.S new file mode 100644 index 0000000000..28f76c2649 --- /dev/null +++ b/sysdeps/libm-i387/s_asinhl.S @@ -0,0 +1,140 @@ +/* ix87 specific implementation of arcsinh. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + 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 <machine/asm.h> + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + + .align ALIGNARG(4) + ASM_TYPE_DIRECTIVE(huge,@object) +huge: .tfloat 1e+4930 + ASM_SIZE_DIRECTIVE(huge) + .align ALIGNARG(4) + /* Please note that we use double value for 1.0. This number + has an exact representation and so we don't get accuracy + problems. The advantage is that the code is simpler. */ + ASM_TYPE_DIRECTIVE(one,@object) +one: .double 1.0 + ASM_SIZE_DIRECTIVE(one) + /* It is not important that this constant is precise. It is only + a value which is known to be on the safe side for using the + fyl2xp1 instruction. */ + ASM_TYPE_DIRECTIVE(limit,@object) +limit: .double 0.29 + ASM_SIZE_DIRECTIVE(limit) + +#ifdef PIC +#define MO(op) op##@GOTOFF(%edx) +#else +#define MO(op) op +#endif + + .text +ENTRY(__asinhl) + movl 12(%esp), %ecx + movl $0x7fff, %eax + andl %ecx, %eax + andl $0x8000, %ecx + xorl %ecx, 12(%esp) + fldt 4(%esp) // |x| + cmpl $0x3fde, %eax + jb 2f // |x| < 2^-34 + fldln2 // log(2) : |x| + cmpl $0x4020, %eax + fxch // |x| : log(2) + ja 3f // |x| > 2^34 +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + cmpl $0x4000, %eax + ja 5f // |x| > 2 + + // 2^-34 <= |x| <= 2 => y = sign(x)*log1p(|x|+|x|^2/(1+sqrt(1+|x|^2))) + fld %st // |x| : |x| : log(2) + fmul %st(1) // |x|^2 : |x| : log(2) + fld %st // |x|^2 : |x|^2 : |x| : log(2) + faddl MO(one) // 1+|x|^2 : |x|^2 : |x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + faddl MO(one) // 1+sqrt(1+|x|^2) : |x|^2 : |x| : log(2) + fdivrp // |x|^2/(1+sqrt(1+|x|^2)) : |x| : log(2) + faddp // |x|+|x|^2/(1+sqrt(1+|x|^2)) : log(2) + fcoml MO(limit) + fnstsw + sahf + ja 6f + fyl2xp1 + jecxz 4f + fchs +4: ret + +6: faddl MO(one) + fyl2x + jecxz 4f + fchs +4: ret + + // |x| < 2^-34 => y = x (inexact iff |x| != 0.0) + .align ALIGNARG(4) +2: +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + jecxz 4f + fchs // x +4: fld %st // x : x + fldt MO(huge) // huge : x : x + faddp // huge+x : x + fincstp // x + ret + + // |x| > 2^34 => y = sign(x) * (log(|x|) + log(2)) + .align ALIGNARG(4) +3: fyl2x // log(|x|) + fldln2 // log(2) : log(|x|) + faddp // log(|x|)+log(2) + jecxz 4f + fchs +4: ret + + // |x| > 2 => y = sign(x) * log(2*|x| + 1/(|x|+sqrt(x*x+1))) + .align ALIGNARG(4) +5: fld %st // |x| : |x| : log(2) + fadd %st, %st(1) // |x| : 2*|x| : log(2) + fld %st // |x| : |x| : 2*|x| : log(2) + fmul %st(1) // |x|^2 : |x| : 2*|x| : log(2) + faddl MO(one) // 1+|x|^2 : |x| : 2*|x| : log(2) + fsqrt // sqrt(1+|x|^2) : |x| : 2*|x| : log(2) + faddp // |x|+sqrt(1+|x|^2) : 2*|x| : log(2) + fdivrl MO(one) // 1/(|x|+sqrt(1+|x|^2)) : 2*|x| : log(2) + faddp // 2*|x|+1/(|x|+sqrt(1+|x|^2)) : log(2) + fyl2x // log(2*|x|+1/(|x|+sqrt(1+|x|^2))) + jecxz 4f + fchs +4: ret +END(__asinhl) +weak_alias (__asinhl, asinhl) diff --git a/sysdeps/libm-i387/s_atan.S b/sysdeps/libm-i387/s_atan.S index f670031877..7502f6d828 100644 --- a/sysdeps/libm-i387/s_atan.S +++ b/sysdeps/libm-i387/s_atan.S @@ -12,5 +12,5 @@ ENTRY(__atan) fld1 fpatan ret -PSEUDO_END (__atan) +END (__atan) weak_alias (__atan, atan) diff --git a/sysdeps/libm-i387/s_atanf.S b/sysdeps/libm-i387/s_atanf.S index 803b7f972d..70232c8240 100644 --- a/sysdeps/libm-i387/s_atanf.S +++ b/sysdeps/libm-i387/s_atanf.S @@ -12,5 +12,5 @@ ENTRY(__atanf) fld1 fpatan ret -PSEUDO_END (__atanf) +END (__atanf) weak_alias (__atanf, atanf) diff --git a/sysdeps/libm-i387/s_atanl.S b/sysdeps/libm-i387/s_atanl.S index 59f139005a..8b07272764 100644 --- a/sysdeps/libm-i387/s_atanl.S +++ b/sysdeps/libm-i387/s_atanl.S @@ -14,5 +14,5 @@ ENTRY(__atanl) fld1 fpatan ret -PSEUDO_END (__atanl) +END (__atanl) weak_alias (__atanl, atanl) diff --git a/sysdeps/libm-i387/s_ceil.S b/sysdeps/libm-i387/s_ceil.S index 5135c90e40..309fe882f8 100644 --- a/sysdeps/libm-i387/s_ceil.S +++ b/sysdeps/libm-i387/s_ceil.S @@ -30,5 +30,5 @@ ENTRY(__ceil) leave ret -PSEUDO_END (__ceil) +END (__ceil) weak_alias (__ceil, ceil) diff --git a/sysdeps/libm-i387/s_ceilf.S b/sysdeps/libm-i387/s_ceilf.S index 93cf40bd43..768d117021 100644 --- a/sysdeps/libm-i387/s_ceilf.S +++ b/sysdeps/libm-i387/s_ceilf.S @@ -30,5 +30,5 @@ ENTRY(__ceilf) leave ret -PSEUDO_END (__ceilf) +END (__ceilf) weak_alias (__ceilf, ceilf) diff --git a/sysdeps/libm-i387/s_ceill.S b/sysdeps/libm-i387/s_ceill.S index a77e550d7b..dcf8719af3 100644 --- a/sysdeps/libm-i387/s_ceill.S +++ b/sysdeps/libm-i387/s_ceill.S @@ -31,5 +31,5 @@ ENTRY(__ceill) leave ret -PSEUDO_END (__ceill) +END (__ceill) weak_alias (__ceill, ceill) diff --git a/sysdeps/libm-i387/s_copysign.S b/sysdeps/libm-i387/s_copysign.S index 45b86f58c8..2520a94427 100644 --- a/sysdeps/libm-i387/s_copysign.S +++ b/sysdeps/libm-i387/s_copysign.S @@ -16,5 +16,5 @@ ENTRY(__copysign) movl %eax,8(%esp) fldl 4(%esp) ret -PSEUDO_END (__copysign) +END (__copysign) weak_alias (__copysign, copysign) diff --git a/sysdeps/libm-i387/s_copysignf.S b/sysdeps/libm-i387/s_copysignf.S index 4844a2b879..57b1a6f119 100644 --- a/sysdeps/libm-i387/s_copysignf.S +++ b/sysdeps/libm-i387/s_copysignf.S @@ -16,5 +16,5 @@ ENTRY(__copysignf) movl %eax,4(%esp) flds 4(%esp) ret -PSEUDO_END (__copysignf) +END (__copysignf) weak_alias (__copysignf, copysignf) diff --git a/sysdeps/libm-i387/s_copysignl.S b/sysdeps/libm-i387/s_copysignl.S index 37e34fe1b4..2163e7b014 100644 --- a/sysdeps/libm-i387/s_copysignl.S +++ b/sysdeps/libm-i387/s_copysignl.S @@ -17,5 +17,5 @@ ENTRY(__copysignl) movl %eax,12(%esp) fldt 4(%esp) ret -PSEUDO_END (__copysignl) +END (__copysignl) weak_alias (__copysignl, copysignl) diff --git a/sysdeps/libm-i387/s_cos.S b/sysdeps/libm-i387/s_cos.S index 6b47e80d2e..f75e98060b 100644 --- a/sysdeps/libm-i387/s_cos.S +++ b/sysdeps/libm-i387/s_cos.S @@ -11,7 +11,7 @@ ENTRY(__cos) fldl 4(%esp) fcos fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f ret 1: fldpi @@ -19,10 +19,10 @@ ENTRY(__cos) fxch %st(1) 2: fprem1 fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fcos ret -PSEUDO_END (__cos) +END (__cos) weak_alias (__cos, cos) diff --git a/sysdeps/libm-i387/s_cosf.S b/sysdeps/libm-i387/s_cosf.S index a2bd0e5fa9..d8e8090639 100644 --- a/sysdeps/libm-i387/s_cosf.S +++ b/sysdeps/libm-i387/s_cosf.S @@ -12,5 +12,5 @@ ENTRY(__cosf) flds 4(%esp) fcos ret -PSEUDO_END (__cosf) +END (__cosf) weak_alias (__cosf, cosf) diff --git a/sysdeps/libm-i387/s_cosl.S b/sysdeps/libm-i387/s_cosl.S index 2ddb549b77..f41fc19958 100644 --- a/sysdeps/libm-i387/s_cosl.S +++ b/sysdeps/libm-i387/s_cosl.S @@ -13,7 +13,7 @@ ENTRY(__cosl) fldt 4(%esp) fcos fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f ret 1: fldpi @@ -21,10 +21,10 @@ ENTRY(__cosl) fxch %st(1) 2: fprem1 fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fcos ret -PSEUDO_END (__cosl) +END (__cosl) weak_alias (__cosl, cosl) diff --git a/sysdeps/libm-i387/s_finite.S b/sysdeps/libm-i387/s_finite.S index 538fec94e1..7c67e1906f 100644 --- a/sysdeps/libm-i387/s_finite.S +++ b/sysdeps/libm-i387/s_finite.S @@ -14,5 +14,5 @@ ENTRY(__finite) setne %al andl $0x000000ff, %eax ret -PSEUDO_END (__finite) +END (__finite) weak_alias (__finite, finite) diff --git a/sysdeps/libm-i387/s_finitef.S b/sysdeps/libm-i387/s_finitef.S index cb0caabf6f..ee26c875a5 100644 --- a/sysdeps/libm-i387/s_finitef.S +++ b/sysdeps/libm-i387/s_finitef.S @@ -14,5 +14,5 @@ ENTRY(__finitef) setne %al andl $0x000000ff, %eax ret -PSEUDO_END (__finitef) +END (__finitef) weak_alias (__finitef, finitef) diff --git a/sysdeps/libm-i387/s_finitel.S b/sysdeps/libm-i387/s_finitel.S index 7af80475ae..944b2497e2 100644 --- a/sysdeps/libm-i387/s_finitel.S +++ b/sysdeps/libm-i387/s_finitel.S @@ -16,5 +16,5 @@ ENTRY(__finitel) setne %al andl $0x000000ff, %eax ret -PSEUDO_END (__finitel) +END (__finitel) weak_alias (__finitel, finitel) diff --git a/sysdeps/libm-i387/s_floor.S b/sysdeps/libm-i387/s_floor.S index ca8914ee14..561f83d98a 100644 --- a/sysdeps/libm-i387/s_floor.S +++ b/sysdeps/libm-i387/s_floor.S @@ -26,5 +26,5 @@ ENTRY(__floor) leave ret -PSEUDO_END (__floor) +END (__floor) weak_alias (__floor, floor) diff --git a/sysdeps/libm-i387/s_floorf.S b/sysdeps/libm-i387/s_floorf.S index 796db4fdad..059f4f3a15 100644 --- a/sysdeps/libm-i387/s_floorf.S +++ b/sysdeps/libm-i387/s_floorf.S @@ -26,5 +26,5 @@ ENTRY(__floorf) leave ret -PSEUDO_END (__floorf) +END (__floorf) weak_alias (__floorf, floorf) diff --git a/sysdeps/libm-i387/s_floorl.S b/sysdeps/libm-i387/s_floorl.S index 396d854edc..7b7cff777a 100644 --- a/sysdeps/libm-i387/s_floorl.S +++ b/sysdeps/libm-i387/s_floorl.S @@ -27,5 +27,5 @@ ENTRY(__floorl) leave ret -PSEUDO_END (__floorl) +END (__floorl) weak_alias (__floorl, floorl) diff --git a/sysdeps/libm-i387/s_ilogb.S b/sysdeps/libm-i387/s_ilogb.S index 6fb51d913f..01b8afac10 100644 --- a/sysdeps/libm-i387/s_ilogb.S +++ b/sysdeps/libm-i387/s_ilogb.S @@ -21,5 +21,5 @@ ENTRY(__ilogb) leave ret -PSEUDO_END (__ilogb) +END (__ilogb) weak_alias (__ilogb, ilogb) diff --git a/sysdeps/libm-i387/s_ilogbf.S b/sysdeps/libm-i387/s_ilogbf.S index 71e4f42c9a..6a943265b2 100644 --- a/sysdeps/libm-i387/s_ilogbf.S +++ b/sysdeps/libm-i387/s_ilogbf.S @@ -21,5 +21,5 @@ ENTRY(__ilogbf) leave ret -PSEUDO_END (__ilogbf) +END (__ilogbf) weak_alias (__ilogbf, ilogbf) diff --git a/sysdeps/libm-i387/s_ilogbl.S b/sysdeps/libm-i387/s_ilogbl.S index 2b841463df..2422a41355 100644 --- a/sysdeps/libm-i387/s_ilogbl.S +++ b/sysdeps/libm-i387/s_ilogbl.S @@ -21,5 +21,5 @@ ENTRY(__ilogbl) leave ret -PSEUDO_END (__ilogbl) +END (__ilogbl) weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/libm-i387/s_log1p.S b/sysdeps/libm-i387/s_log1p.S index ce8665d3a5..10e8a36369 100644 --- a/sysdeps/libm-i387/s_log1p.S +++ b/sysdeps/libm-i387/s_log1p.S @@ -7,18 +7,56 @@ RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .double 0.29 +one: .double 1.0 + /* - * Since the fyl2xp1 instruction has such a limited range: - * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1 - * it's not worth trying to use it. + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. */ - + .text ENTRY(__log1p) fldln2 - fldl 4(%esp) - fld1 - faddp + + fldl 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fcompl limit@GOTOFF(%edx) +#else + fcompl limit +#endif + fnstsw + sahf + jc 2f + +#ifdef PIC + faddl one@GOTOFF(%edx) +#else + faddl one +#endif fyl2x ret -PSEUDO_END (__log1p) + +2: fyl2xp1 + ret + +END (__log1p) weak_alias (__log1p, log1p) diff --git a/sysdeps/libm-i387/s_log1pf.S b/sysdeps/libm-i387/s_log1pf.S index 7a161f26f9..df9fdcbcfc 100644 --- a/sysdeps/libm-i387/s_log1pf.S +++ b/sysdeps/libm-i387/s_log1pf.S @@ -7,18 +7,56 @@ RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $") +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .float 0.29 +one: .float 1.0 + /* - * Since the fyl2xp1 instruction has such a limited range: - * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1 - * it's not worth trying to use it. + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. */ - + .text ENTRY(__log1pf) fldln2 - flds 4(%esp) - fld1 - faddp + + flds 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fcomps limit@GOTOFF(%edx) +#else + fcomps limit +#endif + fnstsw + sahf + jc 2f + +#ifdef PIC + fadds one@GOTOFF(%edx) +#else + fadds one +#endif fyl2x ret -PSEUDO_END (__log1pf) + +2: fyl2xp1 + ret + +END (__log1pf) weak_alias (__log1pf, log1pf) diff --git a/sysdeps/libm-i387/s_log1pl.S b/sysdeps/libm-i387/s_log1pl.S index 647e136413..05a17b2831 100644 --- a/sysdeps/libm-i387/s_log1pl.S +++ b/sysdeps/libm-i387/s_log1pl.S @@ -7,20 +7,62 @@ #include <machine/asm.h> -RCSID("$NetBSD: $") +RCSID("$NetBSD: s_log1p.S,v 1.7 1995/05/09 00:10:58 jtc Exp $") + +#ifdef __ELF__ + .section .rodata +#else + .text +#endif + .align ALIGNARG(4) + /* The fyl2xp1 can only be used for values in + -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 + 0.29 is a safe value. + */ +limit: .tfloat 0.29 + /* Please note: we use a double value here. Since 1.0 has + an exact representation this does not effect the accuracy + but it helps to optimize the code. */ +one: .double 1.0 /* - * Since the fyl2xp1 instruction has such a limited range: - * -(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1 - * it's not worth trying to use it. + * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, + * otherwise fyl2x with the needed extra computation. */ - + .text ENTRY(__log1pl) fldln2 - fldt 4(%esp) - fld1 - faddp + + fldt 4(%esp) + +#ifdef PIC + call 1f +1: popl %edx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %edx +#endif + + fld %st + fabs +#ifdef PIC + fldt limit@GOTOFF(%edx) +#else + fldt limit +#endif + fcompp + fnstsw + sahf + jnc 2f + +#ifdef PIC + faddl one@GOTOFF(%edx) +#else + faddl one +#endif fyl2x ret -PSEUDO_END (__log1pl) + +2: fyl2xp1 + ret + +END (__log1pl) weak_alias (__log1pl, log1pl) diff --git a/sysdeps/libm-i387/s_logb.S b/sysdeps/libm-i387/s_logb.S index 92d8fee85c..2f1afd40cc 100644 --- a/sysdeps/libm-i387/s_logb.S +++ b/sysdeps/libm-i387/s_logb.S @@ -12,5 +12,5 @@ ENTRY(__logb) fxtract fstpl %st ret -PSEUDO_END (__logb) +END (__logb) weak_alias (__logb, logb) diff --git a/sysdeps/libm-i387/s_logbf.S b/sysdeps/libm-i387/s_logbf.S index b557974a82..0052497272 100644 --- a/sysdeps/libm-i387/s_logbf.S +++ b/sysdeps/libm-i387/s_logbf.S @@ -12,5 +12,5 @@ ENTRY(__logbf) fxtract fstpl %st ret -PSEUDO_END (__logbf) +END (__logbf) weak_alias (__logbf, logbf) diff --git a/sysdeps/libm-i387/s_logbl.S b/sysdeps/libm-i387/s_logbl.S index 91bddb6b3a..6ce274c57c 100644 --- a/sysdeps/libm-i387/s_logbl.S +++ b/sysdeps/libm-i387/s_logbl.S @@ -12,5 +12,5 @@ ENTRY(__logbl) fldt 4(%esp) fxtract ret -PSEUDO_END (__logbl) +END (__logbl) weak_alias (__logbl, logbl) diff --git a/sysdeps/libm-i387/s_rint.S b/sysdeps/libm-i387/s_rint.S index 9231fef32d..be36c5f0ca 100644 --- a/sysdeps/libm-i387/s_rint.S +++ b/sysdeps/libm-i387/s_rint.S @@ -11,5 +11,5 @@ ENTRY(__rint) fldl 4(%esp) frndint ret -PSEUDO_END (__rint) +END (__rint) weak_alias (__rint, rint) diff --git a/sysdeps/libm-i387/s_rintf.S b/sysdeps/libm-i387/s_rintf.S index 3e35f2c822..2b358c1cf1 100644 --- a/sysdeps/libm-i387/s_rintf.S +++ b/sysdeps/libm-i387/s_rintf.S @@ -11,5 +11,5 @@ ENTRY(__rintf) flds 4(%esp) frndint ret -PSEUDO_END (__rintf) +END (__rintf) weak_alias (__rintf, rintf) diff --git a/sysdeps/libm-i387/s_rintl.S b/sysdeps/libm-i387/s_rintl.S index a8198d3d7f..fd1ae6324e 100644 --- a/sysdeps/libm-i387/s_rintl.S +++ b/sysdeps/libm-i387/s_rintl.S @@ -12,5 +12,5 @@ ENTRY(__rintl) fldt 4(%esp) frndint ret -PSEUDO_END (__rintl) +END (__rintl) weak_alias (__rintl, rintl) diff --git a/sysdeps/libm-i387/s_scalbn.S b/sysdeps/libm-i387/s_scalbn.S index 4a4149500c..3ec56d4523 100644 --- a/sysdeps/libm-i387/s_scalbn.S +++ b/sysdeps/libm-i387/s_scalbn.S @@ -12,5 +12,5 @@ ENTRY(__scalbn) fldl 4(%esp) fscale ret -PSEUDO_END (__scalbn) +END (__scalbn) weak_alias (__scalbn, scalbn) diff --git a/sysdeps/libm-i387/s_scalbnf.S b/sysdeps/libm-i387/s_scalbnf.S index 080304d574..b1a1c46b6c 100644 --- a/sysdeps/libm-i387/s_scalbnf.S +++ b/sysdeps/libm-i387/s_scalbnf.S @@ -12,5 +12,5 @@ ENTRY(__scalbnf) flds 4(%esp) fscale ret -PSEUDO_END (__scalbnf) +END (__scalbnf) weak_alias (__scalbnf, scalbnf) diff --git a/sysdeps/libm-i387/s_scalbnl.S b/sysdeps/libm-i387/s_scalbnl.S index adf1dea604..0f3323803c 100644 --- a/sysdeps/libm-i387/s_scalbnl.S +++ b/sysdeps/libm-i387/s_scalbnl.S @@ -13,5 +13,5 @@ ENTRY(__scalbnl) fldt 4(%esp) fscale ret -PSEUDO_END (__scalbnl) +END (__scalbnl) weak_alias (__scalbnl, scalbnl) diff --git a/sysdeps/libm-i387/s_significand.S b/sysdeps/libm-i387/s_significand.S index ff72b88560..4f8d91fe9d 100644 --- a/sysdeps/libm-i387/s_significand.S +++ b/sysdeps/libm-i387/s_significand.S @@ -12,5 +12,5 @@ ENTRY(__significand) fxtract fstpl %st(1) ret -PSEUDO_END (__significand) +END (__significand) weak_alias (__significand, significand) diff --git a/sysdeps/libm-i387/s_significandf.S b/sysdeps/libm-i387/s_significandf.S index af92886501..603e9f029d 100644 --- a/sysdeps/libm-i387/s_significandf.S +++ b/sysdeps/libm-i387/s_significandf.S @@ -12,5 +12,5 @@ ENTRY(__significandf) fxtract fstpl %st(1) ret -PSEUDO_END (__significandf) +END (__significandf) weak_alias (__significandf, significandf) diff --git a/sysdeps/libm-i387/s_significandl.S b/sysdeps/libm-i387/s_significandl.S index 1483a0dec2..1d5f4a3f6a 100644 --- a/sysdeps/libm-i387/s_significandl.S +++ b/sysdeps/libm-i387/s_significandl.S @@ -13,5 +13,5 @@ ENTRY(__significandl) fxtract fincstp ret -PSEUDO_END (__significandl) +END (__significandl) weak_alias (__significandl, significandl) diff --git a/sysdeps/libm-i387/s_sin.S b/sysdeps/libm-i387/s_sin.S index f06c9440ad..f048e5278b 100644 --- a/sysdeps/libm-i387/s_sin.S +++ b/sysdeps/libm-i387/s_sin.S @@ -11,7 +11,7 @@ ENTRY(__sin) fldl 4(%esp) fsin fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f ret 1: fldpi @@ -19,10 +19,10 @@ ENTRY(__sin) fxch %st(1) 2: fprem1 fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fsin ret -PSEUDO_END (__sin) +END (__sin) weak_alias (__sin, sin) diff --git a/sysdeps/libm-i387/s_sinf.S b/sysdeps/libm-i387/s_sinf.S index 464ccb2b8a..a010d60f5e 100644 --- a/sysdeps/libm-i387/s_sinf.S +++ b/sysdeps/libm-i387/s_sinf.S @@ -12,5 +12,5 @@ ENTRY(__sinf) flds 4(%esp) fsin ret -PSEUDO_END (__sinf) +END (__sinf) weak_alias (__sinf, sinf) diff --git a/sysdeps/libm-i387/s_sinl.S b/sysdeps/libm-i387/s_sinl.S index 2872334881..7c8c95f8a6 100644 --- a/sysdeps/libm-i387/s_sinl.S +++ b/sysdeps/libm-i387/s_sinl.S @@ -13,7 +13,7 @@ ENTRY(__sinl) fldt 4(%esp) fsin fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f ret 1: fldpi @@ -21,10 +21,10 @@ ENTRY(__sinl) fxch %st(1) 2: fprem1 fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fsin ret -PSEUDO_END (__sinl) +END (__sinl) weak_alias (__sinl, sinl) diff --git a/sysdeps/libm-i387/s_tan.S b/sysdeps/libm-i387/s_tan.S index 9333671873..7b3547af4c 100644 --- a/sysdeps/libm-i387/s_tan.S +++ b/sysdeps/libm-i387/s_tan.S @@ -11,7 +11,7 @@ ENTRY(__tan) fldl 4(%esp) fptan fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f fstp %st(0) ret @@ -20,11 +20,11 @@ ENTRY(__tan) fxch %st(1) 2: fprem1 fstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fptan fstp %st(0) ret -PSEUDO_END (__tan) +END (__tan) weak_alias (__tan, tan) diff --git a/sysdeps/libm-i387/s_tanf.S b/sysdeps/libm-i387/s_tanf.S index cbf8dd8496..7a7509119b 100644 --- a/sysdeps/libm-i387/s_tanf.S +++ b/sysdeps/libm-i387/s_tanf.S @@ -13,5 +13,5 @@ ENTRY(__tanf) fptan fstp %st(0) ret -PSEUDO_END (__tanf) +END (__tanf) weak_alias (__tanf, tanf) diff --git a/sysdeps/libm-i387/s_tanl.S b/sysdeps/libm-i387/s_tanl.S index c818e96f88..f2bdd6a605 100644 --- a/sysdeps/libm-i387/s_tanl.S +++ b/sysdeps/libm-i387/s_tanl.S @@ -13,7 +13,7 @@ ENTRY(__tanl) fldt 4(%esp) fptan fnstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 1f fstp %st(0) ret @@ -22,11 +22,11 @@ ENTRY(__tanl) fxch %st(1) 2: fprem1 fstsw %ax - andw $0x400,%ax + testl $0x400,%eax jnz 2b fstp %st(1) fptan fstp %st(0) ret -PSEUDO_END (__tanl) +END (__tanl) weak_alias (__tanl, tanl) |