[PATCH] D104854: Introduce intrinsic llvm.isnan

Kevin P. Neal via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 20 10:30:22 PDT 2021


kpn added a comment.

In D104854#2957490 <https://reviews.llvm.org/D104854#2957490>, @lebedev.ri wrote:

> In D104854#2957471 <https://reviews.llvm.org/D104854#2957471>, @sepavloff wrote:
>
>> In D104854#2957423 <https://reviews.llvm.org/D104854#2957423>, @spatel wrote:
>>
>>> Is it intentional that we are not canonicalizing the intrinsic call back to `fcmp uno` in the default FP environment?
>>
>> It is lowered to unordered comparison by default. Changing `llvm.isnan` to  `fcmp uno` somewhere in IR would make it possible to optimize out the latter if fast-math mode is on. Preserving semantics of `isnan` when fast-math is in effect was one of the goals of this change.
>
> Eeek. Was there an RFC about this?
> This does not sound good to me at all,
> much like "let's not apply fast-math flags to x86 vector intrinsics".

We can switch into and out of the default FP environment inside a single function. If we want different behavior based on the FP environment then this should be a constrained intrinsic. Then the intrinsic would know the FP environment, or at least enough about it to know if traps and FP status bits are relevant.

I think the distinction is constrained vs non-constrained because FMF can optionally be used in both cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104854



More information about the cfe-commits mailing list