Print this page
5261 libm should stop using synonyms.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/i386/src/exp10.s
+++ new/usr/src/lib/libm/i386/src/exp10.s
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
22 22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
23 23 */
24 24 /*
25 25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 27 */
28 28
29 29 .file "exp10.s"
30 30
31 31 #include "libm.h"
32 -LIBM_ANSI_PRAGMA_WEAK(exp10,function)
33 -#include "libm_synonyms.h"
34 32
35 33 ENTRY(exp10)
36 34 movl 8(%esp),%ecx / ecx <-- hi_32(x)
37 35 andl $0x7fffffff,%ecx / ecx <-- hi_32(|x|)
38 36 cmpl $0x3fd34413,%ecx / Is |x| < log10(2)?
39 37 jb .shortcut / If so, take a shortcut.
40 38 je .check_tail / maybe |x| only slightly < log10(2)
41 39 cmpl $0x7ff00000,%ecx / hi_32(|x|) >= hi_32(INF)?
42 40 jae .not_finite / if so, x is not finite
43 41 .finite_non_special: / Here, log10(2) < |x| < INF
44 42 fldl 4(%esp) / push x (=arg)
45 43
46 44 subl $8,%esp / save RP and set round-to-64-bits
47 45 fstcw (%esp)
48 46 movw (%esp),%ax
49 47 movw %ax,4(%esp)
50 48 orw $0x0300,%ax
51 49 movw %ax,(%esp)
52 50 fldcw (%esp)
53 51
54 52 fldl2t / push log2(10) }NOT for xtndd_dbl
55 53 fmulp %st,%st(1) / z = x*log2(10) }NOT for xtndd_dbl
56 54 fld %st(0) / duplicate stack top
57 55 frndint / [z],z
58 56 fucom / z integral?
59 57 fstsw %ax
60 58 sahf
61 59 je .z_integral / branch if z integral
62 60 fxch / z, [z]
63 61 fsub %st(1),%st / z-[z], [z]
64 62 f2xm1 / 2**(z-[z])-1, [z]
65 63 fld1 / 1,2**(z-[z])-1, [z]
66 64 faddp %st,%st(1) / 2**(z-[z]), [z]
67 65 fscale / 2**z = 10**(arg), [z]
68 66 fstp %st(1)
69 67
70 68 fstcw (%esp) / restore old RP
71 69 movw (%esp),%dx
72 70 andw $0xfcff,%dx
73 71 movw 4(%esp),%cx
74 72 andw $0x0300,%cx
75 73 orw %dx,%cx
76 74 movw %cx,(%esp)
77 75 fldcw (%esp)
78 76 add $8,%esp
79 77
80 78 ret
81 79
82 80 .z_integral: / here, z is integral
83 81 fstp %st(0) / ,z
84 82 fld1 / 1 = 2**0, z
85 83 fscale / 2**(0 + z) = 2**z = 10**(arg), z
86 84 fstp %st(1) / 10**(arg)
87 85
88 86 fstcw (%esp) / restore old RP
89 87 movw (%esp),%dx
90 88 andw $0xfcff,%dx
91 89 movw 4(%esp),%cx
92 90 andw $0x0300,%cx
93 91 orw %dx,%cx
94 92 movw %cx,(%esp)
95 93 fldcw (%esp)
96 94 add $8,%esp
97 95
98 96 ret
99 97
100 98 .check_tail:
101 99 movl 4(%esp),%edx / edx <-- lo_32(x)
102 100 cmpl $0x509f79fe,%edx / Is |x| slightly > log10(2)?
103 101 ja .finite_non_special / branch if |x| slightly > log10(2)
104 102 .shortcut:
105 103 / Here, |x| < log10(2), so |z| = |x*log2(10)| < 1
106 104 / whence z is in f2xm1's domain.
107 105 fldl 4(%esp) / push x (=arg)
108 106 fldl2t / push log2(10) }NOT for xtndd_dbl
109 107 fmulp %st,%st(1) / z = x*log2(10) }NOT for xtndd_dbl
110 108 f2xm1 / 2**z - 1
111 109 fld1 / 1,2**z - 1
112 110 faddp %st,%st(1) / 2**z = 10**x
113 111 ret
114 112
115 113 .not_finite:
116 114 cmpl $0x7ff00000,%ecx / hi_32(|x|) > hi_32(INF)?
117 115 ja .NaN_or_pinf / if so, x is NaN
118 116 movl 4(%esp),%edx / edx <-- lo_32(x)
119 117 cmpl $0,%edx / lo_32(x) = 0?
120 118 jne .NaN_or_pinf / if not, x is NaN
121 119 movl 8(%esp),%eax / eax <-- hi_32(x)
122 120 andl $0x80000000,%eax / here, x is infinite, but +/-?
123 121 jz .NaN_or_pinf / branch if x = +INF
124 122 fldz / Here, x = -inf, so return 0
125 123 ret
126 124
127 125 .NaN_or_pinf:
128 126 / Here, x = NaN or +inf, so load x and return immediately.
129 127 fldl 4(%esp)
130 128 fwait
131 129 ret
132 130 .align 4
133 131 SET_SIZE(exp10)
↓ open down ↓ |
90 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX