[PATCH] D83473: libclc: Fix FP_ILOGBNAN definition

Boris Brezillon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 11:55:25 PDT 2020


bbrezillon added a comment.

>>> The implementation now returns `FP_ILOGBNAN` even for `Inf` input, which is not correct.
>> 
>> Hm, nope, it still returns `0x7fffffff`, which is `INT_MAX`. I think you're referring to my comment, where I'm emitting the idea of merging the 2 tests into a single one since `FP_ILOGBNAN` is now also equal to `INT_MAX`, but as mentioned there, I think clarity prevails over optimization (especially since clang might optimize that for us anyway).
> 
> It doesn't matter if the value is in hex or decimal or a define, The results of `ilogb(Inf)` and `ilogb(NaN)` is now indistinguishable to the caller.
>  The spec is rather clear that the value of `FP_ILOGBNAN` shall be returned only if the input is NaN.

Hm, can you point me to the portion of the spec where this is stated? If there's such a rule stating that `FP_ILOGBNAN` should be unique, the current implementation is wrong since both `FP_ILOGBNAN` and `FP_ILOGB0` map to the same value.


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