This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] Print floating-point exception status after STOP/ERROR STOP


On Wed, Jun 12, 2013 at 3:05 PM, Tobias Burnus <burnus@net-b.de> wrote:
> David: Can you have a look at libgfortran/config/fpu-aix.h - Thanks!
> Uros: Can you have a look at libgfortran/config/fpu-387.h - Thanks!
>

+  unsigned short cw;
+
+  __asm__ ("fnstsw %0" : "=a" (cw));

__asm__ __volatile__ ("fnstsw\t%0" : "=a" (cw));

fnstsw uses processor state (x87 status word) that is hidden to gcc,
so it needs to be __volatile__.

+  if (has_sse())
+    {
+      unsigned int cw_sse;
+      __asm__ ("stmxcsr %0" : "=m" (*&cw_sse));

also __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw_sse));

%v will conditionally emit "v" prefix for TARGET_AVX.

+      cw |= cw_sse;
+    }

Looks OK otherwise.

Thanks,
Uros.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]