On Thu, Jun 5, 2014 at 11:35 AM, FX <fxcoud...@gmail.com> wrote: >> Please look at libgcc/config/i386/crtfastmath.c for how to set >> MXCSR_FTZ from mxcsr. You already have all necessary bits in place, >> the function is basically only: >> >> + if (has_sse()) >> + { >> + unsigned int cw_sse; >> + >> + __asm__ __volatile__ ("%vstmxcsr\t%0" : "=m" (cw_sse)); >> + cw_sse |= MXCSR_DAZ; >> + __asm__ __volatile__ ("%vldmxcsr\t%0" : : "m" (cw_sse)); >> + }
Oops, the above should read MXCSR_FTZ. > Thanks for the suggestion! > > >> Please note, that FTZ applies only to SSE math. x87 and (IIRC) soft-FP >> don't handle this setting. > > Yeah, that’s also why I prefer for now to have it declared as unsupported: > the Fortran standard doesn’t really allow for partial support such as this, > so I’m still trying to figure out what The Right Thing To Do is. Referring to some older mails [1], this looks like a performance-only setting (sort of fast-math). So, we can perhaps just set this bit, regardless of the details. Maybe soft-fp will grow support for FTZ sometime, it looks like a useful addition from the performance POV. [1] https://gcc.gnu.org/ml/fortran/2013-11/msg00133.html Uros.