]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libfortran/26712 (gfortran on mac intel runtime floating point exception when...
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>
Thu, 30 Mar 2006 22:00:21 +0000 (00:00 +0200)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Thu, 30 Mar 2006 22:00:21 +0000 (22:00 +0000)
PR libfortran/26712
* config/fpu-387.h: Add special case for handling of SSE
control bit on i386-darwin.

From-SVN: r112546

libgfortran/ChangeLog
libgfortran/config/fpu-387.h

index d082c073e6470b92fb527f288c5bf43405ce8882..4074c8c47bdcd909fe452080546fdd7603e3bb61 100644 (file)
@@ -1,3 +1,9 @@
+2006-03-30  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR libfortran/26712
+       * config/fpu-387.h: Add special case for handling of SSE
+       control bit on i386-darwin.
+
 2006-03-30  Thomas Koenig  <Thomas.Koenig@online.de>
 
        PR fortran/25031
index bf9fbc8efcedded252384014bb4cf08f4c5d5f1a..5e3dec2d4df33215c8430da6d6d9db1ab389ca5d 100644 (file)
@@ -93,6 +93,17 @@ void set_fpu (void)
       /* SSE */
       asm volatile ("stmxcsr %0" : "=m" (cw_sse));
       cw_sse &= 0xFFFF0000;
+#ifdef __APPLE__
+      cw_sse |= (_FPU_MASK_IM | _FPU_MASK_DM | _FPU_MASK_ZM | _FPU_MASK_OM
+                | _FPU_MASK_UM | _FPU_MASK_PM ) << 7;
+      if (options.fpe & GFC_FPE_INVALID) cw_sse &= ~(_FPU_MASK_IM << 7);
+      if (options.fpe & GFC_FPE_DENORMAL) cw_sse &= ~(_FPU_MASK_DM << 7);
+      if (options.fpe & GFC_FPE_ZERO) cw_sse &= ~(_FPU_MASK_ZM << 7);
+      if (options.fpe & GFC_FPE_OVERFLOW) cw_sse &= ~(_FPU_MASK_OM << 7);
+      if (options.fpe & GFC_FPE_UNDERFLOW) cw_sse &= ~(_FPU_MASK_UM << 7);
+      if (options.fpe & GFC_FPE_PRECISION) cw_sse &= ~(_FPU_MASK_PM << 7);
+      asm volatile ("ldmxcsr %0" : : "m" (cw_sse));
+#else
       if (options.fpe & GFC_FPE_INVALID) cw_sse |= 1 << 7;
       if (options.fpe & GFC_FPE_DENORMAL) cw_sse |= 1 << 8;
       if (options.fpe & GFC_FPE_ZERO) cw_sse |= 1 << 9;
@@ -100,5 +111,6 @@ void set_fpu (void)
       if (options.fpe & GFC_FPE_UNDERFLOW) cw_sse |= 1 << 11;
       if (options.fpe & GFC_FPE_PRECISION) cw_sse |= 1 << 12;
       asm volatile ("ldmxcsr %0" : : "m" (cw_sse));
+#endif
     }
 }