This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [fortran, patch] IEEE intrinsic modules
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: FX <fxcoudert at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Fortran List <fortran at gcc dot gnu dot org>
- Date: Thu, 5 Jun 2014 11:56:14 +0200
- Subject: Re: [fortran, patch] IEEE intrinsic modules
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4bPn3QaPa4MKpOO+iAMo5esVCx3Cn-XptFGe=g69rxptA at mail dot gmail dot com> <DA02C71A-3BF9-4283-B260-60A676855A3E at gmail dot com>
On Thu, Jun 5, 2014 at 11:35 AM, FX <fxcoudert@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.