On Thu, Nov 21, 2013 at 2:12 PM, N.M. Maclaren <n...@cam.ac.uk> wrote: > On Nov 21 2013, Uros Bizjak wrote: >>> >>> >>> Indeed, 387/SSE has flush-to-zero modes. But other APIs do not (glibc, >>> SysV, AIX). I'm perfectly willing to add it, especially to 387/SSE, if given >>> a bit of help (someone to write the assembly code). >> >> >> Just set FTZ bit in mxcsr. Please see >> libgcc/config/i386/crtfastmath.c, this mode is used when -ffast-math >> is used. > > > Does that work for all of Intel's zoo of floating-point mechanisms? > Even if gfortran doesn't use all of them, it is important to at least > know which it works for and which it does not. My understanding of > the architecture is that all of x87, MMX, SSE and AVX are potentially > different in this respect :-(
Only SSE and later ABIs support FTZ. Also, please note that underflow exception has to be masked for FTZ processing to occur. Please see [1]. [1] http://software.intel.com/en-us/articles/x87-and-sse-floating-point-assists-in-ia-32-flush-to-zero-ftz-and-denormals-are-zero-daz Uros.