bongjunj opened PR #13237 from bongjunj:fix-13229 to bytecodealliance:main:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->Cause 1
bitops such as
band,bor, ... are not constrained to receive only integer inputs likeiadd,isub, andicmp.
The IR builder shows this fact:
- https://docs.rs/cranelift-codegen/latest/cranelift_codegen/ir/trait.InstBuilder.html#method.band
- https://docs.rs/cranelift-codegen/latest/cranelift_codegen/ir/trait.InstBuilder.html#method.iadd
Note that there is no float input for
iadd, whereasbandcan take float inputs.Cause 2
iconst_sandiconst_uprovide convenient ways to construct constants on RHS, but they are the main contract breaker of ISLE type system. They are declared as non-partial terms, while their definition is not total. They only work for integer and vec128 types and this is why we need type guards to use them. This fact is not explicitly encoded in the declaration of the terms. I guess this is not a proper way to use ISLE, since we cannot trust the ISLE compiler and the ISLE ruleset in this way... But, to fix this, I guess we need more discussions that could easily go out of the scope of fix, so I want to leave this as a future work.Fix
- I added
ty_iconstpartial extractor which rules constructing terms withiconst_sandiconst_ucan safely use.- The widened rules with bitops in #13199 are now guarded with
ty_iconst.- The reported regression case is added, which tests a float input for
bandterm.
bongjunj requested alexcrichton for a review on PR #13237.
bongjunj requested wasmtime-compiler-reviewers for a review on PR #13237.
bongjunj edited PR #13237:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->This resolves #13229
Cause 1
bitops such as
band,bor, ... are not constrained to receive only integer inputs likeiadd,isub, andicmp.
The IR builder shows this fact:
- https://docs.rs/cranelift-codegen/latest/cranelift_codegen/ir/trait.InstBuilder.html#method.band
- https://docs.rs/cranelift-codegen/latest/cranelift_codegen/ir/trait.InstBuilder.html#method.iadd
Note that there is no float input for
iadd, whereasbandcan take float inputs.Cause 2
iconst_sandiconst_uprovide convenient ways to construct constants on RHS, but they are the main contract breaker of ISLE type system. They are declared as non-partial terms, while their definition is not total. They only work for integer and vec128 types and this is why we need type guards to use them. This fact is not explicitly encoded in the declaration of the terms. I guess this is not a proper way to use ISLE, since we cannot trust the ISLE compiler and the ISLE ruleset in this way... But, to fix this, I guess we need more discussions that could easily go out of the scope of fix, so I want to leave this as a future work.Fix
- I added
ty_iconstpartial extractor which rules constructing terms withiconst_sandiconst_ucan safely use.- The widened rules with bitops in #13199 are now guarded with
ty_iconst.- The reported regression case is added, which tests a float input for
bandterm.
github-actions[bot] added the label cranelift on PR #13237.
github-actions[bot] added the label isle on PR #13237.
github-actions[bot] commented on PR #13237:
Subscribe to Label Action
cc @cfallin, @fitzgen
<details>
This issue or pull request has been labeled: "cranelift", "isle"Thus the following users have been cc'd because of the following labels:
- cfallin: isle
- fitzgen: isle
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
:thumbs_up: alexcrichton submitted PR review:
Thanks! To bikeshed this a bit, maybe
ty_int_or_vec128? The namety_iconstcan make sense in retrospect once it's understood what it does but just by reading it it's not clear.Another possibility is
ty_int_lanebecause in Cranelift I believe all types are considered to have lanes, and scalars just have one lane
Last updated: May 03 2026 at 22:13 UTC