[llvm] specify NaN behavior more precisely (PR #66579)

Ralf Jung via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 01:52:16 PDT 2023


RalfJung wrote:

So, like this?

`fpext`:
> If ``value`` is a NaN, then the result will be a NaN with the same sign, with the quiet/signaling bit non-deterministically either preserved or reset to ``1``, and with the payload non-deterministically being all-zero or the payload of ``value`` extended with trailing (least-significant) zeroes.

`fptruncate`:
> If ``value`` is a NaN, then the result will be a NaN with the same sign, with the quiet/signaling bit non-deterministically either preserved or reset to ``1``, and with the payload non-deterministically being all-zero or the payload of ``value`` truncated by removing the least significant bits.

Though maybe it's easier to just say

`fpext`+`fptruncate`:
> If ``value`` is a NaN, then the result will be a NaN with the same sign, with the quiet/signaling bit non-deterministically either preserved or reset to ``1``, and with the payload non-deterministically chosen.

Or even

`fpext`+`fptruncate`:
> If ``value`` is a NaN, then the result will be a NaN with the quiet/signaling bit non-deterministically either preserved or reset to ``1``, and with the sign and payload non-deterministically chosen.

https://github.com/llvm/llvm-project/pull/66579


More information about the llvm-commits mailing list