From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:05:17 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:05:08 2010
New Revision: 205893
URL: http://svn.freebsd.org/changeset/base/205893
Log:
MFC: r205395
FPU_DEBUG requires <stdio.h>.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/8/lib/libc/sparc64/fpu/fpu.c
stable/8/lib/libc/sparc64/fpu/fpu_explode.c
stable/8/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/8/lib/libc/ (props changed)
stable/8/lib/libc/stdtime/ (props changed)
Modified: stable/8/lib/libc/sparc64/fpu/fpu.c
==============================================================================
--- stable/8/lib/libc/sparc64/fpu/fpu.c Tue Mar 30 19:03:29 2010 (r205892)
+++ stable/8/lib/libc/sparc64/fpu/fpu.c Tue Mar 30 19:05:08 2010 (r205893)
@@ -69,9 +69,12 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <errno.h>
-#include <unistd.h>
#include <signal.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
#include <stdlib.h>
+#include <unistd.h>
#include "un-namespace.h"
#include "libc_private.h"
Modified: stable/8/lib/libc/sparc64/fpu/fpu_explode.c
==============================================================================
--- stable/8/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:03:29 2010 (r205892)
+++ stable/8/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:05:08 2010 (r205893)
@@ -49,6 +49,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
+
#include <machine/frame.h>
#include <machine/fp.h>
#include <machine/fsr.h>
Modified: stable/8/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/8/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:03:29 2010 (r205892)
+++ stable/8/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:05:08 2010 (r205893)
@@ -49,6 +49,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
+
#include <machine/frame.h>
#include <machine/fp.h>
#include <machine/fsr.h>
_______________________________________________
svn-s...@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all...@freebsd.org"
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:03:36 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:03:26 2010
New Revision: 205890
URL: http://svn.freebsd.org/changeset/base/205890
Log:
MFC: r205394
Ensure that __fpu_ftox() both returns the high bits and res[1] contains
the low bits also in the default case.
PR: 144900
Obtained from: OpenBSD
Modified:
stable/8/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/8/lib/libc/ (props changed)
stable/8/lib/libc/stdtime/ (props changed)
Modified: stable/8/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/8/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 18:58:10 2010 (r205889)
+++ stable/8/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:03:26 2010 (r205890)
@@ -248,8 +248,8 @@ __fpu_ftox(fe, fp, res)
sign = fp->fp_sign;
switch (fp->fp_class) {
case FPC_ZERO:
- res[1] = 0;
- return (0);
+ i = 0;
+ goto done;
case FPC_NUM:
/*
@@ -273,15 +273,17 @@ __fpu_ftox(fe, fp, res)
break;
if (sign)
i = -i;
- res[1] = (int)i;
- return (i >> 32);
+ goto done;
default: /* Inf, qNaN, sNaN */
break;
}
/* overflow: replace any inexact exception with invalid */
fe->fe_cx = (fe->fe_cx & ~FSR_NX) | FSR_NV;
- return (0x7fffffffffffffffLL + sign);
+ i = 0x7fffffffffffffffLL + sign;
+done:
+ res[1] = i & 0xffffffff;
+ return (i >> 32);
}
/*
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:16:11 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:15:57 2010
New Revision: 205906
URL: http://svn.freebsd.org/changeset/base/205906
Log:
MFC: r173859, r205410
Avoid aliasing which leads to incorrect results when compiling with the
default strict aliasing rules.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/7/lib/libc/sparc64/fpu/fpu_explode.c
Directory Properties:
stable/7/lib/libc/ (props changed)
stable/7/lib/libc/stdtime/ (props changed)
Modified: stable/7/lib/libc/sparc64/fpu/fpu_explode.c
==============================================================================
--- stable/7/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:13:37 2010 (r205905)
+++ stable/7/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:15:57 2010 (r205906)
@@ -139,9 +139,9 @@ __fpu_xtof(fp, i)
* a signed or unsigned entity.
*/
if (fp->fp_sign && (int64_t)i < 0)
- *((int64_t*)fp->fp_mant) = -i;
+ *((int64_t *)fp->fp_mant) = -i;
else
- *((int64_t*)fp->fp_mant) = i;
+ *((int64_t *)fp->fp_mant) = i;
fp->fp_mant[2] = 0;
fp->fp_mant[3] = 0;
__fpu_norm(fp);
@@ -262,13 +262,12 @@ __fpu_explode(fe, fp, type, reg)
struct fpn *fp;
int type, reg;
{
- u_int32_t s, *sp;
- u_int64_t l[2];
+ u_int64_t l0, l1;
+ u_int32_t s;
if (type == FTYPE_LNG || type == FTYPE_DBL || type == FTYPE_EXT) {
- l[0] = __fpu_getreg64(reg & ~1);
- sp = (u_int32_t *)l;
- fp->fp_sign = sp[0] >> 31;
+ l0 = __fpu_getreg64(reg & ~1);
+ fp->fp_sign = l0 >> 63;
} else {
s = __fpu_getreg(reg);
fp->fp_sign = s >> 31;
@@ -276,7 +275,7 @@ __fpu_explode(fe, fp, type, reg)
fp->fp_sticky = 0;
switch (type) {
case FTYPE_LNG:
- s = __fpu_xtof(fp, l[0]);
+ s = __fpu_xtof(fp, l0);
break;
case FTYPE_INT:
@@ -288,12 +287,13 @@ __fpu_explode(fe, fp, type, reg)
break;
case FTYPE_DBL:
- s = __fpu_dtof(fp, sp[0], sp[1]);
+ s = __fpu_dtof(fp, l0 >> 32, l0 & 0xffffffff);
break;
case FTYPE_EXT:
- l[1] = __fpu_getreg64((reg & ~1) + 2);
- s = __fpu_qtof(fp, sp[0], sp[1], sp[2], sp[3]);
+ l1 = __fpu_getreg64((reg & ~1) + 2);
+ s = __fpu_qtof(fp, l0 >> 32, l0 & 0xffffffff, l1 >> 32,
+ l1 & 0xffffffff);
break;
default:
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:04:06 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:03:29 2010
New Revision: 205892
URL: http://svn.freebsd.org/changeset/base/205892
Log:
MFC: r205394
Ensure that __fpu_ftox() both returns the high bits and res[1] contains
the low bits also in the default case.
PR:i 144900
Obtained from: OpenBSD
Modified:
stable/6/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/6/lib/libc/ (props changed)
Modified: stable/6/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/6/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:03:27 2010 (r205891)
+++ stable/6/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:03:29 2010 (r205892)
@@ -252,8 +252,8 @@ __fpu_ftox(fe, fp, res)
sign = fp->fp_sign;
switch (fp->fp_class) {
case FPC_ZERO:
- res[1] = 0;
- return (0);
+ i = 0;
+ goto done;
case FPC_NUM:
/*
@@ -277,15 +277,17 @@ __fpu_ftox(fe, fp, res)
break;
if (sign)
i = -i;
- res[1] = (int)i;
- return (i >> 32);
+ goto done;
default: /* Inf, qNaN, sNaN */
break;
}
/* overflow: replace any inexact exception with invalid */
fe->fe_cx = (fe->fe_cx & ~FSR_NX) | FSR_NV;
- return (0x7fffffffffffffffLL + sign);
+ i = 0x7fffffffffffffffLL + sign;
+done:
+ res[1] = i & 0xffffffff;
+ return (i >> 32);
}
/*
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:05:48 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:05:20 2010
New Revision: 205895
URL: http://svn.freebsd.org/changeset/base/205895
Log:
MFC: r205395
FPU_DEBUG requires <stdio.h>.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/6/lib/libc/sparc64/fpu/fpu.c
stable/6/lib/libc/sparc64/fpu/fpu_explode.c
stable/6/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/6/lib/libc/ (props changed)
Modified: stable/6/lib/libc/sparc64/fpu/fpu.c
==============================================================================
--- stable/6/lib/libc/sparc64/fpu/fpu.c Tue Mar 30 19:05:11 2010 (r205894)
+++ stable/6/lib/libc/sparc64/fpu/fpu.c Tue Mar 30 19:05:20 2010 (r205895)
@@ -73,9 +73,12 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <errno.h>
-#include <unistd.h>
#include <signal.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
#include <stdlib.h>
+#include <unistd.h>
#include "un-namespace.h"
#include "libc_private.h"
Modified: stable/6/lib/libc/sparc64/fpu/fpu_explode.c
==============================================================================
--- stable/6/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:05:11 2010 (r205894)
+++ stable/6/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:05:20 2010 (r205895)
@@ -53,6 +53,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
+
#include <machine/frame.h>
#include <machine/fp.h>
#include <machine/fsr.h>
Modified: stable/6/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/6/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:05:11 2010 (r205894)
+++ stable/6/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:05:20 2010 (r205895)
@@ -53,6 +53,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
+
#include <machine/frame.h>
#include <machine/fp.h>
#include <machine/fsr.h>
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:03:50 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:03:27 2010
New Revision: 205891
URL: http://svn.freebsd.org/changeset/base/205891
Log:
MFC: r205394
Ensure that __fpu_ftox() both returns the high bits and res[1] contains
the low bits also in the default case.
PR: 144900
Obtained from: OpenBSD
Modified:
stable/7/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/7/lib/libc/ (props changed)
stable/7/lib/libc/stdtime/ (props changed)
Modified: stable/7/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/7/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:03:26 2010 (r205890)
+++ stable/7/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:03:27 2010 (r205891)
@@ -248,8 +248,8 @@ __fpu_ftox(fe, fp, res)
sign = fp->fp_sign;
switch (fp->fp_class) {
case FPC_ZERO:
- res[1] = 0;
- return (0);
+ i = 0;
+ goto done;
case FPC_NUM:
/*
@@ -273,15 +273,17 @@ __fpu_ftox(fe, fp, res)
break;
if (sign)
i = -i;
- res[1] = (int)i;
- return (i >> 32);
+ goto done;
default: /* Inf, qNaN, sNaN */
break;
}
/* overflow: replace any inexact exception with invalid */
fe->fe_cx = (fe->fe_cx & ~FSR_NX) | FSR_NV;
- return (0x7fffffffffffffffLL + sign);
+ i = 0x7fffffffffffffffLL + sign;
+done:
+ res[1] = i & 0xffffffff;
+ return (i >> 32);
}
/*
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:09:07 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:08:05 2010
New Revision: 205903
URL: http://svn.freebsd.org/changeset/base/205903
Log:
MFC: r205397
- While SPARC V9 allows tininess to be detected either before or after
rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and
UltraSPARC processors defines that in all cases tinyness is detected
before rounding, therefore rounding up to the smallest normalised
number should set the underflow flag.
- If an infinite result is rounded down, the result should have an
exponent 1 less than the value for infinity.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/6/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/6/lib/libc/ (props changed)
Modified: stable/6/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/6/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:08:02 2010 (r205902)
+++ stable/6/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:08:05 2010 (r205903)
@@ -333,8 +333,9 @@ __fpu_ftos(fe, fp)
* right to introduce leading zeroes. Rounding then acts
* differently for normals and subnormals: the largest subnormal
* may round to the smallest normal (1.0 x 2^minexp), or may
- * remain subnormal. In the latter case, signal an underflow
- * if the result was inexact or if underflow traps are enabled.
+ * remain subnormal. A number that is subnormal before rounding
+ * will signal an underflow if the result is inexact or if underflow
+ * traps are enabled.
*
* Rounding a normal, on the other hand, always produces another
* normal (although either way the result might be too big for
@@ -349,8 +350,10 @@ __fpu_ftos(fe, fp)
if ((exp = fp->fp_exp + SNG_EXP_BIAS) <= 0) { /* subnormal */
/* -NG for g,r; -SNG_FRACBITS-exp for fraction */
(void) __fpu_shr(fp, FP_NMANT - FP_NG - SNG_FRACBITS - exp);
- if (fpround(fe, fp) && fp->fp_mant[3] == SNG_EXP(1))
+ if (fpround(fe, fp) && fp->fp_mant[3] == SNG_EXP(1)) {
+ fe->fe_cx |= FSR_UF;
return (sign | SNG_EXP(1) | 0);
+ }
if ((fe->fe_cx & FSR_NX) ||
(fe->fe_fsr & (FSR_UF << FSR_TEM_SHIFT)))
fe->fe_cx |= FSR_UF;
@@ -411,6 +414,7 @@ zero: res[1] = 0;
if ((exp = fp->fp_exp + DBL_EXP_BIAS) <= 0) {
(void) __fpu_shr(fp, FP_NMANT - FP_NG - DBL_FRACBITS - exp);
if (fpround(fe, fp) && fp->fp_mant[2] == DBL_EXP(1)) {
+ fe->fe_cx |= FSR_UF;
res[1] = 0;
return (sign | DBL_EXP(1) | 0);
}
@@ -430,7 +434,7 @@ zero: res[1] = 0;
return (sign | DBL_EXP(DBL_EXP_INFNAN) | 0);
}
res[1] = ~0;
- return (sign | DBL_EXP(DBL_EXP_INFNAN) | DBL_MASK);
+ return (sign | DBL_EXP(DBL_EXP_INFNAN - 1) | DBL_MASK);
}
done:
res[1] = fp->fp_mant[3];
@@ -472,6 +476,7 @@ zero: res[1] = res[2] = res[3] = 0;
if ((exp = fp->fp_exp + EXT_EXP_BIAS) <= 0) {
(void) __fpu_shr(fp, FP_NMANT - FP_NG - EXT_FRACBITS - exp);
if (fpround(fe, fp) && fp->fp_mant[0] == EXT_EXP(1)) {
+ fe->fe_cx |= FSR_UF;
res[1] = res[2] = res[3] = 0;
return (sign | EXT_EXP(1) | 0);
}
@@ -491,7 +496,7 @@ zero: res[1] = res[2] = res[3] = 0;
return (sign | EXT_EXP(EXT_EXP_INFNAN) | 0);
}
res[1] = res[2] = res[3] = ~0;
- return (sign | EXT_EXP(EXT_EXP_INFNAN) | EXT_MASK);
+ return (sign | EXT_EXP(EXT_EXP_INFNAN - 1) | EXT_MASK);
}
done:
res[1] = fp->fp_mant[1];
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:13:49 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:13:37 2010
New Revision: 205905
URL: http://svn.freebsd.org/changeset/base/205905
Log:
MFC: r205410
Avoid aliasing which leads to incorrect results when compiling with the
default strict aliasing rules.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/8/lib/libc/sparc64/fpu/fpu_explode.c
Directory Properties:
stable/8/lib/libc/ (props changed)
stable/8/lib/libc/stdtime/ (props changed)
Modified: stable/8/lib/libc/sparc64/fpu/fpu_explode.c
==============================================================================
--- stable/8/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:09:18 2010 (r205904)
+++ stable/8/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:13:37 2010 (r205905)
@@ -139,9 +139,9 @@ __fpu_xtof(fp, i)
* a signed or unsigned entity.
*/
if (fp->fp_sign && (int64_t)i < 0)
- *((int64_t*)fp->fp_mant) = -i;
+ *((int64_t *)fp->fp_mant) = -i;
else
- *((int64_t*)fp->fp_mant) = i;
+ *((int64_t *)fp->fp_mant) = i;
fp->fp_mant[2] = 0;
fp->fp_mant[3] = 0;
__fpu_norm(fp);
@@ -262,14 +262,12 @@ __fpu_explode(fe, fp, type, reg)
struct fpn *fp;
int type, reg;
{
- u_int32_t s, *sp;
- u_int64_t l[2];
- void *vl = l;
+ u_int64_t l0, l1;
+ u_int32_t s;
if (type == FTYPE_LNG || type == FTYPE_DBL || type == FTYPE_EXT) {
- l[0] = __fpu_getreg64(reg & ~1);
- sp = vl;
- fp->fp_sign = sp[0] >> 31;
+ l0 = __fpu_getreg64(reg & ~1);
+ fp->fp_sign = l0 >> 63;
} else {
s = __fpu_getreg(reg);
fp->fp_sign = s >> 31;
@@ -277,7 +275,7 @@ __fpu_explode(fe, fp, type, reg)
fp->fp_sticky = 0;
switch (type) {
case FTYPE_LNG:
- s = __fpu_xtof(fp, l[0]);
+ s = __fpu_xtof(fp, l0);
break;
case FTYPE_INT:
@@ -289,12 +287,13 @@ __fpu_explode(fe, fp, type, reg)
break;
case FTYPE_DBL:
- s = __fpu_dtof(fp, sp[0], sp[1]);
+ s = __fpu_dtof(fp, l0 >> 32, l0 & 0xffffffff);
break;
case FTYPE_EXT:
- l[1] = __fpu_getreg64((reg & ~1) + 2);
- s = __fpu_qtof(fp, sp[0], sp[1], sp[2], sp[3]);
+ l1 = __fpu_getreg64((reg & ~1) + 2);
+ s = __fpu_qtof(fp, l0 >> 32, l0 & 0xffffffff, l1 >> 32,
+ l1 & 0xffffffff);
break;
default:
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:05:32 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:05:11 2010
New Revision: 205894
URL: http://svn.freebsd.org/changeset/base/205894
Log:
MFC: r205395
FPU_DEBUG requires <stdio.h>.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/7/lib/libc/sparc64/fpu/fpu.c
stable/7/lib/libc/sparc64/fpu/fpu_explode.c
stable/7/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/7/lib/libc/ (props changed)
stable/7/lib/libc/stdtime/ (props changed)
Modified: stable/7/lib/libc/sparc64/fpu/fpu.c
==============================================================================
--- stable/7/lib/libc/sparc64/fpu/fpu.c Tue Mar 30 19:05:08 2010 (r205893)
+++ stable/7/lib/libc/sparc64/fpu/fpu.c Tue Mar 30 19:05:11 2010 (r205894)
@@ -69,9 +69,12 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <errno.h>
-#include <unistd.h>
#include <signal.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
#include <stdlib.h>
+#include <unistd.h>
#include "un-namespace.h"
#include "libc_private.h"
Modified: stable/7/lib/libc/sparc64/fpu/fpu_explode.c
==============================================================================
--- stable/7/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:05:08 2010 (r205893)
+++ stable/7/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:05:11 2010 (r205894)
@@ -49,6 +49,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
+
#include <machine/frame.h>
#include <machine/fp.h>
#include <machine/fsr.h>
Modified: stable/7/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/7/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:05:08 2010 (r205893)
+++ stable/7/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:05:11 2010 (r205894)
@@ -49,6 +49,10 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
+#ifdef FPU_DEBUG
+#include <stdio.h>
+#endif
+
#include <machine/frame.h>
#include <machine/fp.h>
#include <machine/fsr.h>
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:16:22 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:16:00 2010
New Revision: 205907
URL: http://svn.freebsd.org/changeset/base/205907
Log:
MFC: r173859, r205410
Avoid aliasing which leads to incorrect results when compiling with the
default strict aliasing rules.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/6/lib/libc/sparc64/fpu/fpu_explode.c
Directory Properties:
stable/6/lib/libc/ (props changed)
Modified: stable/6/lib/libc/sparc64/fpu/fpu_explode.c
==============================================================================
--- stable/6/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:15:57 2010 (r205906)
+++ stable/6/lib/libc/sparc64/fpu/fpu_explode.c Tue Mar 30 19:16:00 2010 (r205907)
@@ -143,9 +143,9 @@ __fpu_xtof(fp, i)
* a signed or unsigned entity.
*/
if (fp->fp_sign && (int64_t)i < 0)
- *((int64_t*)fp->fp_mant) = -i;
+ *((int64_t *)fp->fp_mant) = -i;
else
- *((int64_t*)fp->fp_mant) = i;
+ *((int64_t *)fp->fp_mant) = i;
fp->fp_mant[2] = 0;
fp->fp_mant[3] = 0;
__fpu_norm(fp);
@@ -266,13 +266,12 @@ __fpu_explode(fe, fp, type, reg)
struct fpn *fp;
int type, reg;
{
- u_int32_t s, *sp;
- u_int64_t l[2];
+ u_int64_t l0, l1;
+ u_int32_t s;
if (type == FTYPE_LNG || type == FTYPE_DBL || type == FTYPE_EXT) {
- l[0] = __fpu_getreg64(reg & ~1);
- sp = (u_int32_t *)l;
- fp->fp_sign = sp[0] >> 31;
+ l0 = __fpu_getreg64(reg & ~1);
+ fp->fp_sign = l0 >> 63;
} else {
s = __fpu_getreg(reg);
fp->fp_sign = s >> 31;
@@ -280,7 +279,7 @@ __fpu_explode(fe, fp, type, reg)
fp->fp_sticky = 0;
switch (type) {
case FTYPE_LNG:
- s = __fpu_xtof(fp, l[0]);
+ s = __fpu_xtof(fp, l0);
break;
case FTYPE_INT:
@@ -292,12 +291,13 @@ __fpu_explode(fe, fp, type, reg)
break;
case FTYPE_DBL:
- s = __fpu_dtof(fp, sp[0], sp[1]);
+ s = __fpu_dtof(fp, l0 >> 32, l0 & 0xffffffff);
break;
case FTYPE_EXT:
- l[1] = __fpu_getreg64((reg & ~1) + 2);
- s = __fpu_qtof(fp, sp[0], sp[1], sp[2], sp[3]);
+ l1 = __fpu_getreg64((reg & ~1) + 2);
+ s = __fpu_qtof(fp, l0 >> 32, l0 & 0xffffffff, l1 >> 32,
+ l1 & 0xffffffff);
break;
default:
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:08:51 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:08:02 2010
New Revision: 205902
URL: http://svn.freebsd.org/changeset/base/205902
Log:
MFC: r205397
- While SPARC V9 allows tininess to be detected either before or after
rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and
UltraSPARC processors defines that in all cases tinyness is detected
before rounding, therefore rounding up to the smallest normalised
number should set the underflow flag.
- If an infinite result is rounded down, the result should have an
exponent 1 less than the value for infinity.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/8/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/8/lib/libc/ (props changed)
stable/8/lib/libc/stdtime/ (props changed)
Modified: stable/8/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/8/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:08:01 2010 (r205901)
+++ stable/8/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:08:02 2010 (r205902)
@@ -329,8 +329,9 @@ __fpu_ftos(fe, fp)
* right to introduce leading zeroes. Rounding then acts
* differently for normals and subnormals: the largest subnormal
* may round to the smallest normal (1.0 x 2^minexp), or may
- * remain subnormal. In the latter case, signal an underflow
- * if the result was inexact or if underflow traps are enabled.
+ * remain subnormal. A number that is subnormal before rounding
+ * will signal an underflow if the result is inexact or if underflow
+ * traps are enabled.
*
* Rounding a normal, on the other hand, always produces another
* normal (although either way the result might be too big for
@@ -345,8 +346,10 @@ __fpu_ftos(fe, fp)
if ((exp = fp->fp_exp + SNG_EXP_BIAS) <= 0) { /* subnormal */
/* -NG for g,r; -SNG_FRACBITS-exp for fraction */
(void) __fpu_shr(fp, FP_NMANT - FP_NG - SNG_FRACBITS - exp);
- if (fpround(fe, fp) && fp->fp_mant[3] == SNG_EXP(1))
+ if (fpround(fe, fp) && fp->fp_mant[3] == SNG_EXP(1)) {
+ fe->fe_cx |= FSR_UF;
return (sign | SNG_EXP(1) | 0);
+ }
if ((fe->fe_cx & FSR_NX) ||
(fe->fe_fsr & (FSR_UF << FSR_TEM_SHIFT)))
fe->fe_cx |= FSR_UF;
@@ -407,6 +410,7 @@ zero: res[1] = 0;
if ((exp = fp->fp_exp + DBL_EXP_BIAS) <= 0) {
(void) __fpu_shr(fp, FP_NMANT - FP_NG - DBL_FRACBITS - exp);
if (fpround(fe, fp) && fp->fp_mant[2] == DBL_EXP(1)) {
+ fe->fe_cx |= FSR_UF;
res[1] = 0;
return (sign | DBL_EXP(1) | 0);
}
@@ -426,7 +430,7 @@ zero: res[1] = 0;
return (sign | DBL_EXP(DBL_EXP_INFNAN) | 0);
}
res[1] = ~0;
- return (sign | DBL_EXP(DBL_EXP_INFNAN) | DBL_MASK);
+ return (sign | DBL_EXP(DBL_EXP_INFNAN - 1) | DBL_MASK);
}
done:
res[1] = fp->fp_mant[3];
@@ -468,6 +472,7 @@ zero: res[1] = res[2] = res[3] = 0;
if ((exp = fp->fp_exp + EXT_EXP_BIAS) <= 0) {
(void) __fpu_shr(fp, FP_NMANT - FP_NG - EXT_FRACBITS - exp);
if (fpround(fe, fp) && fp->fp_mant[0] == EXT_EXP(1)) {
+ fe->fe_cx |= FSR_UF;
res[1] = res[2] = res[3] = 0;
return (sign | EXT_EXP(1) | 0);
}
@@ -487,7 +492,7 @@ zero: res[1] = res[2] = res[3] = 0;
return (sign | EXT_EXP(EXT_EXP_INFNAN) | 0);
}
res[1] = res[2] = res[3] = ~0;
- return (sign | EXT_EXP(EXT_EXP_INFNAN) | EXT_MASK);
+ return (sign | EXT_EXP(EXT_EXP_INFNAN - 1) | EXT_MASK);
}
done:
res[1] = fp->fp_mant[1];
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:08:40 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:08:01 2010
New Revision: 205901
URL: http://svn.freebsd.org/changeset/base/205901
Log:
MFC: r205397
- While SPARC V9 allows tininess to be detected either before or after
rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and
UltraSPARC processors defines that in all cases tinyness is detected
before rounding, therefore rounding up to the smallest normalised
number should set the underflow flag.
- If an infinite result is rounded down, the result should have an
exponent 1 less than the value for infinity.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/7/lib/libc/sparc64/fpu/fpu_implode.c
Directory Properties:
stable/7/lib/libc/ (props changed)
stable/7/lib/libc/stdtime/ (props changed)
Modified: stable/7/lib/libc/sparc64/fpu/fpu_implode.c
==============================================================================
--- stable/7/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:07:41 2010 (r205900)
+++ stable/7/lib/libc/sparc64/fpu/fpu_implode.c Tue Mar 30 19:08:01 2010 (r205901)
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:06:40 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:06:31 2010
New Revision: 205896
URL: http://svn.freebsd.org/changeset/base/205896
Log:
MFC: r205396
Division should take both arguments' signs into account when the
the dividend is infinity or zero and the divisor is not the same.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/8/lib/libc/sparc64/fpu/fpu_div.c
Directory Properties:
stable/8/lib/libc/ (props changed)
stable/8/lib/libc/stdtime/ (props changed)
Modified: stable/8/lib/libc/sparc64/fpu/fpu_div.c
==============================================================================
--- stable/8/lib/libc/sparc64/fpu/fpu_div.c Tue Mar 30 19:05:20 2010 (r205895)
+++ stable/8/lib/libc/sparc64/fpu/fpu_div.c Tue Mar 30 19:06:31 2010 (r205896)
@@ -167,14 +167,16 @@ __fpu_div(fe)
* return it. Otherwise we have the following cases:
*
* Inf / Inf = NaN, plus NV exception
- * Inf / num = Inf [i.e., return x]
- * Inf / 0 = Inf [i.e., return x]
- * 0 / Inf = 0 [i.e., return x]
- * 0 / num = 0 [i.e., return x]
+ * Inf / num = Inf [i.e., return x #]
+ * Inf / 0 = Inf [i.e., return x #]
+ * 0 / Inf = 0 [i.e., return x #]
+ * 0 / num = 0 [i.e., return x #]
* 0 / 0 = NaN, plus NV exception
- * num / Inf = 0
+ * num / Inf = 0 #
* num / num = num (do the divide)
- * num / 0 = Inf, plus DZ exception
+ * num / 0 = Inf #, plus DZ exception
+ *
+ * # Sign of result is XOR of operand signs.
*/
if (ISNAN(x) || ISNAN(y)) {
ORDER(x, y);
@@ -183,10 +185,10 @@ __fpu_div(fe)
if (ISINF(x) || ISZERO(x)) {
if (x->fp_class == y->fp_class)
return (__fpu_newnan(fe));
+ x->fp_sign ^= y->fp_sign;
return (x);
}
- /* all results at this point use XOR of operand signs */
x->fp_sign ^= y->fp_sign;
if (ISINF(y)) {
x->fp_class = FPC_ZERO;
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:07:15 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:06:37 2010
New Revision: 205898
URL: http://svn.freebsd.org/changeset/base/205898
Log:
MFC: r205396
Division should take both arguments' signs into account when the
the dividend is infinity or zero and the divisor is not the same.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/6/lib/libc/sparc64/fpu/fpu_div.c
Directory Properties:
stable/6/lib/libc/ (props changed)
Modified: stable/6/lib/libc/sparc64/fpu/fpu_div.c
==============================================================================
--- stable/6/lib/libc/sparc64/fpu/fpu_div.c Tue Mar 30 19:06:33 2010 (r205897)
+++ stable/6/lib/libc/sparc64/fpu/fpu_div.c Tue Mar 30 19:06:37 2010 (r205898)
@@ -171,14 +171,16 @@ __fpu_div(fe)
* return it. Otherwise we have the following cases:
*
* Inf / Inf = NaN, plus NV exception
- * Inf / num = Inf [i.e., return x]
- * Inf / 0 = Inf [i.e., return x]
- * 0 / Inf = 0 [i.e., return x]
- * 0 / num = 0 [i.e., return x]
+ * Inf / num = Inf [i.e., return x #]
+ * Inf / 0 = Inf [i.e., return x #]
+ * 0 / Inf = 0 [i.e., return x #]
+ * 0 / num = 0 [i.e., return x #]
* 0 / 0 = NaN, plus NV exception
- * num / Inf = 0
+ * num / Inf = 0 #
* num / num = num (do the divide)
- * num / 0 = Inf, plus DZ exception
+ * num / 0 = Inf #, plus DZ exception
+ *
+ * # Sign of result is XOR of operand signs.
*/
if (ISNAN(x) || ISNAN(y)) {
ORDER(x, y);
@@ -187,10 +189,10 @@ __fpu_div(fe)
From: dfi...@FreeBSD.ORG (dfilter service)
To: bug-fo...@FreeBSD.org
Cc:
Subject: Re: sparc64/144900: commit references a PR
Date: Tue, 30 Mar 2010 19:07:06 +0000 (UTC)
Author: marius
Date: Tue Mar 30 19:06:33 2010
New Revision: 205897
URL: http://svn.freebsd.org/changeset/base/205897
Log:
MFC: r205396
Division should take both arguments' signs into account when the
the dividend is infinity or zero and the divisor is not the same.
PR: 144900
Submitted by: Peter Jeremy
Modified:
stable/7/lib/libc/sparc64/fpu/fpu_div.c
Directory Properties:
stable/7/lib/libc/ (props changed)
stable/7/lib/libc/stdtime/ (props changed)
Modified: stable/7/lib/libc/sparc64/fpu/fpu_div.c
==============================================================================
--- stable/7/lib/libc/sparc64/fpu/fpu_div.c Tue Mar 30 19:06:31 2010 (r205896)
+++ stable/7/lib/libc/sparc64/fpu/fpu_div.c Tue Mar 30 19:06:33 2010 (r205897)
@@ -167,14 +167,16 @@ __fpu_div(fe)
* return it. Otherwise we have the following cases:
*
* Inf / Inf = NaN, plus NV exception
- * Inf / num = Inf [i.e., return x]
- * Inf / 0 = Inf [i.e., return x]
- * 0 / Inf = 0 [i.e., return x]
- * 0 / num = 0 [i.e., return x]
+ * Inf / num = Inf [i.e., return x #]
+ * Inf / 0 = Inf [i.e., return x #]
+ * 0 / Inf = 0 [i.e., return x #]
+ * 0 / num = 0 [i.e., return x #]
* 0 / 0 = NaN, plus NV exception
- * num / Inf = 0
+ * num / Inf = 0 #
* num / num = num (do the divide)
- * num / 0 = Inf, plus DZ exception
+ * num / 0 = Inf #, plus DZ exception
+ *
+ * # Sign of result is XOR of operand signs.
*/
if (ISNAN(x) || ISNAN(y)) {
ORDER(x, y);
@@ -183,10 +185,10 @@ __fpu_div(fe)