summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2007-01-05 07:15:26 +0000
committerdas <das@FreeBSD.org>2007-01-05 07:15:26 +0000
commitaeb763b099f97941d7b8aac8b7db1a173a9a2e62 (patch)
tree5ae9ffc98cb221b8fd79eecaa8d4fae8fde100c3 /lib
parenta1794f56b7c706a9bcb1fae4b80756ef64ba8dfe (diff)
downloadFreeBSD-src-aeb763b099f97941d7b8aac8b7db1a173a9a2e62.zip
FreeBSD-src-aeb763b099f97941d7b8aac8b7db1a173a9a2e62.tar.gz
Remove an unneeded fnstcw instruction.
Noticed by: bde
Diffstat (limited to 'lib')
-rw-r--r--lib/msun/amd64/fenv.c12
-rw-r--r--lib/msun/i387/fenv.c11
2 files changed, 10 insertions, 13 deletions
diff --git a/lib/msun/amd64/fenv.c b/lib/msun/amd64/fenv.c
index 95c82de..cf07c8b 100644
--- a/lib/msun/amd64/fenv.c
+++ b/lib/msun/amd64/fenv.c
@@ -72,16 +72,14 @@ feraiseexcept(int excepts)
int
fegetenv(fenv_t *envp)
{
- int control;
- /*
- * fnstenv masks all exceptions, so we need to save and
- * restore the control word to avoid this side effect.
- */
- __fnstcw(&control);
__fnstenv(&envp->__x87);
__stmxcsr(&envp->__mxcsr);
- __fldcw(control);
+ /*
+ * fnstenv masks all exceptions, so we need to restore the
+ * control word to avoid this side effect.
+ */
+ __fldcw(envp->__x87.__control);
return (0);
}
diff --git a/lib/msun/i387/fenv.c b/lib/msun/i387/fenv.c
index 567d699..ace2d32 100644
--- a/lib/msun/i387/fenv.c
+++ b/lib/msun/i387/fenv.c
@@ -117,19 +117,18 @@ feraiseexcept(int excepts)
int
fegetenv(fenv_t *envp)
{
- int control, mxcsr;
+ int mxcsr;
+ __fnstenv(envp);
/*
- * fnstenv masks all exceptions, so we need to save and
- * restore the control word to avoid this side effect.
+ * fnstenv masks all exceptions, so we need to restore
+ * the old control word to avoid this side effect.
*/
- __fnstcw(&control);
- __fnstenv(envp);
+ __fldcw(envp->__control);
if (__HAS_SSE()) {
__stmxcsr(&mxcsr);
__set_mxcsr(*envp, mxcsr);
}
- __fldcw(control);
return (0);
}
OpenPOWER on IntegriCloud