This is the mail archive of the gcc@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: FP arithmetic in the compiler


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~


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