This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]