4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
27 * Use is subject to license terms.
30 #include "libm_inlines.h"
33 #define restrict _Restrict
38 extern double sqrt(double);
41 * Instead of type punning, use union type.
49 __vhypotf(int n
, float *restrict x
, int stridex
, float *restrict y
,
50 int stridey
, float *restrict z
, int stridez
)
52 float x0
, x1
, x2
, y0
, y1
, y2
, z0
, z1
, z2
, *pz0
, *pz1
, *pz2
;
53 h32 hx0
, hx1
, hx2
, hy0
, hy1
, hy2
;
66 j0
= hy0
.u
& 0x7f800000;
71 j0
= hx0
.u
& 0x7f800000;
77 if (i
>= 0x0c800000 || j0
>= 0x7f800000) {
79 if (hx0
.u
== 0x7f800000)
81 else if (hy0
.u
== 0x7f800000)
83 else if (hx0
.u
> 0x7f800000 || hy0
.u
> 0x7f800000)
105 hx1
.u
&= ~0x80000000;
106 hy1
.u
&= ~0x80000000;
111 j1
= hy1
.u
& 0x7f800000;
116 j1
= hx1
.u
& 0x7f800000;
122 if (i
>= 0x0c800000 || j1
>= 0x7f800000) {
124 if (hx1
.u
== 0x7f800000)
126 else if (hy1
.u
== 0x7f800000)
128 else if (hx1
.u
> 0x7f800000 || hy1
.u
> 0x7f800000)
150 hx2
.u
&= ~0x80000000;
151 hy2
.u
&= ~0x80000000;
156 j2
= hy2
.u
& 0x7f800000;
161 j2
= hx2
.u
& 0x7f800000;
167 if (i
>= 0x0c800000 || j2
>= 0x7f800000) {
169 if (hx2
.u
== 0x7f800000)
171 else if (hy2
.u
== 0x7f800000)
173 else if (hx2
.u
> 0x7f800000 || hy2
.u
> 0x7f800000)
186 z0
= sqrt(x0
* (double)x0
+ y0
* (double)y0
);
187 z1
= sqrt(x1
* (double)x1
+ y1
* (double)y1
);
188 z2
= sqrt(x2
* (double)x2
+ y2
* (double)y2
);
201 z1
= sqrt(x1
* (double)x1
+ y1
* (double)y1
);
204 z0
= sqrt(x0
* (double)x0
+ y0
* (double)y0
);