[cfe-dev] [llvm-dev] Should isnan be optimized out in fast-math mode?

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 8 13:58:17 PDT 2021


On Wed, Sep 08, 2021 at 06:04:08PM +0000, Chris Tetreault via llvm-dev wrote:
> As a developer (who always reads the docs and generally makes good life
> choices), if I turn on -ffast-math, I want the compiler to produce the
> fastest possible floating point math code possible, floating point
> semantics be darned. Given this viewpoint, my opinion on this topic is
> that the compiler should do whatever it wants, given the constraints of
> the documented behavior of NaN.

There is a huge different between optimisations that assume NaN is not
present and breaking checks for them. I'm not convinced at all that
constant-folding isnan to false will actually speed up real world code.

Joerg


More information about the cfe-dev mailing list