summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-10-21 18:41:06 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-10-21 18:41:06 +0000
commit28a9cd66276c4626ef7c0da595202ea6988a2ec6 (patch)
treecfc8f7871f509719d5c65d52b09c36392de80c46
parent4680183c186df58c7a99599bae3a120b19c2eec6 (diff)
make an ieeefp regress pass; miod@ ok
-rw-r--r--lib/libc/arch/hppa/gen/fabs.c4
-rw-r--r--lib/libc/arch/hppa/gen/flt_rounds.c8
-rw-r--r--lib/libc/arch/hppa/gen/fpgetmask.c8
-rw-r--r--lib/libc/arch/hppa/gen/fpgetround.c8
-rw-r--r--lib/libc/arch/hppa/gen/fpgetsticky.c8
-rw-r--r--lib/libc/arch/hppa/gen/fpsetmask.c12
-rw-r--r--lib/libc/arch/hppa/gen/fpsetround.c13
-rw-r--r--lib/libc/arch/hppa/gen/fpsetsticky.c10
-rw-r--r--sys/arch/hppa/include/cpu.h4
-rw-r--r--sys/arch/hppa/include/float.h8
10 files changed, 44 insertions, 39 deletions
diff --git a/lib/libc/arch/hppa/gen/fabs.c b/lib/libc/arch/hppa/gen/fabs.c
index 35c0d764b4a..88cfb3c39ca 100644
--- a/lib/libc/arch/hppa/gen/fabs.c
+++ b/lib/libc/arch/hppa/gen/fabs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fabs.c,v 1.2 2002/05/22 20:05:01 miod Exp $ */
+/* $OpenBSD: fabs.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
/*
* Written by Miodrag Vallat. Public domain
@@ -8,6 +8,6 @@ double
fabs(double val)
{
- __asm__ __volatile__("fabs,dbl %0,%0" : "+f"(val));
+ __asm__ __volatile__("fabs,dbl %0,%0" : "+f" (val));
return (val);
}
diff --git a/lib/libc/arch/hppa/gen/flt_rounds.c b/lib/libc/arch/hppa/gen/flt_rounds.c
index 515bb930881..a73f534f052 100644
--- a/lib/libc/arch/hppa/gen/flt_rounds.c
+++ b/lib/libc/arch/hppa/gen/flt_rounds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: flt_rounds.c,v 1.2 2002/05/22 20:05:01 miod Exp $ */
+/* $OpenBSD: flt_rounds.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
/*
* Written by Miodrag Vallat. Public domain.
@@ -17,8 +17,8 @@ static const int map[] = {
int
__flt_rounds()
{
- u_int32_t fpsr;
+ u_int64_t fpsr;
- __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr));
- return map[(fpsr >> 9) & 0x03];
+ __asm__ __volatile__("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
+ return map[(fpsr >> 41) & 0x03];
}
diff --git a/lib/libc/arch/hppa/gen/fpgetmask.c b/lib/libc/arch/hppa/gen/fpgetmask.c
index dc7b6c98133..36c46818159 100644
--- a/lib/libc/arch/hppa/gen/fpgetmask.c
+++ b/lib/libc/arch/hppa/gen/fpgetmask.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpgetmask.c,v 1.2 2002/05/22 20:05:01 miod Exp $ */
+/* $OpenBSD: fpgetmask.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
/*
* Written by Miodrag Vallat. Public domain
@@ -10,8 +10,8 @@
fp_except
fpgetmask()
{
- u_int32_t fpsr;
+ u_int64_t fpsr;
- __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr));
- return (fpsr & 0x1f);
+ __asm__ __volatile__("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
+ return ((fpsr >> 32) & 0x1f);
}
diff --git a/lib/libc/arch/hppa/gen/fpgetround.c b/lib/libc/arch/hppa/gen/fpgetround.c
index db1b7f55eaa..e7438f7db19 100644
--- a/lib/libc/arch/hppa/gen/fpgetround.c
+++ b/lib/libc/arch/hppa/gen/fpgetround.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpgetround.c,v 1.2 2002/05/22 20:05:01 miod Exp $ */
+/* $OpenBSD: fpgetround.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
/*
* Written by Miodrag Vallat. Public domain
@@ -10,8 +10,8 @@
fp_rnd
fpgetround()
{
- u_int32_t fpsr;
+ u_int64_t fpsr;
- __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr));
- return ((fpsr >> 9) & 0x3);
+ __asm__ __volatile__("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
+ return ((fpsr >> 41) & 0x3);
}
diff --git a/lib/libc/arch/hppa/gen/fpgetsticky.c b/lib/libc/arch/hppa/gen/fpgetsticky.c
index 515ab823a13..56f61b8cccb 100644
--- a/lib/libc/arch/hppa/gen/fpgetsticky.c
+++ b/lib/libc/arch/hppa/gen/fpgetsticky.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpgetsticky.c,v 1.2 2002/05/22 20:05:01 miod Exp $ */
+/* $OpenBSD: fpgetsticky.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
/*
* Written by Miodrag Vallat. Public domain
@@ -10,8 +10,8 @@
fp_except
fpgetsticky()
{
- u_int32_t fpsr;
+ u_int64_t fpsr;
- __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr));
- return ((fpsr >> 27) & 0x1f);
+ __asm__ __volatile__("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
+ return ((fpsr >> 59) & 0x1f);
}
diff --git a/lib/libc/arch/hppa/gen/fpsetmask.c b/lib/libc/arch/hppa/gen/fpsetmask.c
index 91edb78ced3..f3f0096e5a5 100644
--- a/lib/libc/arch/hppa/gen/fpsetmask.c
+++ b/lib/libc/arch/hppa/gen/fpsetmask.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpsetmask.c,v 1.2 2002/05/22 20:05:01 miod Exp $ */
+/* $OpenBSD: fpsetmask.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
/*
* Written by Miodrag Vallat. Public domain
@@ -11,12 +11,12 @@ fp_except
fpsetmask(mask)
fp_except mask;
{
- u_int32_t fpsr;
+ u_int64_t fpsr;
fp_rnd old;
- __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr));
- old = fpsr & 0x1f;
- fpsr = (fpsr & 0xffffffe0) | (mask & 0x1f);
- __asm__ __volatile__("fldw 0(%0),%%fr0" : : "r"(&fpsr));
+ __asm__ __volatile__("fstd %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr));
+ old = (fpsr >> 32) & 0x1f;
+ fpsr = (fpsr & 0xffffffe000000000LL) | ((u_int64_t)(mask & 0x1f) << 32);
+ __asm__ __volatile__("fldd 0(%0),%%fr0" : : "r"(&fpsr));
return (old);
}
diff --git a/lib/libc/arch/hppa/gen/fpsetround.c b/lib/libc/arch/hppa/gen/fpsetround.c
index 14b1f0804b5..4943efa18ad 100644
--- a/lib/libc/arch/hppa/gen/fpsetround.c
+++ b/lib/libc/arch/hppa/gen/fpsetround.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpsetround.c,v 1.2 2002/05/22 20:05:01 miod Exp $ */
+/* $OpenBSD: fpsetround.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
/*
* Written by Miodrag Vallat. Public domain
@@ -11,12 +11,13 @@ fp_rnd
fpsetround(rnd_dir)
fp_rnd rnd_dir;
{
- u_int32_t fpsr;
+ u_int64_t fpsr;
fp_rnd old;
- __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr));
- old = (fpsr >> 9) & 0x03;
- fpsr = (fpsr & 0xfffff9ff) | ((rnd_dir & 0x03) << 9);
- __asm__ __volatile__("fldw 0(%0),%%fr0" : : "r"(&fpsr));
+ __asm__ __volatile__("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
+ old = (fpsr >> 41) & 0x03;
+ fpsr = (fpsr & 0xfffff9ff00000000LL) |
+ ((u_int64_t)(rnd_dir & 0x03) << 41);
+ __asm__ __volatile__("fldd 0(%0),%%fr0" : : "r" (&fpsr));
return (old);
}
diff --git a/lib/libc/arch/hppa/gen/fpsetsticky.c b/lib/libc/arch/hppa/gen/fpsetsticky.c
index 0a86282d2a4..d23d194d203 100644
--- a/lib/libc/arch/hppa/gen/fpsetsticky.c
+++ b/lib/libc/arch/hppa/gen/fpsetsticky.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fpsetsticky.c,v 1.2 2002/05/22 20:05:01 miod Exp $ */
+/* $OpenBSD: fpsetsticky.c,v 1.3 2002/10/21 18:41:05 mickey Exp $ */
/*
* Written by Miodrag Vallat. Public domain
@@ -11,12 +11,12 @@ fp_except
fpsetsticky(mask)
fp_except mask;
{
- u_int32_t fpsr;
+ u_int64_t fpsr;
fp_rnd old;
- __asm__ __volatile__("fstw %%fr0,0(%1)" : "=m"(fpsr) : "r"(&fpsr));
+ __asm__ __volatile__("fstd %%fr0,0(%1)" : "=m" (fpsr) : "r" (&fpsr));
old = (fpsr >> 27) & 0x1f;
- fpsr = (fpsr & 0x07ffffff) | ((mask & 0x1f) << 27);
- __asm__ __volatile__("fldw 0(%0),%%fr0" : : "r"(&fpsr));
+ fpsr = (fpsr & 0x07ffffff00000000LL) | ((u_int64_t)(mask & 0x1f) << 59);
+ __asm__ __volatile__("fldd 0(%0),%%fr0" : : "r" (&fpsr));
return (old);
}
diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h
index 3d2fcfa67d2..45a215774ec 100644
--- a/sys/arch/hppa/include/cpu.h
+++ b/sys/arch/hppa/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.33 2002/10/07 14:38:40 mickey Exp $ */
+/* $OpenBSD: cpu.h,v 1.34 2002/10/21 18:41:05 mickey Exp $ */
/*
* Copyright (c) 2000-2002 Michael Shalayeff
@@ -95,7 +95,7 @@ extern const char *cpu_typename;
#define HPPA_FPU_CQ 0x00fff800
#define HPPA_FPU_C 0x04000000
#define HPPA_FPU_FLSH 27
-#define HPPA_FPU_INIT (HPPA_FPU_U | HPPA_FPU_O | HPPA_FPU_Z | HPPA_FPU_V)
+#define HPPA_FPU_INIT (0)
#define HPPA_PMSFUS 0x20 /* ??? */
/*
diff --git a/sys/arch/hppa/include/float.h b/sys/arch/hppa/include/float.h
index 62755a386cf..e21cf03dbb1 100644
--- a/sys/arch/hppa/include/float.h
+++ b/sys/arch/hppa/include/float.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: float.h,v 1.3 2000/01/11 10:09:49 mickey Exp $ */
+/* $OpenBSD: float.h,v 1.4 2002/10/21 18:41:05 mickey Exp $ */
/*
* Copyright (c) 1989 Regents of the University of California.
@@ -40,8 +40,12 @@
#include <sys/cdefs.h>
+__BEGIN_DECLS
+int __flt_rounds(void);
+__END_DECLS
+
#define FLT_RADIX 2
-#define FLT_ROUNDS 1
+#define FLT_ROUNDS __flt_rounds()
#define FLT_MANT_DIG 24
#define FLT_EPSILON 1.19209290E-07F