1*47825Sdonn/*- 2*47825Sdonn * Copyright (c) 1991 The Regents of the University of California. 3*47825Sdonn * All rights reserved. 4*47825Sdonn * 5*47825Sdonn * %sccs.include.redist.c% 6*47825Sdonn */ 7*47825Sdonn 8*47825Sdonn#if defined(LIBC_SCCS) && !defined(lint) 9*47825Sdonn .asciz "@(#)udivsi3.s 6.1 (Berkeley) 04/05/91" 10*47825Sdonn#endif /* LIBC_SCCS and not lint */ 11*47825Sdonn 12*47825Sdonn/* 13*47825Sdonn * Unsigned division, GCC flavor. 14*47825Sdonn */ 15*47825Sdonn 16*47825Sdonn#include "DEFS.h" 17*47825Sdonn 18*47825Sdonn#define DIVIDEND 4(ap) 19*47825Sdonn#define DIVISOR 8(ap) 20*47825Sdonn 21*47825SdonnENTRY(__udivsi3,0) 22*47825Sdonn movl DIVISOR,r2 23*47825Sdonn jlss Leasy # big divisor: settle by comparison 24*47825Sdonn movl DIVIDEND,r0 25*47825Sdonn jlss Lhard # big dividend: extended division 26*47825Sdonn divl2 r2,r0 # small divisor and dividend: signed division 27*47825Sdonn ret 28*47825SdonnLhard: 29*47825Sdonn clrl r1 30*47825Sdonn ediv r2,r0,r0,r1 31*47825Sdonn ret 32*47825SdonnLeasy: 33*47825Sdonn cmpl DIVIDEND,r2 34*47825Sdonn jgequ Lone # if dividend is as big or bigger, return 1 35*47825Sdonn clrl r0 # else return 0 36*47825Sdonn ret 37*47825SdonnLone: 38*47825Sdonn movl $1,r0 39*47825Sdonn ret 40