summaryrefslogtreecommitdiffstats
path: root/lib/libm
diff options
context:
space:
mode:
authormartynas <martynas@openbsd.org>2011-05-28 22:13:52 +0000
committermartynas <martynas@openbsd.org>2011-05-28 22:13:52 +0000
commit0f10e34c4795322bf011a2035e758117bbd3b8ef (patch)
tree737be7ce95477ca2f94bc3ddddbeb7b3f9809900 /lib/libm
parentAdapt m68k MD functions to single-precision. (diff)
downloadwireguard-openbsd-0f10e34c4795322bf011a2035e758117bbd3b8ef.tar.xz
wireguard-openbsd-0f10e34c4795322bf011a2035e758117bbd3b8ef.zip
Adapt m68k MD functions to extended-precision.
Go for it miod@.
Diffstat (limited to 'lib/libm')
-rw-r--r--lib/libm/Makefile20
-rw-r--r--lib/libm/arch/mc68881/e_acosl.S42
-rw-r--r--lib/libm/arch/mc68881/e_asinl.S42
-rw-r--r--lib/libm/arch/mc68881/e_sqrtl.S48
-rw-r--r--lib/libm/arch/mc68881/s_atanl.S42
-rw-r--r--lib/libm/arch/mc68881/s_copysignl.S50
-rw-r--r--lib/libm/arch/mc68881/s_cosl.S42
-rw-r--r--lib/libm/arch/mc68881/s_logbl.S61
-rw-r--r--lib/libm/arch/mc68881/s_rintl.S44
-rw-r--r--lib/libm/arch/mc68881/s_scalbnl.S47
-rw-r--r--lib/libm/arch/mc68881/s_sinl.S42
-rw-r--r--lib/libm/arch/mc68881/s_tanl.S42
12 files changed, 513 insertions, 9 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile
index b569920b962..486a71a384a 100644
--- a/lib/libm/Makefile
+++ b/lib/libm/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.81 2011/05/28 21:55:04 martynas Exp $
+# $OpenBSD: Makefile,v 1.82 2011/05/28 22:13:52 martynas Exp $
# $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $
#
# @(#)Makefile 5.1beta 93/09/24
@@ -49,14 +49,16 @@ ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \
s_significandf.S s_sin.S s_sinf.S s_tan.S s_tanf.S
.elif (${MACHINE_ARCH} == "m68k")
.PATH: ${.CURDIR}/arch/mc68881
-ARCH_SRCS = e_acos.S e_acosf.S e_asin.S e_asinf.S e_atanh.S e_atanhf.S \
- e_cosh.S e_coshf.S e_exp.S e_expf.S e_log.S e_logf.S e_log10.S \
- e_log10f.S e_remainder.S e_remainderf.S e_scalb.S e_scalbf.S \
- e_sinh.S e_sinhf.S e_sqrt.S e_sqrtf.S s_atan.S s_atanf.S s_ceil.S \
- s_ceilf.S s_copysign.S s_copysignf.S s_cos.S s_cosf.S s_expm1.S \
- s_expm1f.S s_floor.S s_floorf.S s_log1p.S s_log1pf.S s_logb.S \
- s_logbf.S s_rint.S s_rintf.S s_scalbn.S s_scalbnf.S s_sin.S \
- s_sinf.S s_tan.S s_tanf.S s_tanh.S s_tanhf.S
+ARCH_SRCS = e_acos.S e_acosf.S e_acosl.S e_asin.S e_asinf.S e_asinl.S \
+ e_atanh.S e_atanhf.S e_cosh.S e_coshf.S e_exp.S e_expf.S e_log.S \
+ e_logf.S e_log10.S e_log10f.S e_remainder.S e_remainderf.S \
+ e_scalb.S e_scalbf.S e_sinh.S e_sinhf.S e_sqrt.S e_sqrtf.S \
+ e_sqrtl.S s_atan.S s_atanf.S s_atanl.S s_ceil.S s_ceilf.S \
+ s_copysign.S s_copysignf.S s_copysignl.S s_cos.S s_cosf.S s_cosl.S \
+ s_expm1.S s_expm1f.S s_floor.S s_floorf.S s_log1p.S s_log1pf.S \
+ s_logb.S s_logbf.S s_logbl.S s_rint.S s_rintf.S s_rintl.S \
+ s_scalbn.S s_scalbnf.S s_scalbnl.S s_sin.S s_sinf.S s_sinl.S \
+ s_tan.S s_tanf.S s_tanl.S s_tanh.S s_tanhf.S
.elif (${MACHINE_ARCH} == "hppa")
.PATH: ${.CURDIR}/arch/hppa
ARCH_SRCS = e_sqrt.c e_sqrtf.c e_remainder.c e_remainderf.c \
diff --git a/lib/libm/arch/mc68881/e_acosl.S b/lib/libm/arch/mc68881/e_acosl.S
new file mode 100644
index 00000000000..2b6acc27698
--- /dev/null
+++ b/lib/libm/arch/mc68881/e_acosl.S
@@ -0,0 +1,42 @@
+/* $OpenBSD: e_acosl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(acosl)
+ facosx sp@(4),fp0
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/e_asinl.S b/lib/libm/arch/mc68881/e_asinl.S
new file mode 100644
index 00000000000..558f0bc1c3a
--- /dev/null
+++ b/lib/libm/arch/mc68881/e_asinl.S
@@ -0,0 +1,42 @@
+/* $OpenBSD: e_asinl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(asinl)
+ fasinx sp@(4),fp0
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/e_sqrtl.S b/lib/libm/arch/mc68881/e_sqrtl.S
new file mode 100644
index 00000000000..8681ad49c0d
--- /dev/null
+++ b/lib/libm/arch/mc68881/e_sqrtl.S
@@ -0,0 +1,48 @@
+/* $OpenBSD: e_sqrtl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+/*
+ * sqrtl(x)
+ * returns the square root of x correctly rounded according
+ * to the rounding mode.
+ */
+
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(sqrtl)
+ fsqrtx sp@(4),fp0
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/s_atanl.S b/lib/libm/arch/mc68881/s_atanl.S
new file mode 100644
index 00000000000..851253b8e18
--- /dev/null
+++ b/lib/libm/arch/mc68881/s_atanl.S
@@ -0,0 +1,42 @@
+/* $OpenBSD: s_atanl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(atanl)
+ fatanx sp@(4),fp0
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/s_copysignl.S b/lib/libm/arch/mc68881/s_copysignl.S
new file mode 100644
index 00000000000..028c193da0e
--- /dev/null
+++ b/lib/libm/arch/mc68881/s_copysignl.S
@@ -0,0 +1,50 @@
+/* $OpenBSD: s_copysignl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+| copysignl(x,y)
+| returns x with the sign of y.
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(copysignl)
+ fmovex sp@(4),fp0
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ tstw sp@(16)
+ jmi Lneg
+ bclr #31,_ASM_LABEL(__rv)
+ rts
+Lneg:
+ bset #31,_ASM_LABEL(__rv)
+ rts
diff --git a/lib/libm/arch/mc68881/s_cosl.S b/lib/libm/arch/mc68881/s_cosl.S
new file mode 100644
index 00000000000..ba057cf3123
--- /dev/null
+++ b/lib/libm/arch/mc68881/s_cosl.S
@@ -0,0 +1,42 @@
+/* $OpenBSD: s_cosl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(cosl)
+ fcosx sp@(4),fp0
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/s_logbl.S b/lib/libm/arch/mc68881/s_logbl.S
new file mode 100644
index 00000000000..9db15d7cc79
--- /dev/null
+++ b/lib/libm/arch/mc68881/s_logbl.S
@@ -0,0 +1,61 @@
+/* $OpenBSD: s_logbl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+| logbl(x)
+| returns the unbiased exponent of x, a signed integer in double precision,
+| except that logbl(0) is -INF, logbl(INF) is +INF, and logbl(NAN) is that NAN.
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(logbl)
+ movw sp@(4),d0
+ movw #0x7FFF,d1 | exponent bits
+ andw d1,d0 | mask off all else
+ cmpw d1,d0 | max exponent?
+ bne Lfinite | no, is finite
+ fmovex sp@(4),fp0 | yes, infinite or NaN
+ fbun Ldone | NaN returns NaN
+ fabsx fp0 | +-inf returns inf
+ jra Ldone
+Lfinite:
+ fmovex sp@(4),fp0 | get entire number
+ fbne Lnonz | zero?
+ flog2x fp0 | yes, log(0) a convenient source of -inf
+ jra Ldone
+Lnonz:
+ fgetexpx fp0 | get exponent
+Ldone:
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/s_rintl.S b/lib/libm/arch/mc68881/s_rintl.S
new file mode 100644
index 00000000000..af9717f85c5
--- /dev/null
+++ b/lib/libm/arch/mc68881/s_rintl.S
@@ -0,0 +1,44 @@
+/* $OpenBSD: s_rintl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+| rintl(x)
+| delivers integer nearest x in direction of prevailing rounding mode
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(rintl)
+ fintx sp@(4),fp0 | use prevailing rounding mode
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/s_scalbnl.S b/lib/libm/arch/mc68881/s_scalbnl.S
new file mode 100644
index 00000000000..18f8728f0f1
--- /dev/null
+++ b/lib/libm/arch/mc68881/s_scalbnl.S
@@ -0,0 +1,47 @@
+/* $OpenBSD: s_scalbnl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+| scalbnl(x, N)
+| returns x * (2**N), for integer values N.
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(scalbnl)
+ fmovex sp@(4),fp0
+ fbeq Ldone
+ fscalel sp@(16),fp0
+Ldone:
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/s_sinl.S b/lib/libm/arch/mc68881/s_sinl.S
new file mode 100644
index 00000000000..3fd595567e1
--- /dev/null
+++ b/lib/libm/arch/mc68881/s_sinl.S
@@ -0,0 +1,42 @@
+/* $OpenBSD: s_sinl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(sinl)
+ fsinx sp@(4),fp0
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts
diff --git a/lib/libm/arch/mc68881/s_tanl.S b/lib/libm/arch/mc68881/s_tanl.S
new file mode 100644
index 00000000000..1cca0d76e08
--- /dev/null
+++ b/lib/libm/arch/mc68881/s_tanl.S
@@ -0,0 +1,42 @@
+/* $OpenBSD: s_tanl.S,v 1.1 2011/05/28 22:13:52 martynas Exp $ */
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+.lcomm _ASM_LABEL(__rv),12
+ENTRY(tanl)
+ ftanx sp@(4),fp0
+ fmovex fp0,_ASM_LABEL(__rv)
+ movel #_ASM_LABEL(__rv),d0
+ rts