Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/arch/m68k/fpe Pullup from -current, requested by is...
details: https://anonhg.NetBSD.org/src/rev/d8b48e4dcca0
branches: netbsd-1-5
changeset: 489535:d8b48e4dcca0
user: is <is%NetBSD.org@localhost>
date: Tue Sep 26 09:03:35 2000 +0000
description:
Pullup from -current, requested by is, approved by thorpej:
fpu_emulate.h 1.7, fpu_log.c 1.7: synchronize mantissa length % 32 with fpu_fmovecr.c table
fpu_fmovecr.c 1.8: cheap compile-time consistency check for this
fpu_int.c 1.3: fix bug introduced when reducing mantissa size
This fixes PR 11045.
diffstat:
sys/arch/m68k/fpe/fpu_emulate.h | 12 ++++++------
sys/arch/m68k/fpe/fpu_fmovecr.c | 9 +++++++--
sys/arch/m68k/fpe/fpu_int.c | 4 ++--
sys/arch/m68k/fpe/fpu_log.c | 5 ++---
4 files changed, 17 insertions(+), 13 deletions(-)
diffs (98 lines):
diff -r eb9030a7459c -r d8b48e4dcca0 sys/arch/m68k/fpe/fpu_emulate.h
--- a/sys/arch/m68k/fpe/fpu_emulate.h Tue Sep 26 02:07:17 2000 +0000
+++ b/sys/arch/m68k/fpe/fpu_emulate.h Tue Sep 26 09:03:35 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_emulate.h,v 1.5.12.1 2000/09/19 03:09:45 minoura Exp $ */
+/* $NetBSD: fpu_emulate.h,v 1.5.12.2 2000/09/26 09:03:35 is Exp $ */
/*
* Copyright (c) 1995 Gordon Ross
@@ -44,11 +44,11 @@
* or `unpacked' form consisting of:
* - sign
* - unbiased exponent
- * - mantissa (`1.' + 63-bit fraction + guard + round)
+ * - mantissa (`1.' + 80-bit fraction + guard + round)
* - sticky bit
- * Any implied `1' bit is inserted, giving a 64-bit mantissa that is
+ * Any implied `1' bit is inserted, giving a 81-bit mantissa that is
* always nonzero. Additional low-order `guard' and `round' bits are
- * scrunched in, making the entire mantissa 66 bits long. This is divided
+ * scrunched in, making the entire mantissa 83 bits long. This is divided
* into three 32-bit words, with `spare' bits left over in the upper part
* of the top word (the high bits of fp_mant[0]). An internal `exploded'
* number is thus kept within the half-open interval [1.0,2.0) (but see
@@ -76,10 +76,10 @@
int fp_sign; /* 0 => positive, 1 => negative */
int fp_exp; /* exponent (unbiased) */
int fp_sticky; /* nonzero bits lost at right end */
- u_int fp_mant[3]; /* 66-bit mantissa */
+ u_int fp_mant[3]; /* 83-bit mantissa */
};
-#define FP_NMANT 67 /* total bits in mantissa (incl g,r) */
+#define FP_NMANT 83 /* total bits in mantissa (incl g,r) */
#define FP_NG 2 /* number of low-order guard bits */
#define FP_LG ((FP_NMANT - 1) & 31) /* log2(1.0) for fp_mant[0] */
#define FP_QUIETBIT (1 << (FP_LG - 1)) /* Quiet bit in NaNs (0.5) */
diff -r eb9030a7459c -r d8b48e4dcca0 sys/arch/m68k/fpe/fpu_fmovecr.c
--- a/sys/arch/m68k/fpe/fpu_fmovecr.c Tue Sep 26 02:07:17 2000 +0000
+++ b/sys/arch/m68k/fpe/fpu_fmovecr.c Tue Sep 26 09:03:35 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_fmovecr.c,v 1.7 1999/05/30 20:17:48 briggs Exp $ */
+/* $NetBSD: fpu_fmovecr.c,v 1.7.12.1 2000/09/26 09:03:35 is Exp $ */
/*
* Copyright (c) 1995 Ken Nakata
@@ -37,8 +37,13 @@
#include "fpu_emulate.h"
+/* XXX: quick consistency check */
+#if (FP_1 != 0x40000)
+Error you have to change this table when changing the mantissa size
+#endif
+
static struct fpn constrom[] = {
- /* fp_class, fp_sign, fp_exp, fp_sticky, fp_mant[0] ... [3] */
+ /* fp_class, fp_sign, fp_exp, fp_sticky, fp_mant[0] ... [2] */
{ FPC_NUM, 0, 1, 0, { 0x6487e, 0xd5110b46, 0x11a80000 } },
{ FPC_NUM, 0, -2, 0, { 0x4d104, 0xd427de7f, 0xbcc00000 } },
{ FPC_NUM, 0, 1, 0, { 0x56fc2, 0xa2c515da, 0x54d00000 } },
diff -r eb9030a7459c -r d8b48e4dcca0 sys/arch/m68k/fpe/fpu_int.c
--- a/sys/arch/m68k/fpe/fpu_int.c Tue Sep 26 02:07:17 2000 +0000
+++ b/sys/arch/m68k/fpe/fpu_int.c Tue Sep 26 09:03:35 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_int.c,v 1.2 1999/05/30 20:17:48 briggs Exp $ */
+/* $NetBSD: fpu_int.c,v 1.2.12.1 2000/09/26 09:03:35 is Exp $ */
/*
* Copyright (c) 1995 Ken Nakata
@@ -60,7 +60,7 @@
return x;
}
- clr = 3 - sh / 32;
+ clr = 2 - sh / 32;
mask = (0xffffffff << (sh % 32));
for (i = 2; i > clr; i--) {
diff -r eb9030a7459c -r d8b48e4dcca0 sys/arch/m68k/fpe/fpu_log.c
--- a/sys/arch/m68k/fpe/fpu_log.c Tue Sep 26 02:07:17 2000 +0000
+++ b/sys/arch/m68k/fpe/fpu_log.c Tue Sep 26 09:03:35 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu_log.c,v 1.6 1999/05/30 20:17:48 briggs Exp $ */
+/* $NetBSD: fpu_log.c,v 1.6.12.1 2000/09/26 09:03:35 is Exp $ */
/*
* Copyright (c) 1995 Ken Nakata
@@ -314,8 +314,7 @@
#endif
/* index to the table */
- i = ((F.fp_mant[0] << (7 - FP_LG)) |
- (F.fp_mant[1] >> (32 - (7 - FP_LG)))) & 0x7e;
+ i = (F.fp_mant[0] >> (FP_LG - 7)) & 0x7e;
#if FPE_DEBUG
printf("__fpu_logn: index to logtbl i=%d(%x)\n", i, i);
Home |
Main Index |
Thread Index |
Old Index