http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33135
Oleg Endo <olegendo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |olegendo at gcc dot gnu.org --- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-07-15 20:08:49 UTC --- (In reply to comment #0) > The documentation of -ffinite-math-only states > "This option should never be turned on by any '-O' option" > > but for sh's -mieee it is said "the default is set to -ffinite-math-only" > (-mieee is unset by default) > > as a result the -ffinite-math-only is turned on by default for the sh for all > optimisation levels. > > on chapter 2 it was reenforced that: ... "*By default*, it (gcc) will act as > the compiler for a hosted implementation" ... and a conforming hosted > implementation > supports the whole standard. > > So either the documentation is false or infinite float values should be > supported (by default). > The ability to perform optimum floating point code is preserved by explicitly > setting it. The SH -mieee option documentation is wrong. -ffinite-math-only is not enabled by default (maybe it used to be some time ago?). Thus, -mieee is enabled by default (and -mno-ieee has no effect). Moreover, the documentation part "... getting IEEE-conforming results for comparisons of NANs / infinities incurs extra overhead in every floating-point comparison..." is confusing, because this is not what the compiler actually does. If I observe correctly, the only cases where two fcmp instructions are generated are when doing '>=' or '<=' comparisons. I would suggest to make the -mieee option control only the FPU comparisons and not make it change the flag_finite_math_only. Also support for -mno-ieee should be added.