summaryrefslogtreecommitdiff
path: root/libc/sysdeps/i386
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-12-02 21:11:45 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2012-12-02 21:11:45 +0000
commit94c459cc7a611211d10773eef526826a8da80456 (patch)
tree68526f35a4f1d891b05436e0233a85c74dcc7eff /libc/sysdeps/i386
parent2b19f7c91f9f7c2a7c585cc62b5f3fe75bece1b7 (diff)
downloadeglibc2-94c459cc7a611211d10773eef526826a8da80456.tar.gz
Merge changes between r21775 and r21911 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@21912 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/sysdeps/i386')
-rw-r--r--libc/sysdeps/i386/fpu/e_powl.S55
-rw-r--r--libc/sysdeps/i386/fpu/libm-test-ulps52
2 files changed, 71 insertions, 36 deletions
diff --git a/libc/sysdeps/i386/fpu/e_powl.S b/libc/sysdeps/i386/fpu/e_powl.S
index ac4842cf6..7e297756f 100644
--- a/libc/sysdeps/i386/fpu/e_powl.S
+++ b/libc/sysdeps/i386/fpu/e_powl.S
@@ -26,9 +26,9 @@
.type one,@object
one: .double 1.0
ASM_SIZE_DIRECTIVE(one)
- .type limit,@object
-limit: .double 0.29
- ASM_SIZE_DIRECTIVE(limit)
+ .type p3,@object
+p3: .byte 0, 0, 0, 0, 0, 0, 0x20, 0x40
+ ASM_SIZE_DIRECTIVE(p3)
.type p63,@object
p63: .byte 0, 0, 0, 0, 0, 0, 0xe0, 0x43
ASM_SIZE_DIRECTIVE(p63)
@@ -141,7 +141,15 @@ ENTRY(__ieee754_powl)
fchs // -0x1p-79 : x
jmp 3f
-9: /* OK, we have an integer value for y. */
+9: /* OK, we have an integer value for y. Unless very small
+ (we use < 8), use the algorithm for real exponent to avoid
+ accumulation of errors. */
+ fld %st // y : y : x
+ fabs // |y| : y : x
+ fcompl MO(p3) // y : x
+ fnstsw
+ sahf
+ jnc 2f
popl %eax
cfi_adjust_cfa_offset (-4)
popl %edx
@@ -182,7 +190,7 @@ ENTRY(__ieee754_powl)
cfi_adjust_cfa_offset (8)
.align ALIGNARG(4)
-2: // y is a large integer (absolute value at least 1L<<63), but
+2: // y is a large integer (absolute value at least 8), but
// may be odd unless at least 1L<<64. So it may be necessary
// to adjust the sign of a negative result afterwards.
fxch // x : y
@@ -205,34 +213,21 @@ ENTRY(__ieee754_powl)
fchs // -(1L<<78) : |x|
.align ALIGNARG(4)
3: /* y is a real number. */
- fxch // x : y
- fldl MO(one) // 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
- sahf
- ja 7f
- fsub %st(1) // x-1 : 1.0 : y
- fyl2xp1 // log2(x) : y
- jmp 8f
-
-7: fyl2x // log2(x) : y
-8: fmul %st(1) // y*log2(x) : y
- fst %st(1) // y*log2(x) : y*log2(x)
- frndint // int(y*log2(x)) : y*log2(x)
- fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x))
- fxch // fract(y*log2(x)) : int(y*log2(x))
- f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x))
- faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x))
- fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
- fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x))
+ subl $28, %esp
+ cfi_adjust_cfa_offset (28)
+ fstpt 12(%esp) // x
+ fstpt (%esp) // <empty>
+ mov %edx, 24(%esp)
+ call HIDDEN_JUMPTARGET (__powl_helper) // <result>
+ mov 24(%esp), %edx
+ addl $28, %esp
+ cfi_adjust_cfa_offset (-28)
testb $2, %dh
jz 292f
// x is negative. If y is an odd integer, negate the result.
+#ifdef PIC
+ LOAD_PIC_REG (cx)
+#endif
fldt 24(%esp) // y : abs(result)
fld %st // y : y : abs(result)
fabs // |y| : y : abs(result)
diff --git a/libc/sysdeps/i386/fpu/libm-test-ulps b/libc/sysdeps/i386/fpu/libm-test-ulps
index 239da44a7..5b595bc56 100644
--- a/libc/sysdeps/i386/fpu/libm-test-ulps
+++ b/libc/sysdeps/i386/fpu/libm-test-ulps
@@ -1339,6 +1339,9 @@ idouble: 1
ifloat: 1
# cos
+Test "cos (0x1p+50) == 8.68095904660550604334592502063501320395739e-01":
+float: 1
+ifloat: 1
Test "cos (M_PI_6l * 2.0) == 0.5":
double: 1
float: 1
@@ -1817,10 +1820,10 @@ ldouble: 1
# ctan
Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
-float: 1
-ifloat: 1
double: 1
+float: 1
idouble: 1
+ifloat: 1
ildouble: 1
ldouble: 1
Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
@@ -2477,6 +2480,11 @@ ifloat: 1
ildouble: 1
ldouble: 1
+# pow
+Test "pow (0x0.ffffffp0, -0x1p24) == 2.7182819094701610539628664526874952929416":
+ildouble: 1
+ldouble: 1
+
# pow_downward
Test "pow_downward (1.0625, 1.125) == 1.070582293028761362162622578677070098674":
double: 1
@@ -2683,6 +2691,9 @@ Test "sincos (0x1.fffff8p+127, &sin_res, &cos_res) puts 4.8578606313048733970111
float: 1
Test "sincos (0x1p+127, &sin_res, &cos_res) puts 6.23385512955870240370428801097126489001833e-01 in sin_res":
float: 1
+Test "sincos (0x1p+50, &sin_res, &cos_res) puts 8.68095904660550604334592502063501320395739e-01 in cos_res":
+float: 1
+ifloat: 1
Test "sincos (0x1p65, &sin_res, &cos_res) puts -0.047183876212354673805106149805700013943218 in sin_res":
float: 1
ifloat: 1
@@ -3015,6 +3026,28 @@ ldouble: 1
Test "y0 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127":
double: 1
idouble: 1
+Test "y0 (0x1p-10) == -4.4865150767109739412411806297168793661098":
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-30) == -1.3311940304267782826037118027401817264906e+1":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "y0 (0x1p-40) == -1.7724652307320814696990854700366226762563e+1":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "y0 (0x1p-60) == -2.6550076313426878432849115782108205929120e+1":
+double: 1
+idouble: 1
+Test "y0 (0x1p-70) == -3.0962788316479910300778244424468159753887e+1":
+double: 1
+idouble: 1
+Test "y0 (0x1p-80) == -3.5375500319532942168707373066828113573541e+1":
+double: 1
+idouble: 1
Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
double: 2
float: 1
@@ -3056,6 +3089,9 @@ idouble: 1
ifloat: 2
ildouble: 1
ldouble: 1
+Test "y1 (0x1p-10) == -6.5190099301063115047395187618929589514382e+02":
+float: 1
+ifloat: 1
Test "y1 (1.0) == -0.781212821300288716547150000047964821":
double: 1
idouble: 1
@@ -3562,10 +3598,10 @@ ildouble: 1
ldouble: 1
Function: Real part of "ctan_towardzero":
-float: 1
-ifloat: 1
double: 1
+float: 1
idouble: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -3636,10 +3672,10 @@ ildouble: 4
ldouble: 4
Function: Imaginary part of "ctanh_towardzero":
-float: 1
-ifloat: 1
double: 1
+float: 1
idouble: 1
+ifloat: 1
ildouble: 1
ldouble: 1
@@ -3751,6 +3787,10 @@ ifloat: 1
ildouble: 1
ldouble: 1
+Function: "pow":
+ildouble: 1
+ldouble: 1
+
Function: "pow_downward":
double: 1
float: 1