This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran] Print floating-point exception status after STOP/ERROR STOP
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>, David Edelsohn <dje dot gcc at gmail dot com>
- Date: Wed, 12 Jun 2013 16:04:27 +0200
- Subject: Re: [Patch, Fortran] Print floating-point exception status after STOP/ERROR STOP
- References: <51B8721A dot 6000000 at net-b dot de>
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.