summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libm/Makefile5
-rw-r--r--lib/libm/arch/hppa/e_remainder.c17
-rw-r--r--lib/libm/arch/hppa/e_remainderf.c17
-rw-r--r--lib/libm/arch/hppa/s_ceil.c26
-rw-r--r--lib/libm/arch/hppa/s_ceilf.c26
-rw-r--r--lib/libm/arch/hppa/s_floor.c26
-rw-r--r--lib/libm/arch/hppa/s_floorf.c26
-rw-r--r--lib/libm/arch/hppa/s_rint.c17
-rw-r--r--lib/libm/arch/hppa/s_rintf.c17
9 files changed, 175 insertions, 2 deletions
diff --git a/lib/libm/Makefile b/lib/libm/Makefile
index 9a1eff58f21..080523e1860 100644
--- a/lib/libm/Makefile
+++ b/lib/libm/Makefile
@@ -1,5 +1,5 @@
# $NetBSD: Makefile,v 1.28 1995/11/20 22:06:19 jtc Exp $
-# $OpenBSD: Makefile,v 1.27 2002/05/22 20:55:55 mickey Exp $
+# $OpenBSD: Makefile,v 1.28 2002/05/22 21:34:56 mickey Exp $
#
# @(#)Makefile 5.1beta 93/09/24
#
@@ -71,7 +71,8 @@ ARCH_SRCS = e_acos.S e_asin.S e_atanh.S e_cosh.S e_exp.S e_log.S e_log10.S \
s_logb.S s_rint.S s_scalbn.S s_sin.S s_tan.S s_tanh.S
.elif (${MACHINE_ARCH} == "hppa")
.PATH: ${.CURDIR}/arch/hppa
-ARCH_SRCS = e_sqrt.c e_sqrtf.c
+ARCH_SRCS = e_sqrt.c e_sqrtf.c e_remainder.c e_remainderf.c \
+ s_ceil.c s_ceilf.c s_floor.c s_floorf.c s_rint.c s_rintf.c
.elif (${MACHINE_ARCH} == "vax")
.PATH: ${.CURDIR}/arch/vax
NOIEEE_ARCH=n_infnan.S n_argred.S n_sqrt.S
diff --git a/lib/libm/arch/hppa/e_remainder.c b/lib/libm/arch/hppa/e_remainder.c
new file mode 100644
index 00000000000..15db821d42c
--- /dev/null
+++ b/lib/libm/arch/hppa/e_remainder.c
@@ -0,0 +1,17 @@
+/*
+ * Written by Michael Shalayeff. Public Domain
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: e_remainder.c,v 1.1 2002/05/22 21:34:56 mickey Exp $";
+#endif
+
+#include "math.h"
+
+double
+__ieee754_remainder(double x, double p)
+{
+ __asm__ __volatile__("frem,dbl %0,%1,%0" : "+f" (x) : "f" (p));
+
+ return (x);
+}
diff --git a/lib/libm/arch/hppa/e_remainderf.c b/lib/libm/arch/hppa/e_remainderf.c
new file mode 100644
index 00000000000..366be878631
--- /dev/null
+++ b/lib/libm/arch/hppa/e_remainderf.c
@@ -0,0 +1,17 @@
+/*
+ * Written by Michael Shalayeff. Public Domain
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: e_remainderf.c,v 1.1 2002/05/22 21:34:56 mickey Exp $";
+#endif
+
+#include "math.h"
+
+float
+__ieee754_remainder(float x, float p)
+{
+ __asm__ __volatile__("frem,sgl %0,%1,%0" : "+f" (x) : "f" (p));
+
+ return (x);
+}
diff --git a/lib/libm/arch/hppa/s_ceil.c b/lib/libm/arch/hppa/s_ceil.c
new file mode 100644
index 00000000000..c85f3533492
--- /dev/null
+++ b/lib/libm/arch/hppa/s_ceil.c
@@ -0,0 +1,26 @@
+/*
+ * Written by Michael Shalayeff. Public Domain
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: s_ceil.c,v 1.1 2002/05/22 21:34:56 mickey Exp $";
+#endif
+
+#include <sys/types.h>
+#include <machine/ieeefp.h>
+#include "math.h"
+
+double
+__ieee754_ceil(double x)
+{
+ u_int32_t ofpsr, fpsr;
+
+ __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
+ fpsr = (ofpsr & ~0x600) | (FP_RP << 9);
+ __asm__ __volatile__("fldw 0(%0), %%fr0" :: "r" (&fpsr));
+
+ __asm__ __volatile__("frnd,dbl %0,%0" : "+f" (x));
+
+ __asm__ __volatile__("fldw 0(%0), %%fr0" :: "r" (&ofpsr));
+ return (x);
+}
diff --git a/lib/libm/arch/hppa/s_ceilf.c b/lib/libm/arch/hppa/s_ceilf.c
new file mode 100644
index 00000000000..9c363ae1ce4
--- /dev/null
+++ b/lib/libm/arch/hppa/s_ceilf.c
@@ -0,0 +1,26 @@
+/*
+ * Written by Michael Shalayeff. Public Domain
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: s_ceilf.c,v 1.1 2002/05/22 21:34:56 mickey Exp $";
+#endif
+
+#include <sys/types.h>
+#include <machine/ieeefp.h>
+#include "math.h"
+
+float
+__ieee754_ceil(float x)
+{
+ u_int32_t ofpsr, fpsr;
+
+ __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
+ fpsr = (ofpsr & ~0x600) | (FP_RP << 9);
+ __asm__ __volatile__("fldw 0(%0), %%fr0" :: "r" (&fpsr));
+
+ __asm__ __volatile__("frnd,sgl %0,%0" : "+f" (x));
+
+ __asm__ __volatile__("fldw 0(%0), %%fr0" :: "r" (&ofpsr));
+ return (x);
+}
diff --git a/lib/libm/arch/hppa/s_floor.c b/lib/libm/arch/hppa/s_floor.c
new file mode 100644
index 00000000000..8064793c2bf
--- /dev/null
+++ b/lib/libm/arch/hppa/s_floor.c
@@ -0,0 +1,26 @@
+/*
+ * Written by Michael Shalayeff. Public Domain
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: s_floor.c,v 1.1 2002/05/22 21:34:56 mickey Exp $";
+#endif
+
+#include <sys/types.h>
+#include <machine/ieeefp.h>
+#include "math.h"
+
+double
+__ieee754_floor(double x)
+{
+ u_int32_t ofpsr, fpsr;
+
+ __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
+ fpsr = (ofpsr & ~0x600) | (FP_RN << 9);
+ __asm__ __volatile__("fldw 0(%0), %%fr0" :: "r" (&fpsr));
+
+ __asm__ __volatile__("frnd,dbl %0,%0" : "+f" (x));
+
+ __asm__ __volatile__("fldw 0(%0), %%fr0" :: "r" (&ofpsr));
+ return (x);
+}
diff --git a/lib/libm/arch/hppa/s_floorf.c b/lib/libm/arch/hppa/s_floorf.c
new file mode 100644
index 00000000000..feff01f6fbf
--- /dev/null
+++ b/lib/libm/arch/hppa/s_floorf.c
@@ -0,0 +1,26 @@
+/*
+ * Written by Michael Shalayeff. Public Domain
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: s_floorf.c,v 1.1 2002/05/22 21:34:56 mickey Exp $";
+#endif
+
+#include <sys/types.h>
+#include <machine/ieeefp.h>
+#include "math.h"
+
+float
+__ieee754_floorf(float x)
+{
+ u_int32_t ofpsr, fpsr;
+
+ __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m" (ofpsr) : "r" (&ofpsr));
+ fpsr = (ofpsr & ~0x600) | (FP_RN << 9);
+ __asm__ __volatile__("fldw 0(%0), %%fr0" :: "r" (&fpsr));
+
+ __asm__ __volatile__("frnd,sgl %0,%0" : "+f" (x));
+
+ __asm__ __volatile__("fldw 0(%0), %%fr0" :: "r" (&ofpsr));
+ return (x);
+}
diff --git a/lib/libm/arch/hppa/s_rint.c b/lib/libm/arch/hppa/s_rint.c
new file mode 100644
index 00000000000..101b62c9db0
--- /dev/null
+++ b/lib/libm/arch/hppa/s_rint.c
@@ -0,0 +1,17 @@
+/*
+ * Written by Michael Shalayeff. Public Domain
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: s_rint.c,v 1.1 2002/05/22 21:34:56 mickey Exp $";
+#endif
+
+#include "math.h"
+
+double
+__ieee754_rint(double x)
+{
+ __asm__ __volatile__("frnd,dbl %0,%0" : "+f" (x));
+
+ return (x);
+}
diff --git a/lib/libm/arch/hppa/s_rintf.c b/lib/libm/arch/hppa/s_rintf.c
new file mode 100644
index 00000000000..f3d0a60235c
--- /dev/null
+++ b/lib/libm/arch/hppa/s_rintf.c
@@ -0,0 +1,17 @@
+/*
+ * Written by Michael Shalayeff. Public Domain
+ */
+
+#if defined(LIBM_SCCS) && !defined(lint)
+static char rcsid[] = "$OpenBSD: s_rintf.c,v 1.1 2002/05/22 21:34:56 mickey Exp $";
+#endif
+
+#include "math.h"
+
+float
+__ieee754_rint(float x)
+{
+ __asm__ __volatile__("frnd,dbl %0,%0" : "+f" (x));
+
+ return (x);
+}