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

Kevin P. Neal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 06:53:20 PDT 2018


kpn added a comment.

In https://reviews.llvm.org/D50913#1205242, @uweigand wrote:

> In https://reviews.llvm.org/D50913#1204810, @cameron.mcinally wrote:
>
> > I do see that you wrote -0-x. Is there something special about the -0?
>
>
> I understand this is to map -0 to +0 and vice versa.
>
> In https://reviews.llvm.org/D50913#1204826, @cameron.mcinally wrote:
>
> > User writes 0-x:   Frontend maps to constrained FSUB
> >  User writes -x:     Frontend maps to FSUB
>
>
> Yes, exactly.


That does seem fragile. I don't like fragile. I can imagine getting questions from programmers who are having performance issues and we tell them to replace "0-x" with "-x". Or are having correctness issues with +0 vs -0, fix them, and then have traps where they didn't before. We'd need to make sure the SelectionDAG knows about these implicit agreements (and keeps knowing about them) since it does have that FNEG node.

It seems to me that the SelectionDAG needs to be aware of FENV_ACCESS ON when building the SDAG so it doesn't use FNEG when trapping behavior is wanted. Wouldn't that solve the fragility issue in the FENV_ACCESS ON case at least?

I haven't looked into copysign yet. That's on today's menu.


Repository:
  rL LLVM

https://reviews.llvm.org/D50913





More information about the llvm-commits mailing list