[PATCH] D139785: [InstCombine] preserve signbit semantics of NAN with fold to fabs

Ralf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 21 09:36:52 PST 2022


RalfJung added a comment.

> How was X initialized/observed with -NaN? Testing for bit-equality requires casting to integer. There's no way to do that comparison with FP values?

Yes, this assumes we can convert between float and i32 freely, and non-poison/undef values are preserved perfectly with all their bits when doing that. If this is not true, the LangRef surely must contain big fat warnings about that, and I doubt Rust would be the only frontend that would be broken badly by such a decision.

> Note that we also don't guarantee that NaN payload bits propagate. That part is less well-specified in IEEE-754, so maybe it's less controversial?

They do propagate perfectly in copy, copysign, fneg, fabs according to IEEE, is my understanding.


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

https://reviews.llvm.org/D139785



More information about the llvm-commits mailing list