1/*- 2 * Copyright (c) 1991 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8#if defined(LIBC_SCCS) && !defined(lint) 9 .asciz "@(#)umodsi3.s 6.1 (Berkeley) 04/05/91" 10#endif /* LIBC_SCCS and not lint */ 11 12/* 13 * Unsigned modulus, GCC flavor. 14 */ 15 16#include "DEFS.h" 17 18#define DIVIDEND 4(ap) 19#define DIVISOR 8(ap) 20 21ENTRY(__umodsi3,0) 22 movl DIVISOR,r2 23 jlss Leasy # big divisor: settle by comparison 24 movl DIVIDEND,r0 25 jlss Lhard # big dividend: need extended division 26 divl3 r2,r0,r1 # small divisor and dividend: signed modulus 27 mull2 r2,r1 28 subl2 r1,r0 29 ret 30Lhard: 31 clrl r1 32 ediv r2,r0,r1,r0 33 ret 34Leasy: 35 subl3 r2,DIVIDEND,r0 36 jcc Ldifference # if divisor goes in once, return difference 37 movl DIVIDEND,r0 # if divisor is bigger, return dividend 38Ldifference: 39 ret 40