Added __flt_rounds, fp{get,set}{mask,round,sticky}.
This commit is contained in:
parent
6cabaea642
commit
a0c1305064
|
@ -1,4 +1,6 @@
|
|||
# $NetBSD: Makefile.inc,v 1.2 1995/02/25 16:24:39 cgd Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.3 1995/04/10 21:09:06 jtc Exp $
|
||||
|
||||
SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.c modf.S
|
||||
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
|
||||
fpsetround.c fpsetsticky.c
|
||||
SRCS+= fixunsdfsi.S mul.S umul.S saveregs.S setjmp.S sigsetjmp.S
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
static const int map[] = {
|
||||
1, /* round to nearest */
|
||||
0, /* round to zero */
|
||||
3, /* round to negative infinity */
|
||||
2 /* round to positive infinity */
|
||||
};
|
||||
|
||||
int
|
||||
__flt_rounds()
|
||||
{
|
||||
int x;
|
||||
|
||||
__asm__("st %%fsr,%0" : "=m" (*&x));
|
||||
return map[(x >> 30) & 0x03];
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
|
||||
fp_except
|
||||
fpgetmask()
|
||||
{
|
||||
int x;
|
||||
|
||||
__asm__("st %%fsr,%0" : "=m" (*&x));
|
||||
return (x >> 23) & 0x1f;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
|
||||
fp_rnd
|
||||
fpgetround()
|
||||
{
|
||||
int x;
|
||||
|
||||
__asm__("st %%fsr,%0" : "=m" (*&x));
|
||||
return (x >> 30) & 0x03;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
|
||||
fp_except
|
||||
fpgetsticky()
|
||||
{
|
||||
int x;
|
||||
|
||||
__asm__("st %%fsr,%0" : "=m" (*&x));
|
||||
return (x >> 5) & 0x1f;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
|
||||
fp_except
|
||||
fpsetmask(mask)
|
||||
fp_except mask;
|
||||
{
|
||||
fp_except old;
|
||||
fp_except new;
|
||||
|
||||
__asm__("st %%fsr,%0" : "=m" (*&old));
|
||||
|
||||
new = old;
|
||||
new &= ~(0x1f << 23);
|
||||
new |= ((mask & 0x1f) << 23);
|
||||
|
||||
__asm__("ld %0,%%fsr" : : "m" (*&new));
|
||||
|
||||
return (old >> 23) & 0x1f;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
|
||||
fp_rnd
|
||||
fpsetround(rnd_dir)
|
||||
fp_rnd rnd_dir;
|
||||
{
|
||||
fp_rnd old;
|
||||
fp_rnd new;
|
||||
|
||||
__asm__("st %%fsr,%0" : "=m" (*&old));
|
||||
|
||||
new = old;
|
||||
new &= ~(0x03 << 30);
|
||||
new |= ((rnd_dir & 0x03) << 30);
|
||||
|
||||
__asm__("ld %0,%%fsr" : : "m" (*&new));
|
||||
|
||||
return (old >> 30) & 0x03;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Written by J.T. Conklin, Apr 10, 1995
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <ieeefp.h>
|
||||
|
||||
fp_except
|
||||
fpsetsticky(sticky)
|
||||
fp_except sticky;
|
||||
{
|
||||
fp_except old;
|
||||
fp_except new;
|
||||
|
||||
__asm__("st %%fsr,%0" : "=m" (*&old));
|
||||
|
||||
new = old;
|
||||
new &= ~(0x1f << 5);
|
||||
new |= ((sticky & 0x1f) << 5);
|
||||
|
||||
__asm__("ld %0,%%fsr" : : "m" (*&new));
|
||||
|
||||
return (old >> 5) & 0x1f;
|
||||
}
|
Loading…
Reference in New Issue