This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: FP arithmetic in the compiler
- From: Richard Henderson <rth at redhat dot com>
- To: Joern Rennecke <joern dot rennecke at superh dot com>
- Cc: Jan Hubicka <jh at suse dot cz>, Richard dot Earnshaw at arm dot com, gcc at gcc dot gnu dot org
- Date: Tue, 21 May 2002 14:26:06 -0700
- Subject: Re: FP arithmetic in the compiler
- References: <3CEA98E9.700B3B44@superh.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>
#endif
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD -1
#endif
static inline double
quick_float_mult (a, b)
double a, b;
{
if (FLT_EVAL_METHOD == 0 || FLT_EVAL_METHOD == 1)
return a * b;
else
{
volatile double r = a * b;
return r;
}
}
That will surely be the quickest method to do what we want.
r~