]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 29 Apr 2003 07:18:57 +0000 (07:18 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 29 Apr 2003 07:18:57 +0000 (07:18 +0000)
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].

ChangeLog
sysdeps/i386/fpu/Makefile [new file with mode: 0644]
sysdeps/i386/fpu/fedisblxcpt.c
sysdeps/i386/fpu/feenablxcpt.c
sysdeps/i386/fpu/feholdexcpt.c
sysdeps/i386/fpu/fesetround.c

index c1bb8732975819ef3790d7db79685ff403b24ea0..9d6556bdc8bab08cba23a61f923bbd3addbdac67 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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].
+
 2003-04-28  Ulrich Drepper  <drepper@redhat.com>
 
        * nscd/nscd_getgr_r.c: Compact code a bit.  Add some __builtin_expect.
diff --git a/sysdeps/i386/fpu/Makefile b/sysdeps/i386/fpu/Makefile
new file mode 100644 (file)
index 0000000..1309b64
--- /dev/null
@@ -0,0 +1,3 @@
+ifeq ($(subdir),math)
+$(objpfx)libm.so: $(elfobjdir)/ld.so
+endif
index c7f76f53a933acd00f781ee6df78688b6c07ee6f..754d20d4c86cf9804f831450838b9e0dd47449e1 100644 (file)
@@ -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;
 }
index a672d0e8217ca1384e905503a089063f1ef5d862..65a0a2944cbe73d4d789a54fe54478d49f9d5c19 100644 (file)
@@ -1,5 +1,5 @@
 /* Enable 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.
 
    02111-1307 USA.  */
 
 #include <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
 
 int
 feenableexcept (int excepts)
 {
-  unsigned short int new_exc, old_exc;
+  unsigned short int new_exc;
+  unsigned short int old_exc;
 
   /* Get the current control word.  */
   __asm__ ("fstcw %0" : "=m" (*&new_exc));
@@ -34,5 +38,18 @@ feenableexcept (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__ ("ldmxcsr %0" : "=m" (*&xnew_exc));
+
+      xnew_exc &= ~excepts;
+
+      __asm__ ("stmxcsr %0" : : "m" (*&xnew_exc));
+    }
+
   return old_exc;
 }
index b68ffa32449160531f560a69f4a5e07909c1e5aa..bdbf9107e6c2b150b45719d63ed64c2abac14968 100644 (file)
@@ -1,5 +1,5 @@
 /* Store current floating-point environment and clear exceptions.
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1999, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -19,6 +19,9 @@
    02111-1307 USA.  */
 
 #include <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
 
 int
 feholdexcept (fenv_t *envp)
@@ -32,5 +35,19 @@ feholdexcept (fenv_t *envp)
   work = envp->__control_word | 0x3f;
   __asm__ ("fldcw %0" : : "m" (*&work));
 
+  /* If the CPU supports SSE we set the MXCSR as well.  */
+  if ((GL(dl_hwcap_mask) & HWCAP_I386_XMM) != 0)
+    {
+      unsigned int xwork;
+
+      /* Get the current control word.  */
+      __asm__ ("stmxcsr %0" : "=m" (*&xwork));
+
+      /* Set all exceptions to non-stop.  */
+      work |= 0x1f80;
+
+      __asm__ ("ldmxcsr %0" : : "m" (*&xwork));
+    }
+
   return 0;
 }
index 342ae49c60b50842c17a6b34a9151cc2d9b14a85..342ed42318101693bbc8b3036e9be1cb32842da1 100644 (file)
@@ -1,5 +1,5 @@
 /* Set current rounding direction.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
 
@@ -19,6 +19,9 @@
    02111-1307 USA.  */
 
 #include <fenv.h>
+#include <unistd.h>
+#include <ldsodefs.h>
+#include <dl-procinfo.h>
 
 int
 fesetround (int round)
@@ -34,5 +37,16 @@ fesetround (int round)
   cw |= round;
   __asm__ ("fldcw %0" : : "m" (*&cw));
 
+  /* If the CPU supports SSE we set the MXCSR as well.  */
+  if ((GL(dl_hwcap_mask) & HWCAP_I386_XMM) != 0)
+    {
+      unsigned int xcw;
+
+      __asm__ ("stmxcsr %0" : "=m" (*&xcw));
+      cw &= ~0x6000;
+      cw |= round << 3;
+      __asm__ ("ldmxcsr %0" : : "m" (*&xcw));
+    }
+
   return 0;
 }
This page took 0.0567 seconds and 5 git commands to generate.