Conversation
myunbin
force-pushed
the
add-rules-261001
branch
from
October 1, 2026 08:36
4aae02a to
1e882a2
Compare
myunbin
force-pushed
the
add-rules-261001
branch
from
October 1, 2026 08:47
1aa545d to
06d964f
Compare
Subscribe to Label Actioncc @avanhatt, @cfallin, @fitzgen, @mmcloughlin DetailsThis issue or pull request has been labeled: "cranelift", "isle"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
cfallin
approved these changes
Oct 1, 2026
cfallin
left a comment
Member
There was a problem hiding this comment.
These all look fine overall, thanks! Just one nit below.
| (rule (simplify (isub (fits_in_64 ty) x (band ty x (iconst ty y)))) | ||
| (band ty (iconst ty (imm64_not ty y)) x)) | ||
|
|
||
| ;; (x + C1) - (y + C2) --> (C1 - C2) + (x - y). |
Member
There was a problem hiding this comment.
Let's put the constant on the right of the + in the RHS of the rewrite (so (x - y) + (C1 - C2)) -- this is the direction in which we canonicalize constants in general and should play better with other const-folding rules.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add new mid-end opt rules:
x - (x & M) ==> x & ~M(x - (y & M)) + y ==> (y & ~M) + x(x + y) - (x & M) ==> (x & ~M) + y((1 << k) + 1) * y ==> (y << k) + y(x + C1) - (y + C2) ==> (C1 - C2) + (x - y)and related add/sub formsuextend(x) == 0 ==> x == 0uextend(x) == uextend(y) ==> x == y(x == y) ^ 1 ==> x != yx >u (x - 1) ==> x != 0, and its dual(<u)(c ? x : y) + (c ? p : q) ==> c ? (x + p) : (y + q)(c ? C1 : C2) & M ==> c ? (C1 & M) : (C2 & M)(x == 0) ? y : (x + y) ==> y + x, and its dual (!=)(c ? C1 : C2) << K ==> c ? (C1 << K) : (C2 << K)Thanks!