[llvm-dev] Should NaN payloads be preserved through compilation?

Thomas Lively via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 9 14:04:11 PST 2018


Hi everyone,

The WebAssembly backend recently had Bug 39448
<https://bugs.llvm.org/show_bug.cgi?id=39448> filed against it because NaN
payloads in floating-point immediates are not preserved through compilation
on 32-bit builds. I took a look and the corruption takes place when the
immediates are converted from APFloats to be stored as native doubles in
MCOperand. I assume this bug only appears in 32-bit builds because they are
using x87 doubles that happen to not preserve all possible NaN payloads.

There are two things we could do here: Change MCOperand to not store
floating point immediates as native doubles, or explicitly accept that NaN
payloads in immediates will not necessarily be preserved through
compilation.

The ability to have custom NaN payloads in immediates could be useful to
the WebAssembly community, but if the consensus is that LLVM should not
guarantee their preservation, that's fine too. What do you think?

Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181109/50c738b2/attachment.html>


More information about the llvm-dev mailing list