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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 14:50:05 PDT 2023


efriedma added a comment.

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.

The other possible issue is the interaction with "UnsafeFPMath" and related CodeGen options.  Fast-math is supposed to be a floating-point thing, but if we transform integer ops into floating-point ops, they effectively apply to integer math.  Which is probably (?) not what the user expects.  (I think fast-math flags on individual instructions should interact correctly, since the "fneg" created by this transform won't have any flags; my concern is with the global flags.)


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

https://reviews.llvm.org/D151934



More information about the llvm-commits mailing list