xref: /original-bsd/lib/libc/tahoe/gen/udivsi3.s (revision 05bf53f3)
1/*
2 * Copyright (c) 1988, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Computer Consoles Inc.
9 */
10
11#if defined(LIBC_SCCS) && !defined(lint)
12	.asciz "@(#)udivsi3.s	8.1 (Berkeley) 06/04/93"
13#endif /* LIBC_SCCS and not lint */
14
15/*
16 * Unsigned divide for GCC.
17 *
18 * __udivsi3(dividend, divisor)
19 */
20#include "DEFS.h"
21
22ENTRY(__udivsi3, 0)
23	bitl	$0x80000000,8(fp)	#  if (divisor & 0x80000000){
24	jeql	1f
25	cmpl	8(fp),4(fp)		#  if (divisor > dividend )
26	jlequ	2f
27	clrl	r0			#      return(0);
28	ret
292:					#  else
30	movl	$1,r0			#      return(1);}
31	ret
321:
33	clrl	r2			#  return(dividend/divisor);
34	movl	4(fp),r3
35	ediv	8(fp),r2,r0,r1
36	ret
37