Scott Robert Ladd <[EMAIL PROTECTED]> writes: > To support different expectations, I suggest defining the following > floating-point options for GCC. This is a conceptual overview; once > there's a consensus the categories, I'll propose something more formal. > > -ffp-correct > > This option focuses code generation on mathematical correctness, > portability, and consistency. No 80-bit long doubles, no fsin/fcos, > making certain that comparison operators work within reason. Note that > this option can only go so far in ensuring portability, given that not > every system supports IEEE 754 floats. > > -ffp-ieee754 > > To the best of our ability, assume and follow IEEE 754. Similar to the > above, but assuming IEEE floats and doubles. Note that IEEE 754 has been > undergoing some revision. > > -ffp-balanced (default) > > Balance correctness with speed, enabling performance optimizations that > may reduce portability or consistency, but which do not alter the > overall quality of results. Yeah, I know that's a bit fuzzy; formal > definition of such an option depends on categorizing existing FP code > generation (something I'm working on). > > -ffp-damn-the-torpedoes-full-speed-ahead > > Okay, maybe that should be something shorter, like -ffast-math or > -ffp-fast. This option enables dangerous hardware intrinsics, and > eschews all concerns about portability and consistency in the quest for > speed. The behavior is likely to be the same as the current -ffast-math.
I think it would help to look at what we already have, first. We have -ffast-math, which has a bunch of different sub-options for people who have done careful analysis of their code plus the -funsafe-math-optimizations flag for people who don't care. On many ports (like powerpc), the compiler is intended by default to conform to C99 plus appendix F. I think this is what you mean by '-ffp-correct'. This is already implemented by -fno-fast-math on those ports. So, what I think you want to do is to add another flag under -ffast-math, perhaps called -fwiden-math, which specifically allows the compiler to compute values in a wider mode (that would be 80-bit x87 FP) even when ISO C doesn't allow it. You would have this flag on by default on x86.