• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/timemachine/libgcrypt-1.5.0/mpi/supersparc/
1/* SuperSPARC __udiv_qrnnd division support, used from longlong.h.
2 *            This is for SuperSPARC only, to compensate for its
3 *            semi-functional udiv instruction.
4 *
5 *      Copyright (C) 1993, 1994, 1996, 1998,
6 *                    2001, 2002 Free Software Foundation, Inc.
7 *
8 * This file is part of Libgcrypt.
9 *
10 * Libgcrypt is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2.1 of
13 * the License, or (at your option) any later version.
14 *
15 * Libgcrypt is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
23 *
24 * Note: This code is heavily based on the GNU MP Library.
25 *	 Actually it's the same code with only minor changes in the
26 *	 way the data is stored; this is to support the abstraction
27 *	 of an optional secure memory allocation which may be used
28 *	 to avoid revealing of sensitive data due to paging etc.
29 */
30
31
32
33! INPUT PARAMETERS
34! rem_ptr	i0
35! n1		i1
36! n0		i2
37! d		i3
38
39#include "sysdep.h"
40#undef ret	/* Kludge for glibc */
41
42	.text
43	.align	8
44LC0:	.double 0r4294967296
45LC1:	.double 0r2147483648
46
47	.align	4
48	.global C_SYMBOL_NAME(__udiv_qrnnd)
49C_SYMBOL_NAME(__udiv_qrnnd):
50	!#PROLOGUE# 0
51	save	%sp,-104,%sp
52	!#PROLOGUE# 1
53	st	%i1,[%fp-8]
54	ld	[%fp-8],%f10
55	sethi	%hi(LC0),%o7
56	fitod	%f10,%f4
57	ldd	[%o7+%lo(LC0)],%f8
58	cmp	%i1,0
59	bge	L248
60	mov	%i0,%i5
61	faddd	%f4,%f8,%f4
62L248:
63	st	%i2,[%fp-8]
64	ld	[%fp-8],%f10
65	fmuld	%f4,%f8,%f6
66	cmp	%i2,0
67	bge	L249
68	fitod	%f10,%f2
69	faddd	%f2,%f8,%f2
70L249:
71	st	%i3,[%fp-8]
72	faddd	%f6,%f2,%f2
73	ld	[%fp-8],%f10
74	cmp	%i3,0
75	bge	L250
76	fitod	%f10,%f4
77	faddd	%f4,%f8,%f4
78L250:
79	fdivd	%f2,%f4,%f2
80	sethi	%hi(LC1),%o7
81	ldd	[%o7+%lo(LC1)],%f4
82	fcmped	%f2,%f4
83	nop
84	fbge,a	L251
85	fsubd	%f2,%f4,%f2
86	fdtoi	%f2,%f2
87	st	%f2,[%fp-8]
88	b	L252
89	ld	[%fp-8],%i4
90L251:
91	fdtoi	%f2,%f2
92	st	%f2,[%fp-8]
93	ld	[%fp-8],%i4
94	sethi	%hi(-2147483648),%g2
95	xor	%i4,%g2,%i4
96L252:
97	umul	%i3,%i4,%g3
98	rd	%y,%i0
99	subcc	%i2,%g3,%o7
100	subxcc	%i1,%i0,%g0
101	be	L253
102	cmp	%o7,%i3
103
104	add	%i4,-1,%i0
105	add	%o7,%i3,%o7
106	st	%o7,[%i5]
107	ret
108	restore
109L253:
110	blu	L246
111	mov	%i4,%i0
112	add	%i4,1,%i0
113	sub	%o7,%i3,%o7
114L246:
115	st	%o7,[%i5]
116	ret
117	restore
118
119