Print this page
5261 libm should stop using synonyms.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libm/i386/src/hypot.s
+++ new/usr/src/lib/libm/i386/src/hypot.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 "hypot.s"
30 30
31 31 #include "libm.h"
32 32 LIBM_ANSI_PRAGMA_WEAK(hypot,function)
33 -#include "libm_synonyms.h"
34 33 #include "libm_protos.h"
35 34
36 35 #undef fabs
37 36
38 37 .data
39 38 .align 4
40 39 inf:
41 40 .long 0x7f800000
42 41
43 42 ENTRY(hypot)
44 43 movl 8(%esp),%eax / eax <-- hi_32(x)
45 44 andl $0x7fffffff,%eax / eax <-- hi_32(|x|)
46 45 jz .x_maybe_0 / if x = +/-0, return |y|
47 46 subl $0x7ff00000,%eax / eax <-- hi_32(|x|) - hi_32(INF)
48 47 jz .x_maybe_inf
49 48 .check_y:
50 49 movl 16(%esp),%eax / eax <-- hi_32(y)
51 50 andl $0x7fffffff,%eax / eax <-- hi_32(|y|)
52 51 jz .y_maybe_0 / if y = +/-0, return |x|
53 52 subl $0x7ff00000,%eax / eax <-- hi_32(|y|) - hi_32(INF)
54 53 jz .y_maybe_inf
55 54 .do_hypot:
56 55 fldl 12(%esp) / ,y
57 56 fmul %st(0),%st / ,y*y
58 57 fldl 4(%esp) / x,y*y
59 58 fmul %st(0),%st / x*x,y*y
60 59 faddp %st,%st(1) / x*x+y*y
61 60 fsqrt / sqrt(x*x+y*y)
62 61 subl $8,%esp
63 62 fstpl (%esp) / round to double
64 63 fldl (%esp) / sqrt(x*x+y*y) rounded to double
65 64 PIC_SETUP(1)
66 65 flds PIC_L(inf) / inf , sqrt(x*x+y*y)
67 66 PIC_WRAPUP
68 67 addl $8,%esp
69 68 fucomp
70 69 fstsw %ax / store status in %ax
71 70 sahf / 80387 flags in %ah to 80386 flags
72 71 jz .maybe_ovflw
73 72 ret
74 73
75 74 .maybe_ovflw:
76 75 jnp .ovflw
77 76 ret
78 77
79 78 .ovflw:
80 79 / overflow occurred
81 80 fstp %st(0) / stack empty
82 81 pushl %ebp
83 82 movl %esp,%ebp
84 83 PIC_SETUP(2)
85 84 pushl $4
86 85 pushl 20(%ebp) / high y
87 86 pushl 16(%ebp) / low y
88 87 pushl 12(%ebp) / high x
89 88 pushl 8(%ebp) / low x
90 89 call PIC_F(_SVID_libm_err)
91 90 addl $20,%esp
92 91 PIC_WRAPUP
93 92 leave
94 93 ret
95 94
96 95 .x_maybe_0:
97 96 movl 4(%esp),%ecx / ecx <-- lo_32(x)
98 97 orl %ecx,%eax / is x = +/-0?
99 98 jnz .check_y / branch if x is denormal
100 99 / x = +/-0, so return |y|
101 100 fldl 12(%esp)
102 101 fabs
103 102 ret
104 103
105 104 .x_maybe_inf:
106 105 movl 4(%esp),%ecx / ecx <-- lo_32(x)
107 106 orl %ecx,%eax / is x = +/-INF?
108 107 jnz .check_y / branch if x is NaN
109 108 / push&pop y in case y is a SNaN
110 109 fldl 12(%esp)
111 110 fstp %st(0)
112 111 / x = +/-INF, so return |x|
113 112 fldl 4(%esp)
114 113 fabs
115 114 ret
116 115
117 116 .y_maybe_0:
118 117 movl 12(%esp),%ecx / ecx <-- lo_32(y)
119 118 orl %ecx,%eax / is y = +/-0?
120 119 jnz .do_hypot / branch if y is denormal
121 120 / y = +/-0, so return |x|
122 121 fldl 4(%esp)
123 122 fabs
124 123 ret
125 124
126 125 .y_maybe_inf:
127 126 movl 12(%esp),%ecx / ecx <-- lo_32(y)
128 127 orl %ecx,%eax / is y = +/-INF?
129 128 jnz .do_hypot / branch if y is NaN
130 129 / push&pop x in case x is a SNaN
131 130 fldl 4(%esp)
132 131 fstp %st(0)
133 132 / y = +/-INF, so return |y|
134 133 fldl 12(%esp)
135 134 fabs
136 135 ret
137 136 .align 4
138 137 SET_SIZE(hypot)
↓ open down ↓ |
95 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX