This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [fortran,patch] Support for IEEE underflow control on x86/x86_64
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: FX <fxcoudert at gmail dot com>
- Cc: Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 3 Jul 2014 12:14:15 +0200
- Subject: Re: [fortran,patch] Support for IEEE underflow control on x86/x86_64
- Authentication-results: sourceware.org; auth=none
- References: <184DE738-2E8A-4310-A1FB-8BF351C2F88A at gmail dot com> <CAFULd4apPf0hQSARz2QKNjTCU3m24YQi3mFU0mUWV5RbwdwOkg at mail dot gmail dot com>
On Thu, Jul 3, 2014 at 11:25 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> The attached patch provides support for underflow control in the IEEE_ARITHMETIC module, for x86/x86_64 targets (our main user base).
>> Bootstrapped and regtested on x86_64-apple-darwin13. Comes with a testcase.
> Index: gcc/testsuite/gfortran.dg/ieee/underflow_1.f90
I'd suggest to name this fie ieee_underflow_1.f90 for consistency.
BTW: underflow control also works on alpha, using following code:
--cut here--
int
support_fpu_underflow_control (int kind)
{
return (kind == 4 || kind == 8) ? 1 : 0;
}
int
get_fpu_underflow_mode (void)
{
fenv_t state = __ieee_get_fp_control ();
/* Return 0 for abrupt underflow (flush to zero), 1 for gradual underflow. */
return (state & FE_MAP_UMZ) ? 0 : 1;
}
void
set_fpu_underflow_mode (int gradual __attribute__((unused)))
{
fenv_t state = __ieee_get_fp_control ();
if (gradual)
state &= ~FE_MAP_UMZ;
else
state |= FE_MAP_UMZ;
__ieee_set_fp_control (state);
}
--cut here--
This non-portable code was stuffed into fpu-glibc.h so should be
#ifdef'd with some __ALPHA__ and/or FE_MAP_UMZ check.
Uros.