[llvm] d4f38ef - LangRef: Clarify behavior of llvm.is.fpclass with "denormal-fp-math"

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 5 03:02:27 PST 2023


Author: Matt Arsenault
Date: 2023-02-05T07:02:18-04:00
New Revision: d4f38ef288c3a4cf2318182c8585a5c7e760877a

URL: https://github.com/llvm/llvm-project/commit/d4f38ef288c3a4cf2318182c8585a5c7e760877a
DIFF: https://github.com/llvm/llvm-project/commit/d4f38ef288c3a4cf2318182c8585a5c7e760877a.diff

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

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

Added: 
    

Modified: 
    llvm/docs/LangRef.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 87fd65acebfc3..5540de64a8630 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -24969,7 +24969,12 @@ if the element value satisfies the specified test. The argument ``test`` is a
 bit mask where each bit specifies floating-point class to test. For example, the
 value 0x108 makes test for normal value, - bits 3 and 8 in it are set, which
 means that the function returns ``true`` if ``op`` is a positive or negative
-normal value. The function never raises floating-point exceptions.
+normal value. The function never raises floating-point exceptions. The
+function does not canonicalize its input value and does not depend
+on the floating-point environment. If the floating-point environment
+has a zeroing treatment of subnormal input values (such as indicated
+by the ``"denormal-fp-math"`` attribute), a subnormal value will be
+observed (will not be implicitly treated as zero).
 
 
 General Intrinsics


        


More information about the llvm-commits mailing list