From 80bba6a1e1ea131fdd2b74217541ecabecde9ca6 Mon Sep 17 00:00:00 2001 From: jtc Date: Fri, 7 Apr 1995 14:57:16 +0000 Subject: [PATCH] Added flt_rounds, fpget{round,mask,sticky}. --- lib/libc/arch/i386/gen/Makefile.inc | 3 ++- lib/libc/arch/i386/gen/flt_rounds.S | 24 ++++++++++++++++++++++++ lib/libc/arch/i386/gen/fpgetmask.S | 15 +++++++++++++++ lib/libc/arch/i386/gen/fpgetround.S | 15 +++++++++++++++ lib/libc/arch/i386/gen/fpgetsticky.S | 15 +++++++++++++++ 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 lib/libc/arch/i386/gen/flt_rounds.S create mode 100644 lib/libc/arch/i386/gen/fpgetmask.S create mode 100644 lib/libc/arch/i386/gen/fpgetround.S create mode 100644 lib/libc/arch/i386/gen/fpgetsticky.S diff --git a/lib/libc/arch/i386/gen/Makefile.inc b/lib/libc/arch/i386/gen/Makefile.inc index a7ccd1f7eff0..e913a2fa91e4 100644 --- a/lib/libc/arch/i386/gen/Makefile.inc +++ b/lib/libc/arch/i386/gen/Makefile.inc @@ -1,5 +1,6 @@ -# $NetBSD: Makefile.inc,v 1.2 1995/02/25 16:24:26 cgd Exp $ +# $NetBSD: Makefile.inc,v 1.3 1995/04/07 14:57:16 jtc Exp $ SRCS+= _setjmp.S alloca.S fabs.S frexp.c infinity.c isinf.c ldexp.c modf.S \ setjmp.S sigsetjmp.S +SRCS+= flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S SRCS+= divsi3.S fixdfsi.S fixunsdfsi.S udivsi3.S diff --git a/lib/libc/arch/i386/gen/flt_rounds.S b/lib/libc/arch/i386/gen/flt_rounds.S new file mode 100644 index 000000000000..4922de5558c6 --- /dev/null +++ b/lib/libc/arch/i386/gen/flt_rounds.S @@ -0,0 +1,24 @@ +/* + * Written by J.T. Conklin, Apr 4, 1995 + * Public domain. + */ + +#include + + .text + .align 2 +_map: + .long 1 /* round to nearest */ + .long 3 /* round to negative infinity */ + .long 2 /* round to positive infinity */ + .long 0 /* round to zero */ + +ENTRY(__flt_rounds) + subl $4,%esp + fnstcw 2(%esp) + movw 2(%esp),%ax + shrl $10,%eax + andl $3,%eax + movl _map(,%eax,4),%eax + addl $4,%esp + ret diff --git a/lib/libc/arch/i386/gen/fpgetmask.S b/lib/libc/arch/i386/gen/fpgetmask.S new file mode 100644 index 000000000000..23bffdbdd096 --- /dev/null +++ b/lib/libc/arch/i386/gen/fpgetmask.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin, Apr 4, 1995 + * Public domain. + */ + +#include + +ENTRY(fpgetmask) + subl $4,%esp + fnstcw (%esp) + movw (%esp),%ax + notl %eax + andl $63,%eax + addl $4,%esp + ret diff --git a/lib/libc/arch/i386/gen/fpgetround.S b/lib/libc/arch/i386/gen/fpgetround.S new file mode 100644 index 000000000000..1522110d0008 --- /dev/null +++ b/lib/libc/arch/i386/gen/fpgetround.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin, Apr 4, 1995 + * Public domain. + */ + +#include + +ENTRY(fpgetround) + subl $4,%esp + fnstcw (%esp) + movw (%esp),%ax + shrl $10,%eax + andl $3,%eax + addl $4,%esp + ret diff --git a/lib/libc/arch/i386/gen/fpgetsticky.S b/lib/libc/arch/i386/gen/fpgetsticky.S new file mode 100644 index 000000000000..ae5857f09a0f --- /dev/null +++ b/lib/libc/arch/i386/gen/fpgetsticky.S @@ -0,0 +1,15 @@ +/* + * Written by J.T. Conklin, Apr 4, 1995 + * Public domain. + */ + +#include + +ENTRY(fpgetmask) + subl $4,%esp + fnstsw (%esp) + movw (%esp),%ax + notl %eax + andl $63,%eax + addl $4,%esp + ret