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

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 23 12:30:13 PDT 2018


andrew.w.kaylor added a comment.

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

> 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...


I think that you are correct. If I'm reading the spec correctly, the relevant cases are fneg(NaN) and fneg(0), so we should only be performing the transformation if the nnan and nsz flags are set.

Regarding the constrained fneg, I guess my biggest argument in favor of having a constrained fneg intrinsic is that it would be confusing (as a human reader of the IR) to see a non-constrained floating point operation amongst constrained operations. On the other hand, I don't think that arguments against having a constrained fneg are terribly compelling either.

Did we decide that fast math flags can't be applied in the presence of constrained operations? Maybe that's my best reason to have a constrained fneg.


Repository:
  rL LLVM

https://reviews.llvm.org/D50913





More information about the llvm-commits mailing list