Print this page
5261 libm should stop using synonyms.h
5298 fabs is 0-sized, confuses dis(1) and others
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Gordon Ross <gwr@nexenta.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/i386/src/nextafter.s
+++ new/usr/src/lib/libm/i386/src/nextafter.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.
23 23 */
24 24 /*
25 25 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
↓ open down ↓ |
25 lines elided |
↑ open up ↑ |
26 26 * Use is subject to license terms.
27 27 */
28 28
29 29 .file "nextafter.s"
30 30
31 31 #include "libm.h"
32 32 LIBM_ANSI_PRAGMA_WEAK(nextafter,function)
33 33 .weak _nextafter
34 34 .type _nextafter,@function
35 35 _nextafter = __nextafter
36 -#include "libm_synonyms.h"
37 36 #include "libm_protos.h"
38 37
39 38 .data
40 39 .align 8
41 40 Fmin: .long 0x1,0x0
42 41 ftmp: .long 0,0 /// WILL WRITE INTO
43 42
44 43
45 44 ENTRY(nextafter)
46 45 pushl %ebp
47 46 movl %esp,%ebp
48 47 fldl 16(%ebp) / y
49 48 subl $8,%esp
50 49 fldl 8(%ebp) / load x
51 50 fucom / x : y
52 51 fstsw %ax
53 52 sahf
54 53 jp .NaN
55 54 je .equal
56 55 fstp %st(1) / x
57 56 ja .bigger
58 57 / x < y
59 58 ftst
60 59 movl $1,%ecx /// Fmin
61 60 movl %ecx,-8(%ebp)
62 61 movl $0,%ecx /// Fmin+4
63 62 movl %ecx,-4(%ebp)
64 63 fnstsw %ax
65 64 sahf
66 65 je .final
67 66 ja .addulp
68 67 jb .subulp
69 68 .bigger:
70 69 / x > y
71 70 ftst
72 71 movl $1,%ecx /// Fmin
73 72 movl %ecx,-8(%ebp)
74 73 movl $0,%ecx /// Fmin+4
75 74 xorl $0x80000000,%ecx
76 75 movl %ecx,-4(%ebp)
77 76 fnstsw %ax
78 77 sahf
79 78 je .final
80 79 jb .addulp
81 80 .subulp:
82 81 movl 8(%ebp),%eax / low x
83 82 movl 12(%ebp),%ecx / high x
84 83 subl $1,%eax / low x - ulp
85 84 movl %eax,-8(%ebp)
86 85 sbbl $0x0,%ecx
87 86 movl %ecx,-4(%ebp)
88 87 jmp .final
89 88 .addulp:
90 89 movl 8(%ebp),%eax / low x
91 90 movl 12(%ebp),%ecx / high x
92 91 addl $1,%eax / low x + ulp
93 92 movl %eax,-8(%ebp)
94 93 adcl $0x0,%ecx
95 94 movl %ecx,-4(%ebp)
96 95
97 96 .final:
98 97 fstp %st(0)
99 98 fldl -8(%ebp)
100 99 andl $0x7ff00000,%ecx
101 100 jz .underflow
102 101 cmpl $0x7ff00000,%ecx
103 102 je .overflow
104 103 jmp .return
105 104 .overflow:
106 105 PIC_SETUP(1)
107 106 pushl $46
108 107 fstp %st(0) / stack empty
109 108 pushl -4(%ebp)
110 109 pushl -8(%ebp)
111 110 pushl -4(%ebp)
112 111 pushl -8(%ebp)
113 112 call PIC_F(_SVID_libm_err)
114 113 addl $20,%esp
115 114 PIC_WRAPUP
116 115 jmp .return
117 116 .underflow:
118 117 PIC_SETUP(2)
119 118 fldl PIC_L(Fmin)
120 119 fmul %st(0),%st
121 120 fstpl PIC_L(ftmp) / create underflow signal
122 121 PIC_WRAPUP
123 122 jmp .return
124 123 .equal:
125 124 fstp %st(0) / C99 says to return y when x == y
126 125 jmp .return
127 126 .NaN:
128 127 faddp %st,%st(1) / x+y,x
129 128 .return:
130 129 fwait
131 130 leave
132 131 ret
133 132 .align 4
134 133 SET_SIZE(nextafter)
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX