[PATCH] D139316: ValueTracking: Teach isKnownNeverInfinity about rounding intrinsics

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 21:36:23 PST 2022


sepavloff requested changes to this revision.
sepavloff added a comment.
This revision now requires changes to proceed.

In D139316#3985122 <https://reviews.llvm.org/D139316#3985122>, @jcranmer-intel wrote:

> In D139316#3984954 <https://reviews.llvm.org/D139316#3984954>, @sepavloff wrote:
>
>> PPC uses double double encoding (https://en.wikipedia.org/wiki/Quadruple-precision_floating-point_format), in which a number is represented by a sum of two double precision numbers, where the second just keeps additional mantissa bits. Total number of mantissa bits in ppc_fp128 is about 107 bits. Exponent range is the same as for double numbers: 2^-1022 to 2^1023. So large numbers (above 2^108) are always integers, they do not need rounding and the result of ceil, floor etc is the argument.
>
> My understanding here is that the number of mantissa bits is effectively dynamic, since you could combine a large exponent (e.g., 2^1023) in the first number and a tiny exponent (e.g., 2^-50) in the second one, and all the mantissa bits in the middle would be implied 0. But I have no actual practical experience with `ppc_fp128`, and documentation for these kinds of things isn't great.

It seems you are right. What I spoke about is actually the case of `semPPCDoubleDoubleLegacy`, which indeed has 106 bits of mantissa. So only `Intrinsic::trunc` works as expected for all FP formats, for other rounding functions we should check if the semantics is not `semPPCDoubleDouble`.


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

https://reviews.llvm.org/D139316



More information about the llvm-commits mailing list