summaryrefslogtreecommitdiff
path: root/usr/src/lib/libmvec/common/vis/__vatan2.S
blob: 7df30825b3ae7a5d49c2b5b5177f79522d90c061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
 */
/*
 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

	.file	"__vatan2.S"

#include "libm.h"

	RO_DATA
	.align	64
constants:
	.word	0x3ff921fb,0x54442d18	! pio2
	.word	0x3c91a626,0x33145c07	! pio2_lo
	.word	0xbfd55555,0x555554ee	! p1
	.word	0x3fc99999,0x997a1559	! p2
	.word	0xbfc24923,0x158dfe02	! p3
	.word	0x3fbc639d,0x0ed1347b	! p4
	.word	0xffffffff,0x00000000	! mask
	.word	0x3fc00000,0x00000000	! twom3
	.word	0x46d00000,0x00000000	! two110
	.word	0x3fe921fb,0x54442d18	! pio4

! local storage indices

#define xscl		STACK_BIAS-0x8
#define yscl		STACK_BIAS-0x10
#define twom3		STACK_BIAS-0x18
#define two110		STACK_BIAS-0x20
#define pio4		STACK_BIAS-0x28
#define junk		STACK_BIAS-0x30
! sizeof temp storage - must be a multiple of 16 for V9
#define tmps		0x30

! register use

! i0  n
! i1  y
! i2  stridey
! i3  x
! i4  stridex
! i5  z

! l0  k0
! l1  k1
! l2  k2
! l3  hx
! l4  pz0
! l5  pz1
! l6  pz2
! l7  stridez

! the following are 64-bit registers in both V8+ and V9

! g1  __vlibm_TBL_atan2
! g5  

! o0  hy
! o1  0x00004000
! o2  0x1420
! o3  0x7fe00000
! o4  0x03600000
! o5  0x00100000
! o7  

! f0  y0
! f2  x0
! f4  t0
! f6  ah0
! f8  al0
! f10 y1
! f12 x1
! f14 t1
! f16 ah1
! f18 al1
! f20 y2
! f22 x2
! f24 t2
! f26 ah2
! f28 al2
! f30 
! f32 
! f34 
! f36 sx0
! f38 sx1
! f40 sx2
! f42 sy0
! f44 sy1
! f46 sy2

#define mask	%f48
#define signbit	%f50
#define pio2	%f52
#define pio2_lo	%f54
#define p1	%f56
#define p2	%f58
#define p3	%f60
#define p4	%f62

	ENTRY(__vatan2)
	save	%sp,-SA(MINFRAME)-tmps,%sp
	PIC_SETUP(l7)
	PIC_SET(l7,constants,o0)
	PIC_SET(l7,__vlibm_TBL_atan2,o1)
	wr	%g0,0x82,%asi		! set %asi for non-faulting loads
	mov	%o1, %g1
#ifdef __sparcv9
	ldx	[%fp+STACK_BIAS+0xb0],%l7
#else
	ld	[%fp+0x5c],%l7
#endif
	ldd	[%o0+0x00],pio2		! load/set up constants
	ldd	[%o0+0x08],pio2_lo
	ldd	[%o0+0x10],p1
	ldd	[%o0+0x18],p2
	ldd	[%o0+0x20],p3
	ldd	[%o0+0x28],p4
	ldd	[%o0+0x30],mask
	fzero	signbit
	fnegd	signbit,signbit
	sethi	%hi(0x00004000),%o1
	sethi	%hi(0x1420),%o2
	or	%o2,%lo(0x1420),%o2
	sethi	%hi(0x7fe00000),%o3
	sethi	%hi(0x03600000),%o4
	sethi	%hi(0x00100000),%o5
	ldd	[%o0+0x38],%f0		! copy rarely used constants to stack
	ldd	[%o0+0x40],%f2
	ldd	[%o0+0x48],%f4
	std	%f0,[%fp+twom3]
	std	%f2,[%fp+two110]
	std	%f4,[%fp+pio4]
	sll	%i2,3,%i2		! scale strides
	sll	%i4,3,%i4
	sll	%l7,3,%l7
	fzero	%f20			! loop prologue
	fzero	%f22
	fzero	%f24
	fzero	%f26
	fzero	%f46
	add	%fp,junk,%l6	
	ld	[%i1],%f0		! *y
	ld	[%i1+4],%f1
	ld	[%i3],%f8		! *x
	ld	[%i3+4],%f9
	ld	[%i1],%o0		! hy
	ba	.loop
	ld	[%i3],%l3		! hx

! 16-byte aligned
	.align	16
.loop:
	fabsd	%f0,%f4
	mov	%i5,%l4
	add	%i1,%i2,%i1		! y += stridey

	fabsd	%f8,%f2
	add	%i3,%i4,%i3		! x += stridex
	add	%i5,%l7,%i5		! z += stridez

	fand	%f0,signbit,%f42
	sethi	%hi(0x80000000),%g5

	fand	%f8,signbit,%f36
	andn	%o0,%g5,%o0
	andn	%l3,%g5,%l3

	fcmpd	%fcc0,%f4,%f2

	fmovd	%f4,%f0

	fmovdg	%fcc0,%f2,%f0		! swap if |y| > |x|

	fmovdg	%fcc0,%f4,%f2
	mov	%o0,%o7
	 lda	[%i1]%asi,%f10		! preload next argument

	  faddd	%f26,%f20,%f26
	 lda	[%i1+4]%asi,%f11

	  faddd	%f22,%f24,%f22
	movg	%fcc0,%l3,%o0

	movg	%fcc0,%o7,%l3

	fbu,pn	%fcc0,.nan0		! if x or y is nan
! delay slot
	 lda	[%i3]%asi,%f18

	sub	%l3,%o0,%l0		! hx - hy
	sub	%l3,%o3,%g5
	 fabsd	%f10,%f14
	 lda	[%i3+4]%asi,%f19

	sub	%l0,%o4,%o7
	  faddd	%f22,%f26,%f26

	andcc	%g5,%o7,%g0
	bge,pn	%icc,.big0		! if |x| or |x/y| is big
! delay slot
	nop

	 fabsd	%f18,%f12
	cmp	%o0,%o5
	bl,pn	%icc,.small0		! if |y| is small
! delay slot
	 lda	[%i1]%asi,%o0

	add	%l0,%o1,%l0		! k
	addcc	%i0,-1,%i0
	ble,pn	%icc,.last1
! delay slot
	 lda	[%i3]%asi,%l3

.cont1:
	srl	%l0,10,%l0
	 mov	%i5,%l5
	  fxor	%f26,%f46,%f26
	  st	%f26,[%l6]

	 fand	%f10,signbit,%f44
	andn	%l0,0x1f,%l0
	 add	%i1,%i2,%i1
	  st	%f27,[%l6+4]

	 fand	%f18,signbit,%f38
	cmp	%l0,%o2
	movg	%icc,%o2,%l0

	 fcmpd	%fcc1,%f14,%f12
	 add	%i3,%i4,%i3
	 add	%i5,%l7,%i5

	 fmovd	%f14,%f10
	add	%l0,%g1,%l0
	 sethi	%hi(0x80000000),%g5

	ldd	[%l0+0x10],%f4
	fand	%f2,mask,%f6
	 andn	%o0,%g5,%o0
	 andn	%l3,%g5,%l3

	 fmovdg	%fcc1,%f12,%f10

	 fmovdg	%fcc1,%f14,%f12
	 mov	%o0,%o7
	  lda	[%i1]%asi,%f20

	fsubd	%f2,%f6,%f30
	fmuld	%f6,%f4,%f6
	 movg	%fcc1,%l3,%o0

	fmuld	%f0,%f4,%f8
	 movg	%fcc1,%o7,%l3

	  lda	[%i1+4]%asi,%f21
	 fbu,pn	%fcc1,.nan1
! delay slot
	 nop

	  lda	[%i3]%asi,%f28
	 sub	%l3,%o0,%l1
	 sub	%l3,%o3,%g5

	  lda	[%i3+4]%asi,%f29
	fmuld	%f30,%f4,%f30
	fsubd	%f0,%f6,%f4
	 sub	%l1,%o4,%o7

	  fabsd	%f20,%f24
	 andcc	%g5,%o7,%g0
	 bge,pn	%icc,.big1
! delay slot
	 nop

	faddd	%f2,%f8,%f8
	 cmp	%o0,%o5
	 bl,pn	%icc,.small1
! delay slot
	  lda	[%i1]%asi,%o0

	  fabsd	%f28,%f22
	 add	%l1,%o1,%l1
	 addcc	%i0,-1,%i0
	  lda	[%i3]%asi,%l3

	fsubd	%f4,%f30,%f4
	 srl	%l1,10,%l1
	 ble,pn	%icc,.last2
! delay slot
	  mov	%i5,%l6

.cont2:
	  fand	%f20,signbit,%f46
	 andn	%l1,0x1f,%l1
	  add	%i1,%i2,%i1

	  fand	%f28,signbit,%f40
	 cmp	%l1,%o2
	 movg	%icc,%o2,%l1

	  fcmpd	%fcc2,%f24,%f22
	  add	%i3,%i4,%i3
	  add	%i5,%l7,%i5

	fdivd	%f4,%f8,%f4
	  fmovd	%f24,%f20
	 add	%l1,%g1,%l1
	  sethi	%hi(0x80000000),%g5

	 ldd	[%l1+0x10],%f14
	 fand	%f12,mask,%f16
	  andn	%o0,%g5,%o0
	  andn	%l3,%g5,%l3

	  fmovdg %fcc2,%f22,%f20

	  fmovdg %fcc2,%f24,%f22
	  mov	%o0,%o7

	 fsubd	%f12,%f16,%f32
	 fmuld	%f16,%f14,%f16
	  movg	%fcc2,%l3,%o0

	fnegd	pio2_lo,%f8		! al
	 fmuld	%f10,%f14,%f18
	  movg	%fcc2,%o7,%l3

	fzero	%f0
	  fbu,pn %fcc2,.nan2
! delay slot
	  nop

	fmovdg	%fcc0,signbit,%f0
	  sub	%l3,%o0,%l2
	  sub	%l3,%o3,%g5

	 fmuld	%f32,%f14,%f32
	 fsubd	%f10,%f16,%f14
	  sub	%l2,%o4,%o7

	 faddd	%f12,%f18,%f18
	  andcc	%g5,%o7,%g0
	  bge,pn %icc,.big2
! delay slot
	  nop

	fxor	%f36,%f0,%f36
	  cmp	%o0,%o5
	  bl,pn	%icc,.small2
! delay slot
	  nop

.cont3:
	fmovdg	%fcc0,signbit,%f8
	  add	%l2,%o1,%l2

	 fsubd	%f14,%f32,%f14
	  srl	%l2,10,%l2

	fxor	%f36,pio2_lo,%f30	! al
	  andn	%l2,0x1f,%l2

	fxor	%f36,pio2,%f0		! ah
	  cmp	%l2,%o2
	  movg	%icc,%o2,%l2

	fxor	%f42,%f36,%f42		! sy

	faddd	%f8,%f30,%f8
	ldd	[%l0+0x8],%f30
	  add	%l2,%g1,%l2

	 fdivd	%f14,%f18,%f14
	 fzero	%f10

	  ldd	[%l2+0x10],%f24
	  fand	%f22,mask,%f26

	 fmovdg	%fcc1,signbit,%f10

	fmuld	%f4,%f4,%f36
	faddd	%f8,%f30,%f8

	  fsubd	%f22,%f26,%f34
	  fmuld	%f26,%f24,%f26

	  fmuld	%f20,%f24,%f28
	 fxor	%f38,%f10,%f38

	fmuld	%f4,p3,%f6
	 fnegd	pio2_lo,%f18

	fmuld	%f36,p2,%f2
	 fmovdg	%fcc1,signbit,%f18

	fmuld	%f36,%f4,%f36
	 fxor	%f38,pio2,%f10

	  fmuld	%f34,%f24,%f34
	  fsubd	%f20,%f26,%f24

	  faddd	%f22,%f28,%f28

	faddd	%f2,p1,%f2

	fmuld	%f36,p4,%f30
	 fxor	%f38,pio2_lo,%f32

	  fsubd	%f24,%f34,%f24

	 fxor	%f44,%f38,%f44

	fmuld	%f36,%f2,%f2
	 faddd	%f18,%f32,%f18
	 ldd	[%l1+0x8],%f32

	fmuld	%f36,%f36,%f36
	faddd	%f6,%f30,%f30

	  fdivd	%f24,%f28,%f24
	  fzero	%f20

	  fmovdg %fcc2,signbit,%f20

	faddd	%f2,%f8,%f2

	 fmuld	%f14,%f14,%f38
	 faddd	%f18,%f32,%f18

	fmuld	%f36,%f30,%f36
	  fxor	%f40,%f20,%f40

	fnegd	pio2,%f6		! ah
	 fmuld	%f14,p3,%f16

	fmovdg	%fcc0,signbit,%f6

	 fmuld	%f38,p2,%f12
	  fnegd	pio2_lo,%f28

	faddd	%f2,%f36,%f2
	 fmuld	%f38,%f14,%f38

	faddd	%f6,%f0,%f6
	ldd	[%l0],%f0

	  fmovdg %fcc2,signbit,%f28

	 faddd	%f12,p1,%f12

	 fmuld	%f38,p4,%f32
	  fxor	%f40,pio2_lo,%f34

	  fxor	%f40,pio2,%f20

	faddd	%f2,%f4,%f2

	 fmuld	%f38,%f12,%f12
	  fxor	%f46,%f40,%f46

	 fmuld	%f38,%f38,%f38
	 faddd	%f16,%f32,%f32

	  faddd	%f28,%f34,%f28
	  ldd	[%l2+0x8],%f34

	faddd	%f6,%f0,%f6
	lda	[%i1]%asi,%f0		! preload next argument

	 faddd	%f12,%f18,%f12
	lda	[%i1+4]%asi,%f1

	  fmuld	%f24,%f24,%f40
	lda	[%i3]%asi,%f8

	 fmuld	%f38,%f32,%f38
	  faddd	%f28,%f34,%f28
	lda	[%i3+4]%asi,%f9

	 fnegd	pio2,%f16
	  fmuld	%f24,p3,%f26
	lda	[%i1]%asi,%o0

	 fmovdg	%fcc1,signbit,%f16
	lda	[%i3]%asi,%l3

	  fmuld	%f40,p2,%f22

	 faddd	%f12,%f38,%f12
	  fmuld	%f40,%f24,%f40

	faddd	%f2,%f6,%f6

	 faddd	%f16,%f10,%f16
	 ldd	[%l1],%f10

	  faddd	%f22,p1,%f22

	 faddd	%f12,%f14,%f12
	  fmuld	%f40,p4,%f34

	fxor	%f6,%f42,%f6
	st	%f6,[%l4]

	 faddd	%f16,%f10,%f16
	st	%f7,[%l4+4]

	  fmuld	%f40,%f22,%f22

	  fmuld	%f40,%f40,%f40
	  faddd	%f26,%f34,%f34

	  fnegd	pio2,%f26

	 faddd	%f12,%f16,%f16

	  faddd	%f22,%f28,%f22

	  fmuld	%f40,%f34,%f40
	  fmovdg %fcc2,signbit,%f26

! -

	 fxor	%f16,%f44,%f16
	 st	%f16,[%l5]

	  faddd	%f26,%f20,%f26
	 st	%f17,[%l5+4]
	addcc	%i0,-1,%i0

	  faddd	%f22,%f40,%f22
	bg,pt	%icc,.loop
! delay slot
	  ldd	[%l2],%f20


	  faddd	%f26,%f20,%f26
	  faddd	%f22,%f24,%f22
	  faddd	%f22,%f26,%f26
.done_from_special0:
	  fxor	%f26,%f46,%f26
	  st	%f26,[%l6]
	  st	%f27,[%l6+4]
	  ret
	  restore



	.align	16
.last1:
	fmovd	pio2,%f10		! set up dummy arguments
	fmovd	pio2,%f18
	fabsd	%f10,%f14
	fabsd	%f18,%f12
	sethi	%hi(0x3ff921fb),%o0
	or	%o0,%lo(0x3ff921fb),%o0
	mov	%o0,%l3
	ba,pt	%icc,.cont1
! delay slot
	add	%fp,junk,%i5



	.align	16
.last2:
	fmovd	pio2,%f20
	fmovd	pio2,%f28
	fabsd	%f20,%f24
	fabsd	%f28,%f22
	sethi	%hi(0x3ff921fb),%o0
	or	%o0,%lo(0x3ff921fb),%o0
	mov	%o0,%l3
	ba,pt	%icc,.cont2
! delay slot
	add	%fp,junk,%l6



	.align	16
.nan0:
	  faddd	%f22,%f26,%f26
.nan0_from_special0:
	 fabsd	%f10,%f14
	 lda	[%i3+4]%asi,%f19
	 fabsd	%f18,%f12
	 lda	[%i1]%asi,%o0
	 lda	[%i3]%asi,%l3
	ba,pt	%icc,.special0
! delay slot
	fmuld	%f0,%f2,%f6


	.align	16
.big0:
	 fabsd	%f18,%f12
	 lda	[%i1]%asi,%o0
	 lda	[%i3]%asi,%l3
	cmp	%g5,%o5	
	bge,pn	%icc,.return_ah0	! if hx >= 0x7ff00000
! delay slot
	nop
	cmp	%l0,%o4
	bge,pn	%icc,1f			! if hx - hy >= 0x03600000
! delay slot
	nop
	ldd	[%fp+twom3],%f6
	fmuld	%f0,%f6,%f0
	fmuld	%f2,%f6,%f2
	add	%l0,%o1,%l0
	addcc	%i0,-1,%i0
	ble,pn	%icc,.last1
! delay slot
	nop
	ba,pt	%icc,.cont1
! delay slot
	nop
1:
	fbg,pn	%fcc0,.return_ah0
! delay slot
	nop
	fcmpd	%fcc3,%f8,signbit
	fbl,pn	%fcc3,.return_ah0
! delay slot
	nop
	ba,pt	%icc,.special0
! delay slot
	fdivd	%f0,%f2,%f6


	.align	16
.small0:
	 lda	[%i3]%asi,%l3
	fcmpd	%fcc3,%f0,signbit
	fbe,pt	%fcc3,.return_ah0
! delay slot
	nop
	ldd	[%fp+two110],%f6
	fmuld	%f0,%f6,%f0
	fmuld	%f2,%f6,%f2
	st	%f0,[%fp+yscl]
	ld	[%fp+yscl],%o7
	st	%f2,[%fp+xscl]
	ld	[%fp+xscl],%l0
	sub	%l0,%o7,%l0
	add	%l0,%o1,%l0
	addcc	%i0,-1,%i0
	ble,pn	%icc,.last1
! delay slot
	nop
	ba,pt	%icc,.cont1
! delay slot
	nop


	.align	16
.return_ah0:
	fzero	%f0
	fmovdg	%fcc0,signbit,%f0
	fxor	%f36,%f0,%f36
	fxor	%f36,pio2,%f0
	fxor	%f42,%f36,%f42
	fnegd	pio2,%f6
	fmovdg	%fcc0,signbit,%f6
	faddd	%f6,%f0,%f6
	sub	%g5,%l0,%o7
	cmp	%o7,%o5
	bl,pt	%icc,1f			! if hy < 0x7ff00000
! delay slot
	nop
	ldd	[%fp+pio4],%f0
	faddd	%f6,%f0,%f6
1:
	fdtoi	%f6,%f4
.special0:
	fxor	%f6,%f42,%f6
	st	%f6,[%l4]
	st	%f7,[%l4+4]
	addcc	%i0,-1,%i0
	ble,pn	%icc,.done_from_special0
! delay slot
	nop
	fmovd	%f10,%f0
	fmovd	%f18,%f8
	fmovd	%f14,%f4
	fmovd	%f12,%f2
	mov	%i5,%l4
	add	%i1,%i2,%i1
	add	%i3,%i4,%i3
	add	%i5,%l7,%i5
	fand	%f0,signbit,%f42
	sethi	%hi(0x80000000),%g5
	fand	%f8,signbit,%f36
	andn	%o0,%g5,%o0
	andn	%l3,%g5,%l3
	fcmpd	%fcc0,%f4,%f2
	fmovd	%f4,%f0
	fmovdg	%fcc0,%f2,%f0
	fmovdg	%fcc0,%f4,%f2
	mov	%o0,%o7
	movg	%fcc0,%l3,%o0
	movg	%fcc0,%o7,%l3
	 lda	[%i1]%asi,%f10
	 lda	[%i1+4]%asi,%f11
	fbu,pn	%fcc0,.nan0_from_special0
! delay slot
	 lda	[%i3]%asi,%f18
	 fabsd	%f10,%f14
	 lda	[%i3+4]%asi,%f19
	sub	%l3,%o0,%l0
	sub	%l3,%o3,%g5
	sub	%l0,%o4,%o7
	andcc	%g5,%o7,%g0
	bge,pn	%icc,.big0
! delay slot
	nop
	 fabsd	%f18,%f12
	cmp	%o0,%o5
	bl,pn	%icc,.small0
! delay slot
	 lda	[%i1]%asi,%o0
	add	%l0,%o1,%l0
	addcc	%i0,-1,%i0
	ble,pn	%icc,.last1
! delay slot
	 lda	[%i3]%asi,%l3
	ba,pt	%icc,.cont1
! delay slot
	nop



	.align	16
.nan1:
	fmuld	%f30,%f4,%f30
	fsubd	%f0,%f6,%f4
	faddd	%f2,%f8,%f8
	fsubd	%f4,%f30,%f4
.nan1_from_special1:
	 lda	[%i3]%asi,%f28
	 lda	[%i3+4]%asi,%f29
	 fabsd	%f20,%f24
	 lda	[%i1]%asi,%o0
	 fabsd	%f28,%f22
	 lda	[%i3]%asi,%l3
	 mov	%i5,%l6
	ba,pt	%icc,.special1
! delay slot
	fmuld	%f10,%f12,%f16


	.align	16
.big1:
	faddd	%f2,%f8,%f8
	fsubd	%f4,%f30,%f4
.big1_from_special1:
	 lda	[%i1]%asi,%o0
	 fabsd	%f28,%f22
	 lda	[%i3]%asi,%l3
	 mov	%i5,%l6
	cmp	%g5,%o5	
	bge,pn	%icc,.return_ah1
! delay slot
	nop
	cmp	%l1,%o4
	bge,pn	%icc,1f
! delay slot
	nop
	ldd	[%fp+twom3],%f16
	fmuld	%f10,%f16,%f10
	fmuld	%f12,%f16,%f12
	add	%l1,%o1,%l1
	srl	%l1,10,%l1
	addcc	%i0,-1,%i0
	ble,pn	%icc,.last2
! delay slot
	nop
	ba,pt	%icc,.cont2
! delay slot
	nop
1:
	fbg,pn	%fcc1,.return_ah1
! delay slot
	nop
	fcmpd	%fcc3,%f18,signbit
	fbl,pn	%fcc3,.return_ah1
! delay slot
	nop
	ba,pt	%icc,.special1
! delay slot
	fdivd	%f10,%f12,%f16


	.align	16
.small1:
	fsubd	%f4,%f30,%f4
.small1_from_special1:
	 fabsd	%f28,%f22
	 lda	[%i3]%asi,%l3
	 mov	%i5,%l6
	fcmpd	%fcc3,%f10,signbit
	fbe,pt	%fcc3,.return_ah1
! delay slot
	nop
	ldd	[%fp+two110],%f16
	fmuld	%f10,%f16,%f10
	fmuld	%f12,%f16,%f12
	st	%f10,[%fp+yscl]
	ld	[%fp+yscl],%o7
	st	%f12,[%fp+xscl]
	ld	[%fp+xscl],%l1
	sub	%l1,%o7,%l1
	add	%l1,%o1,%l1
	srl	%l1,10,%l1
	addcc	%i0,-1,%i0
	ble,pn	%icc,.last2
! delay slot
	nop
	ba,pt	%icc,.cont2
! delay slot
	nop


	.align	16
.return_ah1:
	fzero	%f10
	fmovdg	%fcc1,signbit,%f10
	fxor	%f38,%f10,%f38
	fxor	%f38,pio2,%f10
	fxor	%f44,%f38,%f44
	fnegd	pio2,%f16
	fmovdg	%fcc1,signbit,%f16
	faddd	%f16,%f10,%f16
	sub	%g5,%l1,%o7
	cmp	%o7,%o5
	bl,pt	%icc,1f	
! delay slot
	nop
	ldd	[%fp+pio4],%f10
	faddd	%f16,%f10,%f16
1:
	fdtoi	%f16,%f14
.special1:
	fxor	%f16,%f44,%f16
	st	%f16,[%l5]
	st	%f17,[%l5+4]
	addcc	%i0,-1,%i0
	bg,pn	%icc,1f
! delay slot
	nop
	fmovd	pio2,%f20		! set up dummy argument
	fmovd	pio2,%f28
	fabsd	%f20,%f24
	fabsd	%f28,%f22
	sethi	%hi(0x3ff921fb),%o0
	or	%o0,%lo(0x3ff921fb),%o0
	mov	%o0,%l3
	add	%fp,junk,%i5
1:
	fmovd	%f20,%f10
	fmovd	%f28,%f18
	fmovd	%f24,%f14
	fmovd	%f22,%f12
	mov	%i5,%l5
	add	%i1,%i2,%i1
	add	%i3,%i4,%i3
	add	%i5,%l7,%i5
	fand	%f10,signbit,%f44
	sethi	%hi(0x80000000),%g5
	fand	%f18,signbit,%f38
	andn	%o0,%g5,%o0
	andn	%l3,%g5,%l3
	fcmpd	%fcc1,%f14,%f12
	fmovd	%f14,%f10
	fmovdg	%fcc1,%f12,%f10
	fmovdg	%fcc1,%f14,%f12
	mov	%o0,%o7
	movg	%fcc1,%l3,%o0
	movg	%fcc1,%o7,%l3
	 lda	[%i1]%asi,%f20
	 lda	[%i1+4]%asi,%f21
	fbu,pn	%fcc1,.nan1_from_special1
! delay slot
	nop
	 lda	[%i3]%asi,%f28
	 lda	[%i3+4]%asi,%f29
	 fabsd	%f20,%f24
	sub	%l3,%o0,%l1
	sub	%l3,%o3,%g5
	sub	%l1,%o4,%o7
	andcc	%g5,%o7,%g0
	bge,pn	%icc,.big1_from_special1
! delay slot
	nop
	cmp	%o0,%o5
	bl,pn	%icc,.small1_from_special1
! delay slot
	 lda	[%i1]%asi,%o0
	 fabsd	%f28,%f22
	 lda	[%i3]%asi,%l3
	add	%l1,%o1,%l1
	srl	%l1,10,%l1
	addcc	%i0,-1,%i0
	ble,pn	%icc,.last2
! delay slot
	 mov	%i5,%l6
	ba,pt	%icc,.cont2
! delay slot
	nop



	.align	16
.nan2:
	fmovdg	%fcc0,signbit,%f0
	 fmuld	%f32,%f14,%f32
	 fsubd	%f10,%f16,%f14
	 faddd	%f12,%f18,%f18
	fxor	%f36,%f0,%f36
.nan2_from_special2:
	ba,pt	%icc,.special2
! delay slot
	fmuld	%f20,%f22,%f26


	.align	16
.big2:
	fxor	%f36,%f0,%f36
.big2_from_special2:
	cmp	%g5,%o5	
	bge,pn	%icc,.return_ah2
! delay slot
	nop
	cmp	%l2,%o4
	bge,pn	%icc,1f
! delay slot
	nop
	ldd	[%fp+twom3],%f26
	fmuld	%f20,%f26,%f20
	fmuld	%f22,%f26,%f22
	ba,pt	%icc,.cont3
! delay slot
	nop
1:
	fbg,pn	%fcc2,.return_ah2
! delay slot
	nop
	fcmpd	%fcc3,%f28,signbit
	fbl,pn	%fcc3,.return_ah2
! delay slot
	nop
	ba,pt	%icc,.special2
! delay slot
	fdivd	%f20,%f22,%f26


	.align	16
.small2:
	fcmpd	%fcc3,%f20,signbit
	fbe,pt	%fcc3,.return_ah2
! delay slot
	nop
	ldd	[%fp+two110],%f26
	fmuld	%f20,%f26,%f20
	fmuld	%f22,%f26,%f22
	st	%f20,[%fp+yscl]
	ld	[%fp+yscl],%o7
	st	%f22,[%fp+xscl]
	ld	[%fp+xscl],%l2
	sub	%l2,%o7,%l2
	ba,pt	%icc,.cont3
! delay slot
	nop


	.align	16
.return_ah2:
	fzero	%f20
	fmovdg	%fcc2,signbit,%f20
	fxor	%f40,%f20,%f40
	fxor	%f40,pio2,%f20
	fxor	%f46,%f40,%f46
	fnegd	pio2,%f26
	fmovdg	%fcc2,signbit,%f26
	faddd	%f26,%f20,%f26
	sub	%g5,%l2,%o7
	cmp	%o7,%o5
	bl,pt	%icc,1f	
! delay slot
	nop
	ldd	[%fp+pio4],%f20
	faddd	%f26,%f20,%f26
1:
	fdtoi	%f26,%f24
.special2:
	fxor	%f26,%f46,%f26
	st	%f26,[%l6]
	st	%f27,[%l6+4]
	addcc	%i0,-1,%i0
	bg,pn	%icc,1f
! delay slot
	nop
	fmovd	pio2,%f20		! set up dummy argument
	fmovd	pio2,%f22
	fzero	%f40
	fzero	%f46
	mov	0,%l2
	ba,pt	%icc,.cont3
! delay slot
	add	%fp,junk,%l6
1:
	lda	[%i1]%asi,%f20
	lda	[%i1+4]%asi,%f21
	lda	[%i3]%asi,%f28
	lda	[%i3+4]%asi,%f29
	fabsd	%f20,%f24
	lda	[%i1]%asi,%o0
	fabsd	%f28,%f22
	lda	[%i3]%asi,%l3
	mov	%i5,%l6
	fand	%f20,signbit,%f46
	add	%i1,%i2,%i1
	fand	%f28,signbit,%f40
	fcmpd	%fcc2,%f24,%f22
	add	%i3,%i4,%i3
	add	%i5,%l7,%i5
	fmovd	%f24,%f20
	sethi	%hi(0x80000000),%g5
	andn	%o0,%g5,%o0
	andn	%l3,%g5,%l3
	fmovdg	%fcc2,%f22,%f20
	fmovdg	%fcc2,%f24,%f22
	mov	%o0,%o7
	movg	%fcc2,%l3,%o0
	movg	%fcc2,%o7,%l3
	fbu,pn	%fcc2,.nan2_from_special2
! delay slot
	nop
	sub	%l3,%o0,%l2
	sub	%l3,%o3,%g5
	sub	%l2,%o4,%o7
	andcc	%g5,%o7,%g0
	bge,pn	%icc,.big2_from_special2
! delay slot
	nop
	cmp	%o0,%o5
	bl,pn	%icc,.small2
! delay slot
	nop
	ba,pt	%icc,.cont3
! delay slot
	nop

	SET_SIZE(__vatan2)