Print this page
5261 libm should stop using synonyms.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/i386/src/nexttowardl.s
+++ new/usr/src/lib/libm/i386/src/nexttowardl.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 /*
22 22 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
23 23 */
24 24 /*
25 25 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 27 */
28 28
29 29 .file "nexttowardl.s"
30 30
31 31 #include "libm.h"
32 32 LIBM_ANSI_PRAGMA_WEAK(nexttowardl,function)
33 -#include "libm_synonyms.h"
34 33
35 34 .section .rodata
36 35 .align 4
37 36 .LFmaxl: .long 0xffffffff,0xffffffff,0x00007ffe
38 37 .LFminl: .long 0x1,0x0,0x0
39 38
40 39
41 40 ENTRY(nexttowardl)
42 41 pushl %ebp
43 42 movl %esp,%ebp
44 43 fldt 20(%ebp) / y
45 44 subl $12,%esp
46 45 fldt 8(%ebp) / load x
47 46 fucom / x : y
48 47 fstsw %ax
49 48 sahf
50 49 jp .LNaN
51 50 je .Lequal
52 51 fstp %st(1) / x
53 52 ja .Lbigger
54 53 / x < y
55 54 ftst
56 55 movl $1,-12(%ebp) /// -12(%ebp) contains Fminl
57 56 movl $0,-8(%ebp)
58 57 movl $0,%ecx /// final needs this
59 58 movl %ecx,-4(%ebp)
60 59 fnstsw %ax
61 60 sahf
62 61 je .Lfinal
63 62 ja .Laddulp
64 63 jb .Lsubulp
65 64 .Lbigger:
66 65 / x > y
67 66 ftst
68 67 movl $1,-12(%ebp) /// -12(%ebp) contains -Fminl
69 68 movl $0,-8(%ebp)
70 69 movl $0x00008000,%ecx /// final needs this
71 70 movl %ecx,-4(%ebp)
72 71 fnstsw %ax
73 72 sahf
74 73 je .Lfinal
75 74 jb .Laddulp
76 75 .Lsubulp:
77 76 movl 12(%ebp),%edx / high word of significand of x
78 77 movl 16(%ebp),%ecx / x's exponent
79 78 andl $0x0000ffff,%ecx
80 79 movl %edx,%eax
81 80 not %eax
82 81 andl $0x80000000,%eax / look at explicit leading bit
83 82 orl %ecx,%eax
84 83 andl $0x80007fff,%eax
85 84 jnz .Lnot_pseudonormal / zero value implies pseudonormal
86 85 addl $1,%ecx / if pseudonormal, turn into equivalent normal
87 86 .Lnot_pseudonormal:
88 87 movl 8(%ebp),%eax / low x
89 88 subl $1,%eax / low x - ulp
90 89 movl %eax,-12(%ebp)
91 90 cmpl $0xffffffff,%eax / this means low x was 0
92 91 jz .Lborrow
93 92 movl %edx,-8(%ebp)
94 93 movl %ecx,-4(%ebp)
95 94 jmp .Lfinal
96 95 .Lborrow:
97 96 cmpl $0x80000000,%edx / look at high x
98 97 je .Lsecond_borrow
99 98 subl $1,%edx
100 99 movl %edx,-8(%ebp)
101 100 movl %ecx,-4(%ebp)
102 101 jmp .Lfinal
103 102 .Lsecond_borrow:
104 103 movl %ecx,%eax
105 104 andl $0x7fff,%eax / look at exp x without sign bit
106 105 cmpl $1,%eax
107 106 jbe .Lsubnormal_result / exp > 1 ==> result will be normal
108 107 movl $0xffffffff,-8(%ebp)
109 108 subl $1,%ecx
110 109 movl %ecx,-4(%ebp)
111 110 jmp .Lfinal
112 111 .Lsubnormal_result:
113 112 movl $0x7fffffff,-8(%ebp)
114 113 movl %ecx,%eax
115 114 andl $0x8000,%eax / look at sign bit
116 115 jz .Lpositive
117 116 movl $0x8000,%ecx
118 117 movl %ecx,-4(%ebp)
119 118 jmp .Lfinal
120 119 .Lpositive:
121 120 movl $0,%ecx
122 121 movl %ecx,-4(%ebp)
123 122 jmp .Lfinal
124 123 .Laddulp:
125 124 movl 12(%ebp),%edx / high x
126 125 movl 16(%ebp),%ecx / x's exponent
127 126 andl $0x0000ffff,%ecx
128 127 movl %edx,%eax
129 128 not %eax
130 129 andl $0x80000000,%eax / look at explicit leading bit
131 130 orl %ecx,%eax
132 131 andl $0x80007fff,%eax
133 132 jnz .Lnot_pseudonormal_2 / zero value implies pseudonormal
134 133 addl $1,%ecx
135 134 .Lnot_pseudonormal_2:
136 135 movl 8(%ebp),%eax / low x
137 136 addl $1,%eax / low x + ulp
138 137 movl %eax,-12(%ebp)
139 138 jz .Lcarry / jump if the content of %eax is 0
140 139 movl %edx,-8(%ebp)
141 140 movl %ecx,-4(%ebp)
142 141 jmp .Lfinal
143 142 .Lcarry:
144 143 movl %edx,%eax
145 144 andl $0x7fffffff,%eax
146 145 cmpl $0x7fffffff,%eax / look at high x
147 146 je .Lsecond_carry
148 147 addl $1,%edx
149 148 movl %edx,-8(%ebp)
150 149 movl %ecx,-4(%ebp)
151 150 jmp .Lfinal
152 151 .Lsecond_carry:
153 152 movl $0x80000000,-8(%ebp)
154 153 addl $1,%ecx
155 154 movl %ecx,-4(%ebp)
156 155 .Lfinal:
157 156 fstp %st(0)
158 157 fldt -12(%ebp)
159 158 andl $0x00007fff,%ecx
160 159 jz .Lunderflow
161 160 cmpw $0x7fff,%cx
162 161 je .Loverflow
163 162 jmp .Lreturn
164 163 .Loverflow:
165 164 PIC_SETUP(1)
166 165 fldt PIC_L(.LFmaxl)
167 166 PIC_WRAPUP
168 167 fmulp %st,%st(0) / create overflow signal
169 168 jmp .Lreturn
170 169 .Lunderflow:
171 170 PIC_SETUP(2)
172 171 fldt PIC_L(.LFminl)
173 172 PIC_WRAPUP
174 173 fmulp %st,%st(0) / create underflow signal
175 174 jmp .Lreturn
176 175 .Lequal:
177 176 fstp %st(0) / C99 says to return y when x == y
178 177 jmp .Lreturn
179 178 .LNaN:
180 179 faddp %st,%st(1) / x+y,x
181 180 .Lreturn:
182 181 fwait
183 182 leave
184 183 ret
185 184 .align 4
186 185 SET_SIZE(nexttowardl)
↓ open down ↓ |
143 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX