CVS commit: src/lib/libc/quad

2013-09-30 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Sep 30 19:32:14 UTC 2013

Modified Files:
src/lib/libc/quad: floatundidf_ieee754.c

Log Message:
Don't return 0x1.0p31 for every input value 2^N.
There is also no need to special case the value 1.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/quad/floatundidf_ieee754.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/quad/floatundidf_ieee754.c
diff -u src/lib/libc/quad/floatundidf_ieee754.c:1.1 src/lib/libc/quad/floatundidf_ieee754.c:1.2
--- src/lib/libc/quad/floatundidf_ieee754.c:1.1	Sat Aug 24 00:51:48 2013
+++ src/lib/libc/quad/floatundidf_ieee754.c	Mon Sep 30 19:32:14 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: floatundidf_ieee754.c,v 1.1 2013/08/24 00:51:48 matt Exp $	*/
+/*	$NetBSD: floatundidf_ieee754.c,v 1.2 2013/09/30 19:32:14 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: floatundidf_ieee754.c,v 1.1 2013/08/24 00:51:48 matt Exp $");
+__RCSID("$NetBSD: floatundidf_ieee754.c,v 1.2 2013/09/30 19:32:14 mlelstv Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #if defined(SOFTFLOAT) || defined(__ARM_EABI__)
@@ -52,13 +52,9 @@ __floatundidf(u_quad_t x)
 
 	if (x == 0)
 		return 0.0;
-	if (x == 1)
-		return 1.0;
 
 	u_int l = __builtin_clzll(x);
 	x <<= (l + 1);	/* clear implicit bit */
-	if (x == 0)
-		return 0x1.0p31;
 	x >>= 64 - (DBL_FRACHBITS + DBL_FRACLBITS);
 	union uu u = { .uq = x };
 	ux.dblu_frach = u.ul[H];



CVS commit: src/lib/libc/quad

2013-08-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Aug 24 00:51:48 UTC 2013

Modified Files:
src/lib/libc/quad: Makefile.inc floatdisf_ieee754.c
floatundisf_ieee754.c
Added Files:
src/lib/libc/quad: fixdfdi_ieee754.c fixsfdi_ieee754.c
fixunsdfdi_ieee754.c fixunssfdi_ieee754.c floatdidf_ieee754.c
floatundidf_ieee754.c

Log Message:
Add IEEE 754 versions of
fixdfdi.c fixsfdi.c fixunsdfdi.c fixunssfdi.c
floatdidf.c floatdisf.c floatundidf.c floatundisf.c
These don't FP so are well suited to softfloat implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/quad/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/quad/fixdfdi_ieee754.c \
src/lib/libc/quad/fixsfdi_ieee754.c \
src/lib/libc/quad/fixunsdfdi_ieee754.c \
src/lib/libc/quad/fixunssfdi_ieee754.c \
src/lib/libc/quad/floatdidf_ieee754.c \
src/lib/libc/quad/floatundidf_ieee754.c
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/quad/floatdisf_ieee754.c \
src/lib/libc/quad/floatundisf_ieee754.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/quad/Makefile.inc
diff -u src/lib/libc/quad/Makefile.inc:1.16 src/lib/libc/quad/Makefile.inc:1.17
--- src/lib/libc/quad/Makefile.inc:1.16	Tue Apr 30 01:43:01 2013
+++ src/lib/libc/quad/Makefile.inc	Sat Aug 24 00:51:48 2013
@@ -1,13 +1,15 @@
-#	$NetBSD: Makefile.inc,v 1.16 2013/04/30 01:43:01 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.17 2013/08/24 00:51:48 matt Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
 
 # Quad support
 SRCS.quad=	cmpdi2.c ucmpdi2.c 
 SRCS.quad+=	divdi3.c moddi3.c 
+.if empty(LIBC_MACHINE_ARCH:Mearm*)
 SRCS.quad+=	fixdfdi.c fixsfdi.c
 SRCS.quad+=	fixunsdfdi.c fixunssfdi.c
 SRCS.quad+=	floatdidf.c floatdisf.c
-SRCS.quad+=	floatundisf.c floatundidf.c
+SRCS.quad+=	floatundidf.c floatundisf.c
+.endif
 SRCS.quad+=	muldi3.c
 SRCS.quad+=	negdi2.c
 SRCS.quad+=	qdivrem.c
