[PATCH] D151934: InstCombine: Recognize fneg when performed as bitcasted integer

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 15:00:36 PDT 2023


arsenm added a comment.

In D151934#4388968 <https://reviews.llvm.org/D151934#4388968>, @efriedma wrote:

> In general, we need to be careful introducing floating-point values where the don't otherwise exist, for a couple reasons.  One, loading a value into an x87 floating-point register can quiet SNaNs.  And two, certain compiler options obligate us to avoid floating-point code.  That said, if the source value is already floating-point, it should be fine to introduce floating-point operations on it, I think.

fneg is defined as a bitwise operation. It's not a real FP operation, it's a bitwise operation on FP types. It's only permitted to change the sign bit. If x87 decided to quiet an snan in the fneg implementation, the lowering is broken. All concerns about floating-pointness and fast math should be gone since fsub is no longer involved.


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

https://reviews.llvm.org/D151934



More information about the llvm-commits mailing list