1*25c28e83SPiotr Jasiukajtis/*
2*25c28e83SPiotr Jasiukajtis * CDDL HEADER START
3*25c28e83SPiotr Jasiukajtis *
4*25c28e83SPiotr Jasiukajtis * The contents of this file are subject to the terms of the
5*25c28e83SPiotr Jasiukajtis * Common Development and Distribution License (the "License").
6*25c28e83SPiotr Jasiukajtis * You may not use this file except in compliance with the License.
7*25c28e83SPiotr Jasiukajtis *
8*25c28e83SPiotr Jasiukajtis * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*25c28e83SPiotr Jasiukajtis * or http://www.opensolaris.org/os/licensing.
10*25c28e83SPiotr Jasiukajtis * See the License for the specific language governing permissions
11*25c28e83SPiotr Jasiukajtis * and limitations under the License.
12*25c28e83SPiotr Jasiukajtis *
13*25c28e83SPiotr Jasiukajtis * When distributing Covered Code, include this CDDL HEADER in each
14*25c28e83SPiotr Jasiukajtis * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*25c28e83SPiotr Jasiukajtis * If applicable, add the following below this CDDL HEADER, with the
16*25c28e83SPiotr Jasiukajtis * fields enclosed by brackets "[]" replaced with your own identifying
17*25c28e83SPiotr Jasiukajtis * information: Portions Copyright [yyyy] [name of copyright owner]
18*25c28e83SPiotr Jasiukajtis *
19*25c28e83SPiotr Jasiukajtis * CDDL HEADER END
20*25c28e83SPiotr Jasiukajtis */
21*25c28e83SPiotr Jasiukajtis/*
22*25c28e83SPiotr Jasiukajtis * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
23*25c28e83SPiotr Jasiukajtis */
24*25c28e83SPiotr Jasiukajtis/*
25*25c28e83SPiotr Jasiukajtis * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
26*25c28e83SPiotr Jasiukajtis * Use is subject to license terms.
27*25c28e83SPiotr Jasiukajtis */
28*25c28e83SPiotr Jasiukajtis
29*25c28e83SPiotr Jasiukajtis	.file	"__vcos_ultra3.S"
30*25c28e83SPiotr Jasiukajtis
31*25c28e83SPiotr Jasiukajtis#include "libm.h"
32*25c28e83SPiotr Jasiukajtis	.weak	__vcos
33*25c28e83SPiotr Jasiukajtis	.type	__vcos,#function
34*25c28e83SPiotr Jasiukajtis	__vcos = __vcos_ultra3
35*25c28e83SPiotr Jasiukajtis
36*25c28e83SPiotr Jasiukajtis	RO_DATA
37*25c28e83SPiotr Jasiukajtis	.align	64
38*25c28e83SPiotr Jasiukajtisconstants:
39*25c28e83SPiotr Jasiukajtis	.word	0x42c80000,0x00000000	! 3 * 2^44
40*25c28e83SPiotr Jasiukajtis	.word	0x43380000,0x00000000	! 3 * 2^51
41*25c28e83SPiotr Jasiukajtis	.word	0x3fe45f30,0x6dc9c883	! invpio2
42*25c28e83SPiotr Jasiukajtis	.word	0x3ff921fb,0x54442c00	! pio2_1
43*25c28e83SPiotr Jasiukajtis	.word	0x3d318469,0x898cc400	! pio2_2
44*25c28e83SPiotr Jasiukajtis	.word	0x3a71701b,0x839a2520	! pio2_3
45*25c28e83SPiotr Jasiukajtis	.word	0xbfc55555,0x55555533	! pp1
46*25c28e83SPiotr Jasiukajtis	.word	0x3f811111,0x10e7d53b	! pp2
47*25c28e83SPiotr Jasiukajtis	.word	0xbf2a0167,0xe6b3cf9b	! pp3
48*25c28e83SPiotr Jasiukajtis	.word	0xbfdfffff,0xffffff65	! qq1
49*25c28e83SPiotr Jasiukajtis	.word	0x3fa55555,0x54f88ed0	! qq2
50*25c28e83SPiotr Jasiukajtis	.word	0xbf56c12c,0xdd185f60	! qq3
51*25c28e83SPiotr Jasiukajtis
52*25c28e83SPiotr Jasiukajtis! local storage indices
53*25c28e83SPiotr Jasiukajtis
54*25c28e83SPiotr Jasiukajtis#define xsave		STACK_BIAS-0x8
55*25c28e83SPiotr Jasiukajtis#define ysave		STACK_BIAS-0x10
56*25c28e83SPiotr Jasiukajtis#define nsave		STACK_BIAS-0x14
57*25c28e83SPiotr Jasiukajtis#define sxsave		STACK_BIAS-0x18
58*25c28e83SPiotr Jasiukajtis#define sysave		STACK_BIAS-0x1c
59*25c28e83SPiotr Jasiukajtis#define biguns		STACK_BIAS-0x20
60*25c28e83SPiotr Jasiukajtis#define nk3		STACK_BIAS-0x24
61*25c28e83SPiotr Jasiukajtis#define nk2		STACK_BIAS-0x28
62*25c28e83SPiotr Jasiukajtis#define nk1		STACK_BIAS-0x2c
63*25c28e83SPiotr Jasiukajtis#define nk0		STACK_BIAS-0x30
64*25c28e83SPiotr Jasiukajtis#define junk		STACK_BIAS-0x38
65*25c28e83SPiotr Jasiukajtis! sizeof temp storage - must be a multiple of 16 for V9
66*25c28e83SPiotr Jasiukajtis#define tmps		0x40
67*25c28e83SPiotr Jasiukajtis
68*25c28e83SPiotr Jasiukajtis! register use
69*25c28e83SPiotr Jasiukajtis
70*25c28e83SPiotr Jasiukajtis! i0  n
71*25c28e83SPiotr Jasiukajtis! i1  x
72*25c28e83SPiotr Jasiukajtis! i2  stridex
73*25c28e83SPiotr Jasiukajtis! i3  y
74*25c28e83SPiotr Jasiukajtis! i4  stridey
75*25c28e83SPiotr Jasiukajtis! i5  0x80000000
76*25c28e83SPiotr Jasiukajtis
77*25c28e83SPiotr Jasiukajtis! l0  hx0
78*25c28e83SPiotr Jasiukajtis! l1  hx1
79*25c28e83SPiotr Jasiukajtis! l2  hx2
80*25c28e83SPiotr Jasiukajtis! l3  hx3
81*25c28e83SPiotr Jasiukajtis! l4  k0
82*25c28e83SPiotr Jasiukajtis! l5  k1
83*25c28e83SPiotr Jasiukajtis! l6  k2
84*25c28e83SPiotr Jasiukajtis! l7  k3
85*25c28e83SPiotr Jasiukajtis
86*25c28e83SPiotr Jasiukajtis! the following are 64-bit registers in both V8+ and V9
87*25c28e83SPiotr Jasiukajtis
88*25c28e83SPiotr Jasiukajtis! g1  __vlibm_TBL_sincos2
89*25c28e83SPiotr Jasiukajtis! g5  scratch
90*25c28e83SPiotr Jasiukajtis
91*25c28e83SPiotr Jasiukajtis! o0  py0
92*25c28e83SPiotr Jasiukajtis! o1  py1
93*25c28e83SPiotr Jasiukajtis! o2  py2
94*25c28e83SPiotr Jasiukajtis! o3  py3
95*25c28e83SPiotr Jasiukajtis! o4  0x3e400000
96*25c28e83SPiotr Jasiukajtis! o5  0x3fe921fb,0x4099251e
97*25c28e83SPiotr Jasiukajtis! o7  scratch
98*25c28e83SPiotr Jasiukajtis
99*25c28e83SPiotr Jasiukajtis! f0  hx0
100*25c28e83SPiotr Jasiukajtis! f2
101*25c28e83SPiotr Jasiukajtis! f4
102*25c28e83SPiotr Jasiukajtis! f6
103*25c28e83SPiotr Jasiukajtis! f8  hx1
104*25c28e83SPiotr Jasiukajtis! f10
105*25c28e83SPiotr Jasiukajtis! f12
106*25c28e83SPiotr Jasiukajtis! f14
107*25c28e83SPiotr Jasiukajtis! f16 hx2
108*25c28e83SPiotr Jasiukajtis! f18
109*25c28e83SPiotr Jasiukajtis! f20
110*25c28e83SPiotr Jasiukajtis! f22
111*25c28e83SPiotr Jasiukajtis! f24 hx3
112*25c28e83SPiotr Jasiukajtis! f26
113*25c28e83SPiotr Jasiukajtis! f28
114*25c28e83SPiotr Jasiukajtis! f30
115*25c28e83SPiotr Jasiukajtis! f32
116*25c28e83SPiotr Jasiukajtis! f34
117*25c28e83SPiotr Jasiukajtis! f36
118*25c28e83SPiotr Jasiukajtis! f38
119*25c28e83SPiotr Jasiukajtis
120*25c28e83SPiotr Jasiukajtis#define c3two44	%f40
121*25c28e83SPiotr Jasiukajtis#define c3two51	%f42
122*25c28e83SPiotr Jasiukajtis#define invpio2	%f44
123*25c28e83SPiotr Jasiukajtis#define pio2_1	%f46
124*25c28e83SPiotr Jasiukajtis#define pio2_2	%f48
125*25c28e83SPiotr Jasiukajtis#define pio2_3	%f50
126*25c28e83SPiotr Jasiukajtis#define pp1	%f52
127*25c28e83SPiotr Jasiukajtis#define pp2	%f54
128*25c28e83SPiotr Jasiukajtis#define pp3	%f56
129*25c28e83SPiotr Jasiukajtis#define qq1	%f58
130*25c28e83SPiotr Jasiukajtis#define qq2	%f60
131*25c28e83SPiotr Jasiukajtis#define qq3	%f62
132*25c28e83SPiotr Jasiukajtis
133*25c28e83SPiotr Jasiukajtis	ENTRY(__vcos_ultra3)
134*25c28e83SPiotr Jasiukajtis	save	%sp,-SA(MINFRAME)-tmps,%sp
135*25c28e83SPiotr Jasiukajtis	PIC_SETUP(l7)
136*25c28e83SPiotr Jasiukajtis	PIC_SET(l7,constants,o0)
137*25c28e83SPiotr Jasiukajtis	PIC_SET(l7,__vlibm_TBL_sincos2,o1)
138*25c28e83SPiotr Jasiukajtis	mov	%o1,%g1
139*25c28e83SPiotr Jasiukajtis	wr	%g0,0x82,%asi		! set %asi for non-faulting loads
140*25c28e83SPiotr Jasiukajtis#ifdef __sparcv9
141*25c28e83SPiotr Jasiukajtis	stx	%i1,[%fp+xsave]		! save arguments
142*25c28e83SPiotr Jasiukajtis	stx	%i3,[%fp+ysave]
143*25c28e83SPiotr Jasiukajtis#else
144*25c28e83SPiotr Jasiukajtis	st	%i1,[%fp+xsave]		! save arguments
145*25c28e83SPiotr Jasiukajtis	st	%i3,[%fp+ysave]
146*25c28e83SPiotr Jasiukajtis#endif
147*25c28e83SPiotr Jasiukajtis	st	%i0,[%fp+nsave]
148*25c28e83SPiotr Jasiukajtis	st	%i2,[%fp+sxsave]
149*25c28e83SPiotr Jasiukajtis	st	%i4,[%fp+sysave]
150*25c28e83SPiotr Jasiukajtis	st	%g0,[%fp+biguns]	! biguns = 0
151*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x00],c3two44	! load/set up constants
152*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x08],c3two51
153*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x10],invpio2
154*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x18],pio2_1
155*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x20],pio2_2
156*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x28],pio2_3
157*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x30],pp1
158*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x38],pp2
159*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x40],pp3
160*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x48],qq1
161*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x50],qq2
162*25c28e83SPiotr Jasiukajtis	ldd	[%o0+0x58],qq3
163*25c28e83SPiotr Jasiukajtis	sethi	%hi(0x80000000),%i5
164*25c28e83SPiotr Jasiukajtis	sethi	%hi(0x3e400000),%o4
165*25c28e83SPiotr Jasiukajtis	sethi	%hi(0x3fe921fb),%o5
166*25c28e83SPiotr Jasiukajtis	or	%o5,%lo(0x3fe921fb),%o5
167*25c28e83SPiotr Jasiukajtis	sllx	%o5,32,%o5
168*25c28e83SPiotr Jasiukajtis	sethi	%hi(0x4099251e),%o7
169*25c28e83SPiotr Jasiukajtis	or	%o7,%lo(0x4099251e),%o7
170*25c28e83SPiotr Jasiukajtis	or	%o5,%o7,%o5
171*25c28e83SPiotr Jasiukajtis	sll	%i2,3,%i2		! scale strides
172*25c28e83SPiotr Jasiukajtis	sll	%i4,3,%i4
173*25c28e83SPiotr Jasiukajtis	add	%fp,junk,%o1		! loop prologue
174*25c28e83SPiotr Jasiukajtis	add	%fp,junk,%o2
175*25c28e83SPiotr Jasiukajtis	add	%fp,junk,%o3
176*25c28e83SPiotr Jasiukajtis	ld	[%i1],%l0		! *x
177*25c28e83SPiotr Jasiukajtis	ld	[%i1],%f0
178*25c28e83SPiotr Jasiukajtis	ld	[%i1+4],%f3
179*25c28e83SPiotr Jasiukajtis	andn	%l0,%i5,%l0		! mask off sign
180*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1		! x += stridex
181*25c28e83SPiotr Jasiukajtis	ba	.loop0
182*25c28e83SPiotr Jasiukajtis	nop
183*25c28e83SPiotr Jasiukajtis
184*25c28e83SPiotr Jasiukajtis! 16-byte aligned
185*25c28e83SPiotr Jasiukajtis	.align	16
186*25c28e83SPiotr Jasiukajtis.loop0:
187*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%l1		! preload next argument
188*25c28e83SPiotr Jasiukajtis	sub	%l0,%o4,%g5
189*25c28e83SPiotr Jasiukajtis	sub	%o5,%l0,%o7
190*25c28e83SPiotr Jasiukajtis	fabss	%f0,%f2
191*25c28e83SPiotr Jasiukajtis
192*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%f8
193*25c28e83SPiotr Jasiukajtis	orcc	%o7,%g5,%g0
194*25c28e83SPiotr Jasiukajtis	mov	%i3,%o0			! py0 = y
195*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.range0		! hx < 0x3e400000 or hx > 0x4099251e
196*25c28e83SPiotr Jasiukajtis
197*25c28e83SPiotr Jasiukajtis! delay slot
198*25c28e83SPiotr Jasiukajtis	lda	[%i1+4]%asi,%f11
199*25c28e83SPiotr Jasiukajtis	addcc	%i0,-1,%i0
200*25c28e83SPiotr Jasiukajtis	add	%i3,%i4,%i3		! y += stridey
201*25c28e83SPiotr Jasiukajtis	ble,pn	%icc,.last1
202*25c28e83SPiotr Jasiukajtis
203*25c28e83SPiotr Jasiukajtis! delay slot
204*25c28e83SPiotr Jasiukajtis	andn	%l1,%i5,%l1
205*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1		! x += stridex
206*25c28e83SPiotr Jasiukajtis	faddd	%f2,c3two44,%f4
207*25c28e83SPiotr Jasiukajtis	st	%f15,[%o1+4]
208*25c28e83SPiotr Jasiukajtis
209*25c28e83SPiotr Jasiukajtis.loop1:
210*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%l2		! preload next argument
211*25c28e83SPiotr Jasiukajtis	sub	%l1,%o4,%g5
212*25c28e83SPiotr Jasiukajtis	sub	%o5,%l1,%o7
213*25c28e83SPiotr Jasiukajtis	fabss	%f8,%f10
214*25c28e83SPiotr Jasiukajtis
215*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%f16
216*25c28e83SPiotr Jasiukajtis	orcc	%o7,%g5,%g0
217*25c28e83SPiotr Jasiukajtis	mov	%i3,%o1			! py1 = y
218*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.range1		! hx < 0x3e400000 or hx > 0x4099251e
219*25c28e83SPiotr Jasiukajtis
220*25c28e83SPiotr Jasiukajtis! delay slot
221*25c28e83SPiotr Jasiukajtis	lda	[%i1+4]%asi,%f19
222*25c28e83SPiotr Jasiukajtis	addcc	%i0,-1,%i0
223*25c28e83SPiotr Jasiukajtis	add	%i3,%i4,%i3		! y += stridey
224*25c28e83SPiotr Jasiukajtis	ble,pn	%icc,.last2
225*25c28e83SPiotr Jasiukajtis
226*25c28e83SPiotr Jasiukajtis! delay slot
227*25c28e83SPiotr Jasiukajtis	andn	%l2,%i5,%l2
228*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1		! x += stridex
229*25c28e83SPiotr Jasiukajtis	faddd	%f10,c3two44,%f12
230*25c28e83SPiotr Jasiukajtis	st	%f23,[%o2+4]
231*25c28e83SPiotr Jasiukajtis
232*25c28e83SPiotr Jasiukajtis.loop2:
233*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%l3		! preload next argument
234*25c28e83SPiotr Jasiukajtis	sub	%l2,%o4,%g5
235*25c28e83SPiotr Jasiukajtis	sub	%o5,%l2,%o7
236*25c28e83SPiotr Jasiukajtis	fabss	%f16,%f18
237*25c28e83SPiotr Jasiukajtis
238*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%f24
239*25c28e83SPiotr Jasiukajtis	orcc	%o7,%g5,%g0
240*25c28e83SPiotr Jasiukajtis	mov	%i3,%o2			! py2 = y
241*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.range2		! hx < 0x3e400000 or hx > 0x4099251e
242*25c28e83SPiotr Jasiukajtis
243*25c28e83SPiotr Jasiukajtis! delay slot
244*25c28e83SPiotr Jasiukajtis	lda	[%i1+4]%asi,%f27
245*25c28e83SPiotr Jasiukajtis	addcc	%i0,-1,%i0
246*25c28e83SPiotr Jasiukajtis	add	%i3,%i4,%i3		! y += stridey
247*25c28e83SPiotr Jasiukajtis	ble,pn	%icc,.last3
248*25c28e83SPiotr Jasiukajtis
249*25c28e83SPiotr Jasiukajtis! delay slot
250*25c28e83SPiotr Jasiukajtis	andn	%l3,%i5,%l3
251*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1		! x += stridex
252*25c28e83SPiotr Jasiukajtis	faddd	%f18,c3two44,%f20
253*25c28e83SPiotr Jasiukajtis	st	%f31,[%o3+4]
254*25c28e83SPiotr Jasiukajtis
255*25c28e83SPiotr Jasiukajtis.loop3:
256*25c28e83SPiotr Jasiukajtis	sub	%l3,%o4,%g5
257*25c28e83SPiotr Jasiukajtis	sub	%o5,%l3,%o7
258*25c28e83SPiotr Jasiukajtis	fabss	%f24,%f26
259*25c28e83SPiotr Jasiukajtis	st	%f5,[%fp+nk0]
260*25c28e83SPiotr Jasiukajtis
261*25c28e83SPiotr Jasiukajtis	orcc	%o7,%g5,%g0
262*25c28e83SPiotr Jasiukajtis	mov	%i3,%o3			! py3 = y
263*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.range3		! hx < 0x3e400000 or > hx 0x4099251e
264*25c28e83SPiotr Jasiukajtis! delay slot
265*25c28e83SPiotr Jasiukajtis	st	%f13,[%fp+nk1]
266*25c28e83SPiotr Jasiukajtis
267*25c28e83SPiotr Jasiukajtis!!! DONE?
268*25c28e83SPiotr Jasiukajtis.cont:
269*25c28e83SPiotr Jasiukajtis	srlx	%o5,32,%o7
270*25c28e83SPiotr Jasiukajtis	add	%i3,%i4,%i3		! y += stridey
271*25c28e83SPiotr Jasiukajtis	fmovs	%f3,%f1
272*25c28e83SPiotr Jasiukajtis	st	%f21,[%fp+nk2]
273*25c28e83SPiotr Jasiukajtis
274*25c28e83SPiotr Jasiukajtis	sub	%o7,%l0,%l0
275*25c28e83SPiotr Jasiukajtis	sub	%o7,%l1,%l1
276*25c28e83SPiotr Jasiukajtis	faddd	%f26,c3two44,%f28
277*25c28e83SPiotr Jasiukajtis	st	%f29,[%fp+nk3]
278*25c28e83SPiotr Jasiukajtis
279*25c28e83SPiotr Jasiukajtis	sub	%o7,%l2,%l2
280*25c28e83SPiotr Jasiukajtis	sub	%o7,%l3,%l3
281*25c28e83SPiotr Jasiukajtis	fmovs	%f11,%f9
282*25c28e83SPiotr Jasiukajtis
283*25c28e83SPiotr Jasiukajtis	or	%l0,%l1,%l0
284*25c28e83SPiotr Jasiukajtis	or	%l2,%l3,%l2
285*25c28e83SPiotr Jasiukajtis	fmovs	%f19,%f17
286*25c28e83SPiotr Jasiukajtis
287*25c28e83SPiotr Jasiukajtis	fmovs	%f27,%f25
288*25c28e83SPiotr Jasiukajtis	fmuld	%f0,invpio2,%f6		! x * invpio2, for medium range
289*25c28e83SPiotr Jasiukajtis
290*25c28e83SPiotr Jasiukajtis	fmuld	%f8,invpio2,%f14
291*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk0],%l4
292*25c28e83SPiotr Jasiukajtis
293*25c28e83SPiotr Jasiukajtis	fmuld	%f16,invpio2,%f22
294*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk1],%l5
295*25c28e83SPiotr Jasiukajtis
296*25c28e83SPiotr Jasiukajtis	orcc	%l0,%l2,%g0
297*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.medium
298*25c28e83SPiotr Jasiukajtis! delay slot
299*25c28e83SPiotr Jasiukajtis	fmuld	%f24,invpio2,%f30
300*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk2],%l6
301*25c28e83SPiotr Jasiukajtis
302*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk3],%l7
303*25c28e83SPiotr Jasiukajtis	sll	%l4,5,%l4		! k
304*25c28e83SPiotr Jasiukajtis	fcmpd	%fcc0,%f0,pio2_3	! x < pio2_3 iff x < 0
305*25c28e83SPiotr Jasiukajtis
306*25c28e83SPiotr Jasiukajtis	sll	%l5,5,%l5
307*25c28e83SPiotr Jasiukajtis	ldd	[%l4+%g1],%f4
308*25c28e83SPiotr Jasiukajtis	fcmpd	%fcc1,%f8,pio2_3
309*25c28e83SPiotr Jasiukajtis
310*25c28e83SPiotr Jasiukajtis	sll	%l6,5,%l6
311*25c28e83SPiotr Jasiukajtis	ldd	[%l5+%g1],%f12
312*25c28e83SPiotr Jasiukajtis	fcmpd	%fcc2,%f16,pio2_3
313*25c28e83SPiotr Jasiukajtis
314*25c28e83SPiotr Jasiukajtis	sll	%l7,5,%l7
315*25c28e83SPiotr Jasiukajtis	ldd	[%l6+%g1],%f20
316*25c28e83SPiotr Jasiukajtis	fcmpd	%fcc3,%f24,pio2_3
317*25c28e83SPiotr Jasiukajtis
318*25c28e83SPiotr Jasiukajtis	ldd	[%l7+%g1],%f28
319*25c28e83SPiotr Jasiukajtis	fsubd	%f2,%f4,%f2		! x -= __vlibm_TBL_sincos2[k]
320*25c28e83SPiotr Jasiukajtis
321*25c28e83SPiotr Jasiukajtis	fsubd	%f10,%f12,%f10
322*25c28e83SPiotr Jasiukajtis
323*25c28e83SPiotr Jasiukajtis	fsubd	%f18,%f20,%f18
324*25c28e83SPiotr Jasiukajtis
325*25c28e83SPiotr Jasiukajtis	fsubd	%f26,%f28,%f26
326*25c28e83SPiotr Jasiukajtis
327*25c28e83SPiotr Jasiukajtis	fmuld	%f2,%f2,%f0		! z = x * x
328*25c28e83SPiotr Jasiukajtis
329*25c28e83SPiotr Jasiukajtis	fmuld	%f10,%f10,%f8
330*25c28e83SPiotr Jasiukajtis
331*25c28e83SPiotr Jasiukajtis	fmuld	%f18,%f18,%f16
332*25c28e83SPiotr Jasiukajtis
333*25c28e83SPiotr Jasiukajtis	fmuld	%f26,%f26,%f24
334*25c28e83SPiotr Jasiukajtis
335*25c28e83SPiotr Jasiukajtis	fmuld	%f0,qq3,%f6
336*25c28e83SPiotr Jasiukajtis
337*25c28e83SPiotr Jasiukajtis	fmuld	%f8,qq3,%f14
338*25c28e83SPiotr Jasiukajtis
339*25c28e83SPiotr Jasiukajtis	fmuld	%f16,qq3,%f22
340*25c28e83SPiotr Jasiukajtis
341*25c28e83SPiotr Jasiukajtis	fmuld	%f24,qq3,%f30
342*25c28e83SPiotr Jasiukajtis
343*25c28e83SPiotr Jasiukajtis	faddd	%f6,qq2,%f6
344*25c28e83SPiotr Jasiukajtis	fmuld	%f0,pp2,%f4
345*25c28e83SPiotr Jasiukajtis
346*25c28e83SPiotr Jasiukajtis	faddd	%f14,qq2,%f14
347*25c28e83SPiotr Jasiukajtis	fmuld	%f8,pp2,%f12
348*25c28e83SPiotr Jasiukajtis
349*25c28e83SPiotr Jasiukajtis	faddd	%f22,qq2,%f22
350*25c28e83SPiotr Jasiukajtis	fmuld	%f16,pp2,%f20
351*25c28e83SPiotr Jasiukajtis
352*25c28e83SPiotr Jasiukajtis	faddd	%f30,qq2,%f30
353*25c28e83SPiotr Jasiukajtis	fmuld	%f24,pp2,%f28
354*25c28e83SPiotr Jasiukajtis
355*25c28e83SPiotr Jasiukajtis	fmuld	%f0,%f6,%f6
356*25c28e83SPiotr Jasiukajtis	faddd	%f4,pp1,%f4
357*25c28e83SPiotr Jasiukajtis
358*25c28e83SPiotr Jasiukajtis	fmuld	%f8,%f14,%f14
359*25c28e83SPiotr Jasiukajtis	faddd	%f12,pp1,%f12
360*25c28e83SPiotr Jasiukajtis
361*25c28e83SPiotr Jasiukajtis	fmuld	%f16,%f22,%f22
362*25c28e83SPiotr Jasiukajtis	faddd	%f20,pp1,%f20
363*25c28e83SPiotr Jasiukajtis
364*25c28e83SPiotr Jasiukajtis	fmuld	%f24,%f30,%f30
365*25c28e83SPiotr Jasiukajtis	faddd	%f28,pp1,%f28
366*25c28e83SPiotr Jasiukajtis
367*25c28e83SPiotr Jasiukajtis	faddd	%f6,qq1,%f6
368*25c28e83SPiotr Jasiukajtis	fmuld	%f0,%f4,%f4
369*25c28e83SPiotr Jasiukajtis	add	%l4,%g1,%l4
370*25c28e83SPiotr Jasiukajtis
371*25c28e83SPiotr Jasiukajtis	faddd	%f14,qq1,%f14
372*25c28e83SPiotr Jasiukajtis	fmuld	%f8,%f12,%f12
373*25c28e83SPiotr Jasiukajtis	add	%l5,%g1,%l5
374*25c28e83SPiotr Jasiukajtis
375*25c28e83SPiotr Jasiukajtis	faddd	%f22,qq1,%f22
376*25c28e83SPiotr Jasiukajtis	fmuld	%f16,%f20,%f20
377*25c28e83SPiotr Jasiukajtis	add	%l6,%g1,%l6
378*25c28e83SPiotr Jasiukajtis
379*25c28e83SPiotr Jasiukajtis	faddd	%f30,qq1,%f30
380*25c28e83SPiotr Jasiukajtis	fmuld	%f24,%f28,%f28
381*25c28e83SPiotr Jasiukajtis	add	%l7,%g1,%l7
382*25c28e83SPiotr Jasiukajtis
383*25c28e83SPiotr Jasiukajtis	fmuld	%f2,%f4,%f4
384*25c28e83SPiotr Jasiukajtis
385*25c28e83SPiotr Jasiukajtis	fmuld	%f10,%f12,%f12
386*25c28e83SPiotr Jasiukajtis
387*25c28e83SPiotr Jasiukajtis	fmuld	%f18,%f20,%f20
388*25c28e83SPiotr Jasiukajtis
389*25c28e83SPiotr Jasiukajtis	fmuld	%f26,%f28,%f28
390*25c28e83SPiotr Jasiukajtis
391*25c28e83SPiotr Jasiukajtis	fmuld	%f0,%f6,%f6
392*25c28e83SPiotr Jasiukajtis	faddd	%f4,%f2,%f4
393*25c28e83SPiotr Jasiukajtis	ldd	[%l4+16],%f32
394*25c28e83SPiotr Jasiukajtis
395*25c28e83SPiotr Jasiukajtis	fmuld	%f8,%f14,%f14
396*25c28e83SPiotr Jasiukajtis	faddd	%f12,%f10,%f12
397*25c28e83SPiotr Jasiukajtis	ldd	[%l5+16],%f34
398*25c28e83SPiotr Jasiukajtis
399*25c28e83SPiotr Jasiukajtis	fmuld	%f16,%f22,%f22
400*25c28e83SPiotr Jasiukajtis	faddd	%f20,%f18,%f20
401*25c28e83SPiotr Jasiukajtis	ldd	[%l6+16],%f36
402*25c28e83SPiotr Jasiukajtis
403*25c28e83SPiotr Jasiukajtis	fmuld	%f24,%f30,%f30
404*25c28e83SPiotr Jasiukajtis	faddd	%f28,%f26,%f28
405*25c28e83SPiotr Jasiukajtis	ldd	[%l7+16],%f38
406*25c28e83SPiotr Jasiukajtis
407*25c28e83SPiotr Jasiukajtis	fmuld	%f32,%f6,%f6
408*25c28e83SPiotr Jasiukajtis	ldd	[%l4+8],%f2
409*25c28e83SPiotr Jasiukajtis
410*25c28e83SPiotr Jasiukajtis	fmuld	%f34,%f14,%f14
411*25c28e83SPiotr Jasiukajtis	ldd	[%l5+8],%f10
412*25c28e83SPiotr Jasiukajtis
413*25c28e83SPiotr Jasiukajtis	fmuld	%f36,%f22,%f22
414*25c28e83SPiotr Jasiukajtis	ldd	[%l6+8],%f18
415*25c28e83SPiotr Jasiukajtis
416*25c28e83SPiotr Jasiukajtis	fmuld	%f38,%f30,%f30
417*25c28e83SPiotr Jasiukajtis	ldd	[%l7+8],%f26
418*25c28e83SPiotr Jasiukajtis
419*25c28e83SPiotr Jasiukajtis	fmuld	%f2,%f4,%f4
420*25c28e83SPiotr Jasiukajtis
421*25c28e83SPiotr Jasiukajtis	fmuld	%f10,%f12,%f12
422*25c28e83SPiotr Jasiukajtis
423*25c28e83SPiotr Jasiukajtis	fmuld	%f18,%f20,%f20
424*25c28e83SPiotr Jasiukajtis
425*25c28e83SPiotr Jasiukajtis	fmuld	%f26,%f28,%f28
426*25c28e83SPiotr Jasiukajtis
427*25c28e83SPiotr Jasiukajtis	fsubd	%f6,%f4,%f6
428*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%l0		! preload next argument
429*25c28e83SPiotr Jasiukajtis
430*25c28e83SPiotr Jasiukajtis	fsubd	%f14,%f12,%f14
431*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%f0
432*25c28e83SPiotr Jasiukajtis
433*25c28e83SPiotr Jasiukajtis	fsubd	%f22,%f20,%f22
434*25c28e83SPiotr Jasiukajtis	lda	[%i1+4]%asi,%f3
435*25c28e83SPiotr Jasiukajtis
436*25c28e83SPiotr Jasiukajtis	fsubd	%f30,%f28,%f30
437*25c28e83SPiotr Jasiukajtis	andn	%l0,%i5,%l0
438*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1
439*25c28e83SPiotr Jasiukajtis
440*25c28e83SPiotr Jasiukajtis	faddd	%f6,%f32,%f6
441*25c28e83SPiotr Jasiukajtis	st	%f6,[%o0]
442*25c28e83SPiotr Jasiukajtis
443*25c28e83SPiotr Jasiukajtis	faddd	%f14,%f34,%f14
444*25c28e83SPiotr Jasiukajtis	st	%f14,[%o1]
445*25c28e83SPiotr Jasiukajtis
446*25c28e83SPiotr Jasiukajtis	faddd	%f22,%f36,%f22
447*25c28e83SPiotr Jasiukajtis	st	%f22,[%o2]
448*25c28e83SPiotr Jasiukajtis
449*25c28e83SPiotr Jasiukajtis	faddd	%f30,%f38,%f30
450*25c28e83SPiotr Jasiukajtis	st	%f30,[%o3]
451*25c28e83SPiotr Jasiukajtis	addcc	%i0,-1,%i0
452*25c28e83SPiotr Jasiukajtis
453*25c28e83SPiotr Jasiukajtis	bg,pt	%icc,.loop0
454*25c28e83SPiotr Jasiukajtis! delay slot
455*25c28e83SPiotr Jasiukajtis	st	%f7,[%o0+4]
456*25c28e83SPiotr Jasiukajtis
457*25c28e83SPiotr Jasiukajtis	ba,pt	%icc,.end
458*25c28e83SPiotr Jasiukajtis! delay slot
459*25c28e83SPiotr Jasiukajtis	nop
460*25c28e83SPiotr Jasiukajtis
461*25c28e83SPiotr Jasiukajtis
462*25c28e83SPiotr Jasiukajtis	.align	16
463*25c28e83SPiotr Jasiukajtis.medium:
464*25c28e83SPiotr Jasiukajtis	faddd	%f6,c3two51,%f4
465*25c28e83SPiotr Jasiukajtis	st	%f5,[%fp+nk0]
466*25c28e83SPiotr Jasiukajtis
467*25c28e83SPiotr Jasiukajtis	faddd	%f14,c3two51,%f12
468*25c28e83SPiotr Jasiukajtis	st	%f13,[%fp+nk1]
469*25c28e83SPiotr Jasiukajtis
470*25c28e83SPiotr Jasiukajtis	faddd	%f22,c3two51,%f20
471*25c28e83SPiotr Jasiukajtis	st	%f21,[%fp+nk2]
472*25c28e83SPiotr Jasiukajtis
473*25c28e83SPiotr Jasiukajtis	faddd	%f30,c3two51,%f28
474*25c28e83SPiotr Jasiukajtis	st	%f29,[%fp+nk3]
475*25c28e83SPiotr Jasiukajtis
476*25c28e83SPiotr Jasiukajtis	fsubd	%f4,c3two51,%f6
477*25c28e83SPiotr Jasiukajtis
478*25c28e83SPiotr Jasiukajtis	fsubd	%f12,c3two51,%f14
479*25c28e83SPiotr Jasiukajtis
480*25c28e83SPiotr Jasiukajtis	fsubd	%f20,c3two51,%f22
481*25c28e83SPiotr Jasiukajtis
482*25c28e83SPiotr Jasiukajtis	fsubd	%f28,c3two51,%f30
483*25c28e83SPiotr Jasiukajtis
484*25c28e83SPiotr Jasiukajtis	fmuld	%f6,pio2_1,%f2
485*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk0],%l0		! n
486*25c28e83SPiotr Jasiukajtis
487*25c28e83SPiotr Jasiukajtis	fmuld	%f14,pio2_1,%f10
488*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk1],%l1
489*25c28e83SPiotr Jasiukajtis
490*25c28e83SPiotr Jasiukajtis	fmuld	%f22,pio2_1,%f18
491*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk2],%l2
492*25c28e83SPiotr Jasiukajtis
493*25c28e83SPiotr Jasiukajtis	fmuld	%f30,pio2_1,%f26
494*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk3],%l3
495*25c28e83SPiotr Jasiukajtis
496*25c28e83SPiotr Jasiukajtis	fsubd	%f0,%f2,%f0
497*25c28e83SPiotr Jasiukajtis	fmuld	%f6,pio2_2,%f4
498*25c28e83SPiotr Jasiukajtis	add	%l0,1,%l0
499*25c28e83SPiotr Jasiukajtis
500*25c28e83SPiotr Jasiukajtis	fsubd	%f8,%f10,%f8
501*25c28e83SPiotr Jasiukajtis	fmuld	%f14,pio2_2,%f12
502*25c28e83SPiotr Jasiukajtis	add	%l1,1,%l1
503*25c28e83SPiotr Jasiukajtis
504*25c28e83SPiotr Jasiukajtis	fsubd	%f16,%f18,%f16
505*25c28e83SPiotr Jasiukajtis	fmuld	%f22,pio2_2,%f20
506*25c28e83SPiotr Jasiukajtis	add	%l2,1,%l2
507*25c28e83SPiotr Jasiukajtis
508*25c28e83SPiotr Jasiukajtis	fsubd	%f24,%f26,%f24
509*25c28e83SPiotr Jasiukajtis	fmuld	%f30,pio2_2,%f28
510*25c28e83SPiotr Jasiukajtis	add	%l3,1,%l3
511*25c28e83SPiotr Jasiukajtis
512*25c28e83SPiotr Jasiukajtis	fsubd	%f0,%f4,%f32
513*25c28e83SPiotr Jasiukajtis
514*25c28e83SPiotr Jasiukajtis	fsubd	%f8,%f12,%f34
515*25c28e83SPiotr Jasiukajtis
516*25c28e83SPiotr Jasiukajtis	fsubd	%f16,%f20,%f36
517*25c28e83SPiotr Jasiukajtis
518*25c28e83SPiotr Jasiukajtis	fsubd	%f24,%f28,%f38
519*25c28e83SPiotr Jasiukajtis
520*25c28e83SPiotr Jasiukajtis	fsubd	%f0,%f32,%f0
521*25c28e83SPiotr Jasiukajtis	fcmple32 %f32,pio2_3,%l4	! x <= pio2_3 iff x < 0
522*25c28e83SPiotr Jasiukajtis
523*25c28e83SPiotr Jasiukajtis	fsubd	%f8,%f34,%f8
524*25c28e83SPiotr Jasiukajtis	fcmple32 %f34,pio2_3,%l5
525*25c28e83SPiotr Jasiukajtis
526*25c28e83SPiotr Jasiukajtis	fsubd	%f16,%f36,%f16
527*25c28e83SPiotr Jasiukajtis	fcmple32 %f36,pio2_3,%l6
528*25c28e83SPiotr Jasiukajtis
529*25c28e83SPiotr Jasiukajtis	fsubd	%f24,%f38,%f24
530*25c28e83SPiotr Jasiukajtis	fcmple32 %f38,pio2_3,%l7
531*25c28e83SPiotr Jasiukajtis
532*25c28e83SPiotr Jasiukajtis	fsubd	%f0,%f4,%f0
533*25c28e83SPiotr Jasiukajtis	fmuld	%f6,pio2_3,%f6
534*25c28e83SPiotr Jasiukajtis	sll	%l4,30,%l4		! if (x < 0) n = -n ^ 2
535*25c28e83SPiotr Jasiukajtis
536*25c28e83SPiotr Jasiukajtis	fsubd	%f8,%f12,%f8
537*25c28e83SPiotr Jasiukajtis	fmuld	%f14,pio2_3,%f14
538*25c28e83SPiotr Jasiukajtis	sll	%l5,30,%l5
539*25c28e83SPiotr Jasiukajtis
540*25c28e83SPiotr Jasiukajtis	fsubd	%f16,%f20,%f16
541*25c28e83SPiotr Jasiukajtis	fmuld	%f22,pio2_3,%f22
542*25c28e83SPiotr Jasiukajtis	sll	%l6,30,%l6
543*25c28e83SPiotr Jasiukajtis
544*25c28e83SPiotr Jasiukajtis	fsubd	%f24,%f28,%f24
545*25c28e83SPiotr Jasiukajtis	fmuld	%f30,pio2_3,%f30
546*25c28e83SPiotr Jasiukajtis	sll	%l7,30,%l7
547*25c28e83SPiotr Jasiukajtis
548*25c28e83SPiotr Jasiukajtis	fsubd	%f6,%f0,%f6
549*25c28e83SPiotr Jasiukajtis	sra	%l4,31,%l4
550*25c28e83SPiotr Jasiukajtis
551*25c28e83SPiotr Jasiukajtis	fsubd	%f14,%f8,%f14
552*25c28e83SPiotr Jasiukajtis	sra	%l5,31,%l5
553*25c28e83SPiotr Jasiukajtis
554*25c28e83SPiotr Jasiukajtis	fsubd	%f22,%f16,%f22
555*25c28e83SPiotr Jasiukajtis	sra	%l6,31,%l6
556*25c28e83SPiotr Jasiukajtis
557*25c28e83SPiotr Jasiukajtis	fsubd	%f30,%f24,%f30
558*25c28e83SPiotr Jasiukajtis	sra	%l7,31,%l7
559*25c28e83SPiotr Jasiukajtis
560*25c28e83SPiotr Jasiukajtis	fsubd	%f32,%f6,%f0		! reduced x
561*25c28e83SPiotr Jasiukajtis	xor	%l0,%l4,%l0
562*25c28e83SPiotr Jasiukajtis
563*25c28e83SPiotr Jasiukajtis	fsubd	%f34,%f14,%f8
564*25c28e83SPiotr Jasiukajtis	xor	%l1,%l5,%l1
565*25c28e83SPiotr Jasiukajtis
566*25c28e83SPiotr Jasiukajtis	fsubd	%f36,%f22,%f16
567*25c28e83SPiotr Jasiukajtis	xor	%l2,%l6,%l2
568*25c28e83SPiotr Jasiukajtis
569*25c28e83SPiotr Jasiukajtis	fsubd	%f38,%f30,%f24
570*25c28e83SPiotr Jasiukajtis	xor	%l3,%l7,%l3
571*25c28e83SPiotr Jasiukajtis
572*25c28e83SPiotr Jasiukajtis	fabsd	%f0,%f2
573*25c28e83SPiotr Jasiukajtis	sub	%l0,%l4,%l0
574*25c28e83SPiotr Jasiukajtis
575*25c28e83SPiotr Jasiukajtis	fabsd	%f8,%f10
576*25c28e83SPiotr Jasiukajtis	sub	%l1,%l5,%l1
577*25c28e83SPiotr Jasiukajtis
578*25c28e83SPiotr Jasiukajtis	fabsd	%f16,%f18
579*25c28e83SPiotr Jasiukajtis	sub	%l2,%l6,%l2
580*25c28e83SPiotr Jasiukajtis
581*25c28e83SPiotr Jasiukajtis	fabsd	%f24,%f26
582*25c28e83SPiotr Jasiukajtis	sub	%l3,%l7,%l3
583*25c28e83SPiotr Jasiukajtis
584*25c28e83SPiotr Jasiukajtis	faddd	%f2,c3two44,%f4
585*25c28e83SPiotr Jasiukajtis	st	%f5,[%fp+nk0]
586*25c28e83SPiotr Jasiukajtis	and	%l4,2,%l4
587*25c28e83SPiotr Jasiukajtis
588*25c28e83SPiotr Jasiukajtis	faddd	%f10,c3two44,%f12
589*25c28e83SPiotr Jasiukajtis	st	%f13,[%fp+nk1]
590*25c28e83SPiotr Jasiukajtis	and	%l5,2,%l5
591*25c28e83SPiotr Jasiukajtis
592*25c28e83SPiotr Jasiukajtis	faddd	%f18,c3two44,%f20
593*25c28e83SPiotr Jasiukajtis	st	%f21,[%fp+nk2]
594*25c28e83SPiotr Jasiukajtis	and	%l6,2,%l6
595*25c28e83SPiotr Jasiukajtis
596*25c28e83SPiotr Jasiukajtis	faddd	%f26,c3two44,%f28
597*25c28e83SPiotr Jasiukajtis	st	%f29,[%fp+nk3]
598*25c28e83SPiotr Jasiukajtis	and	%l7,2,%l7
599*25c28e83SPiotr Jasiukajtis
600*25c28e83SPiotr Jasiukajtis	fsubd	%f32,%f0,%f4
601*25c28e83SPiotr Jasiukajtis	xor	%l0,%l4,%l0
602*25c28e83SPiotr Jasiukajtis
603*25c28e83SPiotr Jasiukajtis	fsubd	%f34,%f8,%f12
604*25c28e83SPiotr Jasiukajtis	xor	%l1,%l5,%l1
605*25c28e83SPiotr Jasiukajtis
606*25c28e83SPiotr Jasiukajtis	fsubd	%f36,%f16,%f20
607*25c28e83SPiotr Jasiukajtis	xor	%l2,%l6,%l2
608*25c28e83SPiotr Jasiukajtis
609*25c28e83SPiotr Jasiukajtis	fsubd	%f38,%f24,%f28
610*25c28e83SPiotr Jasiukajtis	xor	%l3,%l7,%l3
611*25c28e83SPiotr Jasiukajtis
612*25c28e83SPiotr Jasiukajtis	fzero	%f38
613*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk0],%l4
614*25c28e83SPiotr Jasiukajtis
615*25c28e83SPiotr Jasiukajtis	fsubd	%f4,%f6,%f6		! w
616*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk1],%l5
617*25c28e83SPiotr Jasiukajtis
618*25c28e83SPiotr Jasiukajtis	fsubd	%f12,%f14,%f14
619*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk2],%l6
620*25c28e83SPiotr Jasiukajtis
621*25c28e83SPiotr Jasiukajtis	fnegd	%f38,%f38
622*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk3],%l7
623*25c28e83SPiotr Jasiukajtis	sll	%l4,5,%l4		! k
624*25c28e83SPiotr Jasiukajtis
625*25c28e83SPiotr Jasiukajtis	fsubd	%f20,%f22,%f22
626*25c28e83SPiotr Jasiukajtis	sll	%l5,5,%l5
627*25c28e83SPiotr Jasiukajtis
628*25c28e83SPiotr Jasiukajtis	fsubd	%f28,%f30,%f30
629*25c28e83SPiotr Jasiukajtis	sll	%l6,5,%l6
630*25c28e83SPiotr Jasiukajtis
631*25c28e83SPiotr Jasiukajtis	fand	%f0,%f38,%f32		! sign bit of x
632*25c28e83SPiotr Jasiukajtis	ldd	[%l4+%g1],%f4
633*25c28e83SPiotr Jasiukajtis	sll	%l7,5,%l7
634*25c28e83SPiotr Jasiukajtis
635*25c28e83SPiotr Jasiukajtis	fand	%f8,%f38,%f34
636*25c28e83SPiotr Jasiukajtis	ldd	[%l5+%g1],%f12
637*25c28e83SPiotr Jasiukajtis
638*25c28e83SPiotr Jasiukajtis	fand	%f16,%f38,%f36
639*25c28e83SPiotr Jasiukajtis	ldd	[%l6+%g1],%f20
640*25c28e83SPiotr Jasiukajtis
641*25c28e83SPiotr Jasiukajtis	fand	%f24,%f38,%f38
642*25c28e83SPiotr Jasiukajtis	ldd	[%l7+%g1],%f28
643*25c28e83SPiotr Jasiukajtis
644*25c28e83SPiotr Jasiukajtis	fsubd	%f2,%f4,%f2		! x -= __vlibm_TBL_sincos2[k]
645*25c28e83SPiotr Jasiukajtis
646*25c28e83SPiotr Jasiukajtis	fsubd	%f10,%f12,%f10
647*25c28e83SPiotr Jasiukajtis
648*25c28e83SPiotr Jasiukajtis	fsubd	%f18,%f20,%f18
649*25c28e83SPiotr Jasiukajtis	nop
650*25c28e83SPiotr Jasiukajtis
651*25c28e83SPiotr Jasiukajtis	fsubd	%f26,%f28,%f26
652*25c28e83SPiotr Jasiukajtis	nop
653*25c28e83SPiotr Jasiukajtis
654*25c28e83SPiotr Jasiukajtis! 16-byte aligned
655*25c28e83SPiotr Jasiukajtis	fmuld	%f2,%f2,%f0		! z = x * x
656*25c28e83SPiotr Jasiukajtis	andcc	%l0,1,%g0
657*25c28e83SPiotr Jasiukajtis	bz,pn	%icc,.case8
658*25c28e83SPiotr Jasiukajtis! delay slot
659*25c28e83SPiotr Jasiukajtis	fxor	%f6,%f32,%f32
660*25c28e83SPiotr Jasiukajtis
661*25c28e83SPiotr Jasiukajtis	fmuld	%f10,%f10,%f8
662*25c28e83SPiotr Jasiukajtis	andcc	%l1,1,%g0
663*25c28e83SPiotr Jasiukajtis	bz,pn	%icc,.case4
664*25c28e83SPiotr Jasiukajtis! delay slot
665*25c28e83SPiotr Jasiukajtis	fxor	%f14,%f34,%f34
666*25c28e83SPiotr Jasiukajtis
667*25c28e83SPiotr Jasiukajtis	fmuld	%f18,%f18,%f16
668*25c28e83SPiotr Jasiukajtis	andcc	%l2,1,%g0
669*25c28e83SPiotr Jasiukajtis	bz,pn	%icc,.case2
670*25c28e83SPiotr Jasiukajtis! delay slot
671*25c28e83SPiotr Jasiukajtis	fxor	%f22,%f36,%f36
672*25c28e83SPiotr Jasiukajtis
673*25c28e83SPiotr Jasiukajtis	fmuld	%f26,%f26,%f24
674*25c28e83SPiotr Jasiukajtis	andcc	%l3,1,%g0
675*25c28e83SPiotr Jasiukajtis	bz,pn	%icc,.case1
676*25c28e83SPiotr Jasiukajtis! delay slot
677*25c28e83SPiotr Jasiukajtis	fxor	%f30,%f38,%f38
678*25c28e83SPiotr Jasiukajtis
679*25c28e83SPiotr Jasiukajtis!.case0:
680*25c28e83SPiotr Jasiukajtis	fmuld	%f0,qq3,%f6		! cos(x0)
681*25c28e83SPiotr Jasiukajtis
682*25c28e83SPiotr Jasiukajtis	fmuld	%f8,qq3,%f14		! cos(x1)
683*25c28e83SPiotr Jasiukajtis
684*25c28e83SPiotr Jasiukajtis	fmuld	%f16,qq3,%f22		! cos(x2)
685*25c28e83SPiotr Jasiukajtis
686*25c28e83SPiotr Jasiukajtis	fmuld	%f24,