summary refs log tree commit diff
path: root/sysdeps/i386/fpu/fedisblxcpt.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-29 07:18:57 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-29 07:18:57 +0000
commite40468fa25851309afbc469735897fae83eb893d (patch)
tree0d37d3e92dbcd7195580669f1485b691b65aeb9c /sysdeps/i386/fpu/fedisblxcpt.c
parentb65b0900861221855ea784cf959bbecfc2611acc (diff)
downloadglibc-e40468fa25851309afbc469735897fae83eb893d.tar.gz
glibc-e40468fa25851309afbc469735897fae83eb893d.tar.xz
glibc-e40468fa25851309afbc469735897fae83eb893d.zip
Update.
2003-04-29  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/i386/fpu/Makefile: New file.
	* sysdeps/i386/fpu/fedisblxcpt.c: Also set SSE control word.
	* sysdeps/i386/fpu/feenablxcpt.c: Likewise.
	* sysdeps/i386/fpu/feholdexcpt.c: Likewise.
	* sysdeps/i386/fpu/fesetround.c: Also set SSE rounding mode
	[PR libc/4987].
Diffstat (limited to 'sysdeps/i386/fpu/fedisblxcpt.c')
-rw-r--r--sysdeps/i386/fpu/fedisblxcpt.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/fedisblxcpt.c b/sysdeps/i386/fpu/fedisblxcpt.c
index c7f76f53a9..754d20d4c8 100644
--- a/sysdeps/i386/fpu/fedisblxcpt.c
+++ b/sysdeps/i386/fpu/fedisblxcpt.c
@@ -1,5 +1,5 @@
 /* Disable floating-point exceptions.
-   Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999.
 
@@ -19,6 +19,9 @@
    02111-1307 USA.  */
 
 #include <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
 
 int
 fedisableexcept (int excepts)
@@ -35,5 +38,18 @@ fedisableexcept (int excepts)
   new_exc |= excepts;
   __asm__ ("fldcw %0" : : "m" (*&new_exc));
 
+  /* If the CPU supports SSE we set the MXCSR as well.  */
+  if ((GL(dl_hwcap_mask) & HWCAP_I386_XMM) != 0)
+    {
+      unsigned int xnew_exc;
+
+      /* Get the current control word.  */
+      __asm__ ("stmxcsr %0" : "=m" (*&xnew_exc));
+
+      xnew_exc |= excepts;
+
+      __asm__ ("ldmxcsr %0" : : "m" (*&xnew_exc));
+    }
+
   return old_exc;
 }