@@ -17,8 +19,12 @@ SRCS.quad+=	udivdi3.c umoddi3.c 
 SRCS.quad+=	ashldi3.S ashrdi3.S lshrdi3.S
 .elif (${MACHINE_ARCH} == "m68000")
 SRCS.quad+=	ashldi3.S lshrdi3.S
-.elif (!empty{LIBC_MACHINE_ARCH:Mearm*})
+.elif !empty(LIBC_MACHINE_ARCH:Mearm*)
 SRCS.quad+=	ashldi3.c ashrdi3.c lshrdi3.c lshldi3.c
+SRCS.quad+=	floatdidf_ieee754.c floatdisf_ieee754.c
+SRCS.quad+=	floatundidf_ieee754.c floatundisf_ieee754.c
+SRCS.quad+=	fixdfdi_ieee754.c fixsfdi_ieee754.c
+SRCS.quad+=	fixunsdfdi_ieee754.c fixunssfdi_ieee754.c
 .else
 SRCS.quad+=	ashldi3.c ashrdi3.c lshrdi3.c
 .endif

Index: src/lib/libc/quad/floatdisf_ieee754.c
diff -u src/lib/libc/quad/floatdisf_ieee754.c:1.1 src/lib/libc/quad/floatdisf_ieee754.c:1.2
--- src/lib/libc/quad/floatdisf_ieee754.c:1.1	Fri Aug 23 17:41:03 2013
+++ src/lib/libc/quad/floatdisf_ieee754.c	Sat Aug 24 00:51:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: floatdisf_ieee754.c,v 1.1 2013/08/23 17:41:03 matt Exp $	*/
+/*	$NetBSD: floatdisf_ieee754.c,v 1.2 2013/08/24 00:51:48 matt Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: floatdisf_ieee754.c,v 1.1 2013/08/23 17:41:03 matt Exp $");
+__RCSID("$NetBSD: floatdisf_ieee754.c,v 1.2 2013/08/24 00:51:48 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #if defined(SOFTFLOAT) || defined(__ARM_EABI__)
@@ -69,14 +69,15 @@ __floatdisf(quad_t x)
 
 	ux.sngu_frac = (u_quad_t)x >> (64 - SNG_FRACBITS);
 #else
-	union uu u = { .q = x };
+	union uu u = { .uq = x };
 	uint32_t frac;
+	u_int l;
 	if (u.ul[H] == 0) {
-		u_int l = __builtin_clz(u.ul[L]);
+		l = __builtin_clz(u.ul[L]);
 		frac = u.ul[L] << (l + 1);	/* clear implicit bit */
 		l += 32;
 	} else {
-		u_int l = __builtin_clz(u.ul[H]);
+		l = __builtin_clz(u.ul[H]);
 		frac = u.ul[H] << (l + 1);	/* clear implicit bit */
 		frac |= u.ul[L] >> (32 - (l + 1));
 	}
