-
Notifications
You must be signed in to change notification settings - Fork 235
Open
Labels
Description
This was brought up in #780 (comment).
-ffast-math is shorthand for several flags:
-fno-math-errno(we decided in build: add -fno-math-errno to allow inlining of math functions #780 that we definitely want this)-funsafe-math-optimizations, which is shorthand for:-fno-signed-zeros(probably fine?)-fno-trapping-math(unclear what this would mean for us?)-fassociative-math(unsure)-freciprocal-math(unsure)
-ffinite-math-only(we have a coupleisnans; not sure if this is safe wrt those?)-fno-rounding-math(this is actually the default anyway?)-fno-signaling-nans(this is also the default)-fcx-limited-range(we don't use complex numbers)-fexcess-precision=fast(this is the default)
So this leaves -fno-signed-zeros, -fno-trapping-math, -fassociative-math, -freciprocal-math, and -ffinite-math-only up for discussion. One simple test would be to build with and without each flag, and see what code changes and what perf impact they have.
I think if we have cases where -fassociative-math or -freciprocal-math help (and are safe), we should probably be explicitly adjusting our floating-point code to allow the compiler to produce optimal output even without those flags.