diff options
Diffstat (limited to 'lib/libc/arch/vax/gen/udiv.S')
-rw-r--r-- | lib/libc/arch/vax/gen/udiv.S | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/lib/libc/arch/vax/gen/udiv.S b/lib/libc/arch/vax/gen/udiv.S index 337a205ce1a..d469016a734 100644 --- a/lib/libc/arch/vax/gen/udiv.S +++ b/lib/libc/arch/vax/gen/udiv.S @@ -1,4 +1,4 @@ -/* $OpenBSD: udiv.S,v 1.5 2005/08/07 16:40:15 espie Exp $ */ +/* $OpenBSD: udiv.S,v 1.6 2013/07/05 21:10:50 miod Exp $ */ /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -39,50 +39,58 @@ #include "DEFS.h" -#define DIVIDEND 4(ap) -#define DIVISOR 8(ap) +#define DIVIDEND 4(%ap) +#define DIVISOR 8(%ap) +#ifdef __ELF__ +ASENTRY(__udiv, R2) +#else ASENTRY(udiv,R2) - movl DIVISOR,r2 +#endif + movl DIVISOR,%r2 jlss Leasy # big divisor: settle by comparison - movl DIVIDEND,r0 + movl DIVIDEND,%r0 jlss Lhard # big dividend: extended division - divl2 r2,r0 # small divisor and dividend: signed division + divl2 %r2,%r0 # small divisor and dividend: signed division ret Lhard: - clrl r1 - ediv r2,r0,r0,r1 + clrl %r1 + ediv %r2,%r0,%r0,%r1 ret Leasy: - cmpl DIVIDEND,r2 + cmpl DIVIDEND,%r2 jgequ Lone # if dividend is as big or bigger, return 1 - clrl r0 # else return 0 + clrl %r0 # else return 0 ret Lone: - movl $1,r0 + movl $1,%r0 ret +#ifdef __ELF__ +ASENTRY(__audiv, R2|R3) +#else ASENTRY(audiv,R2|R3) - movl DIVIDEND,r3 - movl DIVISOR,r2 +#endif + movl DIVIDEND,%r3 + movl DIVISOR,%r2 jlss La_easy # big divisor: settle by comparison - movl (r3),r0 + movl (%r3),%r0 jlss La_hard # big dividend: extended division - divl2 r2,r0 # small divisor and dividend: signed division - movl r0,(r3) # leave the value of the assignment in r0 + divl2 %r2,%r0 # small divisor and dividend: signed division + movl %r0,(%r3) # leave the value of the assignment in r0 ret La_hard: - clrl r1 - ediv r2,r0,r0,r1 - movl r0,(r3) + clrl %r1 + ediv %r2,%r0,%r0,%r1 + movl %r0,(%r3) ret La_easy: - cmpl (r3),r2 + cmpl (%r3),%r2 jgequ La_one # if dividend is as big or bigger, return 1 - clrl r0 # else return 0 - clrl (r3) + clrl %r0 # else return 0 + clrl (%r3) ret La_one: - movl $1,r0 - movl r0,(r3) + movl $1,%r0 + movl %r0,(%r3) ret |