diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2013-06-05 22:06:31 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2013-06-05 22:06:31 +0000 |
commit | 6c97d3f46eff8dbdc0dcb1d750a8d663af01cc9f (patch) | |
tree | e21f6fa334717f9f48a8c7d72a4ce8af471c6f73 /lib/libc/arch | |
parent | e2c9de4f1f50855523b617036b66df936f30c6a5 (diff) |
...also add __modsi3 and __umodsi3, and make these symbols weak by default.
Diffstat (limited to 'lib/libc/arch')
-rw-r--r-- | lib/libc/arch/m88k/gen/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/divsi3.S | 5 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/modsi3.S | 65 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/udivsi3.S | 5 | ||||
-rw-r--r-- | lib/libc/arch/m88k/gen/umodsi3.S | 37 |
5 files changed, 112 insertions, 4 deletions
diff --git a/lib/libc/arch/m88k/gen/Makefile.inc b/lib/libc/arch/m88k/gen/Makefile.inc index 60328113560..cff75b8d425 100644 --- a/lib/libc/arch/m88k/gen/Makefile.inc +++ b/lib/libc/arch/m88k/gen/Makefile.inc @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile.inc,v 1.15 2013/06/05 20:15:01 miod Exp $ +# $OpenBSD: Makefile.inc,v 1.16 2013/06/05 22:06:30 miod Exp $ # $NetBSD: Makefile.inc,v 1.3 1995/04/10 21:09:06 jtc Exp $ SRCS+= _setjmp.S fabs.S infinity.c ldexp.c modf.c nan.c SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ fpsetround.c fpsetsticky.c SRCS+= setjmp.S sigsetjmp.S -SRCS+= divsi3.S udivsi3.S +SRCS+= divsi3.S udivsi3.S modsi3.S umodsi3.S diff --git a/lib/libc/arch/m88k/gen/divsi3.S b/lib/libc/arch/m88k/gen/divsi3.S index 0a9ac5048e9..5c096e16e9c 100644 --- a/lib/libc/arch/m88k/gen/divsi3.S +++ b/lib/libc/arch/m88k/gen/divsi3.S @@ -1,4 +1,4 @@ -/* $OpenBSD: divsi3.S,v 1.1 2013/06/05 20:15:01 miod Exp $ */ +/* $OpenBSD: divsi3.S,v 1.2 2013/06/05 22:06:30 miod Exp $ */ /* * Copyright (c) 2013 Miodrag Vallat. @@ -23,6 +23,9 @@ * int __divsi3(int n, int d); */ +#ifndef LDSO +.weak _C_LABEL(__divsi3) +#endif ENTRY(__divsi3) /* if divider is zero, trap */ tcnd eq0, %r3, 503 diff --git a/lib/libc/arch/m88k/gen/modsi3.S b/lib/libc/arch/m88k/gen/modsi3.S new file mode 100644 index 00000000000..4491370d9a6 --- /dev/null +++ b/lib/libc/arch/m88k/gen/modsi3.S @@ -0,0 +1,65 @@ +/* $OpenBSD: modsi3.S,v 1.1 2013/06/05 22:06:30 miod Exp $ */ + +/* + * Copyright (c) 2013 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + +#include "SYS.h" + +/* + * int __modsi3(int n, int d); + */ + +#ifndef LDSO +.weak _C_LABEL(__modsi3) +#endif +ENTRY(__modsi3) + /* if divider is zero, trap */ + tcnd eq0, %r3, 503 + + bb1 31, %r2, 1f + bb1 31, %r3, 2f + + /* both operands are positive */ + divu %r4, %r2, %r3 +9: + mulu %r5, %r4, %r3 + jmp.n %r1 + subu %r2, %r2, %r5 + +1: + bb1 31, %r3, 3f + + /* r2 is negative, r3 is positive */ + subu %r4, %r0, %r2 + divu %r5, %r4, %r3 + subu %r4, %r0, %r5 + br 9b + +2: + /* r2 is positive, r3 is negative */ + subu %r5, %r0, %r3 + divu %r4, %r2, %r5 + subu %r4, %r0, %r4 + br 9b + +3: + /* both operands are negative */ + subu %r4, %r0, %r2 + subu %r5, %r0, %r3 + divu %r4, %r4, %r5 + br 9b +END(__modsi3) diff --git a/lib/libc/arch/m88k/gen/udivsi3.S b/lib/libc/arch/m88k/gen/udivsi3.S index 0ee987eb156..ff7abf7b5ed 100644 --- a/lib/libc/arch/m88k/gen/udivsi3.S +++ b/lib/libc/arch/m88k/gen/udivsi3.S @@ -1,4 +1,4 @@ -/* $OpenBSD: udivsi3.S,v 1.1 2013/06/05 20:15:01 miod Exp $ */ +/* $OpenBSD: udivsi3.S,v 1.2 2013/06/05 22:06:30 miod Exp $ */ /* * Copyright (c) 2013 Miodrag Vallat. @@ -23,6 +23,9 @@ * uint __udivsi3(uint n, uint d); */ +#ifndef LDSO +.weak _C_LABEL(__udivsi3) +#endif ENTRY(__udivsi3) /* if divider is zero, trap */ tcnd eq0, %r3, 503 diff --git a/lib/libc/arch/m88k/gen/umodsi3.S b/lib/libc/arch/m88k/gen/umodsi3.S new file mode 100644 index 00000000000..2cbdf86ec84 --- /dev/null +++ b/lib/libc/arch/m88k/gen/umodsi3.S @@ -0,0 +1,37 @@ +/* $OpenBSD: umodsi3.S,v 1.1 2013/06/05 22:06:30 miod Exp $ */ + +/* + * Copyright (c) 2013 Miodrag Vallat. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + + +#include "SYS.h" + +/* + * uint __umodsi3(uint n, uint d); + */ + +#ifndef LDSO +.weak _C_LABEL(__umodsi3) +#endif +ENTRY(__umodsi3) + /* if divider is zero, trap */ + tcnd eq0, %r3, 503 + + divu %r4, %r2, %r3 + mulu %r5, %r4, %r3 + jmp.n %r1 + subu %r2, %r2, %r5 +END(__umodsi3) |