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 Handle soft-float case, from the a...



details:   https://anonhg.NetBSD.org/src/rev/933fbd8c4f7d
branches:  trunk
changeset: 510274:933fbd8c4f7d
user:      simonb <simonb%NetBSD.org@localhost>
date:      Fri May 25 12:14:05 2001 +0000

description:
Handle soft-float case, from the arm flt_rounds.c.

diffstat:

 lib/libc/arch/powerpc/gen/flt_rounds.c |  38 +++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diffs (56 lines):

diff -r 5f085bd27748 -r 933fbd8c4f7d lib/libc/arch/powerpc/gen/flt_rounds.c
--- a/lib/libc/arch/powerpc/gen/flt_rounds.c    Fri May 25 11:38:57 2001 +0000
+++ b/lib/libc/arch/powerpc/gen/flt_rounds.c    Fri May 25 12:14:05 2001 +0000
@@ -1,5 +1,37 @@
-/*     $NetBSD: flt_rounds.c,v 1.4 1999/07/07 01:53:38 danw Exp $      */
+/*     $NetBSD: flt_rounds.c,v 1.5 2001/05/25 12:14:05 simonb Exp $    */
 
+/*
+ * Copyright (c) 1996 Mark Brinicombe
+ * All rights reserved.
+ *
+ * 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 Mark Brinicombe
+ *     for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 <ieeefp.h>
 #include <float.h>
 
 static const int map[] = {
@@ -12,9 +44,13 @@
 int
 __flt_rounds()
 {
+#ifdef _SOFT_FLOAT
+       return map[fpgetround()];
+#else
        double tmp;
        int x;
 
        __asm__ __volatile("mffs %0; stfiwx %0,0,%1" : "=f"(tmp): "b"(&x));
        return map[x & 0x03];
+#endif
 }



Home | Main Index | Thread Index | Old Index