[fortran, patch] IEEE intrinsic modules

FX fxcoudert@gmail.com
Wed Jun 4 22:04:00 GMT 2014


Hi,

Last November, I worked on a patch to add the IEEE intrinsic modules to gfortran (thread starting at https://gcc.gnu.org/ml/fortran/2013-11/msg00126.html). After a round of review, I continued working on it, then didn’t have time, then development was frozen… Now, I found some time to get back to it, and here’s a more complete patch. I’ve bootstrapped it and regtested on:

  – x86_64-linux (both 32-bit and 64-bit); this also uses 387/SSE assembler
  – x86_64-linux with tweaked configure.host to force it to use glibc functions in config/fpu-glibc.h (both 32-bit and 64-bit)

The current state of the patch: as far as I can tell, nearly full support. In particular, since my last patch, I’ve added “saving/restoring FPU state on procedure entry/exit, when IEEE is used”. This is done in trans-decl.c, by wrapping each affected function body between calls to the library:

  try
    {
      _gfortran_ieee_procedure_entry ((void *) &fpstate.0);
      /* procedure body goes here */
    }
  finally
    {
      _gfortran_ieee_procedure_exit ((void *) &fpstate.0);
    }



What’s missing:

  0. Gradual underflow control is implemented as "not supported by the processor" (its SUPPORT function returns false, and the GET and SET procedures abort if you call them). That’s explicitly allowed by the standard, so it’s not actually “missing". We can improve on this in the future, if people can help.

  1. Documenting the flags necessary for full IEEE compatibility: it seems that "-fno-unsafe-math-optimizations -frounding-math -fsignaling-nans” is good, but I’ll have to check that with the floating-point middle-end experts. That’s next on my list: documenting our support, and interaction with compilation flags.

  2. Your review of the patch!


I really think getting IEEE support early in stage 1 will benefit the compiler, through good testing before release. I’d like to get this in, but I don’t intend to disappear afterwards… though I’m stepping back “full time” into the team, I will be there to fix IEEE bugs and issues.

OK to commit?

FX



-------------- next part --------------
A non-text attachment was scrubbed...
Name: ieee.ChangeLog
Type: application/octet-stream
Size: 2390 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140604/894f9a58/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ieee.diff
Type: application/octet-stream
Size: 143230 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140604/894f9a58/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ieee_withregenerated.diff
Type: application/octet-stream
Size: 162437 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140604/894f9a58/attachment-0002.obj>


More information about the Gcc-patches mailing list