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 * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
2325c28e8Piotr Jasiukajtis */
2425c28e8Piotr Jasiukajtis/*
2525c28e8Piotr Jasiukajtis * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
2625c28e8Piotr Jasiukajtis * Use is subject to license terms.
2725c28e8Piotr Jasiukajtis */
2825c28e8Piotr Jasiukajtis
2925c28e8Piotr Jasiukajtis/*
3025c28e8Piotr Jasiukajtis * __vcosf: single precision vector cos
3125c28e8Piotr Jasiukajtis *
3225c28e8Piotr Jasiukajtis * Algorithm:
3325c28e8Piotr Jasiukajtis *
3425c28e8Piotr Jasiukajtis * For |x| < pi/4, approximate sin(x) by a polynomial x+x*z*(S0+
3525c28e8Piotr Jasiukajtis * z*(S1+z*S2)) and cos(x) by a polynomial 1+z*(-1/2+z*(C0+z*(C1+
3625c28e8Piotr Jasiukajtis * z*C2))), where z = x*x, all evaluated in double precision.
3725c28e8Piotr Jasiukajtis *
3825c28e8Piotr Jasiukajtis * Accuracy:
3925c28e8Piotr Jasiukajtis *
4025c28e8Piotr Jasiukajtis * The largest error is less than 0.6 ulps.
4125c28e8Piotr Jasiukajtis */
4225c28e8Piotr Jasiukajtis
4325c28e8Piotr Jasiukajtis#include <sys/isa_defs.h>
4425c28e8Piotr Jasiukajtis
4525c28e8Piotr Jasiukajtis#ifdef _LITTLE_ENDIAN
4625c28e8Piotr Jasiukajtis#define	HI(x)	*(1+(int *)&x)
4725c28e8Piotr Jasiukajtis#define	LO(x)	*(unsigned *)&x
4825c28e8Piotr Jasiukajtis#else
4925c28e8Piotr Jasiukajtis#define	HI(x)	*(int *)&x
5025c28e8Piotr Jasiukajtis#define	LO(x)	*(1+(unsigned *)&x)
5125c28e8Piotr Jasiukajtis#endif
5225c28e8Piotr Jasiukajtis
5325c28e8Piotr Jasiukajtis#ifdef __RESTRICT
5425c28e8Piotr Jasiukajtis#define	restrict _Restrict
5525c28e8Piotr Jasiukajtis#else
5625c28e8Piotr Jasiukajtis#define	restrict
5725c28e8Piotr Jasiukajtis#endif
5825c28e8Piotr Jasiukajtis
5925c28e8Piotr Jasiukajtisextern int __vlibm_rem_pio2m(double *, double *, int, int, int);
6025c28e8Piotr Jasiukajtis
6125c28e8Piotr Jasiukajtisstatic const double C[] = {
6225c28e8Piotr Jasiukajtis	-1.66666552424430847168e-01,	/* 2^ -3 * -1.5555460000000 */
6325c28e8Piotr Jasiukajtis	8.33219196647405624390e-03,	/* 2^ -7 *  1.11077E0000000 */
6425c28e8Piotr Jasiukajtis	-1.95187909412197768688e-04,	/* 2^-13 * -1.9956B60000000 */
6525c28e8Piotr Jasiukajtis	1.0,
6625c28e8Piotr Jasiukajtis	-0.5,
6725c28e8Piotr Jasiukajtis	4.16666455566883087158e-02,	/* 2^ -5 *  1.55554A0000000 */
6825c28e8Piotr Jasiukajtis	-1.38873036485165357590e-03,	/* 2^-10 * -1.6C0C1E0000000 */
6925c28e8Piotr Jasiukajtis	2.44309903791872784495e-05,	/* 2^-16 *  1.99E24E0000000 */
7025c28e8Piotr Jasiukajtis	0.636619772367581343075535,	/* 2^ -1  * 1.45F306DC9C883 */
7125c28e8Piotr Jasiukajtis	6755399441055744.0,		/* 2^ 52  * 1.8000000000000 */
7225c28e8Piotr Jasiukajtis	1.570796326734125614166,	/* 2^  0  * 1.921FB54400000 */
7325c28e8Piotr Jasiukajtis	6.077100506506192601475e-11,	/* 2^-34  * 1.0B4611A626331 */
7425c28e8Piotr Jasiukajtis};
7525c28e8Piotr Jasiukajtis
7625c28e8Piotr Jasiukajtis#define	S0	C[0]
7725c28e8Piotr Jasiukajtis#define	S1	C[1]
7825c28e8Piotr Jasiukajtis#define	S2	C[2]
7925c28e8Piotr Jasiukajtis#define	one	C[3]
8025c28e8Piotr Jasiukajtis#define	mhalf	C[4]
8125c28e8Piotr Jasiukajtis#define	C0	C[5]
8225c28e8Piotr Jasiukajtis#define	C1	C[6]
8325c28e8Piotr Jasiukajtis#define	C2	C[7]
8425c28e8Piotr Jasiukajtis#define	invpio2	C[8]
8525c28e8Piotr Jasiukajtis#define	c3two51	C[9]
8625c28e8Piotr Jasiukajtis#define	pio2_1  C[10]
8725c28e8Piotr Jasiukajtis#define	pio2_t	C[11]
8825c28e8Piotr Jasiukajtis
8925c28e8Piotr Jasiukajtis#define	PREPROCESS(N, index, label)					\
9025c28e8Piotr Jasiukajtis	hx = *(int *)x;							\
9125c28e8Piotr Jasiukajtis	ix = hx & 0x7fffffff;						\
9225c28e8Piotr Jasiukajtis	t = *x;								\
9325c28e8Piotr Jasiukajtis	x += stridex;							\
9425c28e8Piotr Jasiukajtis	if (ix <= 0x3f490fdb) { /* |x| < pi/4 */			\
9525c28e8Piotr Jasiukajtis		if (ix == 0) {						\
9625c28e8Piotr Jasiukajtis			y[index] = one;					\
9725c28e8Piotr Jasiukajtis			goto label;					\
9825c28e8Piotr Jasiukajtis		}							\
9925c28e8Piotr Jasiukajtis		y##N = (double)t;					\
10025c28e8Piotr Jasiukajtis		n##N = 1;						\
10125c28e8Piotr Jasiukajtis	} else if (ix <= 0x49c90fdb) { /* |x| < 2^19*pi */		\
10225c28e8Piotr Jasiukajtis		y##N = (double)t;					\
10325c28e8Piotr Jasiukajtis		medium = 1;						\
10425c28e8Piotr Jasiukajtis	} else {							\
10525c28e8Piotr Jasiukajtis		if (ix >= 0x7f800000) { /* inf or nan */		\
10625c28e8Piotr Jasiukajtis			y[index] = t / t;				\
10725c28e8Piotr Jasiukajtis			goto label;					\
10825c28e8Piotr Jasiukajtis		}							\
10925c28e8Piotr Jasiukajtis		z##N = y##N = (double)t;				\
11025c28e8Piotr Jasiukajtis		hx = HI(y##N);						\
11125c28e8Piotr Jasiukajtis		n##N = ((hx >> 20) & 0x7ff) - 1046;			\
11225c28e8Piotr Jasiukajtis		HI(z##N) = (hx & 0xfffff) | 0x41600000;			\
11325c28e8Piotr Jasiukajtis		n##N = __vlibm_rem_pio2m(&z##N, &y##N, n##N, 1, 0) + 1;	\
11425c28e8Piotr Jasiukajtis		z##N = y##N * y##N;					\
11525c28e8Piotr Jasiukajtis		if (n##N & 1) { /* compute cos y */			\
11625c28e8Piotr Jasiukajtis			f##N = (float)(one + z##N * (mhalf + z##N *	\
11725c28e8Piotr Jasiukajtis			    (C0 + z##N * (C1 + z##N * C2))));		\
11825c28e8Piotr Jasiukajtis		} else { /* compute sin y */				\
11925c28e8Piotr Jasiukajtis			f##N = (float)(y##N + y##N * z##N * (S0 +	\
12025c28e8Piotr Jasiukajtis			    z##N * (S1 + z##N * S2)));			\
12125c28e8Piotr Jasiukajtis		}							\
12225c28e8Piotr Jasiukajtis		y[index] = (n##N & 2)? -f##N : f##N;			\
12325c28e8Piotr Jasiukajtis		goto label;						\
12425c28e8Piotr Jasiukajtis	}
12525c28e8Piotr Jasiukajtis
12625c28e8Piotr Jasiukajtis#define	PROCESS(N)							\
12725c28e8Piotr Jasiukajtis	if (medium) {							\
12825c28e8Piotr Jasiukajtis		z##N = y##N * invpio2 + c3two51;			\
12925c28e8Piotr Jasiukajtis		n##N = LO(z##N) + 1;					\
13025c28e8Piotr Jasiukajtis		z##N -= c3two51;					\
13125c28e8Piotr Jasiukajtis		y##N = (y##N - z##N * pio2_1) - z##N * pio2_t;		\
13225c28e8Piotr Jasiukajtis	}								\
13325c28e8Piotr Jasiukajtis	z##N = y##N * y##N;						\
13425c28e8Piotr Jasiukajtis	if (n##N & 1) { /* compute cos y */				\
13525c28e8Piotr Jasiukajtis		f##N = (float)(one + z##N * (mhalf + z##N * (C0 +	\
13625c28e8Piotr Jasiukajtis		    z##N * (C1 + z##N * C2))));				\
13725c28e8Piotr Jasiukajtis	} else { /* compute sin y */					\
13825c28e8Piotr Jasiukajtis		f##N = (float)(y##N + y##N * z##N * (S0 + z##N * (S1 +	\
13925c28e8Piotr Jasiukajtis		    z##N * S2)));					\
14025c28e8Piotr Jasiukajtis	}								\
14125c28e8Piotr Jasiukajtis	*y = (n##N & 2)? -f##N : f##N;					\
14225c28e8Piotr Jasiukajtis	y += stridey
14325c28e8Piotr Jasiukajtis
14425c28e8Piotr Jasiukajtisvoid
14525c28e8Piotr Jasiukajtis__vcosf(int n, float *restrict x, int stridex, float *restrict y,
14625c28e8Piotr Jasiukajtis    int stridey)
14725c28e8Piotr Jasiukajtis{
14825c28e8Piotr Jasiukajtis	double		y0, y1, y2, y3;
14925c28e8Piotr Jasiukajtis	double		z0, z1, z2, z3;
15025c28e8Piotr Jasiukajtis	float		f0, f1, f2, f3, t;
15125c28e8Piotr Jasiukajtis	int		n0 = 0, n1 = 0, n2 = 0, n3, hx, ix, medium;
15225c28e8Piotr Jasiukajtis
15325c28e8Piotr Jasiukajtis	y -= stridey;
15425c28e8Piotr Jasiukajtis
15525c28e8Piotr Jasiukajtis	for (;;) {
15625c28e8Piotr Jasiukajtisbegin:
15725c28e8Piotr Jasiukajtis		y += stridey;
15825c28e8Piotr Jasiukajtis
15925c28e8Piotr Jasiukajtis		if (--n < 0)
16025c28e8Piotr Jasiukajtis			break;
16125c28e8Piotr Jasiukajtis
16225c28e8Piotr Jasiukajtis		medium = 0;
16325c28e8Piotr Jasiukajtis		PREPROCESS(0, 0, begin);
16425c28e8Piotr Jasiukajtis
16525c28e8Piotr Jasiukajtis		if (--n < 0)
16625c28e8Piotr Jasiukajtis			goto process1;
16725c28e8Piotr Jasiukajtis
16825c28e8Piotr Jasiukajtis		PREPROCESS(1, stridey, process1);
16925c28e8Piotr Jasiukajtis
17025c28e8Piotr Jasiukajtis		if (--n < 0)
17125c28e8Piotr Jasiukajtis			goto process2;
17225c28e8Piotr Jasiukajtis
17325c28e8Piotr Jasiukajtis		PREPROCESS(2, (stridey << 1), process2);
17425c28e8Piotr Jasiukajtis
17525c28e8Piotr Jasiukajtis		if (--n < 0)
17625c28e8Piotr Jasiukajtis			goto process3;
17725c28e8Piotr Jasiukajtis
17825c28e8Piotr Jasiukajtis		PREPROCESS(3, (stridey << 1) + stridey, process3);
17925c28e8Piotr Jasiukajtis
18025c28e8Piotr Jasiukajtis		if (medium) {
18125c28e8Piotr Jasiukajtis			z0 = y0 * invpio2 + c3two51;
18225c28e8Piotr Jasiukajtis			z1 = y1 * invpio2 + c3two51;
18325c28e8Piotr Jasiukajtis			z2 = y2 * invpio2 + c3two51;
18425c28e8Piotr Jasiukajtis			z3 = y3 * invpio2 + c3two51;
18525c28e8Piotr Jasiukajtis
18625c28e8Piotr Jasiukajtis			n0 = LO(z0) + 1;
18725c28e8Piotr Jasiukajtis			n1 = LO(z1) + 1;
18825c28e8Piotr Jasiukajtis			n2 = LO(z2) + 1;
18925c28e8Piotr Jasiukajtis			n3 = LO(z3) + 1;
19025c28e8Piotr Jasiukajtis
19125c28e8Piotr Jasiukajtis			z0 -= c3two51;
19225c28e8Piotr Jasiukajtis			z1 -= c3two51;
19325c28e8Piotr Jasiukajtis			z2 -= c3two51;
19425c28e8Piotr Jasiukajtis			z3 -= c3two51;
19525c28e8Piotr Jasiukajtis
19625c28e8Piotr Jasiukajtis			y0 = (y0 - z0 * pio2_1) - z0 * pio2_t;
19725c28e8Piotr Jasiukajtis			y1 = (y1 - z1 * pio2_1) - z1 * pio2_t;
19825c28e8Piotr Jasiukajtis			y2 = (y2 - z2 * pio2_1) - z2 * pio2_t;
19925c28e8Piotr Jasiukajtis			y3 = (y3 - z3 * pio2_1) - z3 * pio2_t;
20025c28e8Piotr Jasiukajtis		}
20125c28e8Piotr Jasiukajtis
20225c28e8Piotr Jasiukajtis		z0 = y0 * y0;
20325c28e8Piotr Jasiukajtis		z1 = y1 * y1;
20425c28e8Piotr Jasiukajtis		z2 = y2 * y2;
20525c28e8Piotr Jasiukajtis		z3 = y3 * y3;
20625c28e8Piotr Jasiukajtis
20725c28e8Piotr Jasiukajtis		hx = (n0 & 1) | ((n1 & 1) << 1) | ((n2 & 1) << 2) |
20825c28e8Piotr Jasiukajtis		    ((n3 & 1) << 3);
20925c28e8Piotr Jasiukajtis		switch (hx) {
21025c28e8Piotr Jasiukajtis		case 0:
21125c28e8Piotr Jasiukajtis			f0 = (float)(y0 + y0 * z0 * (S0 + z0 * (S1 + z0 * S2)));
21225c28e8Piotr Jasiukajtis			f1 = (float)(y1 + y1 * z1 * (S0 + z1 * (S1 + z1 * S2)));
21325c28e8Piotr Jasiukajtis			f2 = (float)(y2 + y2 * z2 * (S0 + z2 * (S1 + z2 * S2)));
21425c28e8Piotr Jasiukajtis			f3 = (float)(y3 + y3 * z3 * (S0 + z3 * (S1 + z3 * S2)));
21525c28e8Piotr Jasiukajtis			break;
21625c28e8Piotr Jasiukajtis
21725c28e8Piotr Jasiukajtis		case 1:
21825c28e8Piotr Jasiukajtis			f0 = (float)(one + z0 * (mhalf + z0 * (C0 +
21925c28e8Piotr Jasiukajtis			    z0 * (C1 + z0 * C2))));
22025c28e8Piotr Jasiukajtis			f1 = (float)(y1 + y1 * z1 * (S0 + z1 * (S1 + z1 * S2)));
22125c28e8Piotr Jasiukajtis			f2 = (float)(y2 + y2 * z2 * (S0 + z2 * (S1 + z2 * S2)));
22225c28e8Piotr Jasiukajtis			f3 = (float)(y3 + y3 * z3 * (S0 + z3 * (S1 + z3 * S2)));
22325c28e8Piotr Jasiukajtis			break;
22425c28e8Piotr Jasiukajtis
22525c28e8Piotr Jasiukajtis		case 2:
22625c28e8Piotr Jasiukajtis			f0 = (float)(y0 + y0 * z0 * (S0 + z0 * (S1 + z0 * S2)));
22725c28e8Piotr Jasiukajtis			f1 = (float)(one + z1 * (mhalf + z1 * (C0 +
22825c28e8Piotr Jasiukajtis			    z1 * (C1 + z1 * C2))));
22925c28e8Piotr Jasiukajtis			f2 = (float)(y2 + y2 * z2 * (S0 + z2 * (S1 + z2 * S2)));
23025c28e8Piotr Jasiukajtis			f3 = (float)(y3 + y3 * z3 * (S0 + z3 * (S1 + z3 * S2)));
23125c28e8Piotr Jasiukajtis			break;
23225c28e8Piotr Jasiukajtis
23325c28e8Piotr Jasiukajtis		case 3:
23425c28e8Piotr Jasiukajtis			f0 = (float)(one + z0 * (mhalf + z0 * (C0 +
23525c28e8Piotr Jasiukajtis			    z0 * (C1 + z0 * C2))));
23625c28e8Piotr Jasiukajtis			f1 = (float)(one + z1 * (mhalf + z1 * (C0 +
23725c28e8Piotr Jasiukajtis			    z1 * (C1 + z1 * C2))));
23825c28e8Piotr Jasiukajtis			f2 = (float)(y2 + y2 * z2 * (S0 + z2 * (S1 + z2 * S2)));
23925c28e8Piotr Jasiukajtis			f3 = (float)(y3 + y3 * z3 * (S0 + z3 * (S1 + z3 * S2)));
24025c28e8Piotr Jasiukajtis			break;
24125c28e8Piotr Jasiukajtis
24225c28e8Piotr Jasiukajtis		case 4:
24325c28e8Piotr Jasiukajtis			f0 = (float)(y0 + y0 * z0 * (S0 + z0 * (S1 + z0 * S2)));
24425c28e8Piotr Jasiukajtis			f1 = (float)(y1 + y1 * z1 * (S0 + z1 * (S1 + z1 * S2)));
24525c28e8Piotr Jasiukajtis			f2 = (float)(one + z2 * (mhalf + z2 * (C0 +
24625c28e8Piotr Jasiukajtis			    z2 * (C1 + z2 * C2))));
24725c28e8Piotr Jasiukajtis			f3 = (float)(y3 + y3 * z3 * (S0 + z3 * (S1 + z3 * S2)));
24825c28e8Piotr Jasiukajtis			break;
24925c28e8Piotr Jasiukajtis
25025c28e8Piotr Jasiukajtis		case 5:
25125c28e8Piotr Jasiukajtis			f0 = (float)(one + z0 * (mhalf + z0 * (C0 +
25225c28e8Piotr Jasiukajtis			    z0 * (C1 + z0 * C2))));
25325c28e8Piotr Jasiukajtis			f1 = (float)(y1 + y1 * z1 * (S0 + z1 * (S1 + z1 * S2)));
25425c28e8Piotr Jasiukajtis			f2 = (float)(one + z2 * (mhalf + z2 * (C0 +
25525c28e8Piotr Jasiukajtis			    z2 * (C1 + z2 * C2))));
25625c28e8Piotr Jasiukajtis			f3 = (float)(y3 + y3 * z3 * (S0 + z3 * (S1 + z3 * S2)));
25725c28e8Piotr Jasiukajtis			break;
25825c28e8Piotr Jasiukajtis
25925c28e8Piotr Jasiukajtis		case 6:
26025c28e8Piotr Jasiukajtis			f0 = (float)(y0 + y0 * z0 * (S0 + z0 * (S1 + z0 * S2)));
26125c28e8Piotr Jasiukajtis			f1 = (float)(one + z1 * (mhalf + z1 * (C0 +
26225c28e8Piotr Jasiukajtis			    z1 * (C1 + z1 * C2))));
26325c28e8Piotr Jasiukajtis			f2 = (float)(one + z2 * (mhalf + z2 * (C0 +
26425c28e8Piotr Jasiukajtis			    z2 * (C1 + z2 * C2))));
26525c28e8Piotr Jasiukajtis			f3 = (float)(y3 + y3 * z3 * (S0 + z3 * (S1 + z3 * S2)));
26625c28e8Piotr Jasiukajtis			break;
26725c28e8Piotr Jasiukajtis
26825c28e8Piotr Jasiukajtis		case 7:
26925c28e8Piotr Jasiukajtis			f0 = (float)(one + z0 * (mhalf + z0 * (C0 +
27025c28e8Piotr Jasiukajtis			    z0 * (C1 + z0 * C2))));
27125c28e8Piotr Jasiukajtis			f1 = (float)(one + z1 * (mhalf + z1 * (C0 +
27225c28e8Piotr Jasiukajtis			    z1 * (C1 + z1 * C2))));
27325c28e8Piotr Jasiukajtis			f2 = (float)(one + z2 * (mhalf + z2 * (C0 +
27425c28e8Piotr Jasiukajtis			    z2 * (C1 + z2 * C2))));
27525c28e8Piotr Jasiukajtis			f3 = (float)(y3 + y3 * z3 * (S0 + z3 * (S1 + z3 * S2)));
27625c28e8Piotr Jasiukajtis			break;
27725c28e8Piotr Jasiukajtis
27825c28e8Piotr Jasiukajtis		case 8:
27925c28e8Piotr Jasiukajtis			f0 = (float)(y0 + y0 * z0 * (S0 + z0 * (S1 + z0 * S2)));
28025c28e8Piotr Jasiukajtis			f1 = (float)(y1 + y1 * z1 * (S0 + z1 * (S1 + z1 * S2)));
28125c28e8Piotr Jasiukajtis			f2 = (float)(y2 + y2 * z2 * (S0 + z2 * (S1 + z2 * S2)));
28225c28e8Piotr Jasiukajtis			f3 = (float)(one + z3 * (mhalf + z3 * (C0 +
28325c28e8Piotr Jasiukajtis			    z3 * (C1 + z3 * C2))));
28425c28e8Piotr Jasiukajtis			break;
28525c28e8Piotr Jasiukajtis
28625c28e8Piotr Jasiukajtis		case 9:
28725c28e8Piotr Jasiukajtis			f0 = (float)(one + z0 * (mhalf + z0 * (C0 +
28825c28e8Piotr Jasiukajtis			    z0 * (C1 + z0 * C2))));
28925c28e8Piotr Jasiukajtis			f1 = (float)(y1 + y1 * z1 * (S0 + z1 * (S1 + z1 * S2)));
29025c28e8Piotr Jasiukajtis			f2 = (float)(y2 + y2 * z2 * (S0 + z2 * (S1 + z2 * S2)));
29125c28e8Piotr Jasiukajtis			f3 = (float)(one + z3 * (mhalf + z3 * (C0 +
29225c28e8Piotr Jasiukajtis			    z3 * (C1 + z3 * C2))));
29325c28e8Piotr Jasiukajtis			break;
29425c28e8Piotr Jasiukajtis
29525c28e8Piotr Jasiukajtis		case 10:
29625c28e8Piotr Jasiukajtis			f0 = (float)(y0 + y0 * z0 * (S0 + z0 * (S1 + z0 * S2)));
29725c28e8Piotr Jasiukajtis			f1 = (float)(one + z1 * (mhalf + z1 * (C0 +
29825c28e8Piotr Jasiukajtis			    z1 * (C1 + z1 * C2))));
29925c28e8Piotr Jasiukajtis			f2 = (float)(y2 + y2 * z2 * (S0 + z2 * (S1 + z2 * S2)));
30025c28e8Piotr Jasiukajtis			f3 = (float)(one + z3 * (mhalf + z3 * (C0 +
30125c28e8Piotr Jasiukajtis			    z3 * (C1 + z3 * C2))));
30225c28e8Piotr Jasiukajtis			break;
30325c28e8Piotr Jasiukajtis
30425c28e8Piotr Jasiukajtis		case 11:
30525c28e8Piotr Jasiukajtis			f0 = (float)(one + z0 * (mhalf + z0 * (C0 +
30625c28e8Piotr Jasiukajtis			    z0 * (C1 + z0 * C2))));
30725c28e8Piotr Jasiukajtis			f1 = (float)(one + z1 * (mhalf + z1 * (C0 +
30825c28e8Piotr Jasiukajtis			    z1 * (C1 + z1 * C2))));
30925c28e8Piotr Jasiukajtis			f2 = (float)(y2 + y2 * z2 * (S0 + z2 * (S1 + z2 * S2)));
31025c28e8Piotr Jasiukajtis			f3 = (float)(one + z3 * (mhalf + z3 * (C0 +
31125c28e8Piotr Jasiukajtis			    z3 * (C1 + z3 * C2))));
31225c28e8Piotr Jasiukajtis			break;
31325c28e8Piotr Jasiukajtis
31425c28e8Piotr Jasiukajtis		case 12:
31525c28e8Piotr Jasiukajtis			f0 = (float)(y0 + y0 * z0 * (S0 + z0 * (S1 + z0 * S2)));
31625c28e8Piotr Jasiukajtis			f1 = (float)(y1 + y1 * z1 * (S0 + z1 * (S1 + z1 * S2)));
31725c28e8Piotr Jasiukajtis			f2 = (float)(one + z2 * (mhalf + z2 * (C0 +
31825c28e8Piotr Jasiukajtis			    z2 * (C1 + z2 * C2))));
31925c28e8Piotr Jasiukajtis			f3 = (float)(one + z3 * (mhalf + z3 * (C0 +
32025c28e8Piotr Jasiukajtis			    z3 * (C1 + z3 * C2))));
32125c28e8Piotr Jasiukajtis			break;
32225c28e8Piotr Jasiukajtis
32325c28e8Piotr Jasiukajtis		case 13:
32425c28e8Piotr Jasiukajtis			f0 = (float)(one + z0 * (mhalf + z0 * (C0 +
32525c28e8Piotr Jasiukajtis			    z0 * (C1 + z0 * C2))));
32625c28e8Piotr Jasiukajtis			f1 = (float)(y1 + y1 * z1 * (S0 + z1 * (S1 + z1 * S2)));
32725c28e8Piotr Jasiukajtis			f2 = (float)(one + z2 * (mhalf + z2 * (C0 +
32825c28e8Piotr Jasiukajtis			    z2 * (C1 + z2 * C2))));
32925c28e8Piotr Jasiukajtis			f3 = (float)(one + z3 * (mhalf + z3 * (C0 +
33025c28e8Piotr Jasiukajtis			    z3 * (C1 + z3 * C2))));
33125c28e8Piotr Jasiukajtis			break;
33225c28e8Piotr Jasiukajtis
33325c28e8Piotr Jasiukajtis		case 14:
33425c28e8Piotr Jasiukajtis			f0 = (float)(y0 + y0 * z0 * (S0 + z0 * (S1 + z0 * S2)));
33525c28e8Piotr Jasiukajtis			f1 = (float)(one + z1 * (mhalf + z1 * (C0 +
33625c28e8Piotr Jasiukajtis			    z1 * (C1 + z1 * C2))));
33725c28e8Piotr Jasiukajtis			f2 = (float)(one + z2 * (mhalf + z2 * (C0 +
33825c28e8Piotr Jasiukajtis			    z2 * (C1 + z2 * C2))));
33925c28e8Piotr Jasiukajtis			f3 = (float)(one + z3 * (mhalf + z3 * (C0 +
34025c28e8Piotr Jasiukajtis			    z3 * (C1 + z3 * C2))));
34125c28e8Piotr Jasiukajtis			break;
34225c28e8Piotr Jasiukajtis
34325c28e8Piotr Jasiukajtis		default:
34425c28e8Piotr Jasiukajtis			f0 = (float)(one + z0 * (mhalf + z0 * (C0 +
34525c28e8Piotr Jasiukajtis			    z0 * (C1 + z0 * C2))));
34625c28e8Piotr Jasiukajtis			f1 = (float)(one + z1 * (mhalf + z1 * (C0 +
34725c28e8Piotr Jasiukajtis			    z1 * (C1 + z1 * C2))));
34825c28e8Piotr Jasiukajtis			f2 = (float)(one + z2 * (mhalf + z2 * (C0 +
34925c28e8Piotr Jasiukajtis			    z2 * (C1 + z2 * C2))));
35025c28e8Piotr Jasiukajtis			f3 = (float)(one + z3 * (mhalf + z3 * (C0 +
35125c28e8Piotr Jasiukajtis			    z3 * (C1 + z3 * C2))));
35225c28e8Piotr Jasiukajtis		}
35325c28e8Piotr Jasiukajtis
35425c28e8Piotr Jasiukajtis		*y = (n0 & 2)? -f0 : f0;
35525c28e8Piotr Jasiukajtis		y += stridey;
35625c28e8Piotr Jasiukajtis		*y = (n1 & 2)? -f1 : f1;
35725c28e8Piotr Jasiukajtis		y += stridey;
35825c28e8Piotr Jasiukajtis		*y = (n2 & 2)? -f2 : f2;
35925c28e8Piotr Jasiukajtis		y += stridey;
36025c28e8Piotr Jasiukajtis		*y = (n3 & 2)? -f3 : f3;
36125c28e8Piotr Jasiukajtis		continue;
36225c28e8Piotr Jasiukajtis
36325c28e8Piotr Jasiukajtisprocess1:
36425c28e8Piotr Jasiukajtis		PROCESS(0);
36525c28e8Piotr Jasiukajtis		continue;
36625c28e8Piotr Jasiukajtis
36725c28e8Piotr Jasiukajtisprocess2:
36825c28e8Piotr Jasiukajtis		PROCESS(0);
36925c28e8Piotr Jasiukajtis		PROCESS(1);
37025c28e8Piotr Jasiukajtis		continue;
37125c28e8Piotr Jasiukajtis
37225c28e8Piotr Jasiukajtisprocess3:
37325c28e8Piotr Jasiukajtis		PROCESS(0);
37425c28e8Piotr Jasiukajtis		PROCESS(1);
37525c28e8Piotr Jasiukajtis		PROCESS(2);
37625c28e8Piotr Jasiukajtis	}
37725c28e8Piotr Jasiukajtis}
378