alexcrichton opened PR #12321 from alexcrichton:fix-shift-bug to bytecodealliance:main:
These failed to account for the edge case of 0/width(type) shifts where the
shldinstruction is no longer applicable. Guards are added to ensure that the shift amounts are both greater than zero.This in theory shouldn't have much practical impact since shift-by-zero and shift-by-type-width are both optimized away in the mid-end. That means that this is only possible to expose with opt-level=0 which may help explain why this went undiscovered for ~1 year.
Closes #12318
<!--
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
-->
alexcrichton requested fitzgen for a review on PR #12321.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #12321.
alexcrichton requested wasmtime-core-reviewers for a review on PR #12321.
cfallin submitted PR review.
alexcrichton updated PR #12321.
alexcrichton commented on PR #12321:
@cfallin mind double-checking the Winch-specific commit I added? Looks like Winch's encoding of shift-by-32 was using the immediate form of the instruction but that's not compatible with AArch64's encoding so it ended up encoding an illegal instruction.
cfallin submitted PR review:
Latest commit to Winch looks fine too!
alexcrichton merged PR #12321.
Last updated: Jan 29 2026 at 13:25 UTC