Hacker News new | ask | show | jobs
by physicsguy 1686 days ago
You can do that on a per-compiler basis for e.g. with

#pragma GCC optimize(“fast-math")

1 comments

Hopefully it still works as an attribute but my point is that you can (say) opt in to allowing more liberal use of FMA without (say) opting in to aggressive NaN assumptions
GCC attributes give you per-function control over both target and optimization options (unfortunately not with Fortran). I'd have to look up what's available, but some per-loop control is possible with OpenMP pragmas too (perhaps with GCC's -fopenmp-simd if you don't want the threading).
Fast math is a collection of optimisations, you can enable them individually. You just have to look up what the appropriate ones are
As I have said above the whole point I am making is that you want to turn a set of them on for only one function.
You can, that is exactly what the pragma allows you to do?