[PATCH] D104854: Introduce intrinsic llvm.isnan
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 23 03:45:49 PDT 2021
lebedev.ri added a subscriber: hans.
lebedev.ri added a comment.
In D104854#2959680 <https://reviews.llvm.org/D104854#2959680>, @thopre wrote:
> In D104854#2957735 <https://reviews.llvm.org/D104854#2957735>, @kpn wrote:
>
>> 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.
>
> Really? The constrained intrinsic documentation claims the reverse (https://llvm.org/docs/LangRef.html#constrainedfp):
>
>> If any FP operation in a function is constrained then they all must be constrained. This is required for correct LLVM IR. Optimizations that move code around can create miscompiles if mixing of constrained and normal operations is done. The correct way to mix constrained and less constrained operations is to use the rounding mode and exception handling metadata to mark constrained intrinsics as having LLVM’s default behavior.
@sepavloff please can you undo the clang part of this change (+ at hans) and post an RFC to further hash out the design here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104854/new/
https://reviews.llvm.org/D104854
More information about the llvm-commits
mailing list