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	"__vsin_ultra3.S"
30*25c28e83SPiotr Jasiukajtis
31*25c28e83SPiotr Jasiukajtis#include "libm.h"
32*25c28e83SPiotr Jasiukajtis	.weak	__vsin
33*25c28e83SPiotr Jasiukajtis	.type	__vsin,#function
34*25c28e83SPiotr Jasiukajtis	__vsin = __vsin_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(__vsin_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	ba	.loop0
181*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1		! x += stridex
182*25c28e83SPiotr Jasiukajtis
183*25c28e83SPiotr Jasiukajtis! 16-byte aligned
184*25c28e83SPiotr Jasiukajtis	.align	16
185*25c28e83SPiotr Jasiukajtis.loop0:
186*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%l1		! preload next argument
187*25c28e83SPiotr Jasiukajtis	sub	%l0,%o4,%g5
188*25c28e83SPiotr Jasiukajtis	sub	%o5,%l0,%o7
189*25c28e83SPiotr Jasiukajtis	fabss	%f0,%f2
190*25c28e83SPiotr Jasiukajtis
191*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%f8
192*25c28e83SPiotr Jasiukajtis	orcc	%o7,%g5,%g0
193*25c28e83SPiotr Jasiukajtis	mov	%i3,%o0			! py0 = y
194*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.range0		! hx < 0x3e400000 or hx > 0x4099251e
195*25c28e83SPiotr Jasiukajtis
196*25c28e83SPiotr Jasiukajtis! delay slot
197*25c28e83SPiotr Jasiukajtis	lda	[%i1+4]%asi,%f11
198*25c28e83SPiotr Jasiukajtis	addcc	%i0,-1,%i0
199*25c28e83SPiotr Jasiukajtis	add	%i3,%i4,%i3		! y += stridey
200*25c28e83SPiotr Jasiukajtis	ble,pn	%icc,.last1
201*25c28e83SPiotr Jasiukajtis
202*25c28e83SPiotr Jasiukajtis! delay slot
203*25c28e83SPiotr Jasiukajtis	andn	%l1,%i5,%l1
204*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1		! x += stridex
205*25c28e83SPiotr Jasiukajtis	faddd	%f2,c3two44,%f4
206*25c28e83SPiotr Jasiukajtis	st	%f15,[%o1+4]
207*25c28e83SPiotr Jasiukajtis
208*25c28e83SPiotr Jasiukajtis.loop1:
209*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%l2		! preload next argument
210*25c28e83SPiotr Jasiukajtis	sub	%l1,%o4,%g5
211*25c28e83SPiotr Jasiukajtis	sub	%o5,%l1,%o7
212*25c28e83SPiotr Jasiukajtis	fabss	%f8,%f10
213*25c28e83SPiotr Jasiukajtis
214*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%f16
215*25c28e83SPiotr Jasiukajtis	orcc	%o7,%g5,%g0
216*25c28e83SPiotr Jasiukajtis	mov	%i3,%o1			! py1 = y
217*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.range1		! hx < 0x3e400000 or hx > 0x4099251e
218*25c28e83SPiotr Jasiukajtis
219*25c28e83SPiotr Jasiukajtis! delay slot
220*25c28e83SPiotr Jasiukajtis	lda	[%i1+4]%asi,%f19
221*25c28e83SPiotr Jasiukajtis	addcc	%i0,-1,%i0
222*25c28e83SPiotr Jasiukajtis	add	%i3,%i4,%i3		! y += stridey
223*25c28e83SPiotr Jasiukajtis	ble,pn	%icc,.last2
224*25c28e83SPiotr Jasiukajtis
225*25c28e83SPiotr Jasiukajtis! delay slot
226*25c28e83SPiotr Jasiukajtis	andn	%l2,%i5,%l2
227*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1		! x += stridex
228*25c28e83SPiotr Jasiukajtis	faddd	%f10,c3two44,%f12
229*25c28e83SPiotr Jasiukajtis	st	%f23,[%o2+4]
230*25c28e83SPiotr Jasiukajtis
231*25c28e83SPiotr Jasiukajtis.loop2:
232*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%l3		! preload next argument
233*25c28e83SPiotr Jasiukajtis	sub	%l2,%o4,%g5
234*25c28e83SPiotr Jasiukajtis	sub	%o5,%l2,%o7
235*25c28e83SPiotr Jasiukajtis	fabss	%f16,%f18
236*25c28e83SPiotr Jasiukajtis
237*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%f24
238*25c28e83SPiotr Jasiukajtis	orcc	%o7,%g5,%g0
239*25c28e83SPiotr Jasiukajtis	mov	%i3,%o2			! py2 = y
240*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.range2		! hx < 0x3e400000 or hx > 0x4099251e
241*25c28e83SPiotr Jasiukajtis
242*25c28e83SPiotr Jasiukajtis! delay slot
243*25c28e83SPiotr Jasiukajtis	lda	[%i1+4]%asi,%f27
244*25c28e83SPiotr Jasiukajtis	addcc	%i0,-1,%i0
245*25c28e83SPiotr Jasiukajtis	add	%i3,%i4,%i3		! y += stridey
246*25c28e83SPiotr Jasiukajtis	ble,pn	%icc,.last3
247*25c28e83SPiotr Jasiukajtis
248*25c28e83SPiotr Jasiukajtis! delay slot
249*25c28e83SPiotr Jasiukajtis	andn	%l3,%i5,%l3
250*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1		! x += stridex
251*25c28e83SPiotr Jasiukajtis	faddd	%f18,c3two44,%f20
252*25c28e83SPiotr Jasiukajtis	st	%f31,[%o3+4]
253*25c28e83SPiotr Jasiukajtis
254*25c28e83SPiotr Jasiukajtis.loop3:
255*25c28e83SPiotr Jasiukajtis	sub	%l3,%o4,%g5
256*25c28e83SPiotr Jasiukajtis	sub	%o5,%l3,%o7
257*25c28e83SPiotr Jasiukajtis	fabss	%f24,%f26
258*25c28e83SPiotr Jasiukajtis	st	%f5,[%fp+nk0]
259*25c28e83SPiotr Jasiukajtis
260*25c28e83SPiotr Jasiukajtis	orcc	%o7,%g5,%g0
261*25c28e83SPiotr Jasiukajtis	mov	%i3,%o3			! py3 = y
262*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.range3		! hx < 0x3e400000 or > hx 0x4099251e
263*25c28e83SPiotr Jasiukajtis! delay slot
264*25c28e83SPiotr Jasiukajtis	st	%f13,[%fp+nk1]
265*25c28e83SPiotr Jasiukajtis
266*25c28e83SPiotr Jasiukajtis!!! DONE?
267*25c28e83SPiotr Jasiukajtis.cont:
268*25c28e83SPiotr Jasiukajtis	srlx	%o5,32,%o7
269*25c28e83SPiotr Jasiukajtis	add	%i3,%i4,%i3		! y += stridey
270*25c28e83SPiotr Jasiukajtis	fmovs	%f3,%f1
271*25c28e83SPiotr Jasiukajtis	st	%f21,[%fp+nk2]
272*25c28e83SPiotr Jasiukajtis
273*25c28e83SPiotr Jasiukajtis	sub	%o7,%l0,%l0
274*25c28e83SPiotr Jasiukajtis	sub	%o7,%l1,%l1
275*25c28e83SPiotr Jasiukajtis	faddd	%f26,c3two44,%f28
276*25c28e83SPiotr Jasiukajtis	st	%f29,[%fp+nk3]
277*25c28e83SPiotr Jasiukajtis
278*25c28e83SPiotr Jasiukajtis	sub	%o7,%l2,%l2
279*25c28e83SPiotr Jasiukajtis	sub	%o7,%l3,%l3
280*25c28e83SPiotr Jasiukajtis	fmovs	%f11,%f9
281*25c28e83SPiotr Jasiukajtis
282*25c28e83SPiotr Jasiukajtis	or	%l0,%l1,%l0
283*25c28e83SPiotr Jasiukajtis	or	%l2,%l3,%l2
284*25c28e83SPiotr Jasiukajtis	fmovs	%f19,%f17
285*25c28e83SPiotr Jasiukajtis
286*25c28e83SPiotr Jasiukajtis	fmovs	%f27,%f25
287*25c28e83SPiotr Jasiukajtis	fmuld	%f0,invpio2,%f6		! x * invpio2, for medium range
288*25c28e83SPiotr Jasiukajtis
289*25c28e83SPiotr Jasiukajtis	fmuld	%f8,invpio2,%f14
290*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk0],%l4
291*25c28e83SPiotr Jasiukajtis
292*25c28e83SPiotr Jasiukajtis	fmuld	%f16,invpio2,%f22
293*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk1],%l5
294*25c28e83SPiotr Jasiukajtis
295*25c28e83SPiotr Jasiukajtis	orcc	%l0,%l2,%g0
296*25c28e83SPiotr Jasiukajtis	bl,pn	%icc,.medium
297*25c28e83SPiotr Jasiukajtis! delay slot
298*25c28e83SPiotr Jasiukajtis	fmuld	%f24,invpio2,%f30
299*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk2],%l6
300*25c28e83SPiotr Jasiukajtis
301*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk3],%l7
302*25c28e83SPiotr Jasiukajtis	sll	%l4,5,%l4		! k
303*25c28e83SPiotr Jasiukajtis	fcmpd	%fcc0,%f0,pio2_3	! x < pio2_3 iff x < 0
304*25c28e83SPiotr Jasiukajtis
305*25c28e83SPiotr Jasiukajtis	sll	%l5,5,%l5
306*25c28e83SPiotr Jasiukajtis	ldd	[%l4+%g1],%f4
307*25c28e83SPiotr Jasiukajtis	fcmpd	%fcc1,%f8,pio2_3
308*25c28e83SPiotr Jasiukajtis
309*25c28e83SPiotr Jasiukajtis	sll	%l6,5,%l6
310*25c28e83SPiotr Jasiukajtis	ldd	[%l5+%g1],%f12
311*25c28e83SPiotr Jasiukajtis	fcmpd	%fcc2,%f16,pio2_3
312*25c28e83SPiotr Jasiukajtis
313*25c28e83SPiotr Jasiukajtis	sll	%l7,5,%l7
314*25c28e83SPiotr Jasiukajtis	ldd	[%l6+%g1],%f20
315*25c28e83SPiotr Jasiukajtis	fcmpd	%fcc3,%f24,pio2_3
316*25c28e83SPiotr Jasiukajtis
317*25c28e83SPiotr Jasiukajtis	ldd	[%l7+%g1],%f28
318*25c28e83SPiotr Jasiukajtis	fsubd	%f2,%f4,%f2		! x -= __vlibm_TBL_sincos2[k]
319*25c28e83SPiotr Jasiukajtis
320*25c28e83SPiotr Jasiukajtis	fsubd	%f10,%f12,%f10
321*25c28e83SPiotr Jasiukajtis
322*25c28e83SPiotr Jasiukajtis	fsubd	%f18,%f20,%f18
323*25c28e83SPiotr Jasiukajtis
324*25c28e83SPiotr Jasiukajtis	fsubd	%f26,%f28,%f26
325*25c28e83SPiotr Jasiukajtis
326*25c28e83SPiotr Jasiukajtis	fmuld	%f2,%f2,%f0		! z = x * x
327*25c28e83SPiotr Jasiukajtis
328*25c28e83SPiotr Jasiukajtis	fmuld	%f10,%f10,%f8
329*25c28e83SPiotr Jasiukajtis
330*25c28e83SPiotr Jasiukajtis	fmuld	%f18,%f18,%f16
331*25c28e83SPiotr Jasiukajtis
332*25c28e83SPiotr Jasiukajtis	fmuld	%f26,%f26,%f24
333*25c28e83SPiotr Jasiukajtis
334*25c28e83SPiotr Jasiukajtis	fmuld	%f0,pp3,%f6
335*25c28e83SPiotr Jasiukajtis
336*25c28e83SPiotr Jasiukajtis	fmuld	%f8,pp3,%f14
337*25c28e83SPiotr Jasiukajtis
338*25c28e83SPiotr Jasiukajtis	fmuld	%f16,pp3,%f22
339*25c28e83SPiotr Jasiukajtis
340*25c28e83SPiotr Jasiukajtis	fmuld	%f24,pp3,%f30
341*25c28e83SPiotr Jasiukajtis
342*25c28e83SPiotr Jasiukajtis	faddd	%f6,pp2,%f6
343*25c28e83SPiotr Jasiukajtis	fmuld	%f0,qq2,%f4
344*25c28e83SPiotr Jasiukajtis
345*25c28e83SPiotr Jasiukajtis	faddd	%f14,pp2,%f14
346*25c28e83SPiotr Jasiukajtis	fmuld	%f8,qq2,%f12
347*25c28e83SPiotr Jasiukajtis
348*25c28e83SPiotr Jasiukajtis	faddd	%f22,pp2,%f22
349*25c28e83SPiotr Jasiukajtis	fmuld	%f16,qq2,%f20
350*25c28e83SPiotr Jasiukajtis
351*25c28e83SPiotr Jasiukajtis	faddd	%f30,pp2,%f30
352*25c28e83SPiotr Jasiukajtis	fmuld	%f24,qq2,%f28
353*25c28e83SPiotr Jasiukajtis
354*25c28e83SPiotr Jasiukajtis	fmuld	%f0,%f6,%f6
355*25c28e83SPiotr Jasiukajtis	faddd	%f4,qq1,%f4
356*25c28e83SPiotr Jasiukajtis
357*25c28e83SPiotr Jasiukajtis	fmuld	%f8,%f14,%f14
358*25c28e83SPiotr Jasiukajtis	faddd	%f12,qq1,%f12
359*25c28e83SPiotr Jasiukajtis
360*25c28e83SPiotr Jasiukajtis	fmuld	%f16,%f22,%f22
361*25c28e83SPiotr Jasiukajtis	faddd	%f20,qq1,%f20
362*25c28e83SPiotr Jasiukajtis
363*25c28e83SPiotr Jasiukajtis	fmuld	%f24,%f30,%f30
364*25c28e83SPiotr Jasiukajtis	faddd	%f28,qq1,%f28
365*25c28e83SPiotr Jasiukajtis
366*25c28e83SPiotr Jasiukajtis	faddd	%f6,pp1,%f6
367*25c28e83SPiotr Jasiukajtis	fmuld	%f0,%f4,%f4
368*25c28e83SPiotr Jasiukajtis	add	%l4,%g1,%l4
369*25c28e83SPiotr Jasiukajtis
370*25c28e83SPiotr Jasiukajtis	faddd	%f14,pp1,%f14
371*25c28e83SPiotr Jasiukajtis	fmuld	%f8,%f12,%f12
372*25c28e83SPiotr Jasiukajtis	add	%l5,%g1,%l5
373*25c28e83SPiotr Jasiukajtis
374*25c28e83SPiotr Jasiukajtis	faddd	%f22,pp1,%f22
375*25c28e83SPiotr Jasiukajtis	fmuld	%f16,%f20,%f20
376*25c28e83SPiotr Jasiukajtis	add	%l6,%g1,%l6
377*25c28e83SPiotr Jasiukajtis
378*25c28e83SPiotr Jasiukajtis	faddd	%f30,pp1,%f30
379*25c28e83SPiotr Jasiukajtis	fmuld	%f24,%f28,%f28
380*25c28e83SPiotr Jasiukajtis	add	%l7,%g1,%l7
381*25c28e83SPiotr Jasiukajtis
382*25c28e83SPiotr Jasiukajtis	fmuld	%f0,%f6,%f6
383*25c28e83SPiotr Jasiukajtis	ldd	[%l4+8],%f0
384*25c28e83SPiotr Jasiukajtis
385*25c28e83SPiotr Jasiukajtis	fmuld	%f8,%f14,%f14
386*25c28e83SPiotr Jasiukajtis	ldd	[%l5+8],%f8
387*25c28e83SPiotr Jasiukajtis
388*25c28e83SPiotr Jasiukajtis	fmuld	%f16,%f22,%f22
389*25c28e83SPiotr Jasiukajtis	ldd	[%l6+8],%f16
390*25c28e83SPiotr Jasiukajtis
391*25c28e83SPiotr Jasiukajtis	fmuld	%f24,%f30,%f30
392*25c28e83SPiotr Jasiukajtis	ldd	[%l7+8],%f24
393*25c28e83SPiotr Jasiukajtis
394*25c28e83SPiotr Jasiukajtis	fmuld	%f2,%f6,%f6
395*25c28e83SPiotr Jasiukajtis
396*25c28e83SPiotr Jasiukajtis	fmuld	%f10,%f14,%f14
397*25c28e83SPiotr Jasiukajtis
398*25c28e83SPiotr Jasiukajtis	fmuld	%f18,%f22,%f22
399*25c28e83SPiotr Jasiukajtis
400*25c28e83SPiotr Jasiukajtis	fmuld	%f26,%f30,%f30
401*25c28e83SPiotr Jasiukajtis
402*25c28e83SPiotr Jasiukajtis	faddd	%f6,%f2,%f6
403*25c28e83SPiotr Jasiukajtis	fmuld	%f0,%f4,%f4
404*25c28e83SPiotr Jasiukajtis	ldd	[%l4+16],%f2
405*25c28e83SPiotr Jasiukajtis
406*25c28e83SPiotr Jasiukajtis	faddd	%f14,%f10,%f14
407*25c28e83SPiotr Jasiukajtis	fmuld	%f8,%f12,%f12
408*25c28e83SPiotr Jasiukajtis	ldd	[%l5+16],%f10
409*25c28e83SPiotr Jasiukajtis
410*25c28e83SPiotr Jasiukajtis	faddd	%f22,%f18,%f22
411*25c28e83SPiotr Jasiukajtis	fmuld	%f16,%f20,%f20
412*25c28e83SPiotr Jasiukajtis	ldd	[%l6+16],%f18
413*25c28e83SPiotr Jasiukajtis
414*25c28e83SPiotr Jasiukajtis	faddd	%f30,%f26,%f30
415*25c28e83SPiotr Jasiukajtis	fmuld	%f24,%f28,%f28
416*25c28e83SPiotr Jasiukajtis	ldd	[%l7+16],%f26
417*25c28e83SPiotr Jasiukajtis
418*25c28e83SPiotr Jasiukajtis	fmuld	%f2,%f6,%f6
419*25c28e83SPiotr Jasiukajtis
420*25c28e83SPiotr Jasiukajtis	fmuld	%f10,%f14,%f14
421*25c28e83SPiotr Jasiukajtis
422*25c28e83SPiotr Jasiukajtis	fmuld	%f18,%f22,%f22
423*25c28e83SPiotr Jasiukajtis
424*25c28e83SPiotr Jasiukajtis	fmuld	%f26,%f30,%f30
425*25c28e83SPiotr Jasiukajtis
426*25c28e83SPiotr Jasiukajtis	faddd	%f6,%f4,%f6
427*25c28e83SPiotr Jasiukajtis
428*25c28e83SPiotr Jasiukajtis	faddd	%f14,%f12,%f14
429*25c28e83SPiotr Jasiukajtis
430*25c28e83SPiotr Jasiukajtis	faddd	%f22,%f20,%f22
431*25c28e83SPiotr Jasiukajtis
432*25c28e83SPiotr Jasiukajtis	faddd	%f30,%f28,%f30
433*25c28e83SPiotr Jasiukajtis
434*25c28e83SPiotr Jasiukajtis	faddd	%f6,%f0,%f6
435*25c28e83SPiotr Jasiukajtis
436*25c28e83SPiotr Jasiukajtis	faddd	%f14,%f8,%f14
437*25c28e83SPiotr Jasiukajtis
438*25c28e83SPiotr Jasiukajtis	faddd	%f22,%f16,%f22
439*25c28e83SPiotr Jasiukajtis
440*25c28e83SPiotr Jasiukajtis	faddd	%f30,%f24,%f30
441*25c28e83SPiotr Jasiukajtis
442*25c28e83SPiotr Jasiukajtis	fnegd	%f6,%f4
443*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%l0		! preload next argument
444*25c28e83SPiotr Jasiukajtis
445*25c28e83SPiotr Jasiukajtis	fnegd	%f14,%f12
446*25c28e83SPiotr Jasiukajtis	lda	[%i1]%asi,%f0
447*25c28e83SPiotr Jasiukajtis
448*25c28e83SPiotr Jasiukajtis	fnegd	%f22,%f20
449*25c28e83SPiotr Jasiukajtis	lda	[%i1+4]%asi,%f3
450*25c28e83SPiotr Jasiukajtis
451*25c28e83SPiotr Jasiukajtis	fnegd	%f30,%f28
452*25c28e83SPiotr Jasiukajtis	andn	%l0,%i5,%l0
453*25c28e83SPiotr Jasiukajtis	add	%i1,%i2,%i1
454*25c28e83SPiotr Jasiukajtis
455*25c28e83SPiotr Jasiukajtis	fmovdl	%fcc0,%f4,%f6		! (hx < -0)? -s : s
456*25c28e83SPiotr Jasiukajtis	st	%f6,[%o0]
457*25c28e83SPiotr Jasiukajtis
458*25c28e83SPiotr Jasiukajtis	fmovdl	%fcc1,%f12,%f14
459*25c28e83SPiotr Jasiukajtis	st	%f14,[%o1]
460*25c28e83SPiotr Jasiukajtis
461*25c28e83SPiotr Jasiukajtis	fmovdl	%fcc2,%f20,%f22
462*25c28e83SPiotr Jasiukajtis	st	%f22,[%o2]
463*25c28e83SPiotr Jasiukajtis
464*25c28e83SPiotr Jasiukajtis	fmovdl	%fcc3,%f28,%f30
465*25c28e83SPiotr Jasiukajtis	st	%f30,[%o3]
466*25c28e83SPiotr Jasiukajtis	addcc	%i0,-1,%i0
467*25c28e83SPiotr Jasiukajtis
468*25c28e83SPiotr Jasiukajtis	bg,pt	%icc,.loop0
469*25c28e83SPiotr Jasiukajtis! delay slot
470*25c28e83SPiotr Jasiukajtis	st	%f7,[%o0+4]
471*25c28e83SPiotr Jasiukajtis
472*25c28e83SPiotr Jasiukajtis	ba,pt	%icc,.end
473*25c28e83SPiotr Jasiukajtis! delay slot
474*25c28e83SPiotr Jasiukajtis	nop
475*25c28e83SPiotr Jasiukajtis
476*25c28e83SPiotr Jasiukajtis
477*25c28e83SPiotr Jasiukajtis	.align	16
478*25c28e83SPiotr Jasiukajtis.medium:
479*25c28e83SPiotr Jasiukajtis	faddd	%f6,c3two51,%f4
480*25c28e83SPiotr Jasiukajtis	st	%f5,[%fp+nk0]
481*25c28e83SPiotr Jasiukajtis
482*25c28e83SPiotr Jasiukajtis	faddd	%f14,c3two51,%f12
483*25c28e83SPiotr Jasiukajtis	st	%f13,[%fp+nk1]
484*25c28e83SPiotr Jasiukajtis
485*25c28e83SPiotr Jasiukajtis	faddd	%f22,c3two51,%f20
486*25c28e83SPiotr Jasiukajtis	st	%f21,[%fp+nk2]
487*25c28e83SPiotr Jasiukajtis
488*25c28e83SPiotr Jasiukajtis	faddd	%f30,c3two51,%f28
489*25c28e83SPiotr Jasiukajtis	st	%f29,[%fp+nk3]
490*25c28e83SPiotr Jasiukajtis
491*25c28e83SPiotr Jasiukajtis	fsubd	%f4,c3two51,%f6
492*25c28e83SPiotr Jasiukajtis
493*25c28e83SPiotr Jasiukajtis	fsubd	%f12,c3two51,%f14
494*25c28e83SPiotr Jasiukajtis
495*25c28e83SPiotr Jasiukajtis	fsubd	%f20,c3two51,%f22
496*25c28e83SPiotr Jasiukajtis
497*25c28e83SPiotr Jasiukajtis	fsubd	%f28,c3two51,%f30
498*25c28e83SPiotr Jasiukajtis
499*25c28e83SPiotr Jasiukajtis	fmuld	%f6,pio2_1,%f2
500*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk0],%l0		! n
501*25c28e83SPiotr Jasiukajtis
502*25c28e83SPiotr Jasiukajtis	fmuld	%f14,pio2_1,%f10
503*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk1],%l1
504*25c28e83SPiotr Jasiukajtis
505*25c28e83SPiotr Jasiukajtis	fmuld	%f22,pio2_1,%f18
506*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk2],%l2
507*25c28e83SPiotr Jasiukajtis
508*25c28e83SPiotr Jasiukajtis	fmuld	%f30,pio2_1,%f26
509*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk3],%l3
510*25c28e83SPiotr Jasiukajtis
511*25c28e83SPiotr Jasiukajtis	fsubd	%f0,%f2,%f0
512*25c28e83SPiotr Jasiukajtis	fmuld	%f6,pio2_2,%f4
513*25c28e83SPiotr Jasiukajtis
514*25c28e83SPiotr Jasiukajtis	fsubd	%f8,%f10,%f8
515*25c28e83SPiotr Jasiukajtis	fmuld	%f14,pio2_2,%f12
516*25c28e83SPiotr Jasiukajtis
517*25c28e83SPiotr Jasiukajtis	fsubd	%f16,%f18,%f16
518*25c28e83SPiotr Jasiukajtis	fmuld	%f22,pio2_2,%f20
519*25c28e83SPiotr Jasiukajtis
520*25c28e83SPiotr Jasiukajtis	fsubd	%f24,%f26,%f24
521*25c28e83SPiotr Jasiukajtis	fmuld	%f30,pio2_2,%f28
522*25c28e83SPiotr Jasiukajtis
523*25c28e83SPiotr Jasiukajtis	fsubd	%f0,%f4,%f32
524*25c28e83SPiotr Jasiukajtis
525*25c28e83SPiotr Jasiukajtis	fsubd	%f8,%f12,%f34
526*25c28e83SPiotr Jasiukajtis
527*25c28e83SPiotr Jasiukajtis	fsubd	%f16,%f20,%f36
528*25c28e83SPiotr Jasiukajtis
529*25c28e83SPiotr Jasiukajtis	fsubd	%f24,%f28,%f38
530*25c28e83SPiotr Jasiukajtis
531*25c28e83SPiotr Jasiukajtis	fsubd	%f0,%f32,%f0
532*25c28e83SPiotr Jasiukajtis	fcmple32 %f32,pio2_3,%l4	! x <= pio2_3 iff x < 0
533*25c28e83SPiotr Jasiukajtis
534*25c28e83SPiotr Jasiukajtis	fsubd	%f8,%f34,%f8
535*25c28e83SPiotr Jasiukajtis	fcmple32 %f34,pio2_3,%l5
536*25c28e83SPiotr Jasiukajtis
537*25c28e83SPiotr Jasiukajtis	fsubd	%f16,%f36,%f16
538*25c28e83SPiotr Jasiukajtis	fcmple32 %f36,pio2_3,%l6
539*25c28e83SPiotr Jasiukajtis
540*25c28e83SPiotr Jasiukajtis	fsubd	%f24,%f38,%f24
541*25c28e83SPiotr Jasiukajtis	fcmple32 %f38,pio2_3,%l7
542*25c28e83SPiotr Jasiukajtis
543*25c28e83SPiotr Jasiukajtis	fsubd	%f0,%f4,%f0
544*25c28e83SPiotr Jasiukajtis	fmuld	%f6,pio2_3,%f6
545*25c28e83SPiotr Jasiukajtis	sll	%l4,30,%l4		! if (x < 0) n = -n ^ 2
546*25c28e83SPiotr Jasiukajtis
547*25c28e83SPiotr Jasiukajtis	fsubd	%f8,%f12,%f8
548*25c28e83SPiotr Jasiukajtis	fmuld	%f14,pio2_3,%f14
549*25c28e83SPiotr Jasiukajtis	sll	%l5,30,%l5
550*25c28e83SPiotr Jasiukajtis
551*25c28e83SPiotr Jasiukajtis	fsubd	%f16,%f20,%f16
552*25c28e83SPiotr Jasiukajtis	fmuld	%f22,pio2_3,%f22
553*25c28e83SPiotr Jasiukajtis	sll	%l6,30,%l6
554*25c28e83SPiotr Jasiukajtis
555*25c28e83SPiotr Jasiukajtis	fsubd	%f24,%f28,%f24
556*25c28e83SPiotr Jasiukajtis	fmuld	%f30,pio2_3,%f30
557*25c28e83SPiotr Jasiukajtis	sll	%l7,30,%l7
558*25c28e83SPiotr Jasiukajtis
559*25c28e83SPiotr Jasiukajtis	fsubd	%f6,%f0,%f6
560*25c28e83SPiotr Jasiukajtis	sra	%l4,31,%l4
561*25c28e83SPiotr Jasiukajtis
562*25c28e83SPiotr Jasiukajtis	fsubd	%f14,%f8,%f14
563*25c28e83SPiotr Jasiukajtis	sra	%l5,31,%l5
564*25c28e83SPiotr Jasiukajtis
565*25c28e83SPiotr Jasiukajtis	fsubd	%f22,%f16,%f22
566*25c28e83SPiotr Jasiukajtis	sra	%l6,31,%l6
567*25c28e83SPiotr Jasiukajtis
568*25c28e83SPiotr Jasiukajtis	fsubd	%f30,%f24,%f30
569*25c28e83SPiotr Jasiukajtis	sra	%l7,31,%l7
570*25c28e83SPiotr Jasiukajtis
571*25c28e83SPiotr Jasiukajtis	fsubd	%f32,%f6,%f0		! reduced x
572*25c28e83SPiotr Jasiukajtis	xor	%l0,%l4,%l0
573*25c28e83SPiotr Jasiukajtis
574*25c28e83SPiotr Jasiukajtis	fsubd	%f34,%f14,%f8
575*25c28e83SPiotr Jasiukajtis	xor	%l1,%l5,%l1
576*25c28e83SPiotr Jasiukajtis
577*25c28e83SPiotr Jasiukajtis	fsubd	%f36,%f22,%f16
578*25c28e83SPiotr Jasiukajtis	xor	%l2,%l6,%l2
579*25c28e83SPiotr Jasiukajtis
580*25c28e83SPiotr Jasiukajtis	fsubd	%f38,%f30,%f24
581*25c28e83SPiotr Jasiukajtis	xor	%l3,%l7,%l3
582*25c28e83SPiotr Jasiukajtis
583*25c28e83SPiotr Jasiukajtis	fabsd	%f0,%f2
584*25c28e83SPiotr Jasiukajtis	sub	%l0,%l4,%l0
585*25c28e83SPiotr Jasiukajtis
586*25c28e83SPiotr Jasiukajtis	fabsd	%f8,%f10
587*25c28e83SPiotr Jasiukajtis	sub	%l1,%l5,%l1
588*25c28e83SPiotr Jasiukajtis
589*25c28e83SPiotr Jasiukajtis	fabsd	%f16,%f18
590*25c28e83SPiotr Jasiukajtis	sub	%l2,%l6,%l2
591*25c28e83SPiotr Jasiukajtis
592*25c28e83SPiotr Jasiukajtis	fabsd	%f24,%f26
593*25c28e83SPiotr Jasiukajtis	sub	%l3,%l7,%l3
594*25c28e83SPiotr Jasiukajtis
595*25c28e83SPiotr Jasiukajtis	faddd	%f2,c3two44,%f4
596*25c28e83SPiotr Jasiukajtis	st	%f5,[%fp+nk0]
597*25c28e83SPiotr Jasiukajtis	and	%l4,2,%l4
598*25c28e83SPiotr Jasiukajtis
599*25c28e83SPiotr Jasiukajtis	faddd	%f10,c3two44,%f12
600*25c28e83SPiotr Jasiukajtis	st	%f13,[%fp+nk1]
601*25c28e83SPiotr Jasiukajtis	and	%l5,2,%l5
602*25c28e83SPiotr Jasiukajtis
603*25c28e83SPiotr Jasiukajtis	faddd	%f18,c3two44,%f20
604*25c28e83SPiotr Jasiukajtis	st	%f21,[%fp+nk2]
605*25c28e83SPiotr Jasiukajtis	and	%l6,2,%l6
606*25c28e83SPiotr Jasiukajtis
607*25c28e83SPiotr Jasiukajtis	faddd	%f26,c3two44,%f28
608*25c28e83SPiotr Jasiukajtis	st	%f29,[%fp+nk3]
609*25c28e83SPiotr Jasiukajtis	and	%l7,2,%l7
610*25c28e83SPiotr Jasiukajtis
611*25c28e83SPiotr Jasiukajtis	fsubd	%f32,%f0,%f4
612*25c28e83SPiotr Jasiukajtis	xor	%l0,%l4,%l0
613*25c28e83SPiotr Jasiukajtis
614*25c28e83SPiotr Jasiukajtis	fsubd	%f34,%f8,%f12
615*25c28e83SPiotr Jasiukajtis	xor	%l1,%l5,%l1
616*25c28e83SPiotr Jasiukajtis
617*25c28e83SPiotr Jasiukajtis	fsubd	%f36,%f16,%f20
618*25c28e83SPiotr Jasiukajtis	xor	%l2,%l6,%l2
619*25c28e83SPiotr Jasiukajtis
620*25c28e83SPiotr Jasiukajtis	fsubd	%f38,%f24,%f28
621*25c28e83SPiotr Jasiukajtis	xor	%l3,%l7,%l3
622*25c28e83SPiotr Jasiukajtis
623*25c28e83SPiotr Jasiukajtis	fzero	%f38
624*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk0],%l4
625*25c28e83SPiotr Jasiukajtis
626*25c28e83SPiotr Jasiukajtis	fsubd	%f4,%f6,%f6		! w
627*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk1],%l5
628*25c28e83SPiotr Jasiukajtis
629*25c28e83SPiotr Jasiukajtis	fsubd	%f12,%f14,%f14
630*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk2],%l6
631*25c28e83SPiotr Jasiukajtis
632*25c28e83SPiotr Jasiukajtis	fnegd	%f38,%f38
633*25c28e83SPiotr Jasiukajtis	ld	[%fp+nk3],%l7
634*25c28e83SPiotr Jasiukajtis	sll	%l4,5,%l4		! k
635*25c28e83SPiotr Jasiukajtis
636*25c28e83SPiotr Jasiukajtis	fsubd	%f20,%f22,%f22
637*25c28e83SPiotr Jasiukajtis	sll	%l5,5,%l5
638*25c28e83SPiotr Jasiukajtis
639*25c28e83SPiotr Jasiukajtis	fsubd	%f28,%f30,%f30
640*25c28e83SPiotr Jasiukajtis	sll	%l6,5,%l6
641*25c28e83SPiotr Jasiukajtis
642*25c28e83SPiotr Jasiukajtis	fand	%f0,%f38,%f32		! sign bit of x
643*25c28e83SPiotr Jasiukajtis	ldd	[%l4+%g1],%f4
644*25c28e83SPiotr Jasiukajtis	sll	%l7,5,%l7
645*25c28e83SPiotr Jasiukajtis
646*25c28e83SPiotr Jasiukajtis	fand	%f8,%f38,%f34
647*25c28e83SPiotr Jasiukajtis	ldd	[%l5+%g1],%f12
648*25c28e83SPiotr Jasiukajtis
649*25c28e83SPiotr Jasiukajtis	fand	%f16,%f38,%f36
650*25c28e83SPiotr Jasiukajtis	ldd	[%l6+%g1],%f20
651*25c28e83SPiotr Jasiukajtis
652*25c28e83SPiotr Jasiukajtis	fand	%f24,%f38,%f38
653*25c28e83SPiotr Jasiukajtis	ldd	[%l7+%g1],%f28
654*25c28e83SPiotr Jasiukajtis
655*25c28e83SPiotr Jasiukajtis	fsubd	%f2,%f4,%f2		! x -= __vlibm_TBL_sincos2[k]
656*25c28e83SPiotr Jasiukajtis
657*25c28e83SPiotr Jasiukajtis	fsubd	%f10,%f12,%f10
658*25c28e83SPiotr Jasiukajtis
659*25c28e83SPiotr Jasiukajtis	fsubd	%f18,%f20,%f18
660*25c28e83SPiotr Jasiukajtis	nop
661*25c28e83SPiotr Jasiukajtis
662*25c28e83SPiotr Jasiukajtis	fsubd	%f26,%f28,%f26
663*25c28e83SPiotr Jasiukajtis	nop
664*25c28e83SPiotr Jasiukajtis
665*25c28e83SPiotr Jasiukajtis! 16-byte aligned
666*25c28e83SPiotr Jasiukajtis	fmuld	%f2,%f2,%f0		! z = x * x
667*25c28e83SPiotr Jasiukajtis	andcc	%l0,1,%g0
668*25c28e83SPiotr Jasiukajtis	bz,pn	%icc,.case8
669*25c28e83SPiotr Jasiukajtis! delay slot
670*25c28e83SPiotr Jasiukajtis	fxor	%f6,%f32,%f32
671*25c28e83SPiotr Jasiukajtis
672*25c28e83SPiotr Jasiukajtis	fmuld	%f10,%f10,%f8
673*25c28e83SPiotr Jasiukajtis	andcc	%l1,1,%g0
674*25c28e83SPiotr Jasiukajtis	bz,pn	%icc,.case4
675*25c28e83SPiotr Jasiukajtis! delay slot
676*25c28e83SPiotr Jasiukajtis	fxor	%f14,%f34,%f34
677*25c28e83SPiotr Jasiukajtis
678*25c28e83SPiotr Jasiukajtis	fmuld	%f18,%f18,%f16
679*25c28e83SPiotr Jasiukajtis	andcc	%l2,1,%g0
680*25c28e83SPiotr Jasiukajtis	bz,pn	%icc,.case2
681*25c28e83SPiotr Jasiukajtis! delay slot
682*25c28e83SPiotr Jasiukajtis	fxor	%f22,%f36,%f36
683*25c28e83SPiotr Jasiukajtis
684*25c28e83SPiotr Jasiukajtis	fmuld	%f26,%f26,%f24
685*25c28e83SPiotr Jasiukajtis	andcc	%l3,1,%g0
686*25c28e83SPiotr Jasiukajtis	bz,pn	%icc,.case1
687*25c28e83SPiotr Jasiukajtis! <