Index: src/lib/libc/quad/floatundisf_ieee754.c
diff -u src/lib/libc/quad/floatundisf_ieee754.c:1.1 src/lib/libc/quad/floatundisf_ieee754.c:1.2
--- src/lib/libc/quad/floatundisf_ieee754.c:1.1	Fri Aug 23 17:41:03 2013
+++ src/lib/libc/quad/floatundisf_ieee754.c	Sat Aug 24 00:51:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: floatundisf_ieee754.c,v 1.1 2013/08/23 17:41:03 matt Exp $	*/
+/*	$NetBSD: floatundisf_ieee754.c,v 1.2 2013/08/24 00:51:48 matt Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: floatundisf_ieee754.c,v 1.1 2013/08/23 17:41:03 matt Exp $");
+__RCSID("$NetBSD: floatundisf_ieee754.c,v 1.2 2013/08/24 00:51:48 matt Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #if defined(SOFTFLOAT) || defined(__ARM_EABI__)
@@ -64,12 +64,13 @@ __floatundisf(u_quad_t x)
 #else
 	union uu u = { .uq = x };
 	uint32_t frac;
+	u_int l;
 	if (u.ul[H] == 0) {
-		u_int l = __builtin_clz(u.ul[L]);
+		l = __builtin_clz(u.ul[L]);
 		frac = u.ul[L] << (l + 1);	/* cl

CVS commit: src/lib/libc/quad

2013-08-23 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Aug 23 17:41:03 UTC 2013

Added Files:
src/lib/libc/quad: floatdisf_ieee754.c floatundisf_ieee754.c

Log Message:
Add IEEE 754 versions of __float{,}disf which use no floating point.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libc/quad/floatdisf_ieee754.c \
src/lib/libc/quad/floatundisf_ieee754.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/lib/libc/quad/floatdisf_ieee754.c
diff -u /dev/null src/lib/libc/quad/floatdisf_ieee754.c:1.1
--- /dev/null	Fri Aug 23 17:41:03 2013
+++ src/lib/libc/quad/floatdisf_ieee754.c	Fri Aug 23 17:41:03 2013
@@ -0,0 +1,89 @@
+/*	$NetBSD: floatdisf_ieee754.c,v 1.1 2013/08/23 17:41:03 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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 
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: floatdisf_ieee754.c,v 1.1 2013/08/23 17:41:03 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#if defined(SOFTFLOAT) || defined(__ARM_EABI__)
+#include "softfloat/softfloat-for-gcc.h"
+#endif
+
+#include 
+#include 
+#include "quad.h"
+
+float __floatdisf(quad_t);
+
+/*
+ * Convert signed quad to float.
+ */
+float
+__floatdisf(quad_t x)
+{
+	union ieee_single_u ux = { .sngu_f = 0.0 };
+
+	if (x == 0)
+		return 0.0;
+	if (x == 1)
+		return 1.0;
+
+	if (x < 0) {
+		if (x == QUAD_MIN)
+			return -0x1.0p63;
+		ux.sngu_sign = 1;
+		x = -x;
+	}
+#if defined(_LP64) || defined(__mips_n32)
+	u_int l = __builtin_clzll(x);
+	x <<= (l + 1);	/* clear implicit bit */
+
+	ux.sngu_frac = (u_quad_t)x >> (64 - SNG_FRACBITS);
+#else
+	union uu u = { .q = x };
+	uint32_t frac;
+	if (u.ul[H] == 0) {
+		u_int l = __builtin_clz(u.ul[L]);
+		frac = u.ul[L] << (l + 1);	/* clear implicit bit */
+		l += 32;
+	} else {
+		u_int l = __builtin_clz(u.ul[H]);
+		frac = u.ul[H] << (l + 1);	/* clear implicit bit */
+		frac |= u.ul[L] >> (32 - (l + 1));
+	}
+
+	ux.sngu_frac = frac >> (32 - SNG_FRACBITS);
+#endif
+	ux.sngu_exp = SNG_EXP_BIAS + 63 - l;
+
+	return ux.sngu_f;
+}
Index: src/lib/libc/quad/floatundisf_ieee754.c
diff -u /dev/null src/lib/libc/quad/floatundisf_ieee754.c:1.1
--- /dev/null	Fri Aug 23 17:41:03 2013
+++ src/lib/libc/quad/floatundisf_ieee754.c	Fri Aug 23 17:41:03 2013
@@ -0,0 +1,82 @@
+/*	$NetBSD: floatundisf_ieee754.c,v 1.1 2013/08/23 17:41:03 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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.
+ *
+ * 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, INDIREC

CVS commit: src/lib/libc/quad

2013-04-29 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Apr 30 01:43:02 UTC 2013

Modified Files:
src/lib/libc/quad: Makefile.inc

Log Message:
ARM EABI needs left shift logical too.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/quad/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/quad/Makefile.inc
diff -u src/lib/libc/quad/Makefile.inc:1.15 src/lib/libc/quad/Makefile.inc:1.16
--- src/lib/libc/quad/Makefile.inc:1.15	Sun Feb  3 01:48:53 2013
+++ src/lib/libc/quad/Makefile.inc	Tue Apr 30 01:43:01 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.15 2013/02/03 01:48:53 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.16 2013/04/30 01:43:01 matt Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
 
 # Quad support
@@ -17,8 +17,8 @@ SRCS.quad+=	udivdi3.c umoddi3.c 
 SRCS.quad+=	ashldi3.S ashrdi3.S lshrdi3.S
 .elif (${MACHINE_ARCH} == "m68000")
 SRCS.quad+=	ashldi3.S lshrdi3.S
-.elif (${MACHINE_ARCH:Mearm*} != "")
-SRCS.quad+=	ashrdi3.c lshldi3.c lshrdi3.c
+.elif (!empty{LIBC_MACHINE_ARCH:Mearm*})
+SRCS.quad+=	ashldi3.c ashrdi3.c lshrdi3.c lshldi3.c
 .else
 SRCS.quad+=	ashldi3.c ashrdi3.c lshrdi3.c
 .endif



CVS commit: src/lib/libc/quad

2013-02-02 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Feb  3 01:48:53 UTC 2013

Modified Files:
src/lib/libc/quad: Makefile.inc fixdfdi.c fixsfdi.c fixunsdfdi.c
fixunssfdi.c floatdidf.c floatdisf.c floatundidf.c floatundisf.c

Log Message:
Adapt to earm hard float by including softfloat-for-gcc.h even if __ARM_EABI__
so we can get the __aeabi aliases.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/quad/Makefile.inc
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/quad/fixdfdi.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/quad/fixsfdi.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/quad/fixunsdfdi.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/quad/fixunssfdi.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/quad/floatdidf.c \
src/lib/libc/quad/floatdisf.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/quad/floatundidf.c \
src/lib/libc/quad/floatundisf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/quad/Makefile.inc
diff -u src/lib/libc/quad/Makefile.inc:1.14 src/lib/libc/quad/Makefile.inc:1.15
--- src/lib/libc/quad/Makefile.inc:1.14	Mon Aug  6 08:17:58 2012
+++ src/lib/libc/quad/Makefile.inc	Sun Feb  3 01:48:53 2013
@@ -1,17 +1,23 @@
-#	$NetBSD: Makefile.inc,v 1.14 2012/08/06 08:17:58 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2013/02/03 01:48:53 matt Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
 
 # Quad support
-SRCS.quad=	cmpdi2.c divdi3.c fixdfdi.c fixsfdi.c fixunsdfdi.c \
-	fixunssfdi.c floatdidf.c floatdisf.c floatundisf.c floatundidf.c \
-	moddi3.c muldi3.c negdi2.c qdivrem.c \
-	ucmpdi2.c udivdi3.c umoddi3.c 
+SRCS.quad=	cmpdi2.c ucmpdi2.c 
+SRCS.quad+=	divdi3.c moddi3.c 
+SRCS.quad+=	fixdfdi.c fixsfdi.c
+SRCS.quad+=	fixunsdfdi.c fixunssfdi.c
+SRCS.quad+=	floatdidf.c floatdisf.c
+SRCS.quad+=	floatundisf.c floatundidf.c
+SRCS.quad+=	muldi3.c
+SRCS.quad+=	negdi2.c
+SRCS.quad+=	qdivrem.c
+SRCS.quad+=	udivdi3.c umoddi3.c 
 
 .if   (${MACHINE_ARCH} == "m68k")
 SRCS.quad+=	ashldi3.S ashrdi3.S lshrdi3.S
 .elif (${MACHINE_ARCH} == "m68000")
 SRCS.quad+=	ashldi3.S lshrdi3.S
-.elif (${MACHINE_ARCH} == "earm" || ${MACHINE_ARCH} == "earmeb")
+.elif (${MACHINE_ARCH:Mearm*} != "")
 SRCS.quad+=	ashrdi3.c lshldi3.c lshrdi3.c
 .else
 SRCS.quad+=	ashldi3.c ashrdi3.c lshrdi3.c

Index: src/lib/libc/quad/fixdfdi.c
diff -u src/lib/libc/quad/fixdfdi.c:1.6 src/lib/libc/quad/fixdfdi.c:1.7
--- src/lib/libc/quad/fixdfdi.c:1.6	Sun Aug  5 04:28:58 2012
+++ src/lib/libc/quad/fixdfdi.c	Sun Feb  3 01:48:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fixdfdi.c,v 1.6 2012/08/05 04:28:58 matt Exp $	*/
+/*	$NetBSD: fixdfdi.c,v 1.7 2013/02/03 01:48:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,11 +38,11 @@
 #if 0
 static char sccsid[] = "@(#)fixdfdi.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fixdfdi.c,v 1.6 2012/08/05 04:28:58 matt Exp $");
+__RCSID("$NetBSD: fixdfdi.c,v 1.7 2013/02/03 01:48:53 matt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef SOFTFLOAT
+#if defined(SOFTFLOAT) || defined(__ARM_EABI__)
 #include "softfloat/softfloat-for-gcc.h"
 #endif
 

Index: src/lib/libc/quad/fixsfdi.c
diff -u src/lib/libc/quad/fixsfdi.c:1.5 src/lib/libc/quad/fixsfdi.c:1.6
--- src/lib/libc/quad/fixsfdi.c:1.5	Sun Aug  5 04:28:58 2012
+++ src/lib/libc/quad/fixsfdi.c	Sun Feb  3 01:48:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fixsfdi.c,v 1.5 2012/08/05 04:28:58 matt Exp $	*/
+/*	$NetBSD: fixsfdi.c,v 1.6 2013/02/03 01:48:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992 The Regents of the University of California.
@@ -38,11 +38,11 @@
 #if 0
 static char sccsid[] = "@(#)fixsfdi.c	5.1 (Berkeley) 7/7/92";
 #else
-__RCSID("$NetBSD: fixsfdi.c,v 1.5 2012/08/05 04:28:58 matt Exp $");
+__RCSID("$NetBSD: fixsfdi.c,v 1.6 2013/02/03 01:48:53 matt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef SOFTFLOAT
+#if defined(SOFTFLOAT) || defined(__ARM_EABI__)
 #include "softfloat/softfloat-for-gcc.h"
 #endif
 

Index: src/lib/libc/quad/fixunsdfdi.c
diff -u src/lib/libc/quad/fixunsdfdi.c:1.10 src/lib/libc/quad/fixunsdfdi.c:1.11
--- src/lib/libc/quad/fixunsdfdi.c:1.10	Sun Aug  5 04:28:58 2012
+++ src/lib/libc/quad/fixunsdfdi.c	Sun Feb  3 01:48:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fixunsdfdi.c,v 1.10 2012/08/05 04:28:58 matt Exp $	*/
+/*	$NetBSD: fixunsdfdi.c,v 1.11 2013/02/03 01:48:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,11 +38,11 @@
 #if 0
 static char sccsid[] = "@(#)fixunsdfdi.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fixunsdfdi.c,v 1.10 2012/08/05 04:28:58 matt Exp $");
+__RCSID("$NetBSD: fixunsdfdi.c,v 1.11 2013/02/03 01:48:53 matt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef SOFTFLOAT
+#if defined(SOFTFLOAT) || defined(__ARM_EABI__)
 #include "softfloat/softfloat-for-gcc.h"
 #endif
 

Index: src/lib/libc/quad/fixunssfdi.c
diff -u src/lib/libc/quad/fixunssfdi.c:1.8 src/lib/libc/quad/fixunssfdi.c:1.9
--- src/lib/libc/quad/fixunssfdi.c:1.8	Sun Aug  5 04:28:58 20

CVS commit: src/lib/libc/quad

2012-08-06 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Aug  6 08:17:58 UTC 2012

Modified Files:
src/lib/libc/quad: Makefile.inc

Log Message:
earm* need __lshldi3


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/quad/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/quad/Makefile.inc
diff -u src/lib/libc/quad/Makefile.inc:1.13 src/lib/libc/quad/Makefile.inc:1.14
--- src/lib/libc/quad/Makefile.inc:1.13	Mon Jul  4 11:22:39 2011
+++ src/lib/libc/quad/Makefile.inc	Mon Aug  6 08:17:58 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.13 2011/07/04 11:22:39 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2012/08/06 08:17:58 matt Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
 
 # Quad support
@@ -11,6 +11,8 @@ SRCS.quad=	cmpdi2.c divdi3.c fixdfdi.c f
 SRCS.quad+=	ashldi3.S ashrdi3.S lshrdi3.S
 .elif (${MACHINE_ARCH} == "m68000")
 SRCS.quad+=	ashldi3.S lshrdi3.S
+.elif (${MACHINE_ARCH} == "earm" || ${MACHINE_ARCH} == "earmeb")
+SRCS.quad+=	ashrdi3.c lshldi3.c lshrdi3.c
 .else
 SRCS.quad+=	ashldi3.c ashrdi3.c lshrdi3.c
 .endif



CVS commit: src/lib/libc/quad

2012-03-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 25 19:53:19 UTC 2012

Modified Files:
src/lib/libc/quad: floatunditf_ieee754.c

Log Message:
- change from size_t to unsigned int because we don't need the extra width
- cast to unsigned int results of quad ops


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/quad/floatunditf_ieee754.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/quad/floatunditf_ieee754.c
diff -u src/lib/libc/quad/floatunditf_ieee754.c:1.2 src/lib/libc/quad/floatunditf_ieee754.c:1.3
--- src/lib/libc/quad/floatunditf_ieee754.c:1.2	Fri Jul  8 23:16:40 2011
+++ src/lib/libc/quad/floatunditf_ieee754.c	Sun Mar 25 15:53:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: floatunditf_ieee754.c,v 1.2 2011/07/09 03:16:40 matt Exp $	*/
+/*	$NetBSD: floatunditf_ieee754.c,v 1.3 2012/03/25 19:53:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)floatunsdidf.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: floatunditf_ieee754.c,v 1.2 2011/07/09 03:16:40 matt Exp $");
+__RCSID("$NetBSD: floatunditf_ieee754.c,v 1.3 2012/03/25 19:53:18 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -66,8 +66,8 @@ __floatunditf(u_quad_t x)
 #else
 	union ieee_ext_u extu;
 	quad_t tmp = x;		/* must be signed */
-	size_t width = 64;
-	size_t bit = 0;
+	unsigned int width = 64;
+	unsigned int bit = 0;
 	quad_t mask = ~(quad_t)0;
 
 	if (x == 0)
@@ -87,17 +87,17 @@ __floatunditf(u_quad_t x)
 	x <<= (bit + 1);
 	extu.extu_sign = 0;
 	extu.extu_exp = EXT_EXP_BIAS + (64 - (bit + 1));
-	extu.extu_frach = x >> (64 - EXT_FRACHBITS);
+	extu.extu_frach = (unsigned int)(x >> (64 - EXT_FRACHBITS));
 	x <<= EXT_FRACHBITS;
 #ifdef EXT_FRACHMBITS
-	extu.extu_frachm = x >> (64 - EXT_FRACHMBITS);
+	extu.extu_frachm =(unsigned int)(x >> (64 - EXT_FRACHMBITS));
 	x <<= EXT_FRACHMBITS;
 #endif
 #ifdef EXT_FRACLMBITS
-	extu.extu_fraclm = x >> (64 - EXT_FRACLMBITS);
+	extu.extu_fraclm =(unsigned int)(x >> (64 - EXT_FRACLMBITS));
 	x <<= EXT_FRACLMBITS;
 #endif
-	extu.extu_fracl = x >> (64 - EXT_FRACLBITS);
+	extu.extu_fracl =(unsigned int)(x >> (64 - EXT_FRACLBITS));
 
 	return extu.extu_ld;
 #endif



