Print this page
5261 libm should stop using synonyms.h
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/libmvec/common/__vhypotf.c
+++ new/usr/src/lib/libmvec/common/__vhypotf.c
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
↓ open down ↓ |
19 lines elided |
↑ open up ↑ |
20 20 */
21 21
22 22 /*
23 23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
24 24 */
25 25 /*
26 26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 27 * Use is subject to license terms.
28 28 */
29 29
30 -#include "libm_synonyms.h"
31 30 #include "libm_inlines.h"
32 31
33 32 #ifdef __RESTRICT
34 33 #define restrict _Restrict
35 34 #else
36 35 #define restrict
37 36 #endif
38 37
39 -#define sqrt __sqrt
40 -
41 38 extern double sqrt(double);
42 39
43 40 void
44 41 __vhypotf(int n, float * restrict x, int stridex, float * restrict y,
45 42 int stridey, float * restrict z, int stridez)
46 43 {
47 44 float x0, x1, x2, y0, y1, y2, z0, z1, z2, *pz0, *pz1, *pz2;
48 45 unsigned hx0, hx1, hx2, hy0, hy1, hy2;
49 46 int i, j0, j1, j2;
50 47
51 48 do
52 49 {
53 50 LOOP0:
54 51 hx0 = *(unsigned*)x & ~0x80000000;
55 52 hy0 = *(unsigned*)y & ~0x80000000;
56 53 *(unsigned*)&x0 = hx0;
57 54 *(unsigned*)&y0 = hy0;
58 55 if (hy0 > hx0)
59 56 {
60 57 i = hy0 - hx0;
61 58 j0 = hy0 & 0x7f800000;
62 59 if (hx0 == 0)
63 60 i = 0x7f800000;
64 61 }
65 62 else
66 63 {
67 64 i = hx0 - hy0;
68 65 j0 = hx0 & 0x7f800000;
69 66 if (hy0 == 0)
70 67 i = 0x7f800000;
71 68 else if (hx0 == 0)
72 69 i = 0x7f800000;
73 70 }
74 71 if (i >= 0x0c800000 || j0 >= 0x7f800000)
75 72 {
76 73 z0 = x0 + y0;
77 74 if (hx0 == 0x7f800000)
78 75 z0 = x0;
79 76 else if (hy0 == 0x7f800000)
80 77 z0 = y0;
81 78 else if (hx0 > 0x7f800000 || hy0 > 0x7f800000)
82 79 z0 = *x + *y;
83 80 *z = z0;
84 81 x += stridex;
85 82 y += stridey;
86 83 z += stridez;
87 84 i = 0;
88 85 if (--n <= 0)
89 86 break;
90 87 goto LOOP0;
91 88 }
92 89 pz0 = z;
93 90 x += stridex;
94 91 y += stridey;
95 92 z += stridez;
96 93 i = 1;
97 94 if (--n <= 0)
98 95 break;
99 96
100 97 LOOP1:
101 98 hx1 = *(unsigned*)x & ~0x80000000;
102 99 hy1 = *(unsigned*)y & ~0x80000000;
103 100 *(unsigned*)&x1 = hx1;
104 101 *(unsigned*)&y1 = hy1;
105 102 if (hy1 > hx1)
106 103 {
107 104 i = hy1 - hx1;
108 105 j1 = hy1 & 0x7f800000;
109 106 if (hx1 == 0)
110 107 i = 0x7f800000;
111 108 }
112 109 else
113 110 {
114 111 i = hx1 - hy1;
115 112 j1 = hx1 & 0x7f800000;
116 113 if (hy1 == 0)
117 114 i = 0x7f800000;
118 115 else if (hx1 == 0)
119 116 i = 0x7f800000;
120 117 }
121 118 if (i >= 0x0c800000 || j1 >= 0x7f800000)
122 119 {
123 120 z1 = x1 + y1;
124 121 if (hx1 == 0x7f800000)
125 122 z1 = x1;
126 123 else if (hy1 == 0x7f800000)
127 124 z1 = y1;
128 125 else if (hx1 > 0x7f800000 || hy1 > 0x7f800000)
129 126 z1 = *x + *y;
130 127 *z = z1;
131 128 x += stridex;
132 129 y += stridey;
133 130 z += stridez;
134 131 i = 1;
135 132 if (--n <= 0)
136 133 break;
137 134 goto LOOP1;
138 135 }
139 136 pz1 = z;
140 137 x += stridex;
141 138 y += stridey;
142 139 z += stridez;
143 140 i = 2;
144 141 if (--n <= 0)
145 142 break;
146 143
147 144 LOOP2:
148 145 hx2 = *(unsigned*)x & ~0x80000000;
149 146 hy2 = *(unsigned*)y & ~0x80000000;
150 147 *(unsigned*)&x2 = hx2;
151 148 *(unsigned*)&y2 = hy2;
152 149 if (hy2 > hx2)
153 150 {
154 151 i = hy2 - hx2;
155 152 j2 = hy2 & 0x7f800000;
156 153 if (hx2 == 0)
157 154 i = 0x7f800000;
158 155 }
159 156 else
160 157 {
161 158 i = hx2 - hy2;
162 159 j2 = hx2 & 0x7f800000;
163 160 if (hy2 == 0)
164 161 i = 0x7f800000;
165 162 else if (hx2 == 0)
166 163 i = 0x7f800000;
167 164 }
168 165 if (i >= 0x0c800000 || j2 >= 0x7f800000)
169 166 {
170 167 z2 = x2 + y2;
171 168 if (hx2 == 0x7f800000)
172 169 z2 = x2;
173 170 else if (hy2 == 0x7f800000)
174 171 z2 = y2;
175 172 else if (hx2 > 0x7f800000 || hy2 > 0x7f800000)
176 173 z2 = *x + *y;
177 174 *z = z2;
178 175 x += stridex;
179 176 y += stridey;
180 177 z += stridez;
181 178 i = 2;
182 179 if (--n <= 0)
183 180 break;
184 181 goto LOOP2;
185 182 }
186 183 pz2 = z;
187 184
188 185 z0 = sqrt(x0 * (double)x0 + y0 * (double)y0);
189 186 z1 = sqrt(x1 * (double)x1 + y1 * (double)y1);
190 187 z2 = sqrt(x2 * (double)x2 + y2 * (double)y2);
191 188 *pz0 = z0;
192 189 *pz1 = z1;
193 190 *pz2 = z2;
194 191
195 192 x += stridex;
196 193 y += stridey;
197 194 z += stridez;
198 195 i = 0;
199 196 } while (--n > 0);
200 197
201 198 if (i > 0)
202 199 {
203 200 if (i > 1)
204 201 {
205 202 z1 = sqrt(x1 * (double)x1 + y1 * (double)y1);
206 203 *pz1 = z1;
207 204 }
208 205 z0 = sqrt(x0 * (double)x0 + y0 * (double)y0);
209 206 *pz0 = z0;
210 207 }
211 208 }
↓ open down ↓ |
161 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX