-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SelectionDAG] Avoid one comparison when legalizing fmaximum #142732
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
Conversation
When ordering signed zero, only check the sign of one of the values. We already know at this point that both values must be +/-0.0, so it is sufficient to check one of them to correctly order them.
@llvm/pr-subscribers-backend-powerpc @llvm/pr-subscribers-backend-nvptx Author: Nikita Popov (nikic) ChangesWhen ordering signed zero, only check the sign of one of the values. We already know at this point that both values must be +/-0.0, so it is sufficient to check one of them to correctly order them. For example, for fmaximum, if we know LHS is Patch is 99.26 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/142732.diff 9 Files Affected:
|
Isn't it just one of them that must be +/-0.0? We only know that the other value is smaller (max)/bigger (min) than 0.
If we were actually checking the sign this would work, but we compare equality with integer 0. |
You are right. I've reverted this for now. |
…2732) When ordering signed zero, only check the sign of one of the values. We already know at this point that both values must be +/-0.0, so it is sufficient to check one of them to correctly order them. For example, for fmaximum, if we know LHS is `+0.0` then we can always select LHS, value of RHS does not matter. If LHS is `-0.0` we can always select RHS, value of RHS doesn't matter.
…lvm#142732)" This reverts commit 54da543. I made a logic error here with the assumption that both values are known to be +/-0.0.
…2732) When ordering signed zero, only check the sign of one of the values. We already know at this point that both values must be +/-0.0, so it is sufficient to check one of them to correctly order them. For example, for fmaximum, if we know LHS is `+0.0` then we can always select LHS, value of RHS does not matter. If LHS is `-0.0` we can always select RHS, value of RHS doesn't matter.
…lvm#142732)" This reverts commit 54da543. I made a logic error here with the assumption that both values are known to be +/-0.0.
When ordering signed zero, only check the sign of one of the values. We already know at this point that both values must be +/-0.0, so it is sufficient to check one of them to correctly order them.
For example, for fmaximum, if we know LHS is
+0.0
then we can always select LHS, value of RHS does not matter. If LHS is-0.0
we can always select RHS, value of RHS doesn't matter.