This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR24518 - Intrinsic MOD incorrect for large arg1/arg2 and slow.
- From: Roger Sayle <roger at eyesopen dot com>
- To: Paul Thomas <paulthomas2 at wanadoo dot fr>
- Cc: Uros Bizjak <ubizjak at gmail dot com>, Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>, <fortran at gcc dot gnu dot org>, <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 1 Nov 2006 14:49:34 -0700 (MST)
- Subject: Re: [Patch, fortran] PR24518 - Intrinsic MOD incorrect for large arg1/arg2 and slow.
Hi Uros and Paul,
On Wed, 1 Nov 2006, Paul Thomas wrote:
> >> Regtested on FC5/x86_ia64 - OK for trunk, and 4.2?
> >
> > In 4.2, the fmod intrinsic is still protected by
> > flag_unsafe_math_optimizations. For your fortran patch to be effective
> > on 4.2, fmod patch
> > (http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01209.html) needs to be
> > backported to 4.2. [Patch was OK'd for mainline].
> >
> > Roger, is fmod patch also OK for 4.2?
> >
> > Ah yes, you are quite right. This is not exactly a bug fix, is it?
> > OK for trunk, then? :-)
I believe Paul's patch should be suitable for 4.2, for two reasons.
Firstly, the poor numerical accuracy of gfortran's MOD and MODULO is a
regression from g77 (indeed I've just confirmed this with g77 from
gcc-3.4.3 using a slightly tweaked version of the test case given in:
http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01741.html
Secondly, I believe Paul's patch is fine even without Uros' x87 intrinsic
patch. Adding support for inlining fmod calls on IA-32 clearly helps
performance-wise [on one particular target], but isn't a blocker for
correctness, where we'll simply call libm's fmod, as we do on other
platforms. [Should anywhere not have fmod, it's simple enough to
cook something up for libgfortran/intrinsics/c99_functions.c].
Does this sound like a reasonable compromise?
Roger
--