rahulchaphalkar opened PR #10836 from rahulchaphalkar:compare-instructions-rebase to bytecodealliance:main:
Implement
compareinstructions.
ImplementEflagslogic for DSL and wire up isle rules to set flags when appropriate.
rahulchaphalkar requested abrown for a review on PR #10836.
rahulchaphalkar requested wasmtime-compiler-reviewers for a review on PR #10836.
rahulchaphalkar updated PR #10836.
github-actions[bot] commented on PR #10836:
Subscribe to Label Action
cc @saulecabrera
<details>
This issue or pull request has been labeled: "cranelift", "cranelift:area:x64", "cranelift:meta", "winch"Thus the following users have been cc'd because of the following labels:
- saulecabrera: winch
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
rahulchaphalkar updated PR #10836.
rahulchaphalkar updated PR #10836.
rahulchaphalkar updated PR #10836.
abrown assigned abrown to PR #10836.
abrown submitted PR review.
abrown created PR review comment:
I propose we just name this
Eflagsand then write documentation explaining why this is needed, what it models, and where this might head in the future (i.e., we might want to start modeling individual flag bits). It might also be good to link to https://github.com/bytecodealliance/wasmtime/issues/10298.
abrown created PR review comment:
I'm not a big fan of this; the
lock_stuff below already seemed unfortunate but now this opens a whole new can of worms. There are a few other instructions that probably are in the same situation, notably jumps, so a better overall solution seems like a good idea.In a separate PR, we could:
- give
dsl::Insta way to specify an externalto_stringfunction- here we just say, "if an instruction has special pretty-printing, simply emit that function call"
- then we define that function up at the assembler level, where it's easier to inspect, test, etc.
Perhaps we merge this as-is and refactor later. But we could try the "custom printing" idea prior to this merging and rebase on it. I'm open to either, I just think we should think through a better long-term solution. Thoughts?
abrown created PR review comment:
Do we end up using this?
abrown created PR review comment:
We don't end up lowering to these instructions yet, right? If so, a simplification here could be to keep these instructions out of this PR and add them in once we can do the ISLE conversions at the same time. (I mean, we could also leave them in this PR since we know we'll eventually use them, I'm just flagging that they're not yet used).
abrown created PR review comment:
Shouldn't we be setting
flagsfor all of these?
abrown created PR review comment:
Like we were talking about in the Cranelift meeting, I think we want to reduce these methods hanging off of
Inst. We can probably just fit into the existingmatch sizeabove, but if that doesn't work, I also started using this pattern:
rahulchaphalkar updated PR #10836 (assigned to abrown).
abrown created PR review comment:
Ok, let's leave this as-is for now but we'll need to refactor to something more like the
customlogic introduced by @alexcrichton in https://github.com/bytecodealliance/wasmtime/pull/10887.
abrown submitted PR review:
I think this makes sense; the only remaining refactoring is to unwrap some unnecessary
Inst::*code and then this should be good-to-go.
abrown created PR review comment:
How about this to match the others?
asm::inst::ucomiss_a::new(dst, lhs).into(),
rahulchaphalkar created PR review comment:
Hey, I agree with the idea that lets push the external printing patch first, and then rebase on that. So we can leave this PR open for a bit until I push the other PR, I'll take a look at at https://github.com/bytecodealliance/wasmtime/pull/10887
rahulchaphalkar submitted PR review.
rahulchaphalkar submitted PR review.
rahulchaphalkar created PR review comment:
Removed
rahulchaphalkar submitted PR review.
rahulchaphalkar created PR review comment:
Yes, removed these instructions for now since they weren't lowered
rahulchaphalkar submitted PR review.
rahulchaphalkar created PR review comment:
It needs type annotation, I don't know why only for these couple of instructions rust is unable to infer type, so was having issues with using Into even with types. I can retry with
intowith type annotations, but it still won't match exactly.
rahulchaphalkar updated PR #10836 (assigned to abrown).
rahulchaphalkar updated PR #10836 (assigned to abrown).
rahulchaphalkar commented on PR #10836:
@abrown
I have rebased this on theCustomlogic PR as well as latest main.
For compare instructions, we need to change operands as well (remove the immediate) as well as change name, so now we are passingordered_opsstring tocustom::Displayfunctions, which returns a concatenated string containingnameandordered_ops.
rahulchaphalkar updated PR #10836 (assigned to abrown).
abrown created PR review comment:
Do you need help with this part?
abrown submitted PR review.
abrown created PR review comment:
It seems like in the end we probably just want this to be:
pub fn cmppd_a<R: Registers>(f: &mut std::fmt::Formatter, inst: &inst::cmppd_a<R>) -> std::fmt::Result {The problem with that is that then we have to list out the operands of each instruction in order, so I guess we can go with this for now.
rahulchaphalkar updated PR #10836 (assigned to abrown).
rahulchaphalkar updated PR #10836 (assigned to abrown).
rahulchaphalkar submitted PR review.
rahulchaphalkar created PR review comment:
Done
rahulchaphalkar created PR review comment:
Got it, will push those changes to a later PR.
rahulchaphalkar submitted PR review.
abrown submitted PR review:
LGTM! I think the one last thing we'll want to clean up the
ordered_opsbits once https://github.com/bytecodealliance/wasmtime/pull/11017 is merged.
abrown submitted PR review:
LGTM! I think the one last thing we'll want is to clean up the
ordered_opsbits once https://github.com/bytecodealliance/wasmtime/pull/11017 is merged.
rahulchaphalkar updated PR #10836 (assigned to abrown).
rahulchaphalkar commented on PR #10836:
@abrown ok i have rebased and pushed with changes, CI still running.
rahulchaphalkar updated PR #10836 (assigned to abrown).
rahulchaphalkar updated PR #10836 (assigned to abrown).
rahulchaphalkar updated PR #10836 (assigned to abrown).
rahulchaphalkar updated PR #10836 (assigned to abrown).
abrown has enabled auto merge for PR #10836.
abrown merged PR #10836.
Last updated: Dec 06 2025 at 06:05 UTC