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 <sys/isa_defs.h>
31 #include <sys/ccompile.h>
34 #define HI(x) *(1+(int*)x)
35 #define LO(x) *(unsigned*)x
37 #define HI(x) *(int*)x
38 #define LO(x) *(1+(unsigned*)x)
42 #define restrict _Restrict
47 extern const double __vlibm_TBL_sincos_hi
[], __vlibm_TBL_sincos_lo
[];
50 half
[2] = { 0.5, -0.5 },
52 invpio2
= 0.636619772367581343075535,
53 pio2_1
= 1.570796326734125614166,
54 pio2_2
= 6.077100506303965976596e-11,
55 pio2_3
= 2.022266248711166455796e-21,
56 pio2_3t
= 8.478427660368899643959e-32,
57 pp1
= -1.666666666605760465276263943134982554676e-0001,
58 pp2
= 8.333261209690963126718376566146180944442e-0003,
59 qq1
= -4.999999999977710986407023955908711557870e-0001,
60 qq2
= 4.166654863857219350645055881018842089580e-0002,
61 poly1
[2]= { -1.666666666666629669805215138920301589656e-0001,
62 -4.999999999999931701464060878888294524481e-0001 },
63 poly2
[2]= { 8.333333332390951295683993455280336376663e-0003,
64 4.166666666394861917535640593963708222319e-0002 },
65 poly3
[2]= { -1.984126237997976692791551778230098403960e-0004,
66 -1.388888552656142867832756687736851681462e-0003 },
67 poly4
[2]= { 2.753403624854277237649987622848330351110e-0006,
68 2.478519423681460796618128289454530524759e-0005 };
70 static const unsigned thresh
[2] = { 0x3fc90000, 0x3fc40000 };
72 /* Don't __ the following; acomp will handle it */
73 extern double fabs(double);
74 extern void __vlibm_vsin_big(int, double *, int, double *, int, int);
77 __vsin(int n
, double * restrict x
, int stridex
, double * restrict y
,
80 double x0_or_one
[4], x1_or_one
[4], x2_or_one
[4];
81 double y0_or_zero
[4], y1_or_zero
[4], y2_or_zero
[4];
82 double x0
, x1
, x2
, *py0
= 0, *py1
= 0, *py2
, *xsave
, *ysave
;
83 unsigned hx0
, hx1
, hx2
, xsb0
, xsb1
= 0, xsb2
;
84 int i
, biguns
, nsave
, sxsave
, sysave
;
85 volatile int v __GNU_UNUSED
;
97 hx0
= xsb0
& ~0x80000000;
103 if (hx0
< 0x3e400000)
124 hx1
= xsb1
& ~0x80000000;
125 if (hx1
> 0x3fe921fb)
130 if (hx1
< 0x3e400000)
151 hx2
= xsb2
& ~0x80000000;
152 if (hx2
> 0x3fe921fb)
157 if (hx2
< 0x3e400000)
171 i
= (hx0
- 0x3fc90000) >> 31;
172 i
|= ((hx1
- 0x3fc90000) >> 30) & 2;
173 i
|= ((hx2
- 0x3fc90000) >> 29) & 4;
176 double a0
, a1
, a2
, w0
, w1
, w2
;
177 double t0
, t1
, t2
, z0
, z1
, z2
;
181 j0
= (xsb0
+ 0x4000) & 0xffff8000;
182 j1
= (xsb1
+ 0x4000) & 0xffff8000;
183 j2
= (xsb2
+ 0x4000) & 0xffff8000;
196 t0
= z0
* (qq1
+ z0
* qq2
);
197 t1
= z1
* (qq1
+ z1
* qq2
);
198 t2
= z2
* (qq1
+ z2
* qq2
);
199 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
200 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
201 w2
= x2
* (one
+ z2
* (pp1
+ z2
* pp2
));
202 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
203 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
204 j2
= (((j2
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
205 xsb0
= (xsb0
>> 30) & 2;
206 xsb1
= (xsb1
>> 30) & 2;
207 xsb2
= (xsb2
>> 30) & 2;
208 a0
= __vlibm_TBL_sincos_hi
[j0
+xsb0
];
209 a1
= __vlibm_TBL_sincos_hi
[j1
+xsb1
];
210 a2
= __vlibm_TBL_sincos_hi
[j2
+xsb2
];
211 t0
= (__vlibm_TBL_sincos_hi
[j0
+1] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+xsb0
];
212 t1
= (__vlibm_TBL_sincos_hi
[j1
+1] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+xsb1
];
213 t2
= (__vlibm_TBL_sincos_hi
[j2
+1] * w2
+ a2
* t2
) + __vlibm_TBL_sincos_lo
[j2
+xsb2
];
220 j1
= (xsb1
+ 0x4000) & 0xffff8000;
221 j2
= (xsb2
+ 0x4000) & 0xffff8000;
231 t0
= z0
* (poly3
[0] + z0
* poly4
[0]);
232 t1
= z1
* (qq1
+ z1
* qq2
);
233 t2
= z2
* (qq1
+ z2
* qq2
);
234 t0
= z0
* (poly1
[0] + z0
* (poly2
[0] + t0
));
235 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
236 w2
= x2
* (one
+ z2
* (pp1
+ z2
* pp2
));
237 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
238 j2
= (((j2
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
239 xsb1
= (xsb1
>> 30) & 2;
240 xsb2
= (xsb2
>> 30) & 2;
241 a1
= __vlibm_TBL_sincos_hi
[j1
+xsb1
];
242 a2
= __vlibm_TBL_sincos_hi
[j2
+xsb2
];
244 t1
= (__vlibm_TBL_sincos_hi
[j1
+1] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+xsb1
];
245 t2
= (__vlibm_TBL_sincos_hi
[j2
+1] * w2
+ a2
* t2
) + __vlibm_TBL_sincos_lo
[j2
+xsb2
];
252 j0
= (xsb0
+ 0x4000) & 0xffff8000;
253 j2
= (xsb2
+ 0x4000) & 0xffff8000;
263 t0
= z0
* (qq1
+ z0
* qq2
);
264 t1
= z1
* (poly3
[0] + z1
* poly4
[0]);
265 t2
= z2
* (qq1
+ z2
* qq2
);
266 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
267 t1
= z1
* (poly1
[0] + z1
* (poly2
[0] + t1
));
268 w2
= x2
* (one
+ z2
* (pp1
+ z2
* pp2
));
269 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
270 j2
= (((j2
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
271 xsb0
= (xsb0
>> 30) & 2;
272 xsb2
= (xsb2
>> 30) & 2;
273 a0
= __vlibm_TBL_sincos_hi
[j0
+xsb0
];
274 a2
= __vlibm_TBL_sincos_hi
[j2
+xsb2
];
275 t0
= (__vlibm_TBL_sincos_hi
[j0
+1] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+xsb0
];
277 t2
= (__vlibm_TBL_sincos_hi
[j2
+1] * w2
+ a2
* t2
) + __vlibm_TBL_sincos_lo
[j2
+xsb2
];
284 j2
= (xsb2
+ 0x4000) & 0xffff8000;
291 t0
= z0
* (poly3
[0] + z0
* poly4
[0]);
292 t1
= z1
* (poly3
[0] + z1
* poly4
[0]);
293 t2
= z2
* (qq1
+ z2
* qq2
);
294 t0
= z0
* (poly1
[0] + z0
* (poly2
[0] + t0
));
295 t1
= z1
* (poly1
[0] + z1
* (poly2
[0] + t1
));
296 w2
= x2
* (one
+ z2
* (pp1
+ z2
* pp2
));
297 j2
= (((j2
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
298 xsb2
= (xsb2
>> 30) & 2;
299 a2
= __vlibm_TBL_sincos_hi
[j2
+xsb2
];
302 t2
= (__vlibm_TBL_sincos_hi
[j2
+1] * w2
+ a2
* t2
) + __vlibm_TBL_sincos_lo
[j2
+xsb2
];
309 j0
= (xsb0
+ 0x4000) & 0xffff8000;
310 j1
= (xsb1
+ 0x4000) & 0xffff8000;
320 t0
= z0
* (qq1
+ z0
* qq2
);
321 t1
= z1
* (qq1
+ z1
* qq2
);
322 t2
= z2
* (poly3
[0] + z2
* poly4
[0]);
323 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
324 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
325 t2
= z2
* (poly1
[0] + z2
* (poly2
[0] + t2
));
326 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
327 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
328 xsb0
= (xsb0
>> 30) & 2;
329 xsb1
= (xsb1
>> 30) & 2;
330 a0
= __vlibm_TBL_sincos_hi
[j0
+xsb0
];
331 a1
= __vlibm_TBL_sincos_hi
[j1
+xsb1
];
332 t0
= (__vlibm_TBL_sincos_hi
[j0
+1] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+xsb0
];
333 t1
= (__vlibm_TBL_sincos_hi
[j1
+1] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+xsb1
];
341 j1
= (xsb1
+ 0x4000) & 0xffff8000;
348 t0
= z0
* (poly3
[0] + z0
* poly4
[0]);
349 t1
= z1
* (qq1
+ z1
* qq2
);
350 t2
= z2
* (poly3
[0] + z2
* poly4
[0]);
351 t0
= z0
* (poly1
[0] + z0
* (poly2
[0] + t0
));
352 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
353 t2
= z2
* (poly1
[0] + z2
* (poly2
[0] + t2
));
354 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
355 xsb1
= (xsb1
>> 30) & 2;
356 a1
= __vlibm_TBL_sincos_hi
[j1
+xsb1
];
358 t1
= (__vlibm_TBL_sincos_hi
[j1
+1] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+xsb1
];
366 j0
= (xsb0
+ 0x4000) & 0xffff8000;
373 t0
= z0
* (qq1
+ z0
* qq2
);
374 t1
= z1
* (poly3
[0] + z1
* poly4
[0]);
375 t2
= z2
* (poly3
[0] + z2
* poly4
[0]);
376 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
377 t1
= z1
* (poly1
[0] + z1
* (poly2
[0] + t1
));
378 t2
= z2
* (poly1
[0] + z2
* (poly2
[0] + t2
));
379 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
380 xsb0
= (xsb0
>> 30) & 2;
381 a0
= __vlibm_TBL_sincos_hi
[j0
+xsb0
];
382 t0
= (__vlibm_TBL_sincos_hi
[j0
+1] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+xsb0
];
394 t0
= z0
* (poly3
[0] + z0
* poly4
[0]);
395 t1
= z1
* (poly3
[0] + z1
* poly4
[0]);
396 t2
= z2
* (poly3
[0] + z2
* poly4
[0]);
397 t0
= z0
* (poly1
[0] + z0
* (poly2
[0] + t0
));
398 t1
= z1
* (poly1
[0] + z1
* (poly2
[0] + t1
));
399 t2
= z2
* (poly1
[0] + z2
* (poly2
[0] + t2
));
416 double a0
, a1
, w0
, w1
;
417 double t0
, t1
, z0
, z1
;
422 if (hx1
< 0x3fc90000)
425 t1
= z1
* (poly3
[0] + z1
* poly4
[0]);
426 t1
= z1
* (poly1
[0] + z1
* (poly2
[0] + t1
));
432 j1
= (xsb1
+ 0x4000) & 0xffff8000;
437 t1
= z1
* (qq1
+ z1
* qq2
);
438 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
439 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
440 xsb1
= (xsb1
>> 30) & 2;
441 a1
= __vlibm_TBL_sincos_hi
[j1
+xsb1
];
442 t1
= (__vlibm_TBL_sincos_hi
[j1
+1] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+xsb1
];
446 if (hx0
< 0x3fc90000)
449 t0
= z0
* (poly3
[0] + z0
* poly4
[0]);
450 t0
= z0
* (poly1
[0] + z0
* (poly2
[0] + t0
));
456 j0
= (xsb0
+ 0x4000) & 0xffff8000;
461 t0
= z0
* (qq1
+ z0
* qq2
);
462 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
463 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
464 xsb0
= (xsb0
>> 30) & 2;
465 a0
= __vlibm_TBL_sincos_hi
[j0
+xsb0
];
466 t0
= (__vlibm_TBL_sincos_hi
[j0
+1] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+xsb0
];
474 * MEDIUM RANGE PROCESSING
475 * Jump here at first sign of medium range argument. We are a bit
476 * confused due to the jump.. fix up several variables and jump into
477 * the nth loop, same as was being processed above.
502 else if (biguns
== 2)
512 double fn0
, fn1
, fn2
, a0
, a1
, a2
, w0
, w1
, w2
, y0
, y1
, y2
;
533 if (hx
>= 0x7ff00000)
572 if (hx
>= 0x7ff00000)
611 if (hx
>= 0x7ff00000)
628 n0
= (int) (x0
* invpio2
+ half
[xsb0
]);
629 n1
= (int) (x1
* invpio2
+ half
[xsb1
]);
630 n2
= (int) (x2
* invpio2
+ half
[xsb2
]);
637 a0
= x0
- fn0
* pio2_1
;
638 a1
= x1
- fn1
* pio2_1
;
639 a2
= x2
- fn2
* pio2_1
;
652 w0
= fn0
* pio2_3
- y0
;
653 w1
= fn1
* pio2_3
- y1
;
654 w2
= fn2
* pio2_3
- y2
;
664 w0
= fn0
* pio2_3t
- y0
;
665 w1
= fn1
* pio2_3t
- y1
;
666 w2
= fn2
* pio2_3t
- y2
;
674 i
= ((xsb0
& ~0x80000000) - thresh
[n0
&1]) >> 31;
676 i
|= (((xsb1
& ~0x80000000) - thresh
[n1
&1]) >> 30) & 2;
678 i
|= (((xsb2
& ~0x80000000) - thresh
[n2
&1]) >> 29) & 4;
681 double t0
, t1
, t2
, z0
, z1
, z2
;
685 j0
= (xsb0
+ 0x4000) & 0xffff8000;
686 j1
= (xsb1
+ 0x4000) & 0xffff8000;
687 j2
= (xsb2
+ 0x4000) & 0xffff8000;
700 t0
= z0
* (qq1
+ z0
* qq2
);
701 t1
= z1
* (qq1
+ z1
* qq2
);
702 t2
= z2
* (qq1
+ z2
* qq2
);
703 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
704 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
705 w2
= x2
* (one
+ z2
* (pp1
+ z2
* pp2
));
706 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
707 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
708 j2
= (((j2
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
709 xsb0
= (xsb0
>> 30) & 2;
710 xsb1
= (xsb1
>> 30) & 2;
711 xsb2
= (xsb2
>> 30) & 2;
712 n0
^= (xsb0
& ~(n0
<< 1));
713 n1
^= (xsb1
& ~(n1
<< 1));
714 n2
^= (xsb2
& ~(n2
<< 1));
718 a0
= __vlibm_TBL_sincos_hi
[j0
+n0
];
719 a1
= __vlibm_TBL_sincos_hi
[j1
+n1
];
720 a2
= __vlibm_TBL_sincos_hi
[j2
+n2
];
721 t0
= (__vlibm_TBL_sincos_hi
[j0
+((n0
+xsb0
)&3)] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+n0
];
722 t1
= (__vlibm_TBL_sincos_hi
[j1
+((n1
+xsb1
)&3)] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+n1
];
723 t2
= (__vlibm_TBL_sincos_hi
[j2
+((n2
+xsb2
)&3)] * w2
+ a2
* t2
) + __vlibm_TBL_sincos_lo
[j2
+n2
];
731 j1
= (xsb1
+ 0x4000) & 0xffff8000;
732 j2
= (xsb2
+ 0x4000) & 0xffff8000;
746 t0
= z0
* (poly3
[j0
] + z0
* poly4
[j0
]);
747 t1
= z1
* (qq1
+ z1
* qq2
);
748 t2
= z2
* (qq1
+ z2
* qq2
);
749 t0
= z0
* (poly1
[j0
] + z0
* (poly2
[j0
] + t0
));
750 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
751 w2
= x2
* (one
+ z2
* (pp1
+ z2
* pp2
));
752 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
753 j2
= (((j2
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
754 xsb1
= (xsb1
>> 30) & 2;
755 xsb2
= (xsb2
>> 30) & 2;
756 n1
^= (xsb1
& ~(n1
<< 1));
757 n2
^= (xsb2
& ~(n2
<< 1));
760 a1
= __vlibm_TBL_sincos_hi
[j1
+n1
];
761 a2
= __vlibm_TBL_sincos_hi
[j2
+n2
];
762 t0
= x0_or_one
[n0
] + (y0_or_zero
[n0
] + x0_or_one
[n0
] * t0
);
763 t1
= (__vlibm_TBL_sincos_hi
[j1
+((n1
+xsb1
)&3)] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+n1
];
764 t2
= (__vlibm_TBL_sincos_hi
[j2
+((n2
+xsb2
)&3)] * w2
+ a2
* t2
) + __vlibm_TBL_sincos_lo
[j2
+n2
];
771 j0
= (xsb0
+ 0x4000) & 0xffff8000;
773 j2
= (xsb2
+ 0x4000) & 0xffff8000;
787 t0
= z0
* (qq1
+ z0
* qq2
);
788 t1
= z1
* (poly3
[j1
] + z1
* poly4
[j1
]);
789 t2
= z2
* (qq1
+ z2
* qq2
);
790 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
791 t1
= z1
* (poly1
[j1
] + z1
* (poly2
[j1
] + t1
));
792 w2
= x2
* (one
+ z2
* (pp1
+ z2
* pp2
));
793 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
794 j2
= (((j2
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
795 xsb0
= (xsb0
>> 30) & 2;
796 xsb2
= (xsb2
>> 30) & 2;
797 n0
^= (xsb0
& ~(n0
<< 1));
798 n2
^= (xsb2
& ~(n2
<< 1));
801 a0
= __vlibm_TBL_sincos_hi
[j0
+n0
];
802 a2
= __vlibm_TBL_sincos_hi
[j2
+n2
];
803 t0
= (__vlibm_TBL_sincos_hi
[j0
+((n0
+xsb0
)&3)] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+n0
];
804 t1
= x1_or_one
[n1
] + (y1_or_zero
[n1
] + x1_or_one
[n1
] * t1
);
805 t2
= (__vlibm_TBL_sincos_hi
[j2
+((n2
+xsb2
)&3)] * w2
+ a2
* t2
) + __vlibm_TBL_sincos_lo
[j2
+n2
];
814 j2
= (xsb2
+ 0x4000) & 0xffff8000;
829 t0
= z0
* (poly3
[j0
] + z0
* poly4
[j0
]);
830 t1
= z1
* (poly3
[j1
] + z1
* poly4
[j1
]);
831 t2
= z2
* (qq1
+ z2
* qq2
);
832 t0
= z0
* (poly1
[j0
] + z0
* (poly2
[j0
] + t0
));
833 t1
= z1
* (poly1
[j1
] + z1
* (poly2
[j1
] + t1
));
834 w2
= x2
* (one
+ z2
* (pp1
+ z2
* pp2
));
835 j2
= (((j2
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
836 xsb2
= (xsb2
>> 30) & 2;
837 n2
^= (xsb2
& ~(n2
<< 1));
839 a2
= __vlibm_TBL_sincos_hi
[j2
+n2
];
840 t0
= x0_or_one
[n0
] + (y0_or_zero
[n0
] + x0_or_one
[n0
] * t0
);
841 t1
= x1_or_one
[n1
] + (y1_or_zero
[n1
] + x1_or_one
[n1
] * t1
);
842 t2
= (__vlibm_TBL_sincos_hi
[j2
+((n2
+xsb2
)&3)] * w2
+ a2
* t2
) + __vlibm_TBL_sincos_lo
[j2
+n2
];
849 j0
= (xsb0
+ 0x4000) & 0xffff8000;
850 j1
= (xsb1
+ 0x4000) & 0xffff8000;
865 t0
= z0
* (qq1
+ z0
* qq2
);
866 t1
= z1
* (qq1
+ z1
* qq2
);
867 t2
= z2
* (poly3
[j2
] + z2
* poly4
[j2
]);
868 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
869 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
870 t2
= z2
* (poly1
[j2
] + z2
* (poly2
[j2
] + t2
));
871 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
872 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
873 xsb0
= (xsb0
>> 30) & 2;
874 xsb1
= (xsb1
>> 30) & 2;
875 n0
^= (xsb0
& ~(n0
<< 1));
876 n1
^= (xsb1
& ~(n1
<< 1));
879 a0
= __vlibm_TBL_sincos_hi
[j0
+n0
];
880 a1
= __vlibm_TBL_sincos_hi
[j1
+n1
];
881 t0
= (__vlibm_TBL_sincos_hi
[j0
+((n0
+xsb0
)&3)] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+n0
];
882 t1
= (__vlibm_TBL_sincos_hi
[j1
+((n1
+xsb1
)&3)] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+n1
];
883 t2
= x2_or_one
[n2
] + (y2_or_zero
[n2
] + x2_or_one
[n2
] * t2
);
891 j1
= (xsb1
+ 0x4000) & 0xffff8000;
907 t0
= z0
* (poly3
[j0
] + z0
* poly4
[j0
]);
908 t1
= z1
* (qq1
+ z1
* qq2
);
909 t2
= z2
* (poly3
[j2
] + z2
* poly4
[j2
]);
910 t0
= z0
* (poly1
[j0
] + z0
* (poly2
[j0
] + t0
));
911 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
912 t2
= z2
* (poly1
[j2
] + z2
* (poly2
[j2
] + t2
));
913 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
914 xsb1
= (xsb1
>> 30) & 2;
915 n1
^= (xsb1
& ~(n1
<< 1));
917 a1
= __vlibm_TBL_sincos_hi
[j1
+n1
];
918 t0
= x0_or_one
[n0
] + (y0_or_zero
[n0
] + x0_or_one
[n0
] * t0
);
919 t1
= (__vlibm_TBL_sincos_hi
[j1
+((n1
+xsb1
)&3)] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+n1
];
920 t2
= x2_or_one
[n2
] + (y2_or_zero
[n2
] + x2_or_one
[n2
] * t2
);
927 j0
= (xsb0
+ 0x4000) & 0xffff8000;
944 t0
= z0
* (qq1
+ z0
* qq2
);
945 t1
= z1
* (poly3
[j1
] + z1
* poly4
[j1
]);
946 t2
= z2
* (poly3
[j2
] + z2
* poly4
[j2
]);
947 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
948 t1
= z1
* (poly1
[j1
] + z1
* (poly2
[j1
] + t1
));
949 t2
= z2
* (poly1
[j2
] + z2
* (poly2
[j2
] + t2
));
950 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
951 xsb0
= (xsb0
>> 30) & 2;
952 n0
^= (xsb0
& ~(n0
<< 1));
954 a0
= __vlibm_TBL_sincos_hi
[j0
+n0
];
955 t0
= (__vlibm_TBL_sincos_hi
[j0
+((n0
+xsb0
)&3)] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+n0
];
956 t1
= x1_or_one
[n1
] + (y1_or_zero
[n1
] + x1_or_one
[n1
] * t1
);
957 t2
= x2_or_one
[n2
] + (y2_or_zero
[n2
] + x2_or_one
[n2
] * t2
);
982 t0
= z0
* (poly3
[j0
] + z0
* poly4
[j0
]);
983 t1
= z1
* (poly3
[j1
] + z1
* poly4
[j1
]);
984 t2
= z2
* (poly3
[j2
] + z2
* poly4
[j2
]);
985 t0
= z0
* (poly1
[j0
] + z0
* (poly2
[j0
] + t0
));
986 t1
= z1
* (poly1
[j1
] + z1
* (poly2
[j1
] + t1
));
987 t2
= z2
* (poly1
[j2
] + z2
* (poly2
[j2
] + t2
));
988 t0
= x0_or_one
[n0
] + (y0_or_zero
[n0
] + x0_or_one
[n0
] * t0
);
989 t1
= x1_or_one
[n1
] + (y1_or_zero
[n1
] + x1_or_one
[n1
] * t1
);
990 t2
= x2_or_one
[n2
] + (y2_or_zero
[n2
] + x2_or_one
[n2
] * t2
);
1004 double fn0
, fn1
, a0
, a1
, w0
, w1
, y0
, y1
;
1005 double t0
, t1
, z0
, z1
;
1011 n1
= (int) (x1
* invpio2
+ half
[xsb1
]);
1014 a1
= x1
- fn1
* pio2_1
;
1017 y1
= (a1
- x1
) - w1
;
1019 w1
= fn1
* pio2_3
- y1
;
1021 y1
= (a1
- x1
) - w1
;
1023 w1
= fn1
* pio2_3t
- y1
;
1025 y1
= (a1
- x1
) - w1
;
1027 if ((xsb1
& ~0x80000000) < thresh
[n1
&1])
1033 y1_or_zero
[2] = -y1
;
1035 t1
= z1
* (poly3
[j1
] + z1
* poly4
[j1
]);
1036 t1
= z1
* (poly1
[j1
] + z1
* (poly2
[j1
] + t1
));
1037 t1
= x1_or_one
[n1
] + (y1_or_zero
[n1
] + x1_or_one
[n1
] * t1
);
1042 j1
= (xsb1
+ 0x4000) & 0xffff8000;
1045 x1
= (x1
- t1
) + y1
;
1047 t1
= z1
* (qq1
+ z1
* qq2
);
1048 w1
= x1
* (one
+ z1
* (pp1
+ z1
* pp2
));
1049 j1
= (((j1
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
1050 xsb1
= (xsb1
>> 30) & 2;
1051 n1
^= (xsb1
& ~(n1
<< 1));
1053 a1
= __vlibm_TBL_sincos_hi
[j1
+n1
];
1054 t1
= (__vlibm_TBL_sincos_hi
[j1
+((n1
+xsb1
)&3)] * w1
+ a1
* t1
) + __vlibm_TBL_sincos_lo
[j1
+n1
];
1058 n0
= (int) (x0
* invpio2
+ half
[xsb0
]);
1061 a0
= x0
- fn0
* pio2_1
;
1064 y0
= (a0
- x0
) - w0
;
1066 w0
= fn0
* pio2_3
- y0
;
1068 y0
= (a0
- x0
) - w0
;
1070 w0
= fn0
* pio2_3t
- y0
;
1072 y0
= (a0
- x0
) - w0
;
1074 if ((xsb0
& ~0x80000000) < thresh
[n0
&1])
1080 y0_or_zero
[2] = -y0
;
1082 t0
= z0
* (poly3
[j0
] + z0
* poly4
[j0
]);
1083 t0
= z0
* (poly1
[j0
] + z0
* (poly2
[j0
] + t0
));
1084 t0
= x0_or_one
[n0
] + (y0_or_zero
[n0
] + x0_or_one
[n0
] * t0
);
1089 j0
= (xsb0
+ 0x4000) & 0xffff8000;
1092 x0
= (x0
- t0
) + y0
;
1094 t0
= z0
* (qq1
+ z0
* qq2
);
1095 w0
= x0
* (one
+ z0
* (pp1
+ z0
* pp2
));
1096 j0
= (((j0
& ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
1097 xsb0
= (xsb0
>> 30) & 2;
1098 n0
^= (xsb0
& ~(n0
<< 1));
1100 a0
= __vlibm_TBL_sincos_hi
[j0
+n0
];
1101 t0
= (__vlibm_TBL_sincos_hi
[j0
+((n0
+xsb0
)&3)] * w0
+ a0
* t0
) + __vlibm_TBL_sincos_lo
[j0
+n0
];
1107 __vlibm_vsin_big(nsave
, xsave
, sxsave
, ysave
, sysave
, 0x413921fb);