This is an archive of the discontinued LLVM Phabricator instance.

LangRef: Clarify behavior of llvm.is.fpclass with "denormal-fp-math"
ClosedPublic

Authored by arsenm on Jan 5 2023, 7:36 AM.

Details

Summary

This does not read canonicalized values, which matches the behavior of
the basic DAG expansion using integer operations. There is a buggy
expansion using FP-operations if legal which needs to be adjusted to
account for this. We need to be aware of the denormal mode to switch
between is.fpclass calls and fcmp.

There's no real spec for denormal handling anywhere, but I believe
this is the most harmonious way to deal with the question considering
the requirement to not quiet input signaling nans.

This matches the behavior of MSVC's _fpclass and AMDGPU's
v_cmp_class_f32. fpclassify currently does not use this, and has
inconsistent behavior for denormals under DAZ on different platforms
(i.e. clang and gcc report FP_ZERO return FP_ZERO for a denormal under
DAZ, MSVC reports FP_SUBNORMAL).

Diff Detail

Event Timeline

arsenm created this revision.Jan 5 2023, 7:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2023, 7:36 AM
arsenm requested review of this revision.Jan 5 2023, 7:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2023, 7:36 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm updated this revision to Diff 486577.Jan 5 2023, 7:37 AM

Attach correct patch

jcranmer-intel added inline comments.Jan 13 2023, 1:39 PM
llvm/docs/LangRef.rst
24885–24886

"The function does not read canonicalized values" is a phrase which took me a few tries to understand what was meant. Maybe something like "The function does not canonicalize its input value" would make more sense?

arsenm updated this revision to Diff 489353.Jan 15 2023, 6:18 AM
arsenm marked an inline comment as done.

Rephrase

jcranmer-intel accepted this revision.Feb 3 2023, 1:20 PM
This revision is now accepted and ready to land.Feb 3 2023, 1:20 PM