Should we ever stabilize inline assembly?

Yes, I'll be setting up the WG.

2 Likes

Good, thank you!

Just to respond to the initial premise, I think that yes, Rust needs stable inline assembly as a matter of principle. If it can't do that, then it can't call itself a systems programming language in my opinion. I regularly use Rust's unstable inline assembly to call APIs with odd calling conventions that Rust will probably never support, among other things.

5 Likes

I think it would be nice for the proposal to at least mention how inline asm might look for wasm. I see no reason it couldn't work (except, well, compiler backend support), so it'd be nice to show it in the future possibilities.

LLVM already supports Wasm inline assembly, so we already get it for free.

Interesting!

I'm trying to find documentation for that support, and in particular for what constraints LLVM supports and what they mean. I'd like to make sure we take this into account in the new inline assembly proposal.

1 Like

IIRC we already use LLVM inline assembly support for WASM in libcore (e.g. in core::hint::bench_black_box).

According to this comment "m" constraints aren't supported. That's the only documentation I've found but I haven't look very hard.

That's what I found as well, and I didn't find any other documentation either.

Looks like WebAssembly only supports "r" constraints, and uses them to represent indexes of locals.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.