This is the mail archive of the
mailing list for the GCC project.
Re: FP arithmetic in the compiler
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Joern Rennecke <joern dot rennecke at superh dot com>, Jan Hubicka <jh at suse dot cz>, Richard dot Earnshaw at arm dot com, gcc at gcc dot gnu dot org
- Date: Wed, 22 May 2002 09:49:08 +0100
- Subject: Re: FP arithmetic in the compiler
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> On Tue, May 21, 2002 at 07:58:49PM +0100, Joern Rennecke wrote:
> > Now, since we still want to support bootstraps with other compilers, we can
> > use a native floating-point library instead. In fact, we can implement all
> > the functions in a herder file as macros or inline functions. The esential
> > part that gets us the effect of -ffloat-store is to assign the result to a
> > volatile variable, and read it back from there.
> Now that is a good idea.
> Jan, if you have time to work on this, consider
> #ifdef HAVE_FLOAT_H
> #include <float.h>
> #ifndef FLT_EVAL_METHOD
> #define FLT_EVAL_METHOD -1
> static inline double
> quick_float_mult (a, b)
> double a, b;
> if (FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1)
> return a * b;
> volatile double r = a * b;
> return r;
> That will surely be the quickest method to do what we want.
It still has the problem that cross compiling could occasionally result in
results that are dependent on the host platform, but it should be better
than it was before.