gccoptimizationfloating-point

What are the optimizations facilitated by -ffinite-math-only?


All the info I can find in documentation and the web for -ffinite-math-only is "Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs or +-Infs." This does not seem forthcoming to me. Does anyone know exactly what those optimizations are?


Solution

  • Lots of little things can be optimized under that assumption, like:

    You often see this assumption together with assumptions like "sign of zero doesn't matter", which then allows things like: