PR 48384: reorganize struct ieee_ext for sparc64 to only use a high/low

part for the mantissa.
Adjust arch specific code accordingly.
This commit is contained in:
martin 2013-11-20 22:22:20 +00:00
parent 42e0203237
commit acdd726fe5
4 changed files with 30 additions and 33 deletions

View File

@ -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 @@ __fpclassifyl(long double x)
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;

View File

@ -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 @@ __isinfl(long double x)
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));
}

View File

@ -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 @@ __isnanl(long double x)
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));
}

View File

@ -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