Print this page
5261 libm should stop using synonyms.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/i386/src/exp10f.s
+++ new/usr/src/lib/libm/i386/src/exp10f.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 "exp10f.s"
30 30
31 31 #include "libm.h"
32 -LIBM_ANSI_PRAGMA_WEAK(exp10f,function)
33 -#include "libm_synonyms.h"
34 32
35 33 ENTRY(exp10f)
36 34 movl 4(%esp),%ecx / ecx <-- x
37 35 andl $0x7fffffff,%ecx / ecx <-- |x|
38 36 cmpl $0x3e9a209a,%ecx / Is |x| < log10(2)?
39 37 jbe .shortcut / If so, take a shortcut.
40 38 cmpl $0x7f800000,%ecx / |x| >= INF?
41 39 jae .not_finite / if so, x is not finite
42 40 flds 4(%esp) / push x (=arg)
43 41
44 42 subl $8,%esp / save RP and set round-to-64-bits
45 43 fstcw (%esp)
46 44 movw (%esp),%ax
47 45 movw %ax,4(%esp)
48 46 orw $0x0300,%ax
49 47 movw %ax,(%esp)
50 48 fldcw (%esp)
51 49
52 50 fldl2t / push log2(10) }NOT for xtndd_dbl
53 51 fmulp %st,%st(1) / z = x*log2(10) }NOT for xtndd_dbl
54 52 fld %st(0) / duplicate stack top
55 53 frndint / [z],z
56 54 fucom / z integral?
57 55 fstsw %ax
58 56 sahf
59 57 je .z_integral / branch if z integral
60 58 fxch / z, [z]
61 59 fsub %st(1),%st / z-[z], [z]
62 60 f2xm1 / 2**(z-[z])-1, [z]
63 61 fld1 / 1,2**(z-[z])-1, [z]
64 62 faddp %st,%st(1) / 2**(z-[z]), [z]
65 63 fscale / 2**z = 10**(arg), [z]
66 64 fstp %st(1)
67 65
68 66 fstcw (%esp) / restore old RP
69 67 movw (%esp),%dx
70 68 andw $0xfcff,%dx
71 69 movw 4(%esp),%cx
72 70 andw $0x0300,%cx
73 71 orw %dx,%cx
74 72 movw %cx,(%esp)
75 73 fldcw (%esp)
76 74 add $8,%esp
77 75
78 76 ret
79 77
80 78 .z_integral: / here, z is integral
81 79 fstp %st(0) / ,z
82 80 fld1 / 1 = 2**0, z
83 81 fscale / 2**(0 + z) = 2**z = 10**(arg), z
84 82 fstp %st(1) / 10**(arg)
85 83
86 84 fstcw (%esp) / restore old RP
87 85 movw (%esp),%dx
88 86 andw $0xfcff,%dx
89 87 movw 4(%esp),%cx
90 88 andw $0x0300,%cx
91 89 orw %dx,%cx
92 90 movw %cx,(%esp)
93 91 fldcw (%esp)
94 92 add $8,%esp
95 93
96 94 ret
97 95
98 96 .shortcut:
99 97 / Here, |x| < log10(2), so |z| = |x*log2(10)| < 1
100 98 / whence z is in f2xm1's domain.
101 99 flds 4(%esp) / push x (=arg)
102 100 fldl2t / push log2(10) }NOT for xtndd_dbl
103 101 fmulp %st,%st(1) / z = x*log2(10) }NOT for xtndd_dbl
104 102 f2xm1 / 2**z - 1
105 103 fld1 / 1,2**z - 1
106 104 faddp %st,%st(1) / 2**z = 10**x
107 105 ret
108 106
109 107 .not_finite:
110 108 ja .NaN_or_pinf / branch if x is NaN
111 109 movl 4(%esp),%eax / eax <-- x
112 110 andl $0x80000000,%eax / here, x is infinite, but +/-?
113 111 jz .NaN_or_pinf / branch if x = +INF
114 112 fldz / Here, x = -inf, so return 0
115 113 ret
116 114
117 115 .NaN_or_pinf:
118 116 / Here, x = NaN or +inf, so load x and return immediately.
119 117 flds 4(%esp)
120 118 fwait
121 119 ret
122 120 .align 4
123 121 SET_SIZE(exp10f)
↓ open down ↓ |
80 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX