diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-08-27 17:40:07 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-08-27 17:40:07 +0000 |
| commit | 937003cf22e48ec07dd7b0e3509e242c91a69cbd (patch) | |
| tree | 14010b4a4e27eb617f9bcb3714c82cac8f582fcd /llvm/docs | |
| parent | a2f095f1a3ef344b879913c2341177f20a49d7c9 (diff) | |
| download | bcm5719-llvm-937003cf22e48ec07dd7b0e3509e242c91a69cbd.tar.gz bcm5719-llvm-937003cf22e48ec07dd7b0e3509e242c91a69cbd.zip | |
LangRef: Clarify expected sNaN behavior for minnum/maxnum
This matches the de-facto behavior based on constant folding
and the default lowering to fmin/fmax.
llvm-svn: 340762
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/LangRef.rst | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index b370e63998a..167a33e7c3d 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -11472,13 +11472,22 @@ type. Semantics: """""""""" -Follows the IEEE-754 semantics for minNum, which also match for libm's -fmin. +Follows the IEEE-754 semantics for minNum, except for handling of +signaling NaNs. This match's the behavior of libm's fmin. If either operand is a NaN, returns the other non-NaN operand. Returns -NaN only if both operands are NaN. If the operands compare equal, -returns a value that compares equal to both operands. This means that -fmin(+/-0.0, +/-0.0) could return either -0.0 or 0.0. +NaN only if both operands are NaN. The returned NaN is always +quiet. If the operands compare equal, returns a value that compares +equal to both operands. This means that fmin(+/-0.0, +/-0.0) could +return either -0.0 or 0.0. + +Unlike the IEEE-754 2008 behavior, this does not distinguish between +signaling and quiet NaN inputs. If a target's implementation follows +the standard and returns a quiet NaN if either input is a signaling +NaN, the intrinsic lowering is responsible for quieting the inputs to +correctly return the non-NaN input (e.g. by using the equivalent of +``llvm.canonicalize``). + '``llvm.maxnum.*``' Intrinsic ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -11513,13 +11522,21 @@ type. Semantics: """""""""" -Follows the IEEE-754 semantics for maxNum, which also match for libm's -fmax. +Follows the IEEE-754 semantics for maxNum except for the handling of +signaling NaNs. This matches the behavior of libm's fmax. If either operand is a NaN, returns the other non-NaN operand. Returns -NaN only if both operands are NaN. If the operands compare equal, -returns a value that compares equal to both operands. This means that -fmax(+/-0.0, +/-0.0) could return either -0.0 or 0.0. +NaN only if both operands are NaN. The returned NaN is always +quiet. If the operands compare equal, returns a value that compares +equal to both operands. This means that fmax(+/-0.0, +/-0.0) could +return either -0.0 or 0.0. + +Unlike the IEEE-754 2008 behavior, this does not distinguish between +signaling and quiet NaN inputs. If a target's implementation follows +the standard and returns a quiet NaN if either input is a signaling +NaN, the intrinsic lowering is responsible for quieting the inputs to +correctly return the non-NaN input (e.g. by using the equivalent of +``llvm.canonicalize``). '``llvm.copysign.*``' Intrinsic ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |

