CVS commit: src/sys/arch/hppa/spmath

2019-02-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Feb  6 05:04:41 UTC 2019

Modified Files:
src/sys/arch/hppa/spmath: cnv_float.h

Log Message:
- convert shift results into logical expressions


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/spmath/cnv_float.h

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

Modified files:

Index: src/sys/arch/hppa/spmath/cnv_float.h
diff -u src/sys/arch/hppa/spmath/cnv_float.h:1.3 src/sys/arch/hppa/spmath/cnv_float.h:1.4
--- src/sys/arch/hppa/spmath/cnv_float.h:1.3	Sun Apr  6 08:03:36 2008
+++ src/sys/arch/hppa/spmath/cnv_float.h	Wed Feb  6 05:04:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cnv_float.h,v 1.3 2008/04/06 08:03:36 skrll Exp $	*/
+/*	$NetBSD: cnv_float.h,v 1.4 2019/02/06 05:04:41 mrg Exp $	*/
 
 /*	$OpenBSD: cnv_float.h,v 1.5 2001/03/29 03:58:17 mickey Exp $	*/
 
@@ -75,19 +75,19 @@
 ((exponent < (SGL_P - 1)) ?\
  (Sall(sgl_value) << (SGL_EXP_LENGTH + 1 + exponent)) : false)
 
-#define Int_isinexact_to_sgl(int_value)	(int_value << (33 - SGL_EXP_LENGTH))
+#define Int_isinexact_to_sgl(int_value)	((int_value << (33 - SGL_EXP_LENGTH)) != 0)
 
 #define Sgl_roundnearest_from_int(int_value,sgl_value)			\
 if (int_value & 1<<(SGL_EXP_LENGTH - 2))   /* round bit */		\
-	if ((int_value << (34 - SGL_EXP_LENGTH)) || Slow(sgl_value))	\
+	if (((int_value << (34 - SGL_EXP_LENGTH)) != 0) || Slow(sgl_value))	\
 		Sall(sgl_value)++
 
 #define Dint_isinexact_to_sgl(dint_valueA,dint_valueB)		\
-((Dintp1(dint_valueA) << (33 - SGL_EXP_LENGTH)) || Dintp2(dint_valueB))
+(((Dintp1(dint_valueA) << (33 - SGL_EXP_LENGTH)) != 0) || Dintp2(dint_valueB))
 
 #define Sgl_roundnearest_from_dint(dint_valueA,dint_valueB,sgl_value)	\
 if (Dintp1(dint_valueA) & 1<<(SGL_EXP_LENGTH - 2))			\
-	if ((Dintp1(dint_valueA) << (34 - SGL_EXP_LENGTH)) ||		\
+	if (((Dintp1(dint_valueA) << (34 - SGL_EXP_LENGTH)) != 0) ||	\
 	Dintp2(dint_valueB) || Slow(sgl_value)) Sall(sgl_value)++
 
 #define Dint_isinexact_to_dbl(dint_value)	\



CVS commit: src/sys/arch/hppa/spmath

2018-06-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 13 16:05:14 UTC 2018

Modified Files:
src/sys/arch/hppa/spmath: Makefile.inc

Log Message:
revert previous MAKEOBJDIRPREFIX massaging


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/spmath/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/sys/arch/hppa/spmath/Makefile.inc
diff -u src/sys/arch/hppa/spmath/Makefile.inc:1.11 src/sys/arch/hppa/spmath/Makefile.inc:1.12
--- src/sys/arch/hppa/spmath/Makefile.inc:1.11	Mon Jun 11 17:37:29 2018
+++ src/sys/arch/hppa/spmath/Makefile.inc	Wed Jun 13 12:05:14 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.11 2018/06/11 21:37:29 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.12 2018/06/13 16:05:14 christos Exp $
 
 #	$OpenBSD: Makefile.inc,v 1.4 2001/03/29 03:58:17 mickey Exp $
 #
@@ -15,7 +15,7 @@ SPMATH_PROF=	${SPMATHDST}/spmath.po
 SPMATHMAKE= \
 	cd ${SPMATHDIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
 	  MAKEOBJDIR=${SPMATHDST} ${MAKE} \
-	CC=${CC:q} CFLAGS=${CFLAGS:S/MAKEOBJDIRPREFIX/MAKEOBJDIR/:q} \
+	CC=${CC:q} CFLAGS=${CFLAGS:q} \
 	SPMATHCPPFLAGS=${CPPFLAGS:S@^-I.@-I. -I../../.@g:q} \
 	AS=${AS:q} AFLAGS=${AFLAGS:q} \
 	LD=${LD:q} STRIP=${STRIP:q} \



CVS commit: src/sys/arch/hppa/spmath

2018-06-11 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 11 21:37:29 UTC 2018

Modified Files:
src/sys/arch/hppa/spmath: Makefile.inc

Log Message:
switch from MAKEOBJDIRPREFIX to MAKEOBJDIR.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hppa/spmath/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/sys/arch/hppa/spmath/Makefile.inc
diff -u src/sys/arch/hppa/spmath/Makefile.inc:1.10 src/sys/arch/hppa/spmath/Makefile.inc:1.11
--- src/sys/arch/hppa/spmath/Makefile.inc:1.10	Sat May 26 21:14:50 2018
+++ src/sys/arch/hppa/spmath/Makefile.inc	Mon Jun 11 17:37:29 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.10 2018/05/27 01:14:50 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.11 2018/06/11 21:37:29 christos Exp $
 
 #	$OpenBSD: Makefile.inc,v 1.4 2001/03/29 03:58:17 mickey Exp $
 #
@@ -15,7 +15,7 @@ SPMATH_PROF=	${SPMATHDST}/spmath.po
 SPMATHMAKE= \
 	cd ${SPMATHDIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
 	  MAKEOBJDIR=${SPMATHDST} ${MAKE} \
-	CC=${CC:q} CFLAGS=${CFLAGS:q} \
+	CC=${CC:q} CFLAGS=${CFLAGS:S/MAKEOBJDIRPREFIX/MAKEOBJDIR/:q} \
 	SPMATHCPPFLAGS=${CPPFLAGS:S@^-I.@-I. -I../../.@g:q} \
 	AS=${AS:q} AFLAGS=${AFLAGS:q} \
 	LD=${LD:q} STRIP=${STRIP:q} \



CVS commit: src/sys/arch/hppa/spmath

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:22:06 UTC 2016

Modified Files:
src/sys/arch/hppa/spmath: dfsqrt.c

Log Message:
PR/50870: David Binderman: Use logical and instead of arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/spmath/dfsqrt.c

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

Modified files:

Index: src/sys/arch/hppa/spmath/dfsqrt.c
diff -u src/sys/arch/hppa/spmath/dfsqrt.c:1.5 src/sys/arch/hppa/spmath/dfsqrt.c:1.6
--- src/sys/arch/hppa/spmath/dfsqrt.c:1.5	Sat Feb  4 12:03:09 2012
+++ src/sys/arch/hppa/spmath/dfsqrt.c	Mon Feb 29 13:22:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dfsqrt.c,v 1.5 2012/02/04 17:03:09 skrll Exp $	*/
+/*	$NetBSD: dfsqrt.c,v 1.6 2016/02/29 18:22:06 christos Exp $	*/
 
 /*	$OpenBSD: dfsqrt.c,v 1.5 2001/03/29 03:58:17 mickey Exp $	*/
 
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dfsqrt.c,v 1.5 2012/02/04 17:03:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dfsqrt.c,v 1.6 2016/02/29 18:22:06 christos Exp $");
 
 #include "../spmath/float.h"
 #include "../spmath/dbl_float.h"
@@ -158,7 +158,7 @@ dbl_fsqrt(dbl_floating_point *srcptr, db
 
 	/* check for inexact */
 	if (Dbl_isnotzero(srcp1,srcp2)) {
-		if (!even_exponent & Dbl_islessthan(resultp1,resultp2,srcp1,srcp2)) {
+		if (!even_exponent && Dbl_islessthan(resultp1,resultp2,srcp1,srcp2)) {
 			Dbl_increment(resultp1,resultp2);
 		}
 		guardbit = Dbl_lowmantissap2(resultp2);



CVS commit: src/sys/arch/hppa/spmath

2016-02-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Feb 29 18:20:31 UTC 2016

Modified Files:
src/sys/arch/hppa/spmath: sfsqrt.c

Log Message:
PR/50871: David Binderman: use logical and instead of arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/spmath/sfsqrt.c

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

Modified files:

Index: src/sys/arch/hppa/spmath/sfsqrt.c
diff -u src/sys/arch/hppa/spmath/sfsqrt.c:1.5 src/sys/arch/hppa/spmath/sfsqrt.c:1.6
--- src/sys/arch/hppa/spmath/sfsqrt.c:1.5	Sat Feb  4 12:03:10 2012
+++ src/sys/arch/hppa/spmath/sfsqrt.c	Mon Feb 29 13:20:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sfsqrt.c,v 1.5 2012/02/04 17:03:10 skrll Exp $	*/
+/*	$NetBSD: sfsqrt.c,v 1.6 2016/02/29 18:20:31 christos Exp $	*/
 
 /*	$OpenBSD: sfsqrt.c,v 1.5 2001/03/29 03:58:19 mickey Exp $	*/
 
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sfsqrt.c,v 1.5 2012/02/04 17:03:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sfsqrt.c,v 1.6 2016/02/29 18:20:31 christos Exp $");
 
 #include "../spmath/float.h"
 #include "../spmath/sgl_float.h"
@@ -150,7 +150,7 @@ sgl_fsqrt(sgl_floating_point *srcptr, sg
 
 	/* check for inexact */
 	if (Sgl_isnotzero(src)) {
-		if (!even_exponent & Sgl_islessthan(result,src))
+		if (!even_exponent && Sgl_islessthan(result,src))
 			Sgl_increment(result);
 		guardbit = Sgl_lowmantissa(result);
 		Sgl_rightshiftby1(result);



CVS commit: src/sys/arch/hppa/spmath

2016-01-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan 25 18:55:25 UTC 2016

Modified Files:
src/sys/arch/hppa/spmath: Makefile.inc

Log Message:
use :Q to quote variables properly.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/spmath/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/sys/arch/hppa/spmath/Makefile.inc
diff -u src/sys/arch/hppa/spmath/Makefile.inc:1.7 src/sys/arch/hppa/spmath/Makefile.inc:1.8
--- src/sys/arch/hppa/spmath/Makefile.inc:1.7	Sun Sep  6 11:34:55 2015
+++ src/sys/arch/hppa/spmath/Makefile.inc	Mon Jan 25 13:55:25 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.7 2015/09/06 15:34:55 uebayasi Exp $
+#	$NetBSD: Makefile.inc,v 1.8 2016/01/25 18:55:25 christos Exp $
 
 #	$OpenBSD: Makefile.inc,v 1.4 2001/03/29 03:58:17 mickey Exp $
 #
@@ -15,13 +15,13 @@ SPMATH_PROF=	${SPMATHDST}/spmath.po
 SPMATHMAKE= \
 	cd ${SPMATHDIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
 	  MAKEOBJDIR=${SPMATHDST} ${MAKE} \
-	CC='${CC}' CFLAGS='${CFLAGS}' \
-	SPMATHCPPFLAGS='${CPPFLAGS:S@^-I.@-I. -I../../.@g}'\
-	AS='${AS}' AFLAGS='${AFLAGS}' \
-	LD='${LD}' STRIP='${STRIP}' \
-	CPP='${CPP}' STRIP='${STRIP}' AR='${AR}' \
-	NM='${NM}' LORDER='${LORDER}' \
-	XMACHINE='${MACHINE}' XMACHINE_ARCH='${MACHINE_ARCH}'
+	CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
+	SPMATHCPPFLAGS=${CPPFLAGS:S@^-I.@-I. -I../../.@g:Q} \
+	AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
+	LD=${LD:Q} STRIP=${STRIP:Q} \
+	CPP=${CPP:Q} STRIP=${STRIP:Q} AR=${AR:Q} \
+	NM=${NM:Q} LORDER=${LORDER:Q} \
+	XMACHINE=${MACHINE:Q} XMACHINE_ARCH=${MACHINE_ARCH:Q}
 
 ${SPMATH}:	.NOTMAIN .MAKE __always_make_spmath
 	@echo making sure the spmath library is up to date...



CVS commit: src/sys/arch/hppa/spmath

2015-09-04 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sat Sep  5 04:44:29 UTC 2015

Modified Files:
src/sys/arch/hppa/spmath: Makefile.inc

Log Message:
Fix build of hppa's spmath.o, as m68k's fpsp.o was done.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/spmath/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/sys/arch/hppa/spmath/Makefile.inc
diff -u src/sys/arch/hppa/spmath/Makefile.inc:1.4 src/sys/arch/hppa/spmath/Makefile.inc:1.5
--- src/sys/arch/hppa/spmath/Makefile.inc:1.4	Sat Feb  4 11:23:45 2006
+++ src/sys/arch/hppa/spmath/Makefile.inc	Sat Sep  5 04:44:29 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.4 2006/02/04 11:23:45 dsl Exp $
+#	$NetBSD: Makefile.inc,v 1.5 2015/09/05 04:44:29 uebayasi Exp $
 
 #	$OpenBSD: Makefile.inc,v 1.4 2001/03/29 03:58:17 mickey Exp $
 #
@@ -23,6 +23,9 @@ SPMATHMAKE= \
 	NM='${NM}' LORDER='${LORDER}' \
 	XMACHINE='${MACHINE}' XMACHINE_ARCH='${MACHINE_ARCH}'
 
+spmath.o: ${SPMATH}
+	ln -sf ${SPMATH} $@
+
 ${SPMATH}:	.NOTMAIN .MAKE __always_make_spmath
 	@echo making sure the spmath library is up to date...
 	@${SPMATHMAKE} spmath.o



CVS commit: src/sys/arch/hppa/spmath

2012-02-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb  4 17:03:11 UTC 2012

Modified Files:
src/sys/arch/hppa/spmath: dfadd.c dfcmp.c dfdiv.c dfmpy.c dfrem.c
dfsqrt.c dfsub.c divsfm.c divsfr.c divsim.c divsir.c divufr.c
divuir.c fcnvff.c fcnvfx.c fcnvfxt.c fcnvxf.c frnd.c mpyaccs.c
mpyaccu.c mpys.c mpyscv.c mpyu.c mpyucv.c setovfl.c sfadd.c sfcmp.c
sfdiv.c sfmpy.c sfrem.c sfsqrt.c sfsub.c

Log Message:
-Wold-style-definition

Same code before and after.  OK riz@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/spmath/dfadd.c \
src/sys/arch/hppa/spmath/dfdiv.c src/sys/arch/hppa/spmath/dfmpy.c \
src/sys/arch/hppa/spmath/dfrem.c src/sys/arch/hppa/spmath/dfsqrt.c \
src/sys/arch/hppa/spmath/dfsub.c src/sys/arch/hppa/spmath/divsfm.c \
src/sys/arch/hppa/spmath/divsfr.c src/sys/arch/hppa/spmath/divsim.c \
src/sys/arch/hppa/spmath/divsir.c src/sys/arch/hppa/spmath/divufr.c \
src/sys/arch/hppa/spmath/divuir.c src/sys/arch/hppa/spmath/fcnvfxt.c \
src/sys/arch/hppa/spmath/frnd.c src/sys/arch/hppa/spmath/mpyaccs.c \
src/sys/arch/hppa/spmath/mpyaccu.c src/sys/arch/hppa/spmath/mpys.c \
src/sys/arch/hppa/spmath/mpyscv.c src/sys/arch/hppa/spmath/mpyu.c \
src/sys/arch/hppa/spmath/mpyucv.c src/sys/arch/hppa/spmath/sfadd.c \
src/sys/arch/hppa/spmath/sfdiv.c src/sys/arch/hppa/spmath/sfmpy.c \
src/sys/arch/hppa/spmath/sfrem.c src/sys/arch/hppa/spmath/sfsqrt.c \
src/sys/arch/hppa/spmath/sfsub.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/spmath/dfcmp.c \
src/sys/arch/hppa/spmath/fcnvxf.c src/sys/arch/hppa/spmath/sfcmp.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hppa/spmath/fcnvff.c \
src/sys/arch/hppa/spmath/fcnvfx.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hppa/spmath/setovfl.c

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

Modified files:

Index: src/sys/arch/hppa/spmath/dfadd.c
diff -u src/sys/arch/hppa/spmath/dfadd.c:1.4 src/sys/arch/hppa/spmath/dfadd.c:1.5
--- src/sys/arch/hppa/spmath/dfadd.c:1.4	Thu Feb 22 05:46:29 2007
+++ src/sys/arch/hppa/spmath/dfadd.c	Sat Feb  4 17:03:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dfadd.c,v 1.4 2007/02/22 05:46:29 thorpej Exp $	*/
+/*	$NetBSD: dfadd.c,v 1.5 2012/02/04 17:03:08 skrll Exp $	*/
 
 /*	$OpenBSD: dfadd.c,v 1.4 2001/03/29 03:58:17 mickey Exp $	*/
 
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dfadd.c,v 1.4 2007/02/22 05:46:29 thorpej Exp $);
+__KERNEL_RCSID(0, $NetBSD: dfadd.c,v 1.5 2012/02/04 17:03:08 skrll Exp $);
 
 #include ../spmath/float.h
 #include ../spmath/dbl_float.h
@@ -50,10 +50,9 @@ __KERNEL_RCSID(0, $NetBSD: dfadd.c,v 1.
  * Double_add: add two double precision values.
  */
 int
-dbl_fadd(leftptr, rightptr, dstptr, status)
-dbl_floating_point *leftptr, *rightptr, *dstptr;
-unsigned int *status;
-{
+dbl_fadd(dbl_floating_point *leftptr, dbl_floating_point *rightptr,
+dbl_floating_point *dstptr, unsigned int *status)
+{
 register unsigned int signless_upper_left, signless_upper_right, save;
 register unsigned int leftp1, leftp2, rightp1, rightp2, extent;
 register unsigned int resultp1 = 0, resultp2 = 0;
Index: src/sys/arch/hppa/spmath/dfdiv.c
diff -u src/sys/arch/hppa/spmath/dfdiv.c:1.4 src/sys/arch/hppa/spmath/dfdiv.c:1.5
--- src/sys/arch/hppa/spmath/dfdiv.c:1.4	Thu Feb 22 05:46:29 2007
+++ src/sys/arch/hppa/spmath/dfdiv.c	Sat Feb  4 17:03:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dfdiv.c,v 1.4 2007/02/22 05:46:29 thorpej Exp $	*/
+/*	$NetBSD: dfdiv.c,v 1.5 2012/02/04 17:03:09 skrll Exp $	*/
 
 /*	$OpenBSD: dfdiv.c,v 1.4 2001/03/29 03:58:17 mickey Exp $	*/
 
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dfdiv.c,v 1.4 2007/02/22 05:46:29 thorpej Exp $);
+__KERNEL_RCSID(0, $NetBSD: dfdiv.c,v 1.5 2012/02/04 17:03:09 skrll Exp $);
 
 #include ../spmath/float.h
 #include ../spmath/dbl_float.h
@@ -52,10 +52,8 @@ __KERNEL_RCSID(0, $NetBSD: dfdiv.c,v 1.
  */
 
 int
-dbl_fdiv(srcptr1,srcptr2,dstptr,status)
-
-dbl_floating_point *srcptr1, *srcptr2, *dstptr;
-unsigned int *status;
+dbl_fdiv(dbl_floating_point *srcptr1, dbl_floating_point *srcptr2,
+dbl_floating_point *dstptr, unsigned int *status)
 {
 	register unsigned int opnd1p1, opnd1p2, opnd2p1, opnd2p2;
 	register unsigned int opnd3p1, opnd3p2, resultp1, resultp2;
Index: src/sys/arch/hppa/spmath/dfmpy.c
diff -u src/sys/arch/hppa/spmath/dfmpy.c:1.4 src/sys/arch/hppa/spmath/dfmpy.c:1.5
--- src/sys/arch/hppa/spmath/dfmpy.c:1.4	Thu Feb 22 05:46:29 2007
+++ src/sys/arch/hppa/spmath/dfmpy.c	Sat Feb  4 17:03:09 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: dfmpy.c,v 1.4 2007/02/22 05:46:29 thorpej Exp $	*/
+/*	$NetBSD: dfmpy.c,v 1.5 2012/02/04 17:03:09 skrll Exp $	*/
 
 /*	$OpenBSD: dfmpy.c,v 1.4 2001/03/29 03:58:17 mickey Exp $	*/
 
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dfmpy.c,v 1.4 2007/02/22 05:46:29 

CVS commit: src/sys/arch/hppa/spmath

2012-01-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan  1 20:04:36 UTC 2012

Modified Files:
src/sys/arch/hppa/spmath: fcnvfx.c fcnvfxt.c

Log Message:
When converting a floating value to an integer, properly raise the invalid
exception when the floating value is infinite or NaN or if the integral part
of the floating value exceeds the range of the integer type, as required by
the C99/IEEE754 standard.

Fixes Python 2.6 build on hppa.

From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/hppa/spmath/fcnvfx.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/hppa/spmath/fcnvfxt.c

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

Modified files:

Index: src/sys/arch/hppa/spmath/fcnvfx.c
diff -u src/sys/arch/hppa/spmath/fcnvfx.c:1.4 src/sys/arch/hppa/spmath/fcnvfx.c:1.5
--- src/sys/arch/hppa/spmath/fcnvfx.c:1.4	Thu Feb 22 05:46:30 2007
+++ src/sys/arch/hppa/spmath/fcnvfx.c	Sun Jan  1 20:04:36 2012
@@ -1,6 +1,5 @@
-/*	$NetBSD: fcnvfx.c,v 1.4 2007/02/22 05:46:30 thorpej Exp $	*/
 
-/*	$OpenBSD: fcnvfx.c,v 1.5 2001/03/29 03:58:18 mickey Exp $	*/
+/*	$OpenBSD: fcnvfx.c,v 1.8 2010/07/30 18:05:23 kettenis Exp $	*/
 
 /*
  * Copyright 1996 1995 by Open Software Foundation, Inc.
@@ -42,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fcnvfx.c,v 1.4 2007/02/22 05:46:30 thorpej Exp $);
+__KERNEL_RCSID(0, $NetBSD: fcnvfx.c,v 1.5 2012/01/01 20:04:36 skrll Exp $);
 
 #include ../spmath/float.h
 #include ../spmath/sgl_float.h
@@ -74,12 +73,15 @@ unsigned int *status;
 		/* check for MININT */
 		if ((src_exponent  SGL_FX_MAX_EXP + 1) ||
 		Sgl_isnotzero_mantissa(src) || Sgl_iszero_sign(src)) {
-			/*
-			 * Since source is a number which cannot be
-			 * represented in fixed-point format, return
-			 * largest (or smallest) fixed-point number.
-			 */
-			Sgl_return_overflow(src,dstptr);
+			if (Sgl_iszero_sign(src)) result = 0x7fff;
+			else result = 0x8000;
+
+			if (Is_invalidtrap_enabled()) {
+return(INVALIDEXCEPTION);
+			}
+			Set_invalidflag();
+			*dstptr = result;
+			return(NOEXCEPTION);
 		}
 	}
 	/*
@@ -170,12 +172,21 @@ unsigned int *status;
 		/* check for MININT */
 		if ((src_exponent  DBL_FX_MAX_EXP + 1) ||
 		Sgl_isnotzero_mantissa(src) || Sgl_iszero_sign(src)) {
-			/*
-			 * Since source is a number which cannot be
-			 * represented in fixed-point format, return
-			 * largest (or smallest) fixed-point number.
-			 */
-			Sgl_return_overflow_dbl(src,dstptr);
+			if (Sgl_iszero_sign(src)) {
+resultp1 = 0x7fff;
+resultp2 = 0x;
+			}
+			else {
+resultp1 = 0x8000;
+resultp2 = 0;
+			}
+
+			if (Is_invalidtrap_enabled()) {
+return(INVALIDEXCEPTION);
+			}
+			Set_invalidflag();
+			Dint_copytoptr(resultp1,resultp2,dstptr);
+			return(NOEXCEPTION);
 		}
 		Dint_set_minint(resultp1,resultp2);
 		Dint_copytoptr(resultp1,resultp2,dstptr);
@@ -284,12 +295,15 @@ unsigned int *status;
 	if (src_exponent  SGL_FX_MAX_EXP) {
 		/* check for MININT */
 		if (Dbl_isoverflow_to_int(src_exponent,srcp1,srcp2)) {
-			/*
-			 * Since source is a number which cannot be
-			 * represented in fixed-point format, return
-			 * largest (or smallest) fixed-point number.
-			 */
-			Dbl_return_overflow(srcp1,srcp2,dstptr);
+			if (Dbl_iszero_sign(srcp1)) result = 0x7fff;
+			else result = 0x8000;
+
+			if (Is_invalidtrap_enabled()) {
+return(INVALIDEXCEPTION);
+			}
+			Set_invalidflag();
+			*dstptr = result;
+			return(NOEXCEPTION);
 		}
 	}
 	/*
@@ -310,7 +324,8 @@ unsigned int *status;
 			/*  round result  */
 			switch (Rounding_mode()) {
 			case ROUNDPLUS:
-			 if (Dbl_iszero_sign(srcp1)) result++;
+if (Dbl_iszero_sign(srcp1))
+	result++;
 			 break;
 			case ROUNDMINUS:
 			 if (Dbl_isone_sign(srcp1)) result--;
@@ -326,7 +341,24 @@ unsigned int *status;
 			/* check for overflow */
 			if ((Dbl_iszero_sign(srcp1)  result  0) ||
 			(Dbl_isone_sign(srcp1)  result  0)) {
-Dbl_return_overflow(srcp1,srcp2,dstptr);
+
+if (Dbl_iszero_sign(srcp1))
+	result = 0x7fff;
+else
+	result = 0x8000;
+
+			if (Is_overflowtrap_enabled()) {
+			if (Is_inexacttrap_enabled())
+			  return(OVERFLOWEXCEPTION|INEXACTEXCEPTION);
+			else Set_inexactflag();
+			return(OVERFLOWEXCEPTION);
+			}
+			  Set_overflowflag();
+			  *dstptr = result;
+			  if (Is_inexacttrap_enabled() )
+return(INEXACTEXCEPTION);
+			  else Set_inexactflag();
+			  return(NOEXCEPTION);
 			}
 		}
 	}
@@ -386,12 +418,21 @@ unsigned int *status;
 		/* check for MININT */
 		if ((src_exponent  DBL_FX_MAX_EXP + 1) ||
 		Dbl_isnotzero_mantissa(srcp1,srcp2) || Dbl_iszero_sign(srcp1)) {
-			/*
-			 * Since source is a number which cannot be
-			 * represented in fixed-point format, return
-			 * largest (or smallest) fixed-point number.
-			 */
-			Dbl_return_overflow_dbl(srcp1,srcp2,dstptr);
+			if