Print this page
5261 libm should stop using synonyms.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/amd64/src/exp10l.s
+++ new/usr/src/lib/libm/amd64/src/exp10l.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 "exp10l.s"
30 30
31 31 #include "libm.h"
32 -LIBM_ANSI_PRAGMA_WEAK(exp10l,function)
33 -#include "libm_synonyms.h"
34 32
35 33 .data
36 34 .align 16
37 35 lt2_hi: .4byte 0xfbd00000, 0x9a209a84, 0x3ffd, 0x0
38 36 lt2_lo: .4byte 0x653f4837, 0x8677076a, 0xbfc9, 0x0
39 37
40 38 ENTRY(exp10l)
41 39 movl 16(%rsp),%ecx / cx <--sign&bexp(x)
42 40 andl $0x7fff,%ecx / ecx <-- zero_xtnd(bexp(x))
43 41 cmpl $0x3ffd,%ecx / Is |x| < log10(2)?
44 42 jb .shortcut / If so, take a shortcut.
45 43 je .check_tail / maybe |x| only slightly < log10(2)
46 44 .general_case: / Here, |x| > log10(2) or x is NaN
47 45 cmpl $0x7fff,%ecx / bexp(|x|) = bexp(INF)?
48 46 je .not_finite / if so, x is not finite
49 47 cmpl $0x400e,%ecx / |x| < 32768 = 2^15?
50 48 jb .finite_non_special / if so, proceed with argument reduction
51 49 fldt 8(%rsp) / x
52 50 fld1 / 1, x
53 51 jmp 1f
54 52 .finite_non_special: / Here, log10(2) < |x| < 2^15
55 53 fldt 8(%rsp) / x
56 54 fld %st(0) / x, x
57 55 fldl2t / log2(10), x, x
58 56 fmulp / z := x*log2(10), x
59 57 frndint / [z], x
60 58 fst %st(2) / [z], x, [z]
61 59 PIC_SETUP(1)
62 60 fldt PIC_L(lt2_hi) / lt2_hi, [z], x, [z]
63 61 fmulp / [z]*lt2_hi, x, [z]
64 62 fsubrp %st,%st(1) / x-[z]*lt2_hi, [z]
65 63 fldt PIC_L(lt2_lo) / lt2_lo, x-[z]*lt2_hi, [z]
66 64 PIC_WRAPUP
67 65 fmul %st(2),%st / [z]*lt2_lo, x-[z]*lt2_hi, [z]
68 66 fsubrp %st,%st(1) / r := x-[z]*log10(2), [z]
69 67 fldl2t / log2(10), r, [z]
70 68 fmulp / f := r*log2(10), [z]
71 69 f2xm1 / 2^f-1,[z]
72 70 fld1 / 1, 2^f-1, [z]
73 71 faddp %st,%st(1) / 2^f, [z]
74 72 1:
75 73 fscale / 10^x, [z]
76 74 fstp %st(1)
77 75 ret
78 76
79 77 .check_tail:
80 78 movl 12(%rsp),%ecx / ecx <-- hi_32(sgnfcnd(x))
81 79 cmpl $0x9a209a84,%ecx / Is |x| < log10(2)?
82 80 ja .finite_non_special
83 81 jb .shortcut
84 82 movl 8(%rsp),%edx / edx <-- lo_32(sgnfcnd(x))
85 83 cmpl $0xfbcff798,%edx / Is |x| slightly > log10(2)?
86 84 ja .finite_non_special / branch if |x| slightly > log10(2)
87 85 .shortcut:
88 86 / Here, |x| < log10(2), so |z| = |x/log10(2)| < 1
89 87 / whence z is in f2xm1's domain.
90 88 fldt 8(%rsp) / x
91 89 fldl2t / log2(10), x
92 90 fmulp / z := x*log2(10)
93 91 f2xm1 / 2^z-1
94 92 fld1 / 1, 2^z-1
95 93 faddp %st,%st(1) / 10^x
96 94 ret
97 95
98 96 .not_finite:
99 97 movl 12(%rsp),%ecx / ecx <-- hi_32(sgnfcnd(x))
100 98 cmpl $0x80000000,%ecx / hi_32(sgnfcnd(x)) = hi_32(sgnfcnd(INF))?
101 99 jne .NaN_or_pinf / if not, x is NaN or unsupp.
102 100 movl 8(%rsp),%edx / edx <-- lo_32(sgnfcnd(x))
103 101 cmpl $0,%edx / lo_32(sgnfcnd(x)) = 0?
104 102 jne .NaN_or_pinf / if not, x is NaN
105 103 movl 16(%rsp),%eax / ax <-- sign&bexp((x))
106 104 andl $0x8000,%eax / here, x is infinite, but +/-?
107 105 jz .NaN_or_pinf / branch if x = +INF
108 106 fldz / Here, x = -inf, so return 0
109 107 ret
110 108
111 109 .NaN_or_pinf:
112 110 / Here, x = NaN or +inf, so load x and return immediately.
113 111 fldt 8(%rsp)
114 112 ret
115 113 .align 16
116 114 SET_SIZE(exp10l)
↓ open down ↓ |
73 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX