147825Sdonn/*- 2*61225Sbostic * Copyright (c) 1991, 1993 3*61225Sbostic * The Regents of the University of California. All rights reserved. 447825Sdonn * 547994Sdonn * This code is derived from software contributed to Berkeley by 647994Sdonn * Donn Seeley at UUNET Technologies, Inc. 747994Sdonn * 847825Sdonn * %sccs.include.redist.c% 947825Sdonn */ 1047825Sdonn 1147825Sdonn#if defined(LIBC_SCCS) && !defined(lint) 12*61225Sbostic .asciz "@(#)udivsi3.s 8.1 (Berkeley) 06/04/93" 1347825Sdonn#endif /* LIBC_SCCS and not lint */ 1447825Sdonn 1547825Sdonn/* 1647825Sdonn * Unsigned division, GCC flavor. 1747825Sdonn */ 1847825Sdonn 1947825Sdonn#include "DEFS.h" 2047825Sdonn 2147825Sdonn#define DIVIDEND 4(ap) 2247825Sdonn#define DIVISOR 8(ap) 2347825Sdonn 2447825SdonnENTRY(__udivsi3,0) 2547825Sdonn movl DIVISOR,r2 2647825Sdonn jlss Leasy # big divisor: settle by comparison 2747825Sdonn movl DIVIDEND,r0 2847825Sdonn jlss Lhard # big dividend: extended division 2947825Sdonn divl2 r2,r0 # small divisor and dividend: signed division 3047825Sdonn ret 3147825SdonnLhard: 3247825Sdonn clrl r1 3347825Sdonn ediv r2,r0,r0,r1 3447825Sdonn ret 3547825SdonnLeasy: 3647825Sdonn cmpl DIVIDEND,r2 3747825Sdonn jgequ Lone # if dividend is as big or bigger, return 1 3847825Sdonn clrl r0 # else return 0 3947825Sdonn ret 4047825SdonnLone: 4147825Sdonn movl $1,r0 4247825Sdonn ret 43