myunbin opened PR #14464 from myunbin:add-rules-261001 to bytecodealliance:main:
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!
myunbin requested cfallin for a review on PR #14464.
myunbin requested wasmtime-compiler-reviewers for a review on PR #14464.
myunbin requested wasmtime-core-reviewers for a review on PR #14464.
myunbin updated PR #14464.
myunbin updated PR #14464.
myunbin updated PR #14464.
myunbin updated PR #14464.
github-actions[bot] added the label cranelift on PR #14464.
github-actions[bot] added the label isle on PR #14464.
github-actions[bot] commented on PR #14464:
Subscribe to Label Action
cc @avanhatt, @cfallin, @fitzgen, @mmcloughlin
<details>
This issue or pull request has been labeled: "cranelift", "isle"Thus the following users have been cc'd because of the following labels:
- avanhatt: isle
- cfallin: isle
- fitzgen: isle
- mmcloughlin: isle
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
:thumbs_up: cfallin submitted PR review:
These all look fine overall, thanks! Just one nit below.
:speech_balloon: cfallin created PR review 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.
myunbin updated PR #14464.
:memo: myunbin submitted PR review.
:speech_balloon: myunbin created PR review comment:
@cfallin sorry for the late response. I've updated this and relevant rules.
:thumbs_up: cfallin submitted PR review.
cfallin added PR #14464 Cranelift: add mid-end opt rules to the merge queue.
github-merge-queue[bot] removed PR #14464 Cranelift: add mid-end opt rules from the merge queue.
alexcrichton added PR #14464 Cranelift: add mid-end opt rules to the merge queue.
:check: alexcrichton merged PR #14464.
alexcrichton removed PR #14464 Cranelift: add mid-end opt rules from the merge queue.
Last updated: Oct 11 2026 at 04:10 UTC