alexcrichton opened PR #13347 from alexcrichton:refactor-riscv-traps to bytecodealliance:main:
- Change
TrapIfto take anIntegerComparestructure- Simplify
trapnzandtrapzlowerings- Canonicalize on a single
gen_trapifhelperThis fixes a minor issue as well where the previous lowering of
trapnzandtrapzforgot to extend <64-bit values to the full register width for a comparison against zero.<!--
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 cfallin for a review on PR #13347.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #13347.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13347.
:thumbs_up: cfallin submitted PR review:
Thanks!
:speech_balloon: cfallin created PR review comment:
These new sign-extensions are unfortunate; any way we can avoid them?
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Some of these are miscompiles being fixed from before because
trapnzlooked like:(rule (lower (trapnz value @ (value_type (fits_in_64 _)) code)) (gen_trapnz value code)) (decl gen_trapnz (XReg TrapCode) InstOutput) (rule (gen_trapnz test trap_code) (gen_trapif (IntCC.NotEqual) test (zero_reg) trap_code))which failed to sign-extend the
valueto the full register width for <64-bit values.Otherwise though it's a similar situation to the x64 backend where there's a predicate for "is this
Valuealready sign-extended" and it's filled in for some patterns. It's missing a pattern which will help a little, but I think in general, no, I don't think conditions like this one highlighted here can be removed
alexcrichton added PR #13347 riscv64: Refactor comparison-related rules to the merge queue.
:check: alexcrichton merged PR #13347.
alexcrichton removed PR #13347 riscv64: Refactor comparison-related rules from the merge queue.
Last updated: Jun 01 2026 at 09:49 UTC