125c28e8Piotr Jasiukajtis/*
225c28e8Piotr Jasiukajtis * CDDL HEADER START
325c28e8Piotr Jasiukajtis *
425c28e8Piotr Jasiukajtis * The contents of this file are subject to the terms of the
525c28e8Piotr Jasiukajtis * Common Development and Distribution License (the "License").
625c28e8Piotr Jasiukajtis * You may not use this file except in compliance with the License.
725c28e8Piotr Jasiukajtis *
825c28e8Piotr Jasiukajtis * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
925c28e8Piotr Jasiukajtis * or http://www.opensolaris.org/os/licensing.
1025c28e8Piotr Jasiukajtis * See the License for the specific language governing permissions
1125c28e8Piotr Jasiukajtis * and limitations under the License.
1225c28e8Piotr Jasiukajtis *
1325c28e8Piotr Jasiukajtis * When distributing Covered Code, include this CDDL HEADER in each
1425c28e8Piotr Jasiukajtis * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1525c28e8Piotr Jasiukajtis * If applicable, add the following below this CDDL HEADER, with the
1625c28e8Piotr Jasiukajtis * fields enclosed by brackets "[]" replaced with your own identifying
1725c28e8Piotr Jasiukajtis * information: Portions Copyright [yyyy] [name of copyright owner]
1825c28e8Piotr Jasiukajtis *
1925c28e8Piotr Jasiukajtis * CDDL HEADER END
2025c28e8Piotr Jasiukajtis */
2125c28e8Piotr Jasiukajtis
2225c28e8Piotr Jasiukajtis/*
2325c28e8Piotr Jasiukajtis * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
2425c28e8Piotr Jasiukajtis */
2525c28e8Piotr Jasiukajtis/*
2625c28e8Piotr Jasiukajtis * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
2725c28e8Piotr Jasiukajtis * Use is subject to license terms.
2825c28e8Piotr Jasiukajtis */
2925c28e8Piotr Jasiukajtis
3025c28e8Piotr Jasiukajtis#include <sys/isa_defs.h>
3125c28e8Piotr Jasiukajtis
3225c28e8Piotr Jasiukajtis#ifdef _LITTLE_ENDIAN
3325c28e8Piotr Jasiukajtis#define HI(x)	*(1+(int*)x)
3425c28e8Piotr Jasiukajtis#define LO(x)	*(unsigned*)x
3525c28e8Piotr Jasiukajtis#else
3625c28e8Piotr Jasiukajtis#define HI(x)	*(int*)x
3725c28e8Piotr Jasiukajtis#define LO(x)	*(1+(unsigned*)x)
3825c28e8Piotr Jasiukajtis#endif
3925c28e8Piotr Jasiukajtis
4025c28e8Piotr Jasiukajtis#ifdef __RESTRICT
4125c28e8Piotr Jasiukajtis#define restrict _Restrict
4225c28e8Piotr Jasiukajtis#else
4325c28e8Piotr Jasiukajtis#define restrict
4425c28e8Piotr Jasiukajtis#endif
4525c28e8Piotr Jasiukajtis
4625c28e8Piotr Jasiukajtisextern const double __vlibm_TBL_sincos_hi[], __vlibm_TBL_sincos_lo[];
4725c28e8Piotr Jasiukajtis
4825c28e8Piotr Jasiukajtisstatic const double
4925c28e8Piotr Jasiukajtis	half[2]	= { 0.5, -0.5 },
5025c28e8Piotr Jasiukajtis	one		= 1.0,
5125c28e8Piotr Jasiukajtis	invpio2	= 0.636619772367581343075535,
5225c28e8Piotr Jasiukajtis	pio2_1	= 1.570796326734125614166,
5325c28e8Piotr Jasiukajtis	pio2_2	= 6.077100506303965976596e-11,
5425c28e8Piotr Jasiukajtis	pio2_3	= 2.022266248711166455796e-21,
5525c28e8Piotr Jasiukajtis	pio2_3t	= 8.478427660368899643959e-32,
5625c28e8Piotr Jasiukajtis	pp1		= -1.666666666605760465276263943134982554676e-0001,
5725c28e8Piotr Jasiukajtis	pp2		=  8.333261209690963126718376566146180944442e-0003,
5825c28e8Piotr Jasiukajtis	qq1		= -4.999999999977710986407023955908711557870e-0001,
5925c28e8Piotr Jasiukajtis	qq2		=  4.166654863857219350645055881018842089580e-0002,
6025c28e8Piotr Jasiukajtis	poly1[2]= { -1.666666666666629669805215138920301589656e-0001,
6125c28e8Piotr Jasiukajtis				-4.999999999999931701464060878888294524481e-0001 },
6225c28e8Piotr Jasiukajtis	poly2[2]= {  8.333333332390951295683993455280336376663e-0003,
6325c28e8Piotr Jasiukajtis				 4.166666666394861917535640593963708222319e-0002 },
6425c28e8Piotr Jasiukajtis	poly3[2]= { -1.984126237997976692791551778230098403960e-0004,
6525c28e8Piotr Jasiukajtis				-1.388888552656142867832756687736851681462e-0003 },
6625c28e8Piotr Jasiukajtis	poly4[2]= {  2.753403624854277237649987622848330351110e-0006,
6725c28e8Piotr Jasiukajtis				 2.478519423681460796618128289454530524759e-0005 };
6825c28e8Piotr Jasiukajtis
6925c28e8Piotr Jasiukajtisstatic const unsigned thresh[2] = { 0x3fc90000, 0x3fc40000 };
7025c28e8Piotr Jasiukajtis
7125c28e8Piotr Jasiukajtisextern void __vlibm_vsin_big(int, double *, int, double *, int, int);
7225c28e8Piotr Jasiukajtis
7325c28e8Piotr Jasiukajtisvoid
7425c28e8Piotr Jasiukajtis__vlibm_vsin_big_ultra3(int n, double * restrict x, int stridex, double * restrict y,
7525c28e8Piotr Jasiukajtis	int stridey, int pthresh)
7625c28e8Piotr Jasiukajtis{
7725c28e8Piotr Jasiukajtis	double		x0_or_one[4], x1_or_one[4], x2_or_one[4];
7825c28e8Piotr Jasiukajtis	double		y0_or_zero[4], y1_or_zero[4], y2_or_zero[4];
7925c28e8Piotr Jasiukajtis	double		x0, x1, x2, *py0, *py1, *py2, *xsave, *ysave;
8025c28e8Piotr Jasiukajtis	unsigned	xsb0, xsb1, xsb2;
8125c28e8Piotr Jasiukajtis	int			i, biguns, nsave, sxsave, sysave;
8225c28e8Piotr Jasiukajtis
8325c28e8Piotr Jasiukajtis	nsave = n;
8425c28e8Piotr Jasiukajtis	xsave = x;
8525c28e8Piotr Jasiukajtis	sxsave = stridex;
8625c28e8Piotr Jasiukajtis	ysave = y;
8725c28e8Piotr Jasiukajtis	sysave = stridey;
8825c28e8Piotr Jasiukajtis	biguns = 0;
8925c28e8Piotr Jasiukajtis
9025c28e8Piotr Jasiukajtis	x0_or_one[1] = 1.0;
9125c28e8Piotr Jasiukajtis	x1_or_one[1] = 1.0;
9225c28e8Piotr Jasiukajtis	x2_or_one[1] = 1.0;
9325c28e8Piotr Jasiukajtis	x0_or_one[3] = -1.0;
9425c28e8Piotr Jasiukajtis	x1_or_one[3] = -1.0;
9525c28e8Piotr Jasiukajtis	x2_or_one[3] = -1.0;
9625c28e8Piotr Jasiukajtis	y0_or_zero[1] = 0.0;
9725c28e8Piotr Jasiukajtis	y1_or_zero[1] = 0.0;
9825c28e8Piotr Jasiukajtis	y2_or_zero[1] = 0.0;
9925c28e8Piotr Jasiukajtis	y0_or_zero[3] = 0.0;
10025c28e8Piotr Jasiukajtis	y1_or_zero[3] = 0.0;
10125c28e8Piotr Jasiukajtis	y2_or_zero[3] = 0.0;
10225c28e8Piotr Jasiukajtis
10325c28e8Piotr Jasiukajtis	do
10425c28e8Piotr Jasiukajtis	{
10525c28e8Piotr Jasiukajtis		double		fn0, fn1, fn2, a0, a1, a2, w0, w1, w2, y0, y1, y2;
10625c28e8Piotr Jasiukajtis		unsigned	hx;
10725c28e8Piotr Jasiukajtis		int			n0, n1, n2;
10825c28e8Piotr Jasiukajtis
10925c28e8Piotr Jasiukajtisloop0:
11025c28e8Piotr Jasiukajtis		hx = HI(x);
11125c28e8Piotr Jasiukajtis		xsb0 = hx >> 31;
11225c28e8Piotr Jasiukajtis		hx &= ~0x80000000;
11325c28e8Piotr Jasiukajtis		if (hx <= pthresh || hx > 0x413921fb)
11425c28e8Piotr Jasiukajtis		{
11525c28e8Piotr Jasiukajtis			if (hx > 0x413921fb && hx < 0x7ff00000)
11625c28e8Piotr Jasiukajtis				biguns = 1;
11725c28e8Piotr Jasiukajtis			x += stridex;
11825c28e8Piotr Jasiukajtis			y += stridey;
11925c28e8Piotr Jasiukajtis			i = 0;
12025c28e8Piotr Jasiukajtis			if (--n <= 0)
12125c28e8Piotr Jasiukajtis				break;
12225c28e8Piotr Jasiukajtis			goto loop0;
12325c28e8Piotr Jasiukajtis		}
12425c28e8Piotr Jasiukajtis		x0 = *x;
12525c28e8Piotr Jasiukajtis		py0 = y;
12625c28e8Piotr Jasiukajtis		x += stridex;
12725c28e8Piotr Jasiukajtis		y += stridey;
12825c28e8Piotr Jasiukajtis		i = 1;
12925c28e8Piotr Jasiukajtis		if (--n <= 0)
13025c28e8Piotr Jasiukajtis			break;
13125c28e8Piotr Jasiukajtis
13225c28e8Piotr Jasiukajtisloop1:
13325c28e8Piotr Jasiukajtis		hx = HI(x);
13425c28e8Piotr Jasiukajtis		xsb1 = hx >> 31;
13525c28e8Piotr Jasiukajtis		hx &= ~0x80000000;
13625c28e8Piotr Jasiukajtis		if (hx <= pthresh || hx > 0x413921fb)
13725c28e8Piotr Jasiukajtis		{
13825c28e8Piotr Jasiukajtis			if (hx > 0x413921fb && hx < 0x7ff00000)
13925c28e8Piotr Jasiukajtis				biguns = 1;
14025c28e8Piotr Jasiukajtis			x += stridex;
14125c28e8Piotr Jasiukajtis			y += stridey;
14225c28e8Piotr Jasiukajtis			i = 1;
14325c28e8Piotr Jasiukajtis			if (--n <= 0)
14425c28e8Piotr Jasiukajtis				break;
14525c28e8Piotr Jasiukajtis			goto loop1;
14625c28e8Piotr Jasiukajtis		}
14725c28e8Piotr Jasiukajtis		x1 = *x;
14825c28e8Piotr Jasiukajtis		py1 = y;
14925c28e8Piotr Jasiukajtis		x += stridex;
15025c28e8Piotr Jasiukajtis		y += stridey;
15125c28e8Piotr Jasiukajtis		i = 2;
15225c28e8Piotr Jasiukajtis		if (--n <= 0)
15325c28e8Piotr Jasiukajtis			break;
15425c28e8Piotr Jasiukajtis
15525c28e8Piotr Jasiukajtisloop2:
15625c28e8Piotr Jasiukajtis		hx = HI(x);
15725c28e8Piotr Jasiukajtis		xsb2 = hx >> 31;
15825c28e8Piotr Jasiukajtis		hx &= ~0x80000000;
15925c28e8Piotr Jasiukajtis		if (hx <= pthresh || hx > 0x413921fb)
16025c28e8Piotr Jasiukajtis		{
16125c28e8Piotr Jasiukajtis			if (hx > 0x413921fb && hx < 0x7ff00000)
16225c28e8Piotr Jasiukajtis				biguns = 1;
16325c28e8Piotr Jasiukajtis			x += stridex;
16425c28e8Piotr Jasiukajtis			y += stridey;
16525c28e8Piotr Jasiukajtis			i = 2;
16625c28e8Piotr Jasiukajtis			if (--n <= 0)
16725c28e8Piotr Jasiukajtis				break;
16825c28e8Piotr Jasiukajtis			goto loop2;
16925c28e8Piotr Jasiukajtis		}
17025c28e8Piotr Jasiukajtis		x2 = *x;
17125c28e8Piotr Jasiukajtis		py2 = y;
17225c28e8Piotr Jasiukajtis
17325c28e8Piotr Jasiukajtis		n0 = (int) (x0 * invpio2 + half[xsb0]);
17425c28e8Piotr Jasiukajtis		n1 = (int) (x1 * invpio2 + half[xsb1]);
17525c28e8Piotr Jasiukajtis		n2 = (int) (x2 * invpio2 + half[xsb2]);
17625c28e8Piotr Jasiukajtis		fn0 = (double) n0;
17725c28e8Piotr Jasiukajtis		fn1 = (double) n1;
17825c28e8Piotr Jasiukajtis		fn2 = (double) n2;
17925c28e8Piotr Jasiukajtis		n0 &= 3;
18025c28e8Piotr Jasiukajtis		n1 &= 3;
18125c28e8Piotr Jasiukajtis		n2 &= 3;
18225c28e8Piotr Jasiukajtis		a0 = x0 - fn0 * pio2_1;
18325c28e8Piotr Jasiukajtis		a1 = x1 - fn1 * pio2_1;
18425c28e8Piotr Jasiukajtis		a2 = x2 - fn2 * pio2_1;
18525c28e8Piotr Jasiukajtis		w0 = fn0 * pio2_2;
18625c28e8Piotr Jasiukajtis		w1 = fn1 * pio2_2;
18725c28e8Piotr Jasiukajtis		w2 = fn2 * pio2_2;
18825c28e8Piotr Jasiukajtis		x0 = a0 - w0;
18925c28e8Piotr Jasiukajtis		x1 = a1 - w1;
19025c28e8Piotr Jasiukajtis		x2 = a2 - w2;
19125c28e8Piotr Jasiukajtis		y0 = (a0 - x0) - w0;
19225c28e8Piotr Jasiukajtis		y1 = (a1 - x1) - w1;
19325c28e8Piotr Jasiukajtis		y2 = (a2 - x2) - w2;
19425c28e8Piotr Jasiukajtis		a0 = x0;
19525c28e8Piotr Jasiukajtis		a1 = x1;
19625c28e8Piotr Jasiukajtis		a2 = x2;
19725c28e8Piotr Jasiukajtis		w0 = fn0 * pio2_3 - y0;
19825c28e8Piotr Jasiukajtis		w1 = fn1 * pio2_3 - y1;
19925c28e8Piotr Jasiukajtis		w2 = fn2 * pio2_3 - y2;
20025c28e8Piotr Jasiukajtis		x0 = a0 - w0;
20125c28e8Piotr Jasiukajtis		x1 = a1 - w1;
20225c28e8Piotr Jasiukajtis		x2 = a2 - w2;
20325c28e8Piotr Jasiukajtis		y0 = (a0 - x0) - w0;
20425c28e8Piotr Jasiukajtis		y1 = (a1 - x1) - w1;
20525c28e8Piotr Jasiukajtis		y2 = (a2 - x2) - w2;
20625c28e8Piotr Jasiukajtis		a0 = x0;
20725c28e8Piotr Jasiukajtis		a1 = x1;
20825c28e8Piotr Jasiukajtis		a2 = x2;
20925c28e8Piotr Jasiukajtis		w0 = fn0 * pio2_3t - y0;
21025c28e8Piotr Jasiukajtis		w1 = fn1 * pio2_3t - y1;
21125c28e8Piotr Jasiukajtis		w2 = fn2 * pio2_3t - y2;
21225c28e8Piotr Jasiukajtis		x0 = a0 - w0;
21325c28e8Piotr Jasiukajtis		x1 = a1 - w1;
21425c28e8Piotr Jasiukajtis		x2 = a2 - w2;
21525c28e8Piotr Jasiukajtis		y0 = (a0 - x0) - w0;
21625c28e8Piotr Jasiukajtis		y1 = (a1 - x1) - w1;
21725c28e8Piotr Jasiukajtis		y2 = (a2 - x2) - w2;
21825c28e8Piotr Jasiukajtis		xsb0 = HI(&x0);
21925c28e8Piotr Jasiukajtis		i = ((xsb0 & ~0x80000000) - thresh[n0&1]) >> 31;
22025c28e8Piotr Jasiukajtis		xsb1 = HI(&x1);
22125c28e8Piotr Jasiukajtis		i |= (((xsb1 & ~0x80000000) - thresh[n1&1]) >> 30) & 2;
22225c28e8Piotr Jasiukajtis		xsb2 = HI(&x2);
22325c28e8Piotr Jasiukajtis		i |= (((xsb2 & ~0x80000000) - thresh[n2&1]) >> 29) & 4;
22425c28e8Piotr Jasiukajtis		switch (i)
22525c28e8Piotr Jasiukajtis		{
22625c28e8Piotr Jasiukajtis			double		t0, t1, t2, z0, z1, z2;
22725c28e8Piotr Jasiukajtis			unsigned	j0, j1, j2;
22825c28e8Piotr Jasiukajtis
22925c28e8Piotr Jasiukajtis		case 0:
23025c28e8Piotr Jasiukajtis			j0 = (xsb0 + 0x4000) & 0xffff8000;
23125c28e8Piotr Jasiukajtis			j1 = (xsb1 + 0x4000) & 0xffff8000;
23225c28e8Piotr Jasiukajtis			j2 = (xsb2 + 0x4000) & 0xffff8000;
23325c28e8Piotr Jasiukajtis			HI(&t0) = j0;
23425c28e8Piotr Jasiukajtis			HI(&t1) = j1;
23525c28e8Piotr Jasiukajtis			HI(&t2) = j2;
23625c28e8Piotr Jasiukajtis			LO(&t0) = 0;
23725c28e8Piotr Jasiukajtis			LO(&t1) = 0;
23825c28e8Piotr Jasiukajtis			LO(&t2) = 0;
23925c28e8Piotr Jasiukajtis			x0 = (x0 - t0) + y0;
24025c28e8Piotr Jasiukajtis			x1 = (x1 - t1) + y1;
24125c28e8Piotr Jasiukajtis			x2 = (x2 - t2) + y2;
24225c28e8Piotr Jasiukajtis			z0 = x0 * x0;
24325c28e8Piotr Jasiukajtis			z1 = x1 * x1;
24425c28e8Piotr Jasiukajtis			z2 = x2 * x2;
24525c28e8Piotr Jasiukajtis			t0 = z0 * (qq1 + z0 * qq2);
24625c28e8Piotr Jasiukajtis			t1 = z1 * (qq1 + z1 * qq2);
24725c28e8Piotr Jasiukajtis			t2 = z2 * (qq1 + z2 * qq2);
24825c28e8Piotr Jasiukajtis			w0 = x0 * (one + z0 * (pp1 + z0 * pp2));
24925c28e8Piotr Jasiukajtis			w1 = x1 * (one + z1 * (pp1 + z1 * pp2));
25025c28e8Piotr Jasiukajtis			w2 = x2 * (one + z2 * (pp1 + z2 * pp2));
25125c28e8Piotr Jasiukajtis			j0 = (((j0 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
25225c28e8Piotr Jasiukajtis			j1 = (((j1 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
25325c28e8Piotr Jasiukajtis			j2 = (((j2 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
25425c28e8Piotr Jasiukajtis			xsb0 = (xsb0 >> 30) & 2;
25525c28e8Piotr Jasiukajtis			xsb1 = (xsb1 >> 30) & 2;
25625c28e8Piotr Jasiukajtis			xsb2 = (xsb2 >> 30) & 2;
25725c28e8Piotr Jasiukajtis			n0 ^= (xsb0 & ~(n0 << 1));
25825c28e8Piotr Jasiukajtis			n1 ^= (xsb1 & ~(n1 << 1));
25925c28e8Piotr Jasiukajtis			n2 ^= (xsb2 & ~(n2 << 1));
26025c28e8Piotr Jasiukajtis			xsb0 |= 1;
26125c28e8Piotr Jasiukajtis			xsb1 |= 1;
26225c28e8Piotr Jasiukajtis			xsb2 |= 1;
26325c28e8Piotr Jasiukajtis			a0 = __vlibm_TBL_sincos_hi[j0+n0];
26425c28e8Piotr Jasiukajtis			a1 = __vlibm_TBL_sincos_hi[j1+n1];
26525c28e8Piotr Jasiukajtis			a2 = __vlibm_TBL_sincos_hi[j2+n2];
26625c28e8Piotr Jasiukajtis			t0 = (__vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0) + __vlibm_TBL_sincos_lo[j0+n0];
26725c28e8Piotr Jasiukajtis			t1 = (__vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1) + __vlibm_TBL_sincos_lo[j1+n1];
26825c28e8Piotr Jasiukajtis			t2 = (__vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2) + __vlibm_TBL_sincos_lo[j2+n2];
26925c28e8Piotr Jasiukajtis			*py0 = ( a0 + t0 );
27025c28e8Piotr Jasiukajtis			*py1 = ( a1 + t1 );
27125c28e8Piotr Jasiukajtis			*py2 = ( a2 + t2 );
27225c28e8Piotr Jasiukajtis			break;
27325c28e8Piotr Jasiukajtis
27425c28e8Piotr Jasiukajtis		case 1:
27525c28e8Piotr Jasiukajtis			j0 = n0 & 1;
27625c28e8Piotr Jasiukajtis			j1 = (xsb1 + 0x4000) & 0xffff8000;
27725c28e8Piotr Jasiukajtis			j2 = (xsb2 + 0x4000) & 0xffff8000;
27825c28e8Piotr Jasiukajtis			HI(&t1) = j1;
27925c28e8Piotr Jasiukajtis			HI(&t2) = j2;
28025c28e8Piotr Jasiukajtis			LO(&t1) = 0;
28125c28e8Piotr Jasiukajtis			LO(&t2) = 0;
28225c28e8Piotr Jasiukajtis			x0_or_one[0] = x0;
28325c28e8Piotr Jasiukajtis			x0_or_one[2] = -x0;
28425c28e8Piotr Jasiukajtis			y0_or_zero[0] = y0;
28525c28e8Piotr Jasiukajtis			y0_or_zero[2] = -y0;
28625c28e8Piotr Jasiukajtis			x1 = (x1 - t1) + y1;
28725c28e8Piotr Jasiukajtis			x2 = (x2 - t2) + y2;
28825c28e8Piotr Jasiukajtis			z0 = x0 * x0;
28925c28e8Piotr Jasiukajtis			z1 = x1 * x1;
29025c28e8Piotr Jasiukajtis			z2 = x2 * x2;
29125c28e8Piotr Jasiukajtis			t0 = z0 * (poly3[j0] + z0 * poly4[j0]);
29225c28e8Piotr Jasiukajtis			t1 = z1 * (qq1 + z1 * qq2);
29325c28e8Piotr Jasiukajtis			t2 = z2 * (qq1 + z2 * qq2);
29425c28e8Piotr Jasiukajtis			t0 = z0 * (poly1[j0] + z0 * (poly2[j0] + t0));
29525c28e8Piotr Jasiukajtis			w1 = x1 * (one + z1 * (pp1 + z1 * pp2));
29625c28e8Piotr Jasiukajtis			w2 = x2 * (one + z2 * (pp1 + z2 * pp2));
29725c28e8Piotr Jasiukajtis			j1 = (((j1 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
29825c28e8Piotr Jasiukajtis			j2 = (((j2 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
29925c28e8Piotr Jasiukajtis			xsb1 = (xsb1 >> 30) & 2;
30025c28e8Piotr Jasiukajtis			xsb2 = (xsb2 >> 30) & 2;
30125c28e8Piotr Jasiukajtis			n1 ^= (xsb1 & ~(n1 << 1));
30225c28e8Piotr Jasiukajtis			n2 ^= (xsb2 & ~(n2 << 1));
30325c28e8Piotr Jasiukajtis			xsb1 |= 1;
30425c28e8Piotr Jasiukajtis			xsb2 |= 1;
30525c28e8Piotr Jasiukajtis			a1 = __vlibm_TBL_sincos_hi[j1+n1];
30625c28e8Piotr Jasiukajtis			a2 = __vlibm_TBL_sincos_hi[j2+n2];
30725c28e8Piotr Jasiukajtis			t0 = x0_or_one[n0] + (y0_or_zero[n0] + x0_or_one[n0] * t0);
30825c28e8Piotr Jasiukajtis			t1 = (__vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1) + __vlibm_TBL_sincos_lo[j1+n1];
30925c28e8Piotr Jasiukajtis			t2 = (__vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2) + __vlibm_TBL_sincos_lo[j2+n2];
31025c28e8Piotr Jasiukajtis			*py0 = t0;
31125c28e8Piotr Jasiukajtis			*py1 = ( a1 + t1 );
31225c28e8Piotr Jasiukajtis			*py2 = ( a2 + t2 );
31325c28e8Piotr Jasiukajtis			break;
31425c28e8Piotr Jasiukajtis
31525c28e8Piotr Jasiukajtis		case 2:
31625c28e8Piotr Jasiukajtis			j0 = (xsb0 + 0x4000) & 0xffff8000;
31725c28e8Piotr Jasiukajtis			j1 = n1 & 1;
31825c28e8Piotr Jasiukajtis			j2 = (xsb2 + 0x4000) & 0xffff8000;
31925c28e8Piotr Jasiukajtis			HI(&t0) = j0;
32025c28e8Piotr Jasiukajtis			HI(&t2) = j2;
32125c28e8Piotr Jasiukajtis			LO(&t0) = 0;
32225c28e8Piotr Jasiukajtis			LO(&t2) = 0;
32325c28e8Piotr Jasiukajtis			x1_or_one[0] = x1;
32425c28e8Piotr Jasiukajtis			x1_or_one[2] = -x1;
32525c28e8Piotr Jasiukajtis			x0 = (x0 - t0) + y0;
32625c28e8Piotr Jasiukajtis			y1_or_zero[0] = y1;
32725c28e8Piotr Jasiukajtis			y1_or_zero[2] = -y1;
32825c28e8Piotr Jasiukajtis			x2 = (x2 - t2) + y2;
32925c28e8Piotr Jasiukajtis			z0 = x0 * x0;
33025c28e8Piotr Jasiukajtis			z1 = x1 * x1;
33125c28e8Piotr Jasiukajtis			z2 = x2 * x2;
33225c28e8Piotr Jasiukajtis			t0 = z0 * (qq1 + z0 * qq2);
33325c28e8Piotr Jasiukajtis			t1 = z1 * (poly3[j1] + z1 * poly4[j1]);
33425c28e8Piotr Jasiukajtis			t2 = z2 * (qq1 + z2 * qq2);
33525c28e8Piotr Jasiukajtis			w0 = x0 * (one + z0 * (pp1 + z0 * pp2));
33625c28e8Piotr Jasiukajtis			t1 = z1 * (poly1[j1] + z1 * (poly2[j1] + t1));
33725c28e8Piotr Jasiukajtis			w2 = x2 * (one + z2 * (pp1 + z2 * pp2));
33825c28e8Piotr Jasiukajtis			j0 = (((j0 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
33925c28e8Piotr Jasiukajtis			j2 = (((j2 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
34025c28e8Piotr Jasiukajtis			xsb0 = (xsb0 >> 30) & 2;
34125c28e8Piotr Jasiukajtis			xsb2 = (xsb2 >> 30) & 2;
34225c28e8Piotr Jasiukajtis			n0 ^= (xsb0 & ~(n0 << 1));
34325c28e8Piotr Jasiukajtis			n2 ^= (xsb2 & ~(n2 << 1));
34425c28e8Piotr Jasiukajtis			xsb0 |= 1;
34525c28e8Piotr Jasiukajtis			xsb2 |= 1;
34625c28e8Piotr Jasiukajtis			a0 = __vlibm_TBL_sincos_hi[j0+n0];
34725c28e8Piotr Jasiukajtis			a2 = __vlibm_TBL_sincos_hi[j2+n2];
34825c28e8Piotr Jasiukajtis			t0 = (__vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0) + __vlibm_TBL_sincos_lo[j0+n0];
34925c28e8Piotr Jasiukajtis			t1 = x1_or_one[n1] + (y1_or_zero[n1] + x1_or_one[n1] * t1);
35025c28e8Piotr Jasiukajtis			t2 = (__vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2) + __vlibm_TBL_sincos_lo[j2+n2];
35125c28e8Piotr Jasiukajtis			*py0 = ( a0 + t0 );
35225c28e8Piotr Jasiukajtis			*py1 = t1;
35325c28e8Piotr Jasiukajtis			*py2 = ( a2 + t2 );
35425c28e8Piotr Jasiukajtis			break;
35525c28e8Piotr Jasiukajtis
35625c28e8Piotr Jasiukajtis		case 3:
35725c28e8Piotr Jasiukajtis			j0 = n0 & 1;
35825c28e8Piotr Jasiukajtis			j1 = n1 & 1;
35925c28e8Piotr Jasiukajtis			j2 = (xsb2 + 0x4000) & 0xffff8000;
36025c28e8Piotr Jasiukajtis			HI(&t2) = j2;
36125c28e8Piotr Jasiukajtis			LO(&t2) = 0;
36225c28e8Piotr Jasiukajtis			x0_or_one[0] = x0;
36325c28e8Piotr Jasiukajtis			x0_or_one[2] = -x0;
36425c28e8Piotr Jasiukajtis			x1_or_one[0] = x1;
36525c28e8Piotr Jasiukajtis			x1_or_one[2] = -x1;
36625c28e8Piotr Jasiukajtis			y0_or_zero[0] = y0;
36725c28e8Piotr Jasiukajtis			y0_or_zero[2] = -y0;
36825c28e8Piotr Jasiukajtis			y1_or_zero[0] = y1;
36925c28e8Piotr Jasiukajtis			y1_or_zero[2] = -y1;
37025c28e8Piotr Jasiukajtis			x2 = (x2 - t2) + y2;
37125c28e8Piotr Jasiukajtis			z0 = x0 * x0;
37225c28e8Piotr Jasiukajtis			z1 = x1 * x1;
37325c28e8Piotr Jasiukajtis			z2 = x2 * x2;
37425c28e8Piotr Jasiukajtis			t0 = z0 * (poly3[j0] + z0 * poly4[j0]);
37525c28e8Piotr Jasiukajtis			t1 = z1 * (poly3[j1] + z1 * poly4[j1]);
37625c28e8Piotr Jasiukajtis			t2 = z2 * (qq1 + z2 * qq2);
37725c28e8Piotr Jasiukajtis			t0 = z0 * (poly1[j0] + z0 * (poly2[j0] + t0));
37825c28e8Piotr Jasiukajtis			t1 = z1 * (poly1[j1] + z1 * (poly2[j1] + t1));
37925c28e8Piotr Jasiukajtis			w2 = x2 * (one + z2 * (pp1 + z2 * pp2));
38025c28e8Piotr Jasiukajtis			j2 = (((j2 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
38125c28e8Piotr Jasiukajtis			xsb2 = (xsb2 >> 30) & 2;
38225c28e8Piotr Jasiukajtis			n2 ^= (xsb2 & ~(n2 << 1));
38325c28e8Piotr Jasiukajtis			xsb2 |= 1;
38425c28e8Piotr Jasiukajtis			a2 = __vlibm_TBL_sincos_hi[j2+n2];
38525c28e8Piotr Jasiukajtis			t0 = x0_or_one[n0] + (y0_or_zero[n0] + x0_or_one[n0] * t0);
38625c28e8Piotr Jasiukajtis			t1 = x1_or_one[n1] + (y1_or_zero[n1] + x1_or_one[n1] * t1);
38725c28e8Piotr Jasiukajtis			t2 = (__vlibm_TBL_sincos_hi[j2+((n2+xsb2)&3)] * w2 + a2 * t2) + __vlibm_TBL_sincos_lo[j2+n2];
38825c28e8Piotr Jasiukajtis			*py0 = t0;
38925c28e8Piotr Jasiukajtis			*py1 = t1;
39025c28e8Piotr Jasiukajtis			*py2 = ( a2 + t2 );
39125c28e8Piotr Jasiukajtis			break;
39225c28e8Piotr Jasiukajtis
39325c28e8Piotr Jasiukajtis		case 4:
39425c28e8Piotr Jasiukajtis			j0 = (xsb0 + 0x4000) & 0xffff8000;
39525c28e8Piotr Jasiukajtis			j1 = (xsb1 + 0x4000) & 0xffff8000;
39625c28e8Piotr Jasiukajtis			j2 = n2 & 1;
39725c28e8Piotr Jasiukajtis			HI(&t0) = j0;
39825c28e8Piotr Jasiukajtis			HI(&t1) = j1;
39925c28e8Piotr Jasiukajtis			LO(&t0) = 0;
40025c28e8Piotr Jasiukajtis			LO(&t1) = 0;
40125c28e8Piotr Jasiukajtis			x2_or_one[0] = x2;
40225c28e8Piotr Jasiukajtis			x2_or_one[2] = -x2;
40325c28e8Piotr Jasiukajtis			x0 = (x0 - t0) + y0;
40425c28e8Piotr Jasiukajtis			x1 = (x1 - t1) + y1;
40525c28e8Piotr Jasiukajtis			y2_or_zero[0] = y2;
40625c28e8Piotr Jasiukajtis			y2_or_zero[2] = -y2;
40725c28e8Piotr Jasiukajtis			z0 = x0 * x0;
40825c28e8Piotr Jasiukajtis			z1 = x1 * x1;
40925c28e8Piotr Jasiukajtis			z2 = x2 * x2;
41025c28e8Piotr Jasiukajtis			t0 = z0 * (qq1 + z0 * qq2);
41125c28e8Piotr Jasiukajtis			t1 = z1 * (qq1 + z1 * qq2);
41225c28e8Piotr Jasiukajtis			t2 = z2 * (poly3[j2] + z2 * poly4[j2]);
41325c28e8Piotr Jasiukajtis			w0 = x0 * (one + z0 * (pp1 + z0 * pp2));
41425c28e8Piotr Jasiukajtis			w1 = x1 * (one + z1 * (pp1 + z1 * pp2));
41525c28e8Piotr Jasiukajtis			t2 = z2 * (poly1[j2] + z2 * (poly2[j2] + t2));
41625c28e8Piotr Jasiukajtis			j0 = (((j0 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
41725c28e8Piotr Jasiukajtis			j1 = (((j1 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
41825c28e8Piotr Jasiukajtis			xsb0 = (xsb0 >> 30) & 2;
41925c28e8Piotr Jasiukajtis			xsb1 = (xsb1 >> 30) & 2;
42025c28e8Piotr Jasiukajtis			n0 ^= (xsb0 & ~(n0 << 1));
42125c28e8Piotr Jasiukajtis			n1 ^= (xsb1 & ~(n1 << 1));
42225c28e8Piotr Jasiukajtis			xsb0 |= 1;
42325c28e8Piotr Jasiukajtis			xsb1 |= 1;
42425c28e8Piotr Jasiukajtis			a0 = __vlibm_TBL_sincos_hi[j0+n0];
42525c28e8Piotr Jasiukajtis			a1 = __vlibm_TBL_sincos_hi[j1+n1];
42625c28e8Piotr Jasiukajtis			t0 = (__vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0) + __vlibm_TBL_sincos_lo[j0+n0];
42725c28e8Piotr Jasiukajtis			t1 = (__vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1) + __vlibm_TBL_sincos_lo[j1+n1];
42825c28e8Piotr Jasiukajtis			t2 = x2_or_one[n2] + (y2_or_zero[n2] + x2_or_one[n2] * t2);
42925c28e8Piotr Jasiukajtis			*py0 = ( a0 + t0 );
43025c28e8Piotr Jasiukajtis			*py1 = ( a1 + t1 );
43125c28e8Piotr Jasiukajtis			*py2 = t2;
43225c28e8Piotr Jasiukajtis			break;
43325c28e8Piotr Jasiukajtis
43425c28e8Piotr Jasiukajtis		case 5:
43525c28e8Piotr Jasiukajtis			j0 = n0 & 1;
43625c28e8Piotr Jasiukajtis			j1 = (xsb1 + 0x4000) & 0xffff8000;
43725c28e8Piotr Jasiukajtis			j2 = n2 & 1;
43825c28e8Piotr Jasiukajtis			HI(&t1) = j1;
43925c28e8Piotr Jasiukajtis			LO(&t1) = 0;
44025c28e8Piotr Jasiukajtis			x0_or_one[0] = x0;
44125c28e8Piotr Jasiukajtis			x0_or_one[2] = -x0;
44225c28e8Piotr Jasiukajtis			x2_or_one[0] = x2;
44325c28e8Piotr Jasiukajtis			x2_or_one[2] = -x2;
44425c28e8Piotr Jasiukajtis			y0_or_zero[0] = y0;
44525c28e8Piotr Jasiukajtis			y0_or_zero[2] = -y0;
44625c28e8Piotr Jasiukajtis			x1 = (x1 - t1) + y1;
44725c28e8Piotr Jasiukajtis			y2_or_zero[0] = y2;
44825c28e8Piotr Jasiukajtis			y2_or_zero[2] = -y2;
44925c28e8Piotr Jasiukajtis			z0 = x0 * x0;
45025c28e8Piotr Jasiukajtis			z1 = x1 * x1;
45125c28e8Piotr Jasiukajtis			z2 = x2 * x2;
45225c28e8Piotr Jasiukajtis			t0 = z0 * (poly3[j0] + z0 * poly4[j0]);
45325c28e8Piotr Jasiukajtis			t1 = z1 * (qq1 + z1 * qq2);
45425c28e8Piotr Jasiukajtis			t2 = z2 * (poly3[j2] + z2 * poly4[j2]);
45525c28e8Piotr Jasiukajtis			t0 = z0 * (poly1[j0] + z0 * (poly2[j0] + t0));
45625c28e8Piotr Jasiukajtis			w1 = x1 * (one + z1 * (pp1 + z1 * pp2));
45725c28e8Piotr Jasiukajtis			t2 = z2 * (poly1[j2] + z2 * (poly2[j2] + t2));
45825c28e8Piotr Jasiukajtis			j1 = (((j1 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
45925c28e8Piotr Jasiukajtis			xsb1 = (xsb1 >> 30) & 2;
46025c28e8Piotr Jasiukajtis			n1 ^= (xsb1 & ~(n1 << 1));
46125c28e8Piotr Jasiukajtis			xsb1 |= 1;
46225c28e8Piotr Jasiukajtis			a1 = __vlibm_TBL_sincos_hi[j1+n1];
46325c28e8Piotr Jasiukajtis			t0 = x0_or_one[n0] + (y0_or_zero[n0] + x0_or_one[n0] * t0);
46425c28e8Piotr Jasiukajtis			t1 = (__vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1) + __vlibm_TBL_sincos_lo[j1+n1];
46525c28e8Piotr Jasiukajtis			t2 = x2_or_one[n2] + (y2_or_zero[n2] + x2_or_one[n2] * t2);
46625c28e8Piotr Jasiukajtis			*py0 = t0;
46725c28e8Piotr Jasiukajtis			*py1 = ( a1 + t1 );
46825c28e8Piotr Jasiukajtis			*py2 = t2;
46925c28e8Piotr Jasiukajtis			break;
47025c28e8Piotr Jasiukajtis
47125c28e8Piotr Jasiukajtis		case 6:
47225c28e8Piotr Jasiukajtis			j0 = (xsb0 + 0x4000) & 0xffff8000;
47325c28e8Piotr Jasiukajtis			j1 = n1 & 1;
47425c28e8Piotr Jasiukajtis			j2 = n2 & 1;
47525c28e8Piotr Jasiukajtis			HI(&t0) = j0;
47625c28e8Piotr Jasiukajtis			LO(&t0) = 0;
47725c28e8Piotr Jasiukajtis			x1_or_one[0] = x1;
47825c28e8Piotr Jasiukajtis			x1_or_one[2] = -x1;
47925c28e8Piotr Jasiukajtis			x2_or_one[0] = x2;
48025c28e8Piotr Jasiukajtis			x2_or_one[2] = -x2;
48125c28e8Piotr Jasiukajtis			x0 = (x0 - t0) + y0;
48225c28e8Piotr Jasiukajtis			y1_or_zero[0] = y1;
48325c28e8Piotr Jasiukajtis			y1_or_zero[2] = -y1;
48425c28e8Piotr Jasiukajtis			y2_or_zero[0] = y2;
48525c28e8Piotr Jasiukajtis			y2_or_zero[2] = -y2;
48625c28e8Piotr Jasiukajtis			z0 = x0 * x0;
48725c28e8Piotr Jasiukajtis			z1 = x1 * x1;
48825c28e8Piotr Jasiukajtis			z2 = x2 * x2;
48925c28e8Piotr Jasiukajtis			t0 = z0 * (qq1 + z0 * qq2);
49025c28e8Piotr Jasiukajtis			t1 = z1 * (poly3[j1] + z1 * poly4[j1]);
49125c28e8Piotr Jasiukajtis			t2 = z2 * (poly3[j2] + z2 * poly4[j2]);
49225c28e8Piotr Jasiukajtis			w0 = x0 * (one + z0 * (pp1 + z0 * pp2));
49325c28e8Piotr Jasiukajtis			t1 = z1 * (poly1[j1] + z1 * (poly2[j1] + t1));
49425c28e8Piotr Jasiukajtis			t2 = z2 * (poly1[j2] + z2 * (poly2[j2] + t2));
49525c28e8Piotr Jasiukajtis			j0 = (((j0 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
49625c28e8Piotr Jasiukajtis			xsb0 = (xsb0 >> 30) & 2;
49725c28e8Piotr Jasiukajtis			n0 ^= (xsb0 & ~(n0 << 1));
49825c28e8Piotr Jasiukajtis			xsb0 |= 1;
49925c28e8Piotr Jasiukajtis			a0 = __vlibm_TBL_sincos_hi[j0+n0];
50025c28e8Piotr Jasiukajtis			t0 = (__vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0) + __vlibm_TBL_sincos_lo[j0+n0];
50125c28e8Piotr Jasiukajtis			t1 = x1_or_one[n1] + (y1_or_zero[n1] + x1_or_one[n1] * t1);
50225c28e8Piotr Jasiukajtis			t2 = x2_or_one[n2] + (y2_or_zero[n2] + x2_or_one[n2] * t2);
50325c28e8Piotr Jasiukajtis			*py0 = ( a0 + t0 );
50425c28e8Piotr Jasiukajtis			*py1 = t1;
50525c28e8Piotr Jasiukajtis			*py2 = t2;
50625c28e8Piotr Jasiukajtis			break;
50725c28e8Piotr Jasiukajtis
50825c28e8Piotr Jasiukajtis		case 7:
50925c28e8Piotr Jasiukajtis			j0 = n0 & 1;
51025c28e8Piotr Jasiukajtis			j1 = n1 & 1;
51125c28e8Piotr Jasiukajtis			j2 = n2 & 1;
51225c28e8Piotr Jasiukajtis			x0_or_one[0] = x0;
51325c28e8Piotr Jasiukajtis			x0_or_one[2] = -x0;
51425c28e8Piotr Jasiukajtis			x1_or_one[0] = x1;
51525c28e8Piotr Jasiukajtis			x1_or_one[2] = -x1;
51625c28e8Piotr Jasiukajtis			x2_or_one[0] = x2;
51725c28e8Piotr Jasiukajtis			x2_or_one[2] = -x2;
51825c28e8Piotr Jasiukajtis			y0_or_zero[0] = y0;
51925c28e8Piotr Jasiukajtis			y0_or_zero[2] = -y0;
52025c28e8Piotr Jasiukajtis			y1_or_zero[0] = y1;
52125c28e8Piotr Jasiukajtis			y1_or_zero[2] = -y1;
52225c28e8Piotr Jasiukajtis			y2_or_zero[0] = y2;
52325c28e8Piotr Jasiukajtis			y2_or_zero[2] = -y2;
52425c28e8Piotr Jasiukajtis			z0 = x0 * x0;
52525c28e8Piotr Jasiukajtis			z1 = x1 * x1;
52625c28e8Piotr Jasiukajtis			z2 = x2 * x2;
52725c28e8Piotr Jasiukajtis			t0 = z0 * (poly3[j0] + z0 * poly4[j0]);
52825c28e8Piotr Jasiukajtis			t1 = z1 * (poly3[j1] + z1 * poly4[j1]);
52925c28e8Piotr Jasiukajtis			t2 = z2 * (poly3[j2] + z2 * poly4[j2]);
53025c28e8Piotr Jasiukajtis			t0 = z0 * (poly1[j0] + z0 * (poly2[j0] + t0));
53125c28e8Piotr Jasiukajtis			t1 = z1 * (poly1[j1] + z1 * (poly2[j1] + t1));
53225c28e8Piotr Jasiukajtis			t2 = z2 * (poly1[j2] + z2 * (poly2[j2] + t2));
53325c28e8Piotr Jasiukajtis			t0 = x0_or_one[n0] + (y0_or_zero[n0] + x0_or_one[n0] * t0);
53425c28e8Piotr Jasiukajtis			t1 = x1_or_one[n1] + (y1_or_zero[n1] + x1_or_one[n1] * t1);
53525c28e8Piotr Jasiukajtis			t2 = x2_or_one[n2] + (y2_or_zero[n2] + x2_or_one[n2] * t2);
53625c28e8Piotr Jasiukajtis			*py0 = t0;
53725c28e8Piotr Jasiukajtis			*py1 = t1;
53825c28e8Piotr Jasiukajtis			*py2 = t2;
53925c28e8Piotr Jasiukajtis			break;
54025c28e8Piotr Jasiukajtis		}
54125c28e8Piotr Jasiukajtis
54225c28e8Piotr Jasiukajtis		x += stridex;
54325c28e8Piotr Jasiukajtis		y += stridey;
54425c28e8Piotr Jasiukajtis		i = 0;
54525c28e8Piotr Jasiukajtis	} while (--n > 0);
54625c28e8Piotr Jasiukajtis
54725c28e8Piotr Jasiukajtis	if (i > 0)
54825c28e8Piotr Jasiukajtis	{
54925c28e8Piotr Jasiukajtis		double		fn0, fn1, a0, a1, w0, w1, y0, y1;
55025c28e8Piotr Jasiukajtis		double		t0, t1, z0, z1;
55125c28e8Piotr Jasiukajtis		unsigned	j0, j1;
55225c28e8Piotr Jasiukajtis		int			n0, n1;
55325c28e8Piotr Jasiukajtis
55425c28e8Piotr Jasiukajtis		if (i > 1)
55525c28e8Piotr Jasiukajtis		{
55625c28e8Piotr Jasiukajtis			n1 = (int) (x1 * invpio2 + half[xsb1]);
55725c28e8Piotr Jasiukajtis			fn1 = (double) n1;
55825c28e8Piotr Jasiukajtis			n1 &= 3;
55925c28e8Piotr Jasiukajtis			a1 = x1 - fn1 * pio2_1;
56025c28e8Piotr Jasiukajtis			w1 = fn1 * pio2_2;
56125c28e8Piotr Jasiukajtis			x1 = a1 - w1;
56225c28e8Piotr Jasiukajtis			y1 = (a1 - x1) - w1;
56325c28e8Piotr Jasiukajtis			a1 = x1;
56425c28e8Piotr Jasiukajtis			w1 = fn1 * pio2_3 - y1;
56525c28e8Piotr Jasiukajtis			x1 = a1 - w1;
56625c28e8Piotr Jasiukajtis			y1 = (a1 - x1) - w1;
56725c28e8Piotr Jasiukajtis			a1 = x1;
56825c28e8Piotr Jasiukajtis			w1 = fn1 * pio2_3t - y1;
56925c28e8Piotr Jasiukajtis			x1 = a1 - w1;
57025c28e8Piotr Jasiukajtis			y1 = (a1 - x1) - w1;
57125c28e8Piotr Jasiukajtis			xsb1 = HI(&x1);
57225c28e8Piotr Jasiukajtis			if ((xsb1 & ~0x80000000) < thresh[n1&1])
57325c28e8Piotr Jasiukajtis			{
57425c28e8Piotr Jasiukajtis				j1 = n1 & 1;
57525c28e8Piotr Jasiukajtis				x1_or_one[0] = x1;
57625c28e8Piotr Jasiukajtis				x1_or_one[2] = -x1;
57725c28e8Piotr Jasiukajtis				y1_or_zero[0] = y1;
57825c28e8Piotr Jasiukajtis				y1_or_zero[2] = -y1;
57925c28e8Piotr Jasiukajtis				z1 = x1 * x1;
58025c28e8Piotr Jasiukajtis				t1 = z1 * (poly3[j1] + z1 * poly4[j1]);
58125c28e8Piotr Jasiukajtis				t1 = z1 * (poly1[j1] + z1 * (poly2[j1] + t1));
58225c28e8Piotr Jasiukajtis				t1 = x1_or_one[n1] + (y1_or_zero[n1] + x1_or_one[n1] * t1);
58325c28e8Piotr Jasiukajtis				*py1 = t1;
58425c28e8Piotr Jasiukajtis			}
58525c28e8Piotr Jasiukajtis			else
58625c28e8Piotr Jasiukajtis			{
58725c28e8Piotr Jasiukajtis				j1 = (xsb1 + 0x4000) & 0xffff8000;
58825c28e8Piotr Jasiukajtis				HI(&t1) = j1;
58925c28e8Piotr Jasiukajtis				LO(&t1) = 0;
59025c28e8Piotr Jasiukajtis				x1 = (x1 - t1) + y1;
59125c28e8Piotr Jasiukajtis				z1 = x1 * x1;
59225c28e8Piotr Jasiukajtis				t1 = z1 * (qq1 + z1 * qq2);
59325c28e8Piotr Jasiukajtis				w1 = x1 * (one + z1 * (pp1 + z1 * pp2));
59425c28e8Piotr Jasiukajtis				j1 = (((j1 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
59525c28e8Piotr Jasiukajtis				xsb1 = (xsb1 >> 30) & 2;
59625c28e8Piotr Jasiukajtis				n1 ^= (xsb1 & ~(n1 << 1));
59725c28e8Piotr Jasiukajtis				xsb1 |= 1;
59825c28e8Piotr Jasiukajtis				a1 = __vlibm_TBL_sincos_hi[j1+n1];
59925c28e8Piotr Jasiukajtis				t1 = (__vlibm_TBL_sincos_hi[j1+((n1+xsb1)&3)] * w1 + a1 * t1) + __vlibm_TBL_sincos_lo[j1+n1];
60025c28e8Piotr Jasiukajtis				*py1 = ( a1 + t1 );
60125c28e8Piotr Jasiukajtis			}
60225c28e8Piotr Jasiukajtis		}
60325c28e8Piotr Jasiukajtis		n0 = (int) (x0 * invpio2 + half[xsb0]);
60425c28e8Piotr Jasiukajtis		fn0 = (double) n0;
60525c28e8Piotr Jasiukajtis		n0 &= 3;
60625c28e8Piotr Jasiukajtis		a0 = x0 - fn0 * pio2_1;
60725c28e8Piotr Jasiukajtis		w0 = fn0 * pio2_2;
60825c28e8Piotr Jasiukajtis		x0 = a0 - w0;
60925c28e8Piotr Jasiukajtis		y0 = (a0 - x0) - w0;
61025c28e8Piotr Jasiukajtis		a0 = x0;
61125c28e8Piotr Jasiukajtis		w0 = fn0 * pio2_3 - y0;
61225c28e8Piotr Jasiukajtis		x0 = a0 - w0;
61325c28e8Piotr Jasiukajtis		y0 = (a0 - x0) - w0;
61425c28e8Piotr Jasiukajtis		a0 = x0;
61525c28e8Piotr Jasiukajtis		w0 = fn0 * pio2_3t - y0;
61625c28e8Piotr Jasiukajtis		x0 = a0 - w0;
61725c28e8Piotr Jasiukajtis		y0 = (a0 - x0) - w0;
61825c28e8Piotr Jasiukajtis		xsb0 = HI(&x0);
61925c28e8Piotr Jasiukajtis		if ((xsb0 & ~0x80000000) < thresh[n0&1])
62025c28e8Piotr Jasiukajtis		{
62125c28e8Piotr Jasiukajtis			j0 = n0 & 1;
62225c28e8Piotr Jasiukajtis			x0_or_one[0] = x0;
62325c28e8Piotr Jasiukajtis			x0_or_one[2] = -x0;
62425c28e8Piotr Jasiukajtis			y0_or_zero[0] = y0;
62525c28e8Piotr Jasiukajtis			y0_or_zero[2] = -y0;
62625c28e8Piotr Jasiukajtis			z0 = x0 * x0;
62725c28e8Piotr Jasiukajtis			t0 = z0 * (poly3[j0] + z0 * poly4[j0]);
62825c28e8Piotr Jasiukajtis			t0 = z0 * (poly1[j0] + z0 * (poly2[j0] + t0));
62925c28e8Piotr Jasiukajtis			t0 = x0_or_one[n0] + (y0_or_zero[n0] + x0_or_one[n0] * t0);
63025c28e8Piotr Jasiukajtis			*py0 = t0;
63125c28e8Piotr Jasiukajtis		}
63225c28e8Piotr Jasiukajtis		else
63325c28e8Piotr Jasiukajtis		{
63425c28e8Piotr Jasiukajtis			j0 = (xsb0 + 0x4000) & 0xffff8000;
63525c28e8Piotr Jasiukajtis			HI(&t0) = j0;
63625c28e8Piotr Jasiukajtis			LO(&t0) = 0;
63725c28e8Piotr Jasiukajtis			x0 = (x0 - t0) + y0;
63825c28e8Piotr Jasiukajtis			z0 = x0 * x0;
63925c28e8Piotr Jasiukajtis			t0 = z0 * (qq1 + z0 * qq2);
64025c28e8Piotr Jasiukajtis			w0 = x0 * (one + z0 * (pp1 + z0 * pp2));
64125c28e8Piotr Jasiukajtis			j0 = (((j0 & ~0x80000000) - 0x3fc40000) >> 13) & ~0x3;
64225c28e8Piotr Jasiukajtis			xsb0 = (xsb0 >> 30) & 2;
64325c28e8Piotr Jasiukajtis			n0 ^= (xsb0 & ~(n0 << 1));
64425c28e8Piotr Jasiukajtis			xsb0 |= 1;
64525c28e8Piotr Jasiukajtis			a0 = __vlibm_TBL_sincos_hi[j0+n0];
64625c28e8Piotr Jasiukajtis			t0 = (__vlibm_TBL_sincos_hi[j0+((n0+xsb0)&3)] * w0 + a0 * t0) + __vlibm_TBL_sincos_lo[j0+n0];
64725c28e8Piotr Jasiukajtis			*py0 = ( a0 + t0 );
64825c28e8Piotr Jasiukajtis		}
64925c28e8Piotr Jasiukajtis	}
65025c28e8Piotr Jasiukajtis
65125c28e8Piotr Jasiukajtis	if (biguns)
65225c28e8Piotr Jasiukajtis		__vlibm_vsin_big(nsave, xsave, sxsave, ysave, sysave, 0x413921fb);
65325c28e8Piotr Jasiukajtis}
654