[PATCH] D50913: [FPEnv] Don't need copysign/fabs/fneg constrained intrinsics

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 23 13:12:59 PDT 2018


arsenm added a comment.

In https://reviews.llvm.org/D50913#1211368, @andrew.w.kaylor wrote:

> In https://reviews.llvm.org/D50913#1209179, @cameron.mcinally wrote:
>
> >
>




>> I am not against introducing a first class fneg instruction, but I do want to point out that even if we do so the lack of trapping behavior cannot be part of the definition of the instruction. Or rather that fact won't distinguish it from other FP instructions because the LLVM language reference explicitly states that all FP instructions are assumed to have no side effects. So there is no reason for the optimizer to preserve this non-trapping property in the abscence of constrained intrinsics.
> 
> Your argument here is compelling. If there's no guarantee that an FSUB and FNEG are disjoint, then this won't work. Although, an FSUB and FNEG aren't really the same operation. Perhaps we should only be doing the transformation under UnsafeMath conditions to begin with...

This is more a question of lowering and not an IR semantics question. The fneg will be defined as having no side effects or trapping. If through some architectural specific quirk the expected instructions need something more to avoid this, then that is their issue to deal with. Since it should always be impleentable with bitwise operations, this shouldn't be an issue


Repository:
  rL LLVM

https://reviews.llvm.org/D50913





More information about the llvm-commits mailing list