[PATCH] D88238: [APFloat] convert SNaN to QNaN in convert() and raise Invalid signal

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 09:16:24 PDT 2020


spatel created this revision.
spatel added reviewers: rjmccall, efriedma, scanon.
Herald added subscribers: kerbowa, dexonsmith, hiraditya, nhaehnle, jvesely, mcrosier.
Herald added a project: LLVM.
spatel requested review of this revision.

This is an alternate fix (see D87835 <https://reviews.llvm.org/D87835>) for a bug where a NaN constant gets wrongly transformed into Infinity via truncation.
In this patch, we uniformly convert any SNaN to QNaN while raising 'invalid op'.
But we don't have (AFAIK), a way to specify a 32-bit SNaN value in LLVM IR, so those are always encoded/decoded by calling convert from/to 64-bit hex.
That causes changes in some IR tests and some Clang tests. I don't know the background on those, so I'm not sure how we would proceed from here.


https://reviews.llvm.org/D88238

Files:
  llvm/lib/Support/APFloat.cpp
  llvm/test/Transforms/InstCombine/AMDGPU/ldexp.ll
  llvm/test/Transforms/InstSimplify/ConstProp/cast.ll
  llvm/test/Transforms/InstSimplify/fp-nan.ll
  llvm/test/Transforms/PhaseOrdering/X86/nancvt.ll
  llvm/unittests/ADT/APFloatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88238.294081.patch
Type: text/x-patch
Size: 8151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200924/515a7aa1/attachment.bin>


More information about the llvm-commits mailing list