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