Addition of fp routines. (PR 2281 from Matthias Pfaller.)
This commit is contained in:
parent
151fa70f78
commit
bf6acfece8
|
@ -1,5 +1,6 @@
|
|||
# $NetBSD: Makefile.inc,v 1.4 1995/05/03 03:25:11 phil Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.5 1996/04/05 00:23:05 phil Exp $
|
||||
|
||||
SRCS+= __main.c _setjmp.S alloca.S fabs.S frexp.S infinity.c isinf.c
|
||||
SRCS+= ldexp.S modf.S setjmp.S sigsetjmp.S
|
||||
SRCS+= flt_rounds.c fpgetround.c fpsetround.c
|
||||
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
||||
fpsetround.c fpsetsticky.c
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/fpu.h>
|
||||
|
||||
fp_except
|
||||
fpgetmask()
|
||||
{
|
||||
fp_except x;
|
||||
fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE;
|
||||
|
||||
sfsr(x);
|
||||
|
||||
return x & ebits;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 11, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/fpu.h>
|
||||
|
||||
fp_except
|
||||
fpgetsticky()
|
||||
{
|
||||
fp_except x;
|
||||
fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE;
|
||||
|
||||
sfsr(x);
|
||||
/* Map FPC_UF to soft underflow enable */
|
||||
if (x & FPC_UF)
|
||||
x |= FPC_UNDE << 1;
|
||||
else
|
||||
x &= ~(FPC_UNDE << 1);
|
||||
x >>= 1;
|
||||
|
||||
return x & ebits;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/fpu.h>
|
||||
|
||||
fp_except
|
||||
fpsetmask(mask)
|
||||
fp_except mask;
|
||||
{
|
||||
fp_except old;
|
||||
fp_except new;
|
||||
fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE;
|
||||
|
||||
sfsr(old);
|
||||
|
||||
new = old;
|
||||
new &= ~ebits;
|
||||
new |= mask & ebits;
|
||||
|
||||
lfsr(new);
|
||||
|
||||
return old & ebits;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/fpu.h>
|
||||
|
||||
fp_except
|
||||
fpsetsticky(sticky)
|
||||
fp_except sticky;
|
||||
{
|
||||
fp_except old;
|
||||
fp_except new;
|
||||
fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UEN | FPC_UNDE;
|
||||
|
||||
if (sticky & FPC_UNDE) {
|
||||
sticky |= FPC_UEN;
|
||||
sticky &= ~FPC_UNDE;
|
||||
}
|
||||
|
||||
sfsr(old);
|
||||
|
||||
new = old;
|
||||
new &= ~ebits;
|
||||
new |= (sticky & ebits) << 1;
|
||||
|
||||
lfsr(new);
|
||||
|
||||
/* Map FPC_UF to soft underflow enable */
|
||||
if (old & FPC_UF) {
|
||||
old |= FPC_UNDE << 1;
|
||||
old &= FPC_UF;
|
||||
} else
|
||||
old &= ~(FPC_UNDE << 1);
|
||||
old >>= 1;
|
||||
|
||||
return old & ebits;
|
||||
}
|
Loading…
Reference in New Issue