Linux Audio

Check our new training course

Loading...
v3.1
  1/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
  2
  3This file is part of GNU CC.
  4
  5GNU CC is free software; you can redistribute it and/or modify
  6it under the terms of the GNU General Public License as published by
  7the Free Software Foundation; either version 2, or (at your option)
  8any later version.
  9
 10GNU CC is distributed in the hope that it will be useful,
 11but WITHOUT ANY WARRANTY; without even the implied warranty of
 12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13GNU General Public License for more details.
 14
 15You should have received a copy of the GNU General Public License
 16along with GNU CC; see the file COPYING.  If not, write to
 17the Free Software Foundation, 59 Temple Place - Suite 330,
 18Boston, MA 02111-1307, USA.  */
 19
 20	.data
 21	.align 8
 22	.globl	__clz_tab
 23__clz_tab:
 24	.byte	0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5
 25	.byte	6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6
 26	.byte	7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
 27	.byte	7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
 28	.byte	8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
 29	.byte	8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
 30	.byte	8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
 31	.byte	8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
 32	.size	 __clz_tab,256
 33	.global .udiv
 34
 35	.text
 36	.align 4
 37	.globl __divdi3
 38__divdi3:
 39	save %sp,-104,%sp
 40	cmp %i0,0
 41	bge .LL40
 42	mov 0,%l4
 43	mov -1,%l4
 44	sub %g0,%i1,%o0
 45	mov %o0,%o5
 46	subcc %g0,%o0,%g0
 47	sub %g0,%i0,%o0
 48	subx %o0,0,%o4
 49	mov %o4,%i0
 50	mov %o5,%i1
 51.LL40:
 52	cmp %i2,0
 53	bge .LL84
 54	mov %i3,%o4
 55	xnor %g0,%l4,%l4
 56	sub %g0,%i3,%o0
 57	mov %o0,%o3
 58	subcc %g0,%o0,%g0
 59	sub %g0,%i2,%o0
 60	subx %o0,0,%o2
 61	mov %o2,%i2
 62	mov %o3,%i3
 63	mov %i3,%o4
 64.LL84:
 65	cmp %i2,0
 66	bne .LL45
 67	mov %i1,%i3
 68	cmp %o4,%i0
 69	bleu .LL46
 70	mov %i3,%o1
 71	mov	32,%g1
 72	subcc	%i0,%o4,%g0
 731:	bcs	5f
 74	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
 75	sub	%i0,%o4,%i0	! this kills msb of n
 76	addx	%i0,%i0,%i0	! so this cannot give carry
 77	subcc	%g1,1,%g1
 782:	bne	1b
 79	 subcc	%i0,%o4,%g0
 80	bcs	3f
 81	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
 82	b	3f
 83	 sub	%i0,%o4,%i0	! this kills msb of n
 844:	sub	%i0,%o4,%i0
 855:	addxcc	%i0,%i0,%i0
 86	bcc	2b
 87	 subcc	%g1,1,%g1
 88! Got carry from n.  Subtract next step to cancel this carry.
 89	bne	4b
 90	 addcc	%o1,%o1,%o1	! shift n1n0 and a 0-bit in lsb
 91	sub	%i0,%o4,%i0
 923:	xnor	%o1,0,%o1
 93	b .LL50
 94	mov 0,%o2
 95.LL46:
 96	cmp %o4,0
 97	bne .LL85
 98	mov %i0,%o2
 99	mov 1,%o0
