[PATCH] D83473: libclc: Fix FP_ILOGBNAN definition

Boris Brezillon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 11 02:16:05 PDT 2020


bbrezillon added a comment.

>> Note that LLVM internally uses `INT_MIN + 1 (-INT_MAX)` for `ilogb(0)`, `INT_MIN` for `ilogb(NaN)` and `INT_MAX` for `ilogb(Inf)` [0]. This means that any optimization handling these constants and ilogb operation would be incorrect in LLVM.
> 
> Hm, don't you have the same problem when such optimizations happen and the binary is linked with a libc that has different definitions for those values?

I had a quick look, and it seems that `ilogb()` results are never returned directly. All callers seem to compare the result to the `IEK_xxx` defs and handle the `Inf`, `NaN` and `Zero` properly or check the arg value before passing it to `ilogb()`, so I don't think this mismatch is an issue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83473





More information about the llvm-commits mailing list