This is the mail archive of the
mailing list for the GCC project.
Re: Reorganize -ffast-math code.
- To: torvalds at transmeta dot com (Linus Torvalds)
- Subject: Re: Reorganize -ffast-math code.
- From: Brad Lucier <lucier at math dot purdue dot edu>
- Date: Thu, 8 Mar 2001 14:21:58 -0500 (EST)
- Cc: lucier at math dot purdue dot edu (Brad Lucier), gcc-patches at gcc dot gnu dot org
Linux Torvalds wrote:
> You're an evil man.
> Yup, that pretty much means that every single intermediate result would
> have to go through memory to get truly predictable results.
The following computational model will give predictable results and will allow
simulation of IEEE floating point without extended precision as implemented
on other processors (except for things like PowePC fused multiply-add
0. The programmer can declare the precision of all operations.
1. All temporaries generated for a single expression are always maintained
in extended precision, even when spilled to the stack, and
2. Each assignment to a variable is stored to memory. (And, if the value of
that variable is used later by dereferencing its lvalue, the value is loaded
from memory and the temporary that was stored to memory is not re-used.)
Item 0 is already implemented in the Linux-Gnu/glibc/gcc/x86 combination. We
just need the possibility of setting items 1 and 2 through options; they don't
need to be the default. The performance hit would be much less than with your
suggestion, and people designing algorithms can write them to exploit the x86
extended format precision and range within each expression to write simpler,
faster, and more accurate codes for some problems. (And, if someone really
wants to simulate on x86 how IEEE floating point is done on Alpha, say, they
can use macros that explicitly incorporate the methods I gave in my previous post.)