Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/arch/powerpc/gen add the ieeefp functions



details:   https://anonhg.NetBSD.org/src/rev/b88e7e391517
branches:  trunk
changeset: 474457:b88e7e391517
user:      danw <danw%NetBSD.org@localhost>
date:      Wed Jul 07 01:55:07 1999 +0000

description:
add the ieeefp functions

diffstat:

 lib/libc/arch/powerpc/gen/Makefile.inc  |   4 +-
 lib/libc/arch/powerpc/gen/fpgetmask.c   |  49 +++++++++++++++++++++++++++++
 lib/libc/arch/powerpc/gen/fpgetround.c  |  49 +++++++++++++++++++++++++++++
 lib/libc/arch/powerpc/gen/fpgetsticky.c |  49 +++++++++++++++++++++++++++++
 lib/libc/arch/powerpc/gen/fpsetmask.c   |  54 +++++++++++++++++++++++++++++++++
 lib/libc/arch/powerpc/gen/fpsetround.c  |  54 +++++++++++++++++++++++++++++++++
 lib/libc/arch/powerpc/gen/fpsetsticky.c |  54 +++++++++++++++++++++++++++++++++
 7 files changed, 312 insertions(+), 1 deletions(-)

diffs (truncated from 349 to 300 lines):

diff -r d18e28db41c4 -r b88e7e391517 lib/libc/arch/powerpc/gen/Makefile.inc
--- a/lib/libc/arch/powerpc/gen/Makefile.inc    Wed Jul 07 01:54:46 1999 +0000
+++ b/lib/libc/arch/powerpc/gen/Makefile.inc    Wed Jul 07 01:55:07 1999 +0000
@@ -1,9 +1,11 @@
-#      $NetBSD: Makefile.inc,v 1.5 1999/04/17 21:16:45 ws Exp $
+#      $NetBSD: Makefile.inc,v 1.6 1999/07/07 01:55:07 danw Exp $
 
 SRCS+= _setjmp.S setjmp.S sigsetjmp.S __setjmp14.S __sigsetjmp14.S
 SRCS+= isinf.c isnan.c ldexp.c fabs.S flt_rounds.c infinity.c
 SRCS+= bswap16.c bswap32.c bswap64.c
 SRCS+= frexp.c modf.c
 SRCS+= syncicache.c
+SRCS+= fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c
+SRCS+= fpgetsticky.c fpsetsticky.c
 
 KMSRCS+=syncicache.c
diff -r d18e28db41c4 -r b88e7e391517 lib/libc/arch/powerpc/gen/fpgetmask.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/powerpc/gen/fpgetmask.c     Wed Jul 07 01:55:07 1999 +0000
@@ -0,0 +1,49 @@
+/*     $NetBSD: fpgetmask.c,v 1.1 1999/07/07 01:55:07 danw Exp $       */
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ * 
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <ieeefp.h>
+
+fp_except
+fpgetmask()
+{
+       u_int64_t fpscr;
+
+       __asm__ __volatile("mffs %0" : "=f"(fpscr));
+       return ((fpscr >> 3) & 0x1f);
+}
diff -r d18e28db41c4 -r b88e7e391517 lib/libc/arch/powerpc/gen/fpgetround.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/powerpc/gen/fpgetround.c    Wed Jul 07 01:55:07 1999 +0000
@@ -0,0 +1,49 @@
+/*     $NetBSD: fpgetround.c,v 1.1 1999/07/07 01:55:08 danw Exp $      */
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ * 
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <ieeefp.h>
+
+fp_rnd
+fpgetround()
+{
+       u_int64_t fpscr;
+
+       __asm__ __volatile("mffs %0" : "=f"(fpscr));
+       return (fpscr & 0x3);
+}
diff -r d18e28db41c4 -r b88e7e391517 lib/libc/arch/powerpc/gen/fpgetsticky.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/powerpc/gen/fpgetsticky.c   Wed Jul 07 01:55:07 1999 +0000
@@ -0,0 +1,49 @@
+/*     $NetBSD: fpgetsticky.c,v 1.1 1999/07/07 01:55:08 danw Exp $     */
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ * 
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <ieeefp.h>
+
+fp_except
+fpgetsticky()
+{
+       u_int64_t fpscr;
+
+       __asm__ __volatile("mffs %0" : "=f"(fpscr));
+       return ((fpscr >> 25) & 0x1f);
+}
diff -r d18e28db41c4 -r b88e7e391517 lib/libc/arch/powerpc/gen/fpsetmask.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/powerpc/gen/fpsetmask.c     Wed Jul 07 01:55:07 1999 +0000
@@ -0,0 +1,54 @@
+/*     $NetBSD: fpsetmask.c,v 1.1 1999/07/07 01:55:08 danw Exp $       */
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ * 
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <ieeefp.h>
+
+fp_except
+fpsetmask(mask)
+       fp_except mask;
+{
+       u_int64_t fpscr;
+       fp_rnd old;
+
+       __asm__ __volatile("mffs %0" : "=f"(fpscr));
+       old = (fpscr >> 3) & 0x1f;
+       fpscr = (fpscr & 0xffffff07) | (mask << 3);
+       __asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr));
+       return (old);
+}
diff -r d18e28db41c4 -r b88e7e391517 lib/libc/arch/powerpc/gen/fpsetround.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/powerpc/gen/fpsetround.c    Wed Jul 07 01:55:07 1999 +0000
@@ -0,0 +1,54 @@
+/*     $NetBSD: fpsetround.c,v 1.1 1999/07/07 01:55:08 danw Exp $      */
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ * 
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dan Winship.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <ieeefp.h>
+
+fp_rnd
+fpsetround(rnd_dir)
+       fp_rnd rnd_dir;
+{
+       u_int64_t fpscr;
+       fp_rnd old;
+
+       __asm__ __volatile("mffs %0" : "=f"(fpscr));
+       old = fpscr & 0x3;
+       fpscr = (fpscr & 0xfffffffc) | rnd_dir;
+       __asm__ __volatile("mtfsf 0xff,%0" :: "f"(fpscr));
+       return (old);
+}
diff -r d18e28db41c4 -r b88e7e391517 lib/libc/arch/powerpc/gen/fpsetsticky.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/powerpc/gen/fpsetsticky.c   Wed Jul 07 01:55:07 1999 +0000
@@ -0,0 +1,54 @@
+/*     $NetBSD: fpsetsticky.c,v 1.1 1999/07/07 01:55:08 danw Exp $     */
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.



Home | Main Index | Thread Index | Old Index