Stream: git-wasmtime

Topic: wasmtime / PR #13815 Arm32 thumb2 (Cortex-M) support


view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 00:32):

cpetig opened PR #13815 from cpetig:arm32 to bytecodealliance:main:

This is related to https://github.com/bytecodealliance/wasmtime/issues/1173 (might fix parts of that issue once complete)

The goal is to implement ARM32 thumb2 not the original ARM32 commands of e.g. ARM9 as they have less practical relevance.

This for now is a skeleton to get a newly added arm32 backend compiling. Further work will gradually implement instructions and functionality.

Of course the naming and scope of the architecture can already be discussed here.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 00:45):

cpetig updated PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 01:13):

cpetig updated PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 02:59):

cpetig updated PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 05:55):

github-actions[bot] added the label isle on PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 05:55):

github-actions[bot] added the label cranelift:meta on PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 05:55):

github-actions[bot] added the label cranelift on PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 07:36):

github-actions[bot] commented on PR #13815:

Subscribe to Label Action

cc @cfallin, @fitzgen

<details>
This issue or pull request has been labeled: "cranelift", "cranelift:meta", "isle"

Thus the following users have been cc'd because of the following labels:

To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 08:27):

:memo: bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 04 2026 at 08:27):

:speech_balloon: bjorn3 created PR review comment:

cg_clif would at the very least need the thumb2 (use thumb2 rather than the original thumb) and thumb-mode (actually use thumb rather than arm instructions) settings to match LLVM. And the current backend you wrote should error when either is not set.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 10:41):

:memo: cpetig submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 10:41):

:speech_balloon: cpetig created PR review comment:

I agree about the erroring part, do you have specific names for the flags in mind so that they are more easily compatible with cg_clif?

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 10:55):

:memo: cpetig submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 10:55):

:speech_balloon: cpetig created PR review comment:

I guess other settings are has_fp32, has_fp64, has_dsp, has_cbz, has_it.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 10:59):

:memo: cpetig submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 10:59):

:speech_balloon: cpetig created PR review comment:

I guess this should be "arm32" here, I was unsure which part of the triple this matches to.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 11:43):

:speech_balloon: cpetig edited PR review comment.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 16:35):

cpetig updated PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 16:37):

cpetig updated PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 16:39):

:memo: cpetig submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 16:39):

:speech_balloon: cpetig created PR review comment:

unintentionally included warning fix (newer Rust compiler)

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 16:41):

cpetig updated PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 16:53):

cpetig commented on PR #13815:

I re-read all the included code, simplified use statements and removed accidental file edits on other architectures (warning fixes for unused use something::*;)

I think this would be a good initial minimal discussion point. I admit that the ABI implementation is more complex than it would need to be for a minimal inclusion (prepared for i64 arguments and results), but also less complex than it will need to become (floating point arguments (hardware float in Sx registers) aren't handled, yet). I can shrink it to the bare minimum if needed.

I really would like to do more realistic tests for this new architecture as well. But as far as I understand runtime tests are restricted to the architecture they are built on, qemu-user is not an option, yet. Any recommendations? [I was toying with the idea of rustc_codegen_clif]

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 17:03):

cpetig updated PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 17:13):

cpetig commented on PR #13815:

As this now forms an atomic step towards arm32 support I mark it as ready for review to start the discussion about its final form.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 17:13):

cpetig has marked PR #13815 as ready for review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 17:13):

cpetig requested fitzgen for a review on PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 17:13):

cpetig requested wasmtime-compiler-reviewers for a review on PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 17:13):

cpetig requested wasmtime-default-reviewers for a review on PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 22:54):

:memo: cpetig submitted PR review:

The bug described in https://bytecodealliance.zulipchat.com/#narrow/channel/217117-cranelift/topic/Arm32.20backend.20.28for.20now.20thumb-2.20only.29.20started/near/608325866 is likely caused by this.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 22:54):

:speech_balloon: cpetig created PR review comment:

similarly here

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 22:54):

:speech_balloon: cpetig created PR review comment:

I think this should save clobbers as well.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 22:54):

:speech_balloon: cpetig created PR review comment:

This is a nice optimization but doesn't combine with frame setup.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 23:20):

:memo: cpetig submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 05 2026 at 23:20):

:speech_balloon: cpetig created PR review comment:

I think you mean these subtarget flags: https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/ARM/ARMSubtarget.h and https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/TargetParser/Triple.h - but at least thumb vs arm is selected by the target triple.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2026 at 18:23):

fitzgen unassigned fitzgen from PR #13815 Arm32 thumb2 (Cortex-M) support.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2026 at 18:23):

fitzgen requested cfallin for a review on PR #13815.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2026 at 18:24):

fitzgen commented on PR #13815:

Moving review to @cfallin because (a) I'm not really knowledgeable about arm32 and (b) I will be out of office next week and don't have time to look at it this week.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2026 at 18:28):

cfallin commented on PR #13815:

(I'm also on PTO this week, and traveling next week, so I will look at this the week of Mon Jul 20; happy to do so of course)

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2026 at 18:51):

:memo: bjorn3 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 06 2026 at 18:51):

:speech_balloon: bjorn3 created PR review comment:

You can select between thumb and arm on a per-function basis in LLVM and Rust, so changing the target triple is not the only way of choosing thumb mode. #[instruction_set(arm::t32)] lowers to what is effectively #[target_feature(enable = "thumb-mode")] in the LLVM backend of rustc. And a couple of rustc targets also use target_features: "+thumb-mode" in the target spec.


Last updated: Jul 29 2026 at 05:03 UTC