CVS commit: src/lib/libc/quad

2011-07-08 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Jul  9 03:16:40 UTC 2011

Modified Files:
src/lib/libc/quad: floatunditf_ieee754.c

Log Message:
Appease lint and don't use C99 features.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/quad/floatunditf_ieee754.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/quad/floatunditf_ieee754.c
diff -u src/lib/libc/quad/floatunditf_ieee754.c:1.1 src/lib/libc/quad/floatunditf_ieee754.c:1.2
--- src/lib/libc/quad/floatunditf_ieee754.c:1.1	Sat Jul  9 02:30:27 2011
+++ src/lib/libc/quad/floatunditf_ieee754.c	Sat Jul  9 03:16:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: floatunditf_ieee754.c,v 1.1 2011/07/09 02:30:27 matt Exp $	*/
+/*	$NetBSD: floatunditf_ieee754.c,v 1.2 2011/07/09 03:16:40 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)floatunsdidf.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: floatunditf_ieee754.c,v 1.1 2011/07/09 02:30:27 matt Exp $");
+__RCSID("$NetBSD: floatunditf_ieee754.c,v 1.2 2011/07/09 03:16:40 matt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -65,16 +65,16 @@
 	return (ld);
 #else
 	union ieee_ext_u extu;
+	quad_t tmp = x;		/* must be signed */
+	size_t width = 64;
+	size_t bit = 0;
+	quad_t mask = ~(quad_t)0;
 
 	if (x == 0)
 		return 0.0L;
 	if (x == 1)
 		return 1.0L;
 
-	quad_t tmp = x;		/* must be signed */
-	size_t width = 64;
-	size_t bit = 0;
-	quad_t mask = ~(quad_t)0;
 	while (mask != 0 && (tmp >= 0)) {
 		width >>= 1;
 		mask <<= width;