-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Revert "LangRef: Clarify llvm.minnum and llvm.maxnum about sNaN and signed zero (#112852)" #168838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17290,7 +17290,7 @@ versions of the intrinsics respect the exception behavior. | |||||
| - qNaN, invalid exception | ||||||
|
|
||||||
| * - ``+0.0 vs -0.0`` | ||||||
| - +0.0(max)/-0.0(min) | ||||||
| - either one | ||||||
| - +0.0(max)/-0.0(min) | ||||||
| - +0.0(max)/-0.0(min) | ||||||
|
|
||||||
|
|
@@ -17334,30 +17334,21 @@ type. | |||||
|
|
||||||
| Semantics: | ||||||
| """""""""" | ||||||
| Follows the semantics of minNum in IEEE-754-2008, except that -0.0 < +0.0 for the purposes | ||||||
| of this intrinsic. As for signaling NaNs, per the minNum semantics, if either operand is sNaN, | ||||||
| the result is qNaN. This matches the recommended behavior for the libm | ||||||
| function ``fmin``, although not all implementations have implemented these recommended behaviors. | ||||||
|
|
||||||
| If either operand is a qNaN, returns the other non-NaN operand. Returns NaN only if both operands are | ||||||
| NaN or if either operand is sNaN. Note that arithmetic on an sNaN doesn't consistently produce a qNaN, | ||||||
| so arithmetic feeding into a minnum can produce inconsistent results. For example, | ||||||
| ``minnum(fadd(sNaN, -0.0), 1.0)`` can produce qNaN or 1.0 depending on whether ``fadd`` is folded. | ||||||
|
|
||||||
| IEEE-754-2008 defines minNum, and it was removed in IEEE-754-2019. As the replacement, IEEE-754-2019 | ||||||
| defines :ref:`minimumNumber <i_minimumnum>`. | ||||||
| Follows the IEEE-754 semantics for minNum, except for handling of | ||||||
| signaling NaNs. This match's the behavior of libm's fmin. | ||||||
|
|
||||||
|
||||||
| signaling NaNs. This match's the behavior of libm's fmin. | |
| signaling NaNs. This matches the behavior of libm's fmin. |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmin(+0.0, -0.0) returns non-deterministic value (either -0.0 or 0.0). | |
| fmin(+0.0, -0.0) non-deterministically returns either operand (-0.0 or 0.0). |
just a grammar fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-introducing this sentence here seems confusing: it's not correct that this "follows the IEEE-754 semantics for minNum, except for handling of signaling NaNs". The handling of signed zeros also does not match IEEE-754 minNum. This is clarified later, but it's not great when the first sentence describing the semantics is contradicted by later sentences.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would
IEEE-754-2008make it more clear?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the old version of the standard allows both outcomes for signed zeros... TIL. Yeah that would help.