100	call .udiv,0
101	mov 0,%o1
 
 
102	mov %o0,%o4
103	mov %i0,%o2
104.LL85:
105	mov 0,%g3
106	mov	32,%g1
107	subcc	%g3,%o4,%g0
1081:	bcs	5f
109	 addxcc %o2,%o2,%o2	! shift n1n0 and a q-bit in lsb
110	sub	%g3,%o4,%g3	! this kills msb of n
111	addx	%g3,%g3,%g3	! so this cannot give carry
112	subcc	%g1,1,%g1
1132:	bne	1b
114	 subcc	%g3,%o4,%g0
115	bcs	3f
116	 addxcc %o2,%o2,%o2	! shift n1n0 and a q-bit in lsb
117	b	3f
118	 sub	%g3,%o4,%g3	! this kills msb of n
1194:	sub	%g3,%o4,%g3
1205:	addxcc	%g3,%g3,%g3
121	bcc	2b
122	 subcc	%g1,1,%g1
123! Got carry from n.  Subtract next step to cancel this carry.
124	bne	4b
125	 addcc	%o2,%o2,%o2	! shift n1n0 and a 0-bit in lsb
126	sub	%g3,%o4,%g3
1273:	xnor	%o2,0,%o2
128	mov %g3,%i0
129	mov %i3,%o1
130	mov	32,%g1
131	subcc	%i0,%o4,%g0
1321:	bcs	5f
133	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
134	sub	%i0,%o4,%i0	! this kills msb of n
135	addx	%i0,%i0,%i0	! so this cannot give carry
136	subcc	%g1,1,%g1
1372:	bne	1b
138	 subcc	%i0,%o4,%g0
139	bcs	3f
140	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
141	b	3f
142	 sub	%i0,%o4,%i0	! this kills msb of n
1434:	sub	%i0,%o4,%i0
1445:	addxcc	%i0,%i0,%i0
145	bcc	2b
146	 subcc	%g1,1,%g1
147! Got carry from n.  Subtract next step to cancel this carry.
148	bne	4b
149	 addcc	%o1,%o1,%o1	! shift n1n0 and a 0-bit in lsb
150	sub	%i0,%o4,%i0
1513:	xnor	%o1,0,%o1
152	b .LL86
153	mov %o1,%l1
154.LL45:
155	cmp %i2,%i0
156	bleu .LL51
157	sethi %hi(65535),%o0
158	b .LL78
159	mov 0,%o1
160.LL51:
161	or %o0,%lo(65535),%o0
162	cmp %i2,%o0
163	bgu .LL58
164	mov %i2,%o1
165	cmp %i2,256
166	addx %g0,-1,%o0
167	b .LL64
168	and %o0,8,%o2
169.LL58:
170	sethi %hi(16777215),%o0
171	or %o0,%lo(16777215),%o0
172	cmp %i2,%o0
173	bgu .LL64
174	mov 24,%o2
175	mov 16,%o2
176.LL64:
177	srl %o1,%o2,%o0
178	sethi %hi(__clz_tab),%o1
179	or %o1,%lo(__clz_tab),%o1
180	ldub [%o0+%o1],%o0
181	add %o0,%o2,%o0
182	mov 32,%o1
183	subcc %o1,%o0,%o3
184	bne,a .LL72
185	sub %o1,%o3,%o1
186	cmp %i0,%i2
187	bgu .LL74
188	cmp %i3,%o4
189	blu .LL78
190	mov 0,%o1
191.LL74:
192	b .LL78
193	mov 1,%o1
194.LL72:
195	sll %i2,%o3,%o2
196	srl %o4,%o1,%o0
197	or %o2,%o0,%i2
198	sll %o4,%o3,%o4
199	srl %i0,%o1,%o2
200	sll %i0,%o3,%o0
201	srl %i3,%o1,%o1
202	or %o0,%o1,%i0
203	sll %i3,%o3,%i3
204	mov %i0,%o1
205	mov	32,%g1
206	subcc	%o2,%i2,%g0
2071:	bcs	5f
208	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
209	sub	%o2,%i2,%o2	! this kills msb of n
210	addx	%o2,%o2,%o2	! so this cannot give carry
211	subcc	%g1,1,%g1
2122:	bne	1b
213	 subcc	%o2,%i2,%g0
214	bcs	3f
215	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
216	b	3f
217	 sub	%o2,%i2,%o2	! this kills msb of n
2184:	sub	%o2,%i2,%o2
2195:	addxcc	%o2,%o2,%o2
220	bcc	2b
221	 subcc	%g1,1,%g1
222! Got carry from n.  Subtract next step to cancel this carry.
223	bne	4b
224	 addcc	%o1,%o1,%o1	! shift n1n0 and a 0-bit in lsb
225	sub	%o2,%i2,%o2
2263:	xnor	%o1,0,%o1
227	mov %o2,%i0
228	wr	%g0,%o1,%y	! SPARC has 0-3 delay insn after a wr
229	sra	%o4,31,%g2	! Do not move this insn
230	and	%o1,%g2,%g2	! Do not move this insn
231	andcc	%g0,0,%g1	! Do not move this insn
232	mulscc	%g1,%o4,%g1
233	mulscc	%g1,%o4,%g1
234	mulscc	%g1,%o4,%g1
235	mulscc	%g1,%o4,%g1
236	mulscc	%g1,%o4,%g1
237	mulscc	%g1,%o4,%g1
238	mulscc	%g1,%o4,%g1
239	mulscc	%g1,%o4,%g1
240	mulscc	%g1,%o4,%g1
241	mulscc	%g1,%o4,%g1
242	mulscc	%g1,%o4,%g1
243	mulscc	%g1,%o4,%g1
244	mulscc	%g1,%o4,%g1
245	mulscc	%g1,%o4,%g1
246	mulscc	%g1,%o4,%g1
247	mulscc	%g1,%o4,%g1
248	mulscc	%g1,%o4,%g1
249	mulscc	%g1,%o4,%g1
250	mulscc	%g1,%o4,%g1
251	mulscc	%g1,%o4,%g1
252	mulscc	%g1,%o4,%g1
253	mulscc	%g1,%o4,%g1
254	mulscc	%g1,%o4,%g1
255	mulscc	%g1,%o4,%g1
256	mulscc	%g1,%o4,%g1
257	mulscc	%g1,%o4,%g1
258	mulscc	%g1,%o4,%g1
259	mulscc	%g1,%o4,%g1
260	mulscc	%g1,%o4,%g1
261	mulscc	%g1,%o4,%g1
262	mulscc	%g1,%o4,%g1
263	mulscc	%g1,%o4,%g1
264	mulscc	%g1,0,%g1
265	add	%g1,%g2,%o0
266	rd	%y,%o2
267	cmp %o0,%i0
268	bgu,a .LL78
269	add %o1,-1,%o1
270	bne,a .LL50
271	mov 0,%o2
272	cmp %o2,%i3
273	bleu .LL50
274	mov 0,%o2
275	add %o1,-1,%o1
276.LL78:
277	mov 0,%o2
278.LL50:
279	mov %o1,%l1
280.LL86:
281	mov %o2,%l0
282	mov %l0,%i0
283	mov %l1,%i1
284	cmp %l4,0
285	be .LL81
286	sub %g0,%i1,%o0
287	mov %o0,%l3
288	subcc %g0,%o0,%g0
289	sub %g0,%i0,%o0
290	subx %o0,0,%l2
291	mov %l2,%i0
292	mov %l3,%i1
293.LL81:
294	ret
295	restore
v4.10.11
  1/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
  2
  3This file is part of GNU CC.
  4
  5GNU CC is free software; you can redistribute it and/or modify
  6it under the terms of the GNU General Public License as published by
  7the Free Software Foundation; either version 2, or (at your option)
  8any later version.
  9
 10GNU CC is distributed in the hope that it will be useful,
 11but WITHOUT ANY WARRANTY; without even the implied warranty of
 12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13GNU General Public License for more details.
 14
 15You should have received a copy of the GNU General Public License
 16along with GNU CC; see the file COPYING.  If not, write to
 17the Free Software Foundation, 59 Temple Place - Suite 330,
 18Boston, MA 02111-1307, USA.  */
 19
 20#include <asm/export.h>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 21	.text
 22	.align 4
 23	.globl __divdi3
 24__divdi3:
 25	save %sp,-104,%sp
 26	cmp %i0,0
 27	bge .LL40
 28	mov 0,%l4
 29	mov -1,%l4
 30	sub %g0,%i1,%o0
 31	mov %o0,%o5
 32	subcc %g0,%o0,%g0
 33	sub %g0,%i0,%o0
 34	subx %o0,0,%o4
 35	mov %o4,%i0
 36	mov %o5,%i1
 37.LL40:
 38	cmp %i2,0
 39	bge .LL84
 40	mov %i3,%o4
 41	xnor %g0,%l4,%l4
 42	sub %g0,%i3,%o0
 43	mov %o0,%o3
 44	subcc %g0,%o0,%g0
 45	sub %g0,%i2,%o0
 46	subx %o0,0,%o2
 47	mov %o2,%i2
 48	mov %o3,%i3
 49	mov %i3,%o4
 50.LL84:
 51	cmp %i2,0
 52	bne .LL45
 53	mov %i1,%i3
 54	cmp %o4,%i0
 55	bleu .LL46
 56	mov %i3,%o1
 57	mov	32,%g1
 58	subcc	%i0,%o4,%g0
 591:	bcs	5f
 60	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
 61	sub	%i0,%o4,%i0	! this kills msb of n
 62	addx	%i0,%i0,%i0	! so this cannot give carry
 63	subcc	%g1,1,%g1
 642:	bne	1b
 65	 subcc	%i0,%o4,%g0
 66	bcs	3f
 67	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
 68	b	3f
 69	 sub	%i0,%o4,%i0	! this kills msb of n
 704:	sub	%i0,%o4,%i0
 715:	addxcc	%i0,%i0,%i0
 72	bcc	2b
 73	 subcc	%g1,1,%g1
 74! Got carry from n.  Subtract next step to cancel this carry.
 75	bne	4b
 76	 addcc	%o1,%o1,%o1	! shift n1n0 and a 0-bit in lsb
 77	sub	%i0,%o4,%i0
 783:	xnor	%o1,0,%o1
 79	b .LL50
 80	mov 0,%o2
 81.LL46:
 82	cmp %o4,0
 83	bne .LL85
 84	mov %i0,%o2
 85	mov 1,%o0
 
 86	mov 0,%o1
 87	wr %g0, 0, %y
 88	udiv %o0, %o1, %o0
 89	mov %o0,%o4
 90	mov %i0,%o2
 91.LL85:
 92	mov 0,%g3
 93	mov	32,%g1
 94	subcc	%g3,%o4,%g0
 951:	bcs	5f
 96	 addxcc %o2,%o2,%o2	! shift n1n0 and a q-bit in lsb
 97	sub	%g3,%o4,%g3	! this kills msb of n
 98	addx	%g3,%g3,%g3	! so this cannot give carry
 99	subcc	%g1,1,%g1
