diff options
author | Lewis Crawford <lcrawford@nvidia.com> | 2025-09-25 16:19:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-25 16:19:11 +0100 |
commit | 25c0da8b0d004b7b32061691dbac81e854d1f6dd (patch) | |
tree | a79d3dadd8543d16f453ecd9955fbf6687504470 /llvm/unittests/Support/CommandLineTest.cpp | |
parent | ec27c2d340c08f98ffc893e01a60045b7377ebff (diff) | |
download | llvm-25c0da8b0d004b7b32061691dbac81e854d1f6dd.zip llvm-25c0da8b0d004b7b32061691dbac81e854d1f6dd.tar.gz llvm-25c0da8b0d004b7b32061691dbac81e854d1f6dd.tar.bz2 |
[NVPTX] Fix NaN + overflow semantics of f2ll/d2i (#159530)
Fix the NaN-handling semantics of various NVVM intrinsics converting
from fp types to integer types.
Previously in ConstantFolding, NaN inputs would be constant-folded to 0.
However, v9.0 of the PTX spec states that:
In float-to-integer conversions, depending upon conversion types, NaN
input results in following value:
* Zero if source is not `.f64` and destination is not `.s64`, .`u64`.
* Otherwise `1 << (BitWidth(dst) - 1)` corresponding to the value of
`(MAXINT >> 1) + 1` for unsigned type or `MININT` for signed type.
Also, support for constant-folding +/-Inf and values which
overflow/underflow the integer output type has been added (they clamp to
min/max int).
Because of this NaN-handling semantic difference, we also need to
disable transforming several intrinsics to FPToSI/FPToUI, as the LLVM
intstruction will return poison, but the intrinsics have defined
behaviour for these edge-cases like NaN/Inf/overflow.
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
0 files changed, 0 insertions, 0 deletions