aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/x86_64/fpu
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/x86_64/fpu')
-rw-r--r--sysdeps/x86_64/fpu/bits/mathdef.h48
-rw-r--r--sysdeps/x86_64/fpu/e_log10l.S5
-rw-r--r--sysdeps/x86_64/fpu/e_log2l.S5
-rw-r--r--sysdeps/x86_64/fpu/e_logl.S12
-rw-r--r--sysdeps/x86_64/fpu/e_powl.S19
-rw-r--r--sysdeps/x86_64/fpu/feholdexcpt.c3
-rw-r--r--sysdeps/x86_64/fpu/fesetround.c3
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps19
-rw-r--r--sysdeps/x86_64/fpu/math_private.h21
-rw-r--r--sysdeps/x86_64/fpu/printf_fphex.c4
-rw-r--r--sysdeps/x86_64/fpu/s_log1pl.S5
-rw-r--r--sysdeps/x86_64/fpu/s_sincos.S61
-rw-r--r--sysdeps/x86_64/fpu/s_sincosl.S7
13 files changed, 130 insertions, 82 deletions
diff --git a/sysdeps/x86_64/fpu/bits/mathdef.h b/sysdeps/x86_64/fpu/bits/mathdef.h
deleted file mode 100644
index 7b16189..0000000
--- a/sysdeps/x86_64/fpu/bits/mathdef.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
-# define _MATH_H_MATHDEF 1
-
-# include <bits/wordsize.h>
-
-# if __WORDSIZE == 64 || (defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0)
-/* The x86-64 architecture computes values with the precission of the
- used type. Similarly for -m32 -mfpmath=sse. */
-typedef float float_t; /* `float' expressions are evaluated as `float'. */
-typedef double double_t; /* `double' expressions are evaluated
- as `double'. */
-# else
-/* The ix87 FPUs evaluate all values in the 80 bit floating-point format
- which is also available for the user as `long double'. Therefore we
- define: */
-typedef long double float_t; /* `float' expressions are evaluated as
- `long double'. */
-typedef long double double_t; /* `double' expressions are evaluated as
- `long double'. */
-# endif
-
-/* The values returned by `ilogb' for 0 and NaN respectively. */
-# define FP_ILOGB0 (-2147483647 - 1)
-# define FP_ILOGBNAN (-2147483647 - 1)
-
-#endif /* ISO C99 */
diff --git a/sysdeps/x86_64/fpu/e_log10l.S b/sysdeps/x86_64/fpu/e_log10l.S
index b4343be..633234b 100644
--- a/sysdeps/x86_64/fpu/e_log10l.S
+++ b/sysdeps/x86_64/fpu/e_log10l.S
@@ -42,7 +42,7 @@ ENTRY(__ieee754_log10l)
fxam
fnstsw
fld %st // x : x : log10(2)
- andb $1,%ah
+ testb $1, %ah
jnz 3f // in case x is NaN or ħInf
4: fsubl MO(one) // x-1 : x : log10(2)
fld %st // x-1 : x-1 : x : log10(2)
@@ -59,7 +59,8 @@ ENTRY(__ieee754_log10l)
fyl2x // log10(x)
ret
-3: jp 4b // in case x is ħInf
+3: testb $4, %ah
+ jnz 4b // in case x is ħInf
fstp %st(1)
fstp %st(1)
ret
diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S
index 7a89b94..f04d30a 100644
--- a/sysdeps/x86_64/fpu/e_log2l.S
+++ b/sysdeps/x86_64/fpu/e_log2l.S
@@ -39,7 +39,7 @@ ENTRY(__ieee754_log2l)
fxam
fnstsw
fld %st // x : x : 1
- andb $1,%ah
+ testb $1, %ah
jnz 3f // in case x is NaN or ħInf
4: fsub %st(2), %st // x-1 : x : 1
fld %st // x-1 : x-1 : x : 1
@@ -56,7 +56,8 @@ ENTRY(__ieee754_log2l)
fyl2x // log(x)
ret
-3: jp 4b // in case x is ħInf
+3: testb $4, %ah
+ jnz 4b // in case x is ħInf
fstp %st(1)
fstp %st(1)
ret
diff --git a/sysdeps/x86_64/fpu/e_logl.S b/sysdeps/x86_64/fpu/e_logl.S
index a0bed66..2ba91ee 100644
--- a/sysdeps/x86_64/fpu/e_logl.S
+++ b/sysdeps/x86_64/fpu/e_logl.S
@@ -38,8 +38,12 @@ limit: .double 0.29
ENTRY(__ieee754_logl)
fldln2 // log(2)
fldt 8(%rsp) // x : log(2)
+ fxam
+ fnstsw
fld %st // x : x : log(2)
- fsubl MO(one) // x-1 : x : log(2)
+ testb $1, %ah
+ jnz 3f // in case x is NaN or +-Inf
+4: 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)
@@ -53,4 +57,10 @@ ENTRY(__ieee754_logl)
2: fstp %st(0) // x : log(2)
fyl2x // log(x)
ret
+
+3: testb $4, %ah
+ jnz 4b // in case x is +-Inf
+ fstp %st(1)
+ fstp %st(1)
+ ret
END (__ieee754_logl)
diff --git a/sysdeps/x86_64/fpu/e_powl.S b/sysdeps/x86_64/fpu/e_powl.S
index 85f4deb..4959bea 100644
--- a/sysdeps/x86_64/fpu/e_powl.S
+++ b/sysdeps/x86_64/fpu/e_powl.S
@@ -1,5 +1,6 @@
/* ix87 specific implementation of pow function.
- Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2001, 2004, 2007
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -146,10 +147,11 @@ ENTRY(__ieee754_powl)
2: /* y is a real number. */
fxch // x : y
fldl MO(one) // 1.0 : x : y
- fld %st(1) // x : 1.0 : x : y
- fsub %st(1) // x-1 : 1.0 : x : y
- fabs // |x-1| : 1.0 : x : y
- fcompl MO(limit) // 1.0 : x : y
+ fldl MO(limit) // 0.29 : 1.0 : x : y
+ fld %st(2) // x : 0.29 : 1.0 : x : y
+ fsub %st(2) // x-1 : 0.29 : 1.0 : x : y
+ fabs // |x-1| : 0.29 : 1.0 : x : y
+ fucompp // 1.0 : x : y
fnstsw
fxch // x : 1.0 : y
test $4500,%eax
@@ -190,9 +192,10 @@ ENTRY(__ieee754_powl)
// y == ħinf
.align ALIGNARG(4)
12: fstp %st(0) // pop y
- fldt 8(%rsp) // x
- fabs
- fcompl MO(one) // < 1, == 1, or > 1
+ fldl MO(one) // 1
+ fldt 8(%rsp) // x : 1
+ fabs // abs(x) : 1
+ fucompp // < 1, == 1, or > 1
fnstsw
andb $0x45, %ah
cmpb $0x45, %ah
diff --git a/sysdeps/x86_64/fpu/feholdexcpt.c b/sysdeps/x86_64/fpu/feholdexcpt.c
index db53d0f..a9b21a3 100644
--- a/sysdeps/x86_64/fpu/feholdexcpt.c
+++ b/sysdeps/x86_64/fpu/feholdexcpt.c
@@ -1,5 +1,5 @@
/* Store current floating-point environment and clear exceptions.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -39,3 +39,4 @@ feholdexcept (fenv_t *envp)
return 0;
}
+libm_hidden_def (feholdexcept)
diff --git a/sysdeps/x86_64/fpu/fesetround.c b/sysdeps/x86_64/fpu/fesetround.c
index 429b7f1..408116e 100644
--- a/sysdeps/x86_64/fpu/fesetround.c
+++ b/sysdeps/x86_64/fpu/fesetround.c
@@ -1,5 +1,5 @@
/* Set current rounding direction.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -44,3 +44,4 @@ fesetround (int round)
return 0;
}
+libm_hidden_def (fesetround)
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index b3ce8bf..0ced4be 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -24,17 +24,14 @@ ldouble: 1
# atan2
Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
-float: 3
-ifloat: 3
+float: 1
+ifloat: 1
Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
float: 1
ifloat: 1
-Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112":
-float: 6
-ifloat: 6
# atanh
Test "atanh (0.75) == 0.972955074527656652552676371721589865":
@@ -51,14 +48,14 @@ ildouble: 2
ldouble: 2
# cacosh
-Test "Real part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
ildouble: 6
ldouble: 6
-Test "Imaginary part of: cacosh (-2 - 3 i) == -1.9833870299165354323470769028940395 + 2.1414491111159960199416055713254211 i":
+Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
@@ -953,8 +950,8 @@ ildouble: 1
ldouble: 1
Function: "atan2":
-float: 6
-ifloat: 6
+float: 1
+ifloat: 1
Function: "atanh":
float: 1
diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h
new file mode 100644
index 0000000..4febcbb
--- /dev/null
+++ b/sysdeps/x86_64/fpu/math_private.h
@@ -0,0 +1,21 @@
+#ifndef _MATH_PRIVATE_H
+
+#define math_opt_barrier(x) \
+({ __typeof(x) __x; \
+ if (sizeof (x) <= sizeof (double)) \
+ __asm ("" : "=x" (__x) : "0" (x)); \
+ else \
+ __asm ("" : "=t" (__x) : "0" (x)); \
+ __x; })
+#define math_force_eval(x) \
+do \
+ { \
+ if (sizeof (x) <= sizeof (double)) \
+ __asm __volatile ("" : : "x" (x)); \
+ else \
+ __asm __volatile ("" : : "f" (x)); \
+ } \
+while (0)
+
+#include <math/math_private.h>
+#endif
diff --git a/sysdeps/x86_64/fpu/printf_fphex.c b/sysdeps/x86_64/fpu/printf_fphex.c
index d6ca102..b701b20 100644
--- a/sysdeps/x86_64/fpu/printf_fphex.c
+++ b/sysdeps/x86_64/fpu/printf_fphex.c
@@ -1,5 +1,5 @@
/* Print floating point number in hexadecimal notation according to ISO C99.
- Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,1999,2000,2001,2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -89,4 +89,4 @@ do { \
} \
} while (0)
-#include <sysdeps/generic/printf_fphex.c>
+#include <stdio-common/printf_fphex.c>
diff --git a/sysdeps/x86_64/fpu/s_log1pl.S b/sysdeps/x86_64/fpu/s_log1pl.S
index 7fbd0e5..ac2bd22 100644
--- a/sysdeps/x86_64/fpu/s_log1pl.S
+++ b/sysdeps/x86_64/fpu/s_log1pl.S
@@ -45,7 +45,7 @@ ENTRY(__log1pl)
fxam
fnstsw
fld %st
- andb $1,%ah
+ testb $1, %ah
jnz 3f // in case x is NaN or ħInf
4:
fabs
@@ -62,7 +62,8 @@ ENTRY(__log1pl)
2: fyl2xp1
ret
-3: jp 4b // in case x is ħInf
+3: testb $4, %ah
+ jnz 4b // in case x is ħInf
fstp %st(1)
fstp %st(1)
ret
diff --git a/sysdeps/x86_64/fpu/s_sincos.S b/sysdeps/x86_64/fpu/s_sincos.S
new file mode 100644
index 0000000..9a33615
--- /dev/null
+++ b/sysdeps/x86_64/fpu/s_sincos.S
@@ -0,0 +1,61 @@
+/* Compute sine and cosine of argument.
+ Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <machine/asm.h>
+#include "bp-sym.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE /* no space for saved regs */
+#define ANGLE PARMS
+#define SINP ANGLE+12
+#define COSP SINP+PTR_SIZE
+
+ .text
+ENTRY (BP_SYM (__sincos))
+ ENTER
+
+ movsd %xmm0, -8(%rsp)
+ fldl -8(%rsp)
+ fsincos
+ fnstsw %ax
+ testl $0x400,%eax
+ jnz 1f
+ fstpl (%rsi)
+ fstpl (%rdi)
+
+ LEAVE
+ retq
+
+1: fldpi
+ fadd %st(0)
+ fxch %st(1)
+2: fprem1
+ fnstsw %ax
+ testl $0x400,%eax
+ jnz 2b
+ fstp %st(1)
+ fsincos
+ fstpl (%rsi)
+ fstpl (%rdi)
+
+ LEAVE
+ retq
+END (BP_SYM (__sincos))
+weak_alias (BP_SYM (__sincos), BP_SYM (sincos))
diff --git a/sysdeps/x86_64/fpu/s_sincosl.S b/sysdeps/x86_64/fpu/s_sincosl.S
index 9a3025a..b17eabe 100644
--- a/sysdeps/x86_64/fpu/s_sincosl.S
+++ b/sysdeps/x86_64/fpu/s_sincosl.S
@@ -1,5 +1,5 @@
/* Compute sine and cosine of argument.
- Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -40,9 +40,8 @@ ENTRY (BP_SYM (__sincosl))
fstpt (%rdi)
LEAVE
- ret
+ retq
- .align ALIGNARG(4)
1: fldpi
fadd %st(0)
fxch %st(1)
@@ -56,6 +55,6 @@ ENTRY (BP_SYM (__sincosl))
fstpt (%rdi)
LEAVE
- ret
+ retq
END (BP_SYM (__sincosl))
weak_alias (BP_SYM (__sincosl), BP_SYM (sincosl))