[PATCH] D142907: LangRef: Add "dynamic" option to "denormal-fp-math"

Andy Kaylor via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 10 12:43:40 PST 2023


andrew.w.kaylor added a comment.

In general, it seems like the denormal mode should be considered part of the floating point environment (though as far as I know the C standard, at least, doesn't document it as such). If it were considered part of the floating point environment, the LLVM rules would tell us we could assume the default setting, which I'd assume to be IEEE, and it would only be legal to change this mode in strict mode. However, for your use case preserving the behavior of fpclass seems like what users would want, even in fast-math modes. In this sense, this is a lot like the problem we have with preserving isnan() behavior when fast-math is enabled. Our rules allow it, but it's not what most people would want.

I think the new denormal mode is a good addition.

Do you need to do something with the inliner to handle the case where functions with different denormal modes are inlined into one another? We don't seem to handle that case correctly now (https://godbolt.org/z/PEsWaMEq6), but with the dynamic mode we could handle it without blocking inlining completely.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142907/new/

https://reviews.llvm.org/D142907



More information about the cfe-commits mailing list