1002:	bne	1b
101	 subcc	%g3,%o4,%g0
102	bcs	3f
103	 addxcc %o2,%o2,%o2	! shift n1n0 and a q-bit in lsb
104	b	3f
105	 sub	%g3,%o4,%g3	! this kills msb of n
1064:	sub	%g3,%o4,%g3
1075:	addxcc	%g3,%g3,%g3
108	bcc	2b
109	 subcc	%g1,1,%g1
110! Got carry from n.  Subtract next step to cancel this carry.
111	bne	4b
112	 addcc	%o2,%o2,%o2	! shift n1n0 and a 0-bit in lsb
113	sub	%g3,%o4,%g3
1143:	xnor	%o2,0,%o2
115	mov %g3,%i0
116	mov %i3,%o1
117	mov	32,%g1
118	subcc	%i0,%o4,%g0
1191:	bcs	5f
120	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
121	sub	%i0,%o4,%i0	! this kills msb of n
122	addx	%i0,%i0,%i0	! so this cannot give carry
123	subcc	%g1,1,%g1
1242:	bne	1b
125	 subcc	%i0,%o4,%g0
126	bcs	3f
127	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
128	b	3f
129	 sub	%i0,%o4,%i0	! this kills msb of n
1304:	sub	%i0,%o4,%i0
1315:	addxcc	%i0,%i0,%i0
132	bcc	2b
133	 subcc	%g1,1,%g1
134! Got carry from n.  Subtract next step to cancel this carry.
135	bne	4b
136	 addcc	%o1,%o1,%o1	! shift n1n0 and a 0-bit in lsb
137	sub	%i0,%o4,%i0
1383:	xnor	%o1,0,%o1
139	b .LL86
140	mov %o1,%l1
141.LL45:
142	cmp %i2,%i0
143	bleu .LL51
144	sethi %hi(65535),%o0
145	b .LL78
146	mov 0,%o1
147.LL51:
148	or %o0,%lo(65535),%o0
149	cmp %i2,%o0
150	bgu .LL58
151	mov %i2,%o1
152	cmp %i2,256
153	addx %g0,-1,%o0
154	b .LL64
155	and %o0,8,%o2
156.LL58:
157	sethi %hi(16777215),%o0
158	or %o0,%lo(16777215),%o0
159	cmp %i2,%o0
160	bgu .LL64
161	mov 24,%o2
162	mov 16,%o2
163.LL64:
164	srl %o1,%o2,%o0
165	sethi %hi(__clz_tab),%o1
166	or %o1,%lo(__clz_tab),%o1
167	ldub [%o0+%o1],%o0
168	add %o0,%o2,%o0
169	mov 32,%o1
170	subcc %o1,%o0,%o3
171	bne,a .LL72
172	sub %o1,%o3,%o1
173	cmp %i0,%i2
174	bgu .LL74
175	cmp %i3,%o4
176	blu .LL78
177	mov 0,%o1
178.LL74:
179	b .LL78
180	mov 1,%o1
181.LL72:
182	sll %i2,%o3,%o2
183	srl %o4,%o1,%o0
184	or %o2,%o0,%i2
185	sll %o4,%o3,%o4
186	srl %i0,%o1,%o2
187	sll %i0,%o3,%o0
188	srl %i3,%o1,%o1
189	or %o0,%o1,%i0
190	sll %i3,%o3,%i3
191	mov %i0,%o1
192	mov	32,%g1
193	subcc	%o2,%i2,%g0
1941:	bcs	5f
195	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
196	sub	%o2,%i2,%o2	! this kills msb of n
197	addx	%o2,%o2,%o2	! so this cannot give carry
198	subcc	%g1,1,%g1
1992:	bne	1b
200	 subcc	%o2,%i2,%g0
201	bcs	3f
202	 addxcc %o1,%o1,%o1	! shift n1n0 and a q-bit in lsb
203	b	3f
204	 sub	%o2,%i2,%o2	! this kills msb of n
2054:	sub	%o2,%i2,%o2
2065:	addxcc	%o2,%o2,%o2
207	bcc	2b
208	 subcc	%g1,1,%g1
209! Got carry from n.  Subtract next step to cancel this carry.
210	bne	4b
211	 addcc	%o1,%o1,%o1	! shift n1n0 and a 0-bit in lsb
212	sub	%o2,%i2,%o2
2133:	xnor	%o1,0,%o1
214	mov %o2,%i0
215	wr	%g0,%o1,%y	! SPARC has 0-3 delay insn after a wr
216	sra	%o4,31,%g2	! Do not move this insn
217	and	%o1,%g2,%g2	! Do not move this insn
218	andcc	%g0,0,%g1	! Do not move this insn
219	mulscc	%g1,%o4,%g1
220	mulscc	%g1,%o4,%g1
221	mulscc	%g1,%o4,%g1
222	mulscc	%g1,%o4,%g1
223	mulscc	%g1,%o4,%g1
224	mulscc	%g1,%o4,%g1
225	mulscc	%g1,%o4,%g1
226	mulscc	%g1,%o4,%g1
227	mulscc	%g1,%o4,%g1
228	mulscc	%g1,%o4,%g1
229	mulscc	%g1,%o4,%g1
230	mulscc	%g1,%o4,%g1
231	mulscc	%g1,%o4,%g1
232	mulscc	%g1,%o4,%g1
233	mulscc	%g1,%o4,%g1
234	mulscc	%g1,%o4,%g1
235	mulscc	%g1,%o4,%g1
236	mulscc	%g1,%o4,%g1
237	mulscc	%g1,%o4,%g1
238	mulscc	%g1,%o4,%g1
239	mulscc	%g1,%o4,%g1
240	mulscc	%g1,%o4,%g1
241	mulscc	%g1,%o4,%g1
242	mulscc	%g1,%o4,%g1
243	mulscc	%g1,%o4,%g1
244	mulscc	%g1,%o4,%g1
245	mulscc	%g1,%o4,%g1
246	mulscc	%g1,%o4,%g1
247	mulscc	%g1,%o4,%g1
248	mulscc	%g1,%o4,%g1
249	mulscc	%g1,%o4,%g1
250	mulscc	%g1,%o4,%g1
251	mulscc	%g1,0,%g1
252	add	%g1,%g2,%o0
253	rd	%y,%o2
254	cmp %o0,%i0
255	bgu,a .LL78
256	add %o1,-1,%o1
257	bne,a .LL50
258	mov 0,%o2
259	cmp %o2,%i3
260	bleu .LL50
261	mov 0,%o2
262	add %o1,-1,%o1
263.LL78:
264	mov 0,%o2
265.LL50:
266	mov %o1,%l1
267.LL86:
268	mov %o2,%l0
269	mov %l0,%i0
270	mov %l1,%i1
271	cmp %l4,0
272	be .LL81
273	sub %g0,%i1,%o0
274	mov %o0,%l3
275	subcc %g0,%o0,%g0
276	sub %g0,%i0,%o0
277	subx %o0,0,%l2
278	mov %l2,%i0
279	mov %l3,%i1
280.LL81:
281	ret
282	restore
283EXPORT_SYMBOL(__divdi3)