alexcrichton opened PR #13315 from alexcrichton:aarch64-refactor to bytecodealliance:main:
This commit refactors the aarch64 backend to match the x64 backend with how it handles conditionals. Specifically there's now a "narrow waist" of a
CondResulttype which is used fortrapnz,trapz,select,icmp,brif, andselect_spectre_guard. This means that any lowering optimizations to handle conditionals are equally applied to all of these locations. Notably the smattering of optimizations and implementations across these instructions have all been deduplicated an unified. Codegen oftrap{n,}zis much better than before, and minor optimizations such as testing if an 8-bit value is 0 are now improved across the board. Finally, jumping after comparing a less-than-64-bit value now will use a 32-bit comparison instruction instead of a 64-bit comparison instruction, sometimes eliding the need to extend a 32-bit value to a 64-bit value.During this refactoring the method of comparing 128-bit integers was copied over from the x64 backend as well. This additionally significantly improves codegen over the previous iteration.
The end result is that it should be significantly easier to apply optimizations and bug fixes in the future. For example some float comparison orderings are not yet currently supported in the aarch64 backend, but are supported in the x64 backend, and this paves the way to make it much easier to add support for this feature as only one comparison-generation location need be updated and a small set of do-something-with-a-comparison locations will be specialized to the condition necessary.
<!--
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 #13315.
alexcrichton requested wasmtime-compiler-reviewers for a review on PR #13315.
alexcrichton requested wasmtime-core-reviewers for a review on PR #13315.
alexcrichton updated PR #13315.
alexcrichton updated PR #13315.
github-actions[bot] added the label cranelift on PR #13315.
github-actions[bot] added the label cranelift:area:aarch64 on PR #13315.
:thumbs_up: cfallin submitted PR review:
Looks great -- thanks!
cfallin added PR #13315 aarch64: Simplify and improve handling of conditionals to the merge queue.
github-merge-queue[bot] removed PR #13315 aarch64: Simplify and improve handling of conditionals from the merge queue.
alexcrichton added PR #13315 aarch64: Simplify and improve handling of conditionals to the merge queue.
:check: alexcrichton merged PR #13315.
alexcrichton removed PR #13315 aarch64: Simplify and improve handling of conditionals from the merge queue.
Last updated: Jun 01 2026 at 09:49 UTC