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

Ralf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 11 10:09:17 PST 2022


RalfJung added a comment.

> the signbit of NAN is never meaningful in real code,

This is the statement I am still objecting to. It *is* meaningful in the sense that (a) code can look at it if it wants, and (b) some operations guarantee to treat it in a particular way (in particular, `float Y = true ? X1 : X2;` guarantees that `Y` has the same signbit as `X1`).

The signbit is never meaningful in code that only treats float values as approximation to mathematical real numbers, but LLVM must work on other code, too. For that reason I think the mindset of "it is not meaningful but ..." is confusing, and easily leads to misunderstandings and bugs such as the one this change is fixing.


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

https://reviews.llvm.org/D139785



More information about the llvm-commits mailing list