From 3fd797268f53e596aa9aac69f030a4b98ad2ff12 Mon Sep 17 00:00:00 2001 From: pk Date: Tue, 26 Nov 2002 14:30:53 +0000 Subject: [PATCH] Add a shared library containing sparc version 8 specific multiply, divide and remainder functions (i.e. .[u]mul, .[u]div, .[u]rem). --- lib/libarch/Makefile | 5 +- lib/libarch/sparc/Makefile.inc | 6 ++ lib/libarch/sparc/v8/Makefile | 9 +++ lib/libarch/sparc/v8/shlib_version | 5 ++ lib/libarch/sparc/v8/sparc_v8.S | 94 ++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 lib/libarch/sparc/Makefile.inc create mode 100644 lib/libarch/sparc/v8/Makefile create mode 100644 lib/libarch/sparc/v8/shlib_version create mode 100644 lib/libarch/sparc/v8/sparc_v8.S diff --git a/lib/libarch/Makefile b/lib/libarch/Makefile index 5ec943412f39..5a718ea64693 100644 --- a/lib/libarch/Makefile +++ b/lib/libarch/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.19 2002/07/06 10:19:08 fvdl Exp $ +# $NetBSD: Makefile,v 1.20 2002/11/26 14:30:53 pk Exp $ # These should always be a MACHINE_CPU value -ARCHDIRS= alpha arm i386 m68k x86_64 +ARCHDIRS= alpha arm i386 m68k sparc x86_64 .for arch in ${ARCHDIRS} .include "${.CURDIR}/${arch}/Makefile.inc" @@ -22,3 +22,4 @@ SHLIB_VERSION_FILE= ${.CURDIR}/${LIB}/shlib_version # ... otherwise just build the manpages .include .endif +.include diff --git a/lib/libarch/sparc/Makefile.inc b/lib/libarch/sparc/Makefile.inc new file mode 100644 index 000000000000..6c0b8c5f9d00 --- /dev/null +++ b/lib/libarch/sparc/Makefile.inc @@ -0,0 +1,6 @@ +# $NetBSD: Makefile.inc,v 1.1 2002/11/26 14:30:53 pk Exp $ + +.if (${MACHINE_ARCH} == "sparc") +SUBDIR=sparc/v8 +.endif + diff --git a/lib/libarch/sparc/v8/Makefile b/lib/libarch/sparc/v8/Makefile new file mode 100644 index 000000000000..a181ee771d8b --- /dev/null +++ b/lib/libarch/sparc/v8/Makefile @@ -0,0 +1,9 @@ +# $NetBSD: Makefile,v 1.1 2002/11/26 14:30:54 pk Exp $ + +NOLINT= # defined +USE_SHLIBDIR= yes +LIB= sparc_v8 + +SRCS= sparc_v8.S + +.include diff --git a/lib/libarch/sparc/v8/shlib_version b/lib/libarch/sparc/v8/shlib_version new file mode 100644 index 000000000000..c601618882ae --- /dev/null +++ b/lib/libarch/sparc/v8/shlib_version @@ -0,0 +1,5 @@ +# $NetBSD: shlib_version,v 1.1 2002/11/26 14:30:54 pk Exp $ +# Remember to update distrib/sets/lists/base/md.i386 when changing +# +major=0 +minor=0 diff --git a/lib/libarch/sparc/v8/sparc_v8.S b/lib/libarch/sparc/v8/sparc_v8.S new file mode 100644 index 000000000000..12911e87b825 --- /dev/null +++ b/lib/libarch/sparc/v8/sparc_v8.S @@ -0,0 +1,94 @@ +/* + * GCC generated output for sparc v8 mul/div/rem operations. + * Included in the sparc_v8.so shared library for use on sparc v8 + * machines instead of the libc.so versions. + */ + .file "sparc_v8.S" +.section ".text" + +/*--- .umul ---*/ + .align 4 + .global .umul + .type .umul,@function + .proc 016 + +.umul: + !#PROLOGUE# 0 + !#PROLOGUE# 1 + retl + umul %o0, %o1, %o0 +.LLfe1: + .size .umul,.LLfe1-.umul + +/*--- .mul ---*/ + .align 4 + .global .mul + .type .mul,@function + .proc 04 +.mul: + !#PROLOGUE# 0 + !#PROLOGUE# 1 + retl + smul %o0, %o1, %o0 +.LLfe2: + .size .mul,.LLfe2-.mul + +/*--- .udiv ---*/ + .align 4 + .global .udiv + .type .udiv,@function + .proc 016 +.udiv: + wr %g0, 0, %y + nop; nop; nop + retl + udiv %o0, %o1, %o0 +.LLfe3: + .size .udiv,.LLfe3-.udiv + +/*--- .div ---*/ + .align 4 + .global .div + .type .div,@function + .proc 04 + +.div: + sra %o0, 31, %g2 + wr %g2, 0, %y + nop; nop; nop + retl + sdiv %o0, %o1, %o0 +.LLfe4: + .size .div,.LLfe4-.div + +/*--- .urem ---*/ + .align 4 + .global .urem + .type .urem,@function + .proc 016 +.urem: + wr %g0, %g0, %y + nop; nop; nop + udiv %o0, %o1, %g2 + smul %g2, %o1, %g2 + retl + sub %o0, %g2, %o0 +.LLfe5: + .size .urem,.LLfe5-.urem + +/*--- .rem ---*/ + .align 4 + .global .rem + .type .rem,@function + .proc 04 +.rem: + sra %o0, 31, %g3 + wr %g3, 0, %y + nop; nop; nop + sdiv %o0, %o1, %g2 + smul %g2, %o1, %g2 + retl + sub %o0, %g2, %o0 +.LLfe6: + .size .rem,.LLfe6-.rem + !.ident "GCC: (GNU) 2.95.3 20010315 (release) (NetBSD nb3)"