Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2012 04:57:09 +0000 (UTC)
From:      David Schultz <das@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r229842 - in stable/8/lib/msun: amd64 i387
Message-ID:  <201201090457.q094v9ue023527@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: das
Date: Mon Jan  9 04:57:09 2012
New Revision: 229842
URL: http://svn.freebsd.org/changeset/base/229842

Log:
  MFC r226594:
    Bugfix: feenableexcept() and fedisableexcept() should just return the
    old exception mask, not mask | ~FE_ALL_EXCEPT.

Modified:
  stable/8/lib/msun/amd64/fenv.c
  stable/8/lib/msun/i387/fenv.c
Directory Properties:
  stable/8/lib/msun/   (props changed)

Modified: stable/8/lib/msun/amd64/fenv.c
==============================================================================
--- stable/8/lib/msun/amd64/fenv.c	Mon Jan  9 04:57:06 2012	(r229841)
+++ stable/8/lib/msun/amd64/fenv.c	Mon Jan  9 04:57:09 2012	(r229842)
@@ -120,12 +120,12 @@ __feenableexcept(int mask)
 	mask &= FE_ALL_EXCEPT;
 	__fnstcw(&control);
 	__stmxcsr(&mxcsr);
-	omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
+	omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
 	control &= ~mask;
 	__fldcw(control);
 	mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
 	__ldmxcsr(mxcsr);
-	return (~omask);
+	return (omask);
 }
 
 int
@@ -137,12 +137,12 @@ __fedisableexcept(int mask)
 	mask &= FE_ALL_EXCEPT;
 	__fnstcw(&control);
 	__stmxcsr(&mxcsr);
-	omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
+	omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
 	control |= mask;
 	__fldcw(control);
 	mxcsr |= mask << _SSE_EMASK_SHIFT;
 	__ldmxcsr(mxcsr);
-	return (~omask);
+	return (omask);
 }
 
 __weak_reference(__feenableexcept, feenableexcept);

Modified: stable/8/lib/msun/i387/fenv.c
==============================================================================
--- stable/8/lib/msun/i387/fenv.c	Mon Jan  9 04:57:06 2012	(r229841)
+++ stable/8/lib/msun/i387/fenv.c	Mon Jan  9 04:57:09 2012	(r229842)
@@ -177,14 +177,14 @@ __feenableexcept(int mask)
 		__stmxcsr(&mxcsr);
 	else
 		mxcsr = 0;
-	omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
+	omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
 	control &= ~mask;
 	__fldcw(control);
 	if (__HAS_SSE()) {
 		mxcsr &= ~(mask << _SSE_EMASK_SHIFT);
 		__ldmxcsr(mxcsr);
 	}
-	return (~omask);
+	return (omask);
 }
 
 int
@@ -199,14 +199,14 @@ __fedisableexcept(int mask)
 		__stmxcsr(&mxcsr);
 	else
 		mxcsr = 0;
-	omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
+	omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT;
 	control |= mask;
 	__fldcw(control);
 	if (__HAS_SSE()) {
 		mxcsr |= mask << _SSE_EMASK_SHIFT;
 		__ldmxcsr(mxcsr);
 	}
-	return (~omask);
+	return (omask);
 }
 
 __weak_reference(__feenableexcept, feenableexcept);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201090457.q094v9ue023527>