Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src PR 48384: reorganize struct ieee_ext for sparc64 to only use...
details: https://anonhg.NetBSD.org/src/rev/2b7154a0ad72
branches: trunk
changeset: 791488:2b7154a0ad72
user: martin <martin%NetBSD.org@localhost>
date: Wed Nov 20 22:22:20 2013 +0000
description:
PR 48384: reorganize struct ieee_ext for sparc64 to only use a high/low
part for the mantissa.
Adjust arch specific code accordingly.
diffstat:
lib/libc/arch/sparc64/gen/fpclassifyl.c | 10 +++-----
lib/libc/arch/sparc64/gen/isinfl.c | 7 ++---
lib/libc/arch/sparc64/gen/isnanl.c | 7 ++---
sys/arch/sparc/include/ieee.h | 39 ++++++++++++++++----------------
4 files changed, 30 insertions(+), 33 deletions(-)
diffs (143 lines):
diff -r 6c95af4f2d46 -r 2b7154a0ad72 lib/libc/arch/sparc64/gen/fpclassifyl.c
--- a/lib/libc/arch/sparc64/gen/fpclassifyl.c Wed Nov 20 21:12:30 2013 +0000
+++ b/lib/libc/arch/sparc64/gen/fpclassifyl.c Wed Nov 20 22:22:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpclassifyl.c,v 1.2 2008/04/28 20:22:57 martin Exp $ */
+/* $NetBSD: fpclassifyl.c,v 1.3 2013/11/20 22:22:20 martin Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpclassifyl.c,v 1.2 2008/04/28 20:22:57 martin Exp $");
+__RCSID("$NetBSD: fpclassifyl.c,v 1.3 2013/11/20 22:22:20 martin Exp $");
#endif
#include <machine/ieee.h>
@@ -49,14 +49,12 @@
u.extu_ld = x;
if (u.extu_ext.ext_exp == 0) {
- if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0 &&
- u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0)
+ if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_fracl == 0)
return FP_ZERO;
else
return FP_SUBNORMAL;
} else if (u.extu_ext.ext_exp == EXT_EXP_INFNAN) {
- if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0 &&
- u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0)
+ if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_fracl == 0)
return FP_INFINITE;
else
return FP_NAN;
diff -r 6c95af4f2d46 -r 2b7154a0ad72 lib/libc/arch/sparc64/gen/isinfl.c
--- a/lib/libc/arch/sparc64/gen/isinfl.c Wed Nov 20 21:12:30 2013 +0000
+++ b/lib/libc/arch/sparc64/gen/isinfl.c Wed Nov 20 22:22:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isinfl.c,v 1.4 2004/03/04 23:42:39 kleink Exp $ */
+/* $NetBSD: isinfl.c,v 1.5 2013/11/20 22:22:20 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: isinfl.c,v 1.4 2004/03/04 23:42:39 kleink Exp $");
+__RCSID("$NetBSD: isinfl.c,v 1.5 2013/11/20 22:22:20 martin Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -59,6 +59,5 @@
u.extu_ld = x;
return (u.extu_ext.ext_exp == EXT_EXP_INFNAN &&
- (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0 &&
- u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0));
+ (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_fracl == 0));
}
diff -r 6c95af4f2d46 -r 2b7154a0ad72 lib/libc/arch/sparc64/gen/isnanl.c
--- a/lib/libc/arch/sparc64/gen/isnanl.c Wed Nov 20 21:12:30 2013 +0000
+++ b/lib/libc/arch/sparc64/gen/isnanl.c Wed Nov 20 22:22:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isnanl.c,v 1.4 2004/03/04 23:42:39 kleink Exp $ */
+/* $NetBSD: isnanl.c,v 1.5 2013/11/20 22:22:20 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: isnanl.c,v 1.4 2004/03/04 23:42:39 kleink Exp $");
+__RCSID("$NetBSD: isnanl.c,v 1.5 2013/11/20 22:22:20 martin Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -59,6 +59,5 @@
u.extu_ld = x;
return (u.extu_ext.ext_exp == EXT_EXP_INFNAN &&
- (u.extu_ext.ext_frach != 0 || u.extu_ext.ext_frachm != 0 ||
- u.extu_ext.ext_fraclm != 0 || u.extu_ext.ext_fracl != 0));
+ (u.extu_ext.ext_frach != 0 || u.extu_ext.ext_fracl != 0));
}
diff -r 6c95af4f2d46 -r 2b7154a0ad72 sys/arch/sparc/include/ieee.h
--- a/sys/arch/sparc/include/ieee.h Wed Nov 20 21:12:30 2013 +0000
+++ b/sys/arch/sparc/include/ieee.h Wed Nov 20 22:22:20 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieee.h,v 1.15 2013/02/14 09:34:46 martin Exp $ */
+/* $NetBSD: ieee.h,v 1.16 2013/11/20 22:22:20 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -57,27 +57,28 @@
#if defined(__arch64__) || defined(_KERNEL)
#define EXT_EXPBITS 15
-#define EXT_FRACHBITS 16
-#define EXT_FRACHMBITS 32
-#define EXT_FRACLMBITS 32
-#define EXT_FRACLBITS 32
-#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACLMBITS + EXT_FRACHMBITS + EXT_FRACHBITS)
-
-#define EXT_TO_ARRAY32(u, a) do { \
- (a)[0] = (uint32_t)(u).extu_ext.ext_fracl; \
- (a)[1] = (uint32_t)(u).extu_ext.ext_fraclm; \
- (a)[2] = (uint32_t)(u).extu_ext.ext_frachm; \
- (a)[3] = (uint32_t)(u).extu_ext.ext_frach; \
-} while(/*CONSTCOND*/0)
+#define EXT_FRACHBITS (16+32)
+#define EXT_FRACLBITS (32+32)
+#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
struct ieee_ext {
- u_int ext_sign:1;
- u_int ext_exp:EXT_EXPBITS;
- u_int ext_frach:EXT_FRACHBITS;
- u_int ext_frachm;
- u_int ext_fraclm;
- u_int ext_fracl;
+ uint64_t ext_sign:1;
+ uint64_t ext_exp:EXT_EXPBITS;
+ uint64_t ext_frach:EXT_FRACHBITS;
+ uint64_t ext_fracl;
};
+__CTASSERT(sizeof(struct ieee_ext) == 16);
+
+/*
+ * Copy all mantissa bits to an array of uint32_t big enough to hold them all.
+ * This is an insane API (seems to only be needed in gdtoa).
+ */
+#define EXT_TO_ARRAY32(u, a) do { \
+ (a)[0] = (uint32_t)((u).extu_ext.ext_fracl & 0x0ffffffffL); \
+ (a)[1] = (uint32_t)((u).extu_ext.ext_fracl >> 32); \
+ (a)[2] = (uint32_t)((u).extu_ext.ext_frach & 0x0ffffffffL); \
+ (a)[3] = (uint32_t)((u).extu_ext.ext_frach >> 32) & 0x0ffff; \
+} while(/*CONSTCOND*/0)
/*
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
Home |
Main Index |
Thread Index |
Old Index