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

All the information I can find in the documentation and on the Internet for -ffinite-math-only is "Allow optimizations for floating point arithmetic, which assume that the arguments and results are not NaN or + -Infs." I don’t think so. Does anyone know exactly what optimization is? Thanks

+5
source share
1 answer

Under this assumption, many small things can be optimized, for example:

  • x == x1
  • x * 1x
  • x >= y!(x < y)and the like.
  • x/x1if the compiler can prove it x != 0.
  • it can allow the compiler to use the hardware max / min commands for type expressions x > y ? x : y.
  • ...

, " ", , :

  • x - x0
  • 0 / x0
  • x * 00
+8